Posts

Showing posts from January, 2011

ruby on rails - Consuming messages from RabbitMQ: [amqp] Detected TCP connection failure -

the following rails rake task works on rails development system. after deploying rails production environment fails. rake pform_queue:receive rails_env=production stop ctrl+c waiting application forms ... [amqp] detected tcp connection failure telnet shows rabbitmq listening on default port: telnet localhost 5672 trying 127.0.0.1... connected localhost. escape character '^]'. rtyr fghtryr amqp connection closed foreign host. below code of rake task. desc "wait application forms pform" task :receive => :environment require "amqp" eventmachine.run connection = amqp.connect(:host => 'localhost') channel = amqp::channel.new(connection) queue = channel.queue("pform.applicationforms", :durable => true) puts "stop ctrl+c" puts "waiting application forms ..." queue.subscribe |payload| puts "#{time.now} received message" end

java ee - JPA Current Version -

Image
what current version of java persistence api? know jpa defined on jsr 338 , (march 2014) version 2.1 : but according peter pilgrim, on chapter 4 of java ee 7 developer handbook , jsr 338 defines version 3.2 of java persistence api: the java persistence api (jpa), jsr 338, version 3.2 specification mandates how persistence can applied objects in java ee product. well, didn't read book, pages needed. book ok or outdated? actually, think should re-read chapter 1 , re-examine contents of java ee 7 html5 productivity table displayed in book (pages 7 9). java ee 7 defines following: ejb specification version 3.2 defines enterprise java beans, entity beans , ejb ql, jsr 345; jpa specification version 2.1 defines java persistence api, jsr 338 pp

c++ - OpenCV CvSVM.predict() decision function value -

i training images bag of words. however, every time change condition value in if statement or sign, e.g. if(response<0) if(response>0) or if(response<-1) if(response<-0.5) different results results.push_back(response) . not figure out why happens. change condition, that's it. please, me problem. in advance. int i, j; for(i=1;i<=img.cols-width;i=i+20){ for(j=1;j<=img.rows-height;j=j+20){ vector<keypoint>keypoints; mat roi = img(rect(i, j, w, h)); detector.detect(roi,keypoints); if (keypoints.data()){ mat bowdescriptor2; bowde.compute(img,keypoints,bowdescriptor2); evaldata.push_back(bowdescriptor2); std::cout<<"svm predicting..."<<std::endl; float response = svm.predict(bowdescriptor2,1); results.push_back(response); std::cout<<response<<std::endl; if(response<0) { static cvscalar red = {0,

php - Is it possible to store date as meta_key in wordpress? -

i'm trying store dates , holidays in post_meta in wordpress database. made custom post type store data. in table wp_post, store _event_date = date , _event_holiday = holiday. problem can't query date has holiday want query. thinking store dates in "meta_key" fields, values stored in meta_keys needs have underscore. hesitate it. my current codes follows. this how store current data in wp_postmeta. add_post_meta($post->id, "_event_name", $_post["_event_name"]); add_post_meta($post->id, "_event_date", $_post["_event_date"]); this want instead. add_post_meta($post->id, $_post[_event_date], $_post["_event_name"]); would method have problems wordpress or something? you may use without underscore this add_post_meta($post->id, $_post['event_date'], $_post['event_name']); but, if need store using preceding underscore may use , there won't problem. btw, have this:

perl - Compare lines in a file -

i have large dataset looks this: identifier,feature 1, feature 2, feature 3, ... 29239999, 2,5,3,... 29239999, 2,4,3,... 29239999, 2,6,7,... 17221882, 2,6,7,... 17221882, 1,1,7,... i write script groups these lines identifier (so first 3 , last 2 grouped) in order compare them. so, example, 3 29239999 , take 1 of 2 feature 3 3 , last feature 3 7. in particular, take 1 has largest feature 2 (it third line 29239999). my specific question: of 2 options: (1) hashes , (2) making each identifier object , comparing them, best? if working "large" data set , data grouped id in example, suggest process these go instead of building huge hash. use strict; use warnings; # skip header row <data>; @group; $lastid = ''; while (<data>) { ($id, $data) = split /,\s*/, $_, 2; if ($id ne $lastid) { processdata($lastid, @group); @group = (); } push @group, $data; $lastid = $id; } processdata($lastid, @group); sub p

visual c++ - How to fix : "Microsoft (r) developer studio has stopped working" in VC6 -

Image
i'm designing mfc interface application, throws following error: microsoft (r) developer studio has stopped working ex: if drag tabcontrol toolbar windows design area; when right click change properties , events, throws error: how 1 fix it? i'm using windows 7 ultimate x64 . i'm tried in windows xp , showed me same error.

python 2.7 - Making subarray from function on multiple arrays -

in 1 folder have 13 txt files have 3 columns of data t, x, y. use path in glob set multiple arrays data values. question if want create separate array each of main arrays (t, x, y) for path in glob("f:\thermal motion\*.txt"): t, x, y = np.loadtxt(path, unpack=true) in range(len(x)): d = ((x[i] - x[0])**2 + (y[i] - y[0])**2)**0.5 so when print d, don't array list. want sort d arrays according original 13 files. data first file going through d 1 array, , on... d looks float me, not array or list. if understand need correctly, need list of " d -values" each file you're reading in. let's want list of values associated name of file produced them simplicity; can reorder them want later. use list comprehension store values, , dict map file names lists of d values. this: d_values = {} path in glob("f:\thermal motion\*.txt"): t, x, y = np.loadtxt(path, unpack=true) # add list of computed d values d_values dictionar

multithreading - Kill a thread in previous activity in android -

i have thread in activity starts activity b after 30 seconds.but user can go activity b before time on button click.i want kill thread in activity if user clicks button activity b wont started again. tried kill thread if button clicked, of no use , finish() not killing thread after navigating b. thread t=new thread() { public void run() { try { sleep(5000); currentclass = class.forname("com.crazydna.memorizethepic.level"+levelnumber); intent ourintent = new intent(picturedisplay.this, currentclass); startactivity(ourintent); } catch (classnotfoundexception e) { // todo auto-generated catch block log.e("tag","error: " +e.getstacktrace()); //e.printstacktrace(); alertdialog.builder alertdialog=new alertdialog.builder(picturedisplay.this); alertdialog.

c# - How to Combine Arbitrary Regexes with AND -

is there generic way combine regexes together? while coding solution of 1 of euler problems, code ended performing this: list<string> expressions; //there 50 regex expr in list list<regex> regexes = new list<regex>(); foreach (string expr in expressions) { regexes.add(new regex(expr, regexoptions.compiled)); } foreach (string line in file.readalllines(...)) { bool matches = true; foreach (regex regex in regexes) { if (!regex.ismatch(line)) { matches = false; break; } } if (matches) { console.writeline("this line matches of regexes: "); console.writeline(line); break; } } the approach above innefficient since scans every line in file 50 times. i create 1 regex matches line if 50 regexes match string. way each line scanned once (and unmatching lines fail earlier due more restrictive regex). (i don't care match, need know if match). f

jquery mobile - Create Table plugin dynamically using javascript API's -

how create table plugin dynamically using javascript api's in jquery mobile. now i'm creating table plugin using append method in javascript, want create in javascript api's. html <table data-role="table" data-mode="columntoggle" class="ui-responsive table ui-shadow" id="today_app"> <tr><th>name</th><th>duration</th></tr> </table> javascript for (var = 0; < servicename.length; i++) { $('#today_app').append('<tr><td>'+servicename[i].name+'</td><td>'+servicename[i].from+'</td></tr>'); } code without jquery mobile append... var = document.getelementbyid('today_app'); (var = 0; < servicename.length; i++) { var row = document.createelement("tr"); // create table cells var td1 = document.createelement("td"); var td2

php - search function in yii gridview -

i have project implemented in yii. grid view search function not working in server. in localhost grid view search function working. issue in that. please suggest me should change. my recipe controller: public function actionadmin() { $model=new recipe('search'); $model->unsetattributes(); // clear default values if(isset($_get['recipe'])) $model->attributes=$_get['recipe']; $this->render('admin',array( 'model'=>$model, )); } my model part: public function search() { // warning: please modify following code remove attributes // should not searched. $criteria=new cdbcriteria; $pagination=array('pagesize'=>'10'); $criteria->compare('recipe_id',$this->recipe_id); $criteria->compare('posted_id',$this->posted_id,true); $criteria->compare('name',$this->name,true); $criteria->compare(&

Top n closest numbers from a python list -

i need select amount of numbers list, closest ones other number. for example: x0 = 45 n = 3 mylist = [12,32,432,43,54,234,23,543,2] so, how select n numbers list closest ones x0 ? there built-in method? topn = [43, 54, 32] the way see below, looks bit convoluted: diffs = sorted([(abs(x - x0), x) x in mylist]) topn = [d[1] d in diffs[:n]] use heapq.nsmallest : heapq.nsmallest(n, iterable[, key]) return list n smallest elements dataset defined iterable. key, if provided, specifies function of 1 argument used extract comparison key each element in iterable: key=str.lower equivalent to: sorted(iterable, key=key)[:n] so in particular case: import heapq x0 = 45 n = 3 mylist = [12,32,432,43,54,234,23,543,2] heapq.nsmallest(n, mylist, key=lambda x: abs(x-x0)) this uses less overhead because discards elements exceed n .

apache - Nginx as Reverse Proxy - Double Proxy Pass ? is this possible? -

i have common problem can encounter when run nginx reverse proxy server apache, want add double proxy_pass variables nginx conf. file doesn't seems allowed nginx. for example situations have in website have chat engine runs openfire, runs on port 5280 jetty , have set apache proxy pass directive set proxypass /member-chat http://xyx.com:5280/http-bind proxypassreverse /member-chat http://xyx.com:5280/http-bind proxyrequests off but want pass comes "/member-chat" send directly chat-server rather apache, because apache again proxy pass openfire (member-chat), takes more time , useless loading apache. when add nginx proxy server want add below didn't work, reason, cant find location gives me 404 error. location / { proxy_pass http://85.xxx.yyy.2x2:7080; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; access_log

Dequeue in a Priority queue using a Sorted Dictionary in C# -

i have sorted dictionary of form: sorteddictionary<prioritytype, list<t>> dictionary; where prioritytype enum class. now trying make priority queue methods have apprehensions whether dequeue method work or not. public t dequeue() { if (isempty()) { throw new exception("the priority queue empty! dequeuing not possible!"); } var highestprioritylist = dictionary[dictionary.keys.first()]; var topelement = highestprioritylist.firstordefault(); if (highestprioritylist.count == 0) { dictionary.remove(dictionary.keys.first()); } highestprioritylist.removeat(0); return topelement; } please me improve method! note: dequeue() method supposed remove , return object highest priority , before other elements same priority. okay able modify above code suit dequeue operation! public t dequeue() { var highestprioritylist = dictionar

nlp - Embedding jape rules in java (Gate) -

i trying write own rule annotates author (from author,jape) in java code have initialized new processing resource.the code runs fine not annotates ma text: input: author of xyz output: should annotated author , shd save name of book in temporary variable. java code: gate.init(); gate.getcreoleregister().registerdirectories( new file(gate.getpluginshome(), "annie").touri().tourl()); serialanalysercontroller pipeline = (serialanalysercontroller)gate.factory.createresource( "gate.creole.serialanalysercontroller"); languageanalyser tokeniser = (languageanalyser)gate.factory.createresource( "gate.creole.tokeniser.defaulttokeniser"); languageanalyser jape = (languageanalyser)gate.factory.createresource( "gate.creole.transducer", gate.utils.featuremap( "grammarurl", new file("e:\\gate_developer_7.1\\plugins\\annie\\resources\\ne\\author.jape").touri().to

objective c - KeyboardDismissMode crashes the app -

so, have uitableview, , fetch data web array , show in tableview. also, have uitextfield acting search bar tableview. type text in text field, click search , tableview table gets generated. and here problem: tried implement new exciting feature presented in ios 7 - keyboarddimissmode hide keyboard when scrolling starts, works ok if have dozens of cells (basically, if have more 1 screen). if have no results, or 2-3 results , have keyboard on screen, , start scroll screen down - app crashes sigabrt error right away. it doesn't matter if use checkbox in storyboard or type self.tableview.keyboarddismissmode = uiscrollviewkeyboarddismissmodeondrag; it crashes anyway. if old style, this - (void)scrollviewwillbegindragging:(uiscrollview *)scrollview { [searchbar resignfirstresponder]; } then works fine. , when happens doesn't go cellforrowatindexpath or that, crashes right away. and there more: tried implement uiscrollviewkeyboarddismissmodeinteractive mode

sql - Symmetricds Transform Single Table to Multiple Tables Example -

please provide example configuration of transformation of single table multiple tables practical scenario: have corp node , store node. have 2 tables customers , imp_customers in corp node, have 1 table customers in store node. i have transform customers node in store customers , imp_customers in cloud node. please give example configuration of above transform in symmetricds 3.5 using sym_transfrom_table , sym_transform_column. to transform single table multiple tables, step 1:- first setup trigger table , link router (please ignore if have triggers) step 2:- create row in sym_transform_table, specify direction of data, when perform transform, , tables involved. insert sym_transform_table(transform_id, source_node_group_id, target_node_group_id, transform_point, source_table_name, target_table_name, delete_action, column_policy) values ('customers_to_imp_customers', 'store', 'corp', 'extract','customers',

ios7 - Animation with Autolayout -

i don't use ib. laying out code. i have uitoolbar on top of view. setting height 64 or , width stretch horizontally fit screen width. when first launch app, perfect. change orientation, toolbar resizes, good. now comes animation part. when swipe on view, toolbar should move on top of screen , hide. when swipe down on view, toolbar should come down. i tried setting constraints in following manner. initially this. // width [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|-[toolbar]-|" options:0 metrics:nil views:viewdict]]; // height [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:[toolbar(toolbarheight)]" options:0 metrics:metricdict views:viewdict]]; now, during swipe up [self.view removeconstraint:[nslayoutconstraint constraintwithitem:self.toolbar attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.view attribute:nslayoutattributetop multiplier:1 constant:

node.js - Why does --module override Typescript compiler's --out flag? -

if run $ tsc --out foo.js myfile.ts file foo.js . if specify --module commonjs option, --out parameter overriden , myfile.js ie: $ tsc --out foo.js --module commonjs myfile.ts given use export assignment in ts code have classes available nodejs js code, need --module flag. think it's bug --out flag value ignored/overridded. the reason want suffix generated js code .gen.js can write scm rule ignore generated code. $ node --version && tsc --version v0.10.22 version 0.9.7.0 --out ignored files multiple modules because it's not clear means (what if had specified tsc --out foo.js module1.ts module2.ts , module1 had require 'd module2 ?). the theory here use external build tool (grunt, jake, make, frakes, etc) rename file afterwards if wanted named different. it's intended compile external module file other filename, since compile not run. there's codeplex issue can vote on show support implementing post-1.0.

html - Font-Family not being imported -

Image
i'm trying use font called "patua one" changes not showing when add attribute inside css. here css code: .p1{ font-family: "patua one"; font-size: 70px; color: #1b423e; } this import looks like: @font-face { font-family: 'patua_oneregular'; src: url('patuaone-regular-webfont.eot'); src: url('patuaone-regular-webfont.eot?#iefix') format('embedded-opentype'), url('patuaone-regular-webfont.woff') format('woff'), url('patuaone-regular-webfont.ttf') format('truetype'), url('patuaone-regular-webfont.svg#patua_oneregular') format('svg'); font-weight: normal; font-style: normal; } if wondering, src: url('patuaone-regular-webfont') located in webroot , includes of files. this root directory then inside webfontkit these files: inside style.css @import css posted above. your font-family should have consistent value when importing , using.

sql - How Can I Skip a row(an iteration) in MSSQL Cursor based on some condition? -

how can skip row(an iteration) in mssql cursor based on condition, have dts migrates thousands of records , based on criteria, records need not migrated duplicates , want skip these records. any idea how can accomplish in mssql cursor? thanks sirak i'm making few assumptions here use following guide: -- create test data select ' ' [word] #mytempdataset; insert #mytempdataset select 'this'; insert #mytempdataset select 'is'; insert #mytempdataset select 'a'; insert #mytempdataset select 'basic'; insert #mytempdataset select 'basic'; insert #mytempdataset select 'test'; declare @counter int declare @word varchar(50) declare mycursor cursor select * #mytempdataset; open mycursor fetch next mycursor @word while @@fetch_status = 0 begin -

java - Getting class cast exception while using android.support.v7.widget.SearchView -

i using menu show search icon on action bar. have create search view itemsearch = menu.finditem(r.id.action_search_chat_home_container); searchview = (searchview) menuitemcompat.getactionview(itemsearch); i using android-support-v7-appcompat library project . xml menu... <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:homecontainer="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_search_chat_home_container" android:icon="@drawable/ic_action_search" android:title="@string/action_search" homecontainer:showasaction="ifroom|collapseactionview" homecontainer:actionviewclass="android.support.v7.widget.searchview"/> </menu> i getting following error *03-18 12:19:46.965 e/com.abc.contactbook.rtcontactbookactivity<======(14993): java.lang.classcastexcepti

is it possible to send a push notification without using the alert attribute in a json using iOS? -

i trying send json format doesn't have "alert" attribute. thing is, when try remove alert attribute, notification won't appear. there way can handle this? in advance p.s i've tried use action, still doesn't show (i think possible in android) yes, can it. possible send push notification without alert. can register application badge notifications, in case provider server won't able send alerts or sounds. the notification payload each push notification carries payload. payload specifies how users alerted data waiting downloaded client application. maximum size allowed notification payload 256 bytes; apple push notification service refuses notification exceeds limit. remember delivery of notifications “best effort” , not guaranteed. for each notification, providers must compose json dictionary object strictly adheres rfc 4627. dictionary must contain dictionary identified key aps. aps dictionary contains 1 or more properties specify follow

Android App Crashes on Phone When Viewing call logs -

i have been working on app reads call logs. used code. public string log_dump(contentresolver con){ stringbuffer sb = new stringbuffer(); cursor managedcursor = con.query(calllog.calls.content_uri, null,null, null, null); int number = managedcursor.getcolumnindex(calllog.calls.number); int type = managedcursor.getcolumnindex(calllog.calls.type); int date = managedcursor.getcolumnindex(calllog.calls.date); int duration = managedcursor.getcolumnindex(calllog.calls.duration); sb.append("call details :"); int i=0; while (managedcursor.movetonext()) { string phnumber = managedcursor.getstring(number); string calltype = managedcursor.getstring(type); string calldate = managedcursor.getstring(date); date calldaytime = new date(long.valueof(calldate)); string callduration = managedcursor.getstring(duration); string dir = null; int dircode = integer.parseint(calltype); switch (di

c# - GetEnumerator returns null -

object htmldocument.body.all not null. why getenumerator() return null? ienumerator<htmlelement> hm = htmldocument.body.all.getenumerator() ienumerator<htmlelement>; i think want this. although why want enumerator<htmlelement> have no clue. ienumerator<htmlelement> hm = htmldocument.body.all .oftype<htmlelement>() .getenumerator(); in cases find can things more with foreach(var element in htmldocument.body.all.oftype<htmlelement>()) { //stuff }

PHP Mysql submit form -

i trying submit data html form using php sql database. completed part 5 doesn't appear actual data in of table rows apart auto increment userid. code protected sql injection? best way input datestamp sql database? example clientsince field. here clientsubmit.php <?php // create connection echo "made it! part 1"; $con=mysqli_connect("xxx","xxx","xxx","xxx"); echo "made it! part 2"; // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $txtnam = mysql_real_escape_string($_post["name"]); $txtemail = mysql_real_escape_string($_post["email"]); $txtslots = mysql_real_escape_string($_post["slotcount"]); $txtsecurity = mysql_real_escape_string($_post["passcode"]); echo "made it! part 3"; $sql = "insert accounts (name, email, slotcount, securitycode) values('$txtnam','$txtemail'

mysql - How to find id which is string with semicolon -

i want find assigned jury id table.problem id joint semicolon here records. id jury_id 1 2;4;6 i want find jury_id=4. how can find record ? appreciated. use find_in_set() : where find_in_set(?, replace(jury_id, ';', ',')) > 0 replace ? target value. note use function search string must csv, must replace semicolons commas.

unix - How to configure SVN to block certain file type? -

i have svn install in unix server. implement strategy in svn accepting file type, , error message prompt alert users. got clue done within pre-commit hook script don't know how? may know how done? the pre-commit script script store in hooks directory under root location of svn repository (the location server uses, not location you've checked out to). can sort of script can run executable - example perl, python or bash script, correct #! line , set executable. every time attempts commit, commit stored uncommitted transaction, script called 2 arguments - path of repo , name of transaction. script can use svn utilities such svnlook or svn log (usually option -t name_of_transaction ) information transaction, , decide whether it's valid. it produces 2 important outputs. first of exit code affect whether transaction goes ahead or not. 0 cancel transaction. eg in perl script put test decide if filename valid or not, exit(-1) if it's not. secondly if transa

Android:Get button clicked in custom listview -

i have used lazyadapter creating custom listview. require use image can clicked dial number. error coming in onclick method of image. startactivity says "there no such method in lazyadapter". posting code below. public class lazyadapter extends baseadapter { private activity activity; private string[] data; private string[] project; context con; public lazyadapter(context con) { this.con = con; } public lazyadapter(activity a, string[] pic, string[] p) { activity = a; data = pic; project = p; inflater = (layoutinflater) activity .getsystemservice(context.layout_inflater_service); imageloader = new imageloader(activity.getapplicationcontext()); } public int getcount() { return data.length; } public object getitem(int position) { return position; } public long getitemid(int position) { return position; } public view getview(final int position, view convertview, viewgroup parent) { layoutinflater inflater = (lay

git - how to auto export files when merge a branch? -

i'm working website using git repository 2 branches master-branch , dev-branch. i work in dev-branch , when things go fine merge master-branch. , need copy whole dir deployment directory or upload server. i know if there way automatically export/copy files/changes directory every time merged/commit master-branch? i know there kind of nodejs plugin watches directory , auto upload files deployment server when files inside changed. didn't try them. i appreciate if have better way upload them without running nodejs app, or using git itself. thanks. you set post-merge hook task you. however, hook run when git merge might not best solution general use. i set small script me. first, have build list of files modified. can done git diff : git diff --name-only $fromrev..$torev > filelist where $fromrev old revision (i.e. last revision created archive) $torev new revision (i.e. current state want export) filelist temporary file hold file name

vb.net - Not able to fetch data from sql database in asp.net web application using vb -

i using below code fetch data sql, not getting error code not working on button click dim strsql string = string.empty strsql = "select * jhg" using connection new sqlconnection (configurationmanager.connectionstrings("xyz").connectionstring) dim command new sqlcommand(strsql, connection) connection.open() reader sqldatareader = command.executereader() while reader.read() gridview1.datasource = reader end while 'end connection , using close you need databind gridview after providing datasource: gridview1.databind();

wso2esb - How to invoke methods inside a service using wso2 proxy service -

i new wso2 i have created 2 jar services 1) simple service has 2 methods add , subtract 2 numbers 2) simple service has 2 methods multiply , divide 2 numbers i want invoke these 2 services based on condition,that have implemented using filter mediator. i want call methods inside services. say, if a > b called first service,then want call operations(methods) inside these service,say addtwonumbers(int a,int b) , subtwonumberes(int , int b) how call these methods using proxy service? can me on ? you have 2 backend services , want expose both service 1 proxy service.. proxy service must capable of deciding backend service message must sent. so, can create 1 proxy service using wso2esb , can attach new wsdl it. once message received proxy service, filer mediator can use send different based on parameters. can extract a , b values incoming message using xpath expression. these 2 values can compared. once filter mediator compares them, can build soap me

ios - Is it possible to include different content for different social media using UIActivityViewController? -

i using mobilecoreservices of ios 7 post content app social media. . , here code .. nsarray *activityitems; nsstring *title = _titlelabel.text; if (_imagelabel.image != nil) { activityitems = @[title, _imagelabel.image]; } else { activityitems = @[title]; } uiactivityviewcontroller *activitycontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems applicationactivities:nil]; [self presentviewcontroller:activitycontroller animated:yes completion:nil]; now sends common text. wish post different titles facebook , twitter. possible? i found tutorial helpful: http://www.albertopasca.it/whiletrue/2012/10/objective-c-custom-uiactivityviewcontroller-icons-text/ but gist of following: you need subclass uiactivityitemprovider @interface apcustomactivityprovider : uiactivityitemprovider <uiactivityitemsource> @end add following implementation file @implementation apcustomactivityprovider - (id) activityviewcontroller:(u

show - How to display an Report using DynamicReports on a JFrame? -

i want display report on jframe without using show() method. i don't want have popup frame, want see on jframe . here current situation: private void jbutton1actionperformed(java.awt.event.actionevent evt) { jasperreportbuilder jrb = new jasperreportbuilder(); int ifontsizestringi = (integer) jspinner1.getvalue(); int ifontsizestringii= (integer) jspinner2.getvalue(); string spagesize =(string)jcombobox1.getselecteditem(); string spageorientation = (string)jcombobox2.getselecteditem(); string 1 = jtextfield1.gettext(); string 2 = jtextfield2.gettext(); fontbuilder fonti = stl.font("courier new", true, false, ifontsizestringi); fontbuilder fontii = stl.font("courier new", true, false, ifontsizestringii); if(spageorientation.equalsignorecase("landscape") && spagesize.equalsignorecase("a4")) jrb.setpageformat(paget

sql - SSRS Cache errors -

i've got problem need with. i'm designing ssrs dashboard report consisting of 1 table , several graphs. there 2 parameters report: date , site. site can either total 2 sites or individual site total. i've set defaults 'yesterday' date , combined site value. the report takes 2 minutes run, , thought i'd cache it. i've cached several other reports no problem. i've created 3 different cache refresh plans - 1 each of 3 site values, using default date. set cache expire on daily basis. i waited until cache plans had run successfully, , viewed report. report 'site total' value ran fine, changed drop down site 1 , pressed 'view report' button. report came in less 2 seconds expect, values , graphs same. same happened site 2. the reports produce correct values in visual studio, , in browser when cacheing turned off. i've tried various changes report (shortening report name, having dates selectable drop down list rather calendar

backbone.js - Backbone JST template update without rendering again -

i'm looking update template data without rendering template again since need change number <div class="l-col l-col-left float-l results-text">showing {{= data.showingnow }} out of {{= data.numofresults }} results </div> this code part of template , update "data.showingnow" without rendering template again since small part need's update can done? you can use : $('.results-text').html(/* new html here */)

java - Spring controller throwing HttpStatus.UNAUTHORIZED fires 500 Http error instead of 401 -

here's scenario : created following custom response exception, fire 401 http status : @responsestatus(value = httpstatus.unauthorized) public class httpunauthorizedexception extends runtimeexception { } the controller uses exception : @controller public usercontroller { @requestmapping(value = "api/user") @responsebody public string dologin( @requestparam(value = "username", required = false) string username, @requestparam(value = "password", required = false) string password) { if(userloggedin(string username, string password)) { return "ok"; } else { throw new httpunauthorizedexception(); } } ... } now when try access controller see 401 exception, server fires http error code 500 instead. interestingly enough, when try httpstatus.not_found works, server fires 404. there i'm missing on here? thanks in advance :-) first

android - listview custom cell seletor? -

Image
i create custom listview cell card but when click cell have problem the selector display after cell, want selector display on cell. blue color fill cell range, please help.. lot this rowshadow.xml in drawable <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item > <shape android:shape="rectangle"> <solid android:color="@android:color/darker_gray" /> <corners android:radius="0dp"/> </shape> </item> <item android:right="1dp" android:left="1dp" android:bottom="2dp"> <shape android:shape="rectangle"> <solid android:color="@android:color/white"/> <corners android:radius="0dp"/> </shape> <

How to compare/calculate time values in vb.net? -

so have datetimepicker formatted pick/show time values. if pick time before specific time, say, 6 pm, label should "undertime", otherwise should "overtime". want find timespan difference between picked time , 6 pm. i've tried these codes, didn't work wanted: if tp.value > #6:00:00 pm# label1.text = "overtime: " & (tp.value - #6:00:00 pm#).tostring else label1.text = "undertime: " & (#6:00:00 pm# - tp.value).tostring end if use timespan instead of datetime . problem date has time part of 18 correct, it's date part's year 0 (since date literal doesn't contain date-part it's initialized default date) lower datetimepicker 's date . so use timespan , compare datetime.timeofday timespan : dim time = timespan.fromhours(18) if tp.value.timeofday > time label1.text = "overtime: " & (tp.value.timeofday - time).tostring else label1.text = "undertime: "

excel - Highlight continuous values in column -

i have several column either ok , [blank] , fail (these results generated formulae). note: of these 3 results separated 4 blank cells. i want continuous cells ok appearing more 4 times highlighted special formatting. want formatting continue looking cells ok if blank cell appears stop if fail appears. after fail want restart counting again. for instance, in array below string of ok values appear 5 times continuously (count should not interrupted blank cell) should highlighted. also, please note in array results ( ok , [blank] , fail ) spaced 4 blank columns. fail ok ok ok fail fail ok ok ok ok ok ok fail greatly, appreciate suggestions. thanks. try this: sub check4() dim range set = selection.cells(1) n = 0 100 v = a.offset(n, 0).value select case v case "ok": countok = countok + 1 case "": ign = ign + 1 case else countok = 0: ign = 0 end select select case countok case 5 x = n - (4 + ign) n a.offset(x, 0).font.color = colorconstants.v

javascript - Playing audio stream using html5 -

how can play rtsp streams html5 audio tag, check streaming links wowza http , rtsp both work on vlc when embed these links in html5 audio tag, nothing seems work appreciated. here html5 code <!doctype html> <html> <body> <audio controls> <source src="http://[serverip]:1935/bw/_definst_/mp3:audio/64kbps/a_b_c_d_any_body_can_dance_bezubaan.mp3/playlist.m3u8" type="audio/mpeg"> audio not supported </audio> </body> </html> edit: stream works on smartphones perfectly, doesn't work on pc browsers hls (m3u8 files) play on ios (and android support can clunky) , mac os safari in html5 audio tag: <video width="640" height="360" preload="auto" controls src="http://[serverip]:1935/vod/test.mp4/playlist.m3u8"></video> rtsp can played on android via tag in chrome: <div id="myelement"> <a hr

webkit - Disable subframes(iframes) loading in PhantomJs/QtWebKit -

is there way disable loading subframes in phantomjs or qtwebkit/webkit in general? have no problem massing bit source code if necessary. i'm doing web manipulation don't need contents of iframes, slows down loading time. i know can done in mozilla example. websetup->setproperty(nsiwebbrowsersetup::setup_allow_subframes,pr_true); but far didn't find in qtwebkit this. maybe there's way using onresourcerequested block requests iframes ? this seems work: // load main page, no iframes page.onloadstarted = function() { page.navigationlocked = true; }; could unlock again after page loads, if necessary. alternatively, can use block loading resources: var req_count = 0; page.onresourcerequested = function(requestdata, networkrequest) { if (req_count++ > 0) { networkrequest.abort(); } } see also: http://phantomjs.org/api/webpage/handler/on-resource-requested.html http://newspaint.wordpress.com/2013/0

sql - Postgres: SELECT where a list of JOINed subtables contains specific data -

in our project have table events each of can have multiple dates . means each row in dates has event_id , position position (starting @ 0) unique within same event_id . dates (obviously) has date column. now want select events have specific list of date child values (ordered position ). possible within single sql query? example tables events: (id, name, event_type, description, comment, user_id) dates: (id, event_id, position, date_at, latitude, longitude, location) id , position , lat/long columns integer, date_at date, rest strings (character varying) don't matter here. example: insert events (id, name) values (1, 'birthday party'); insert dates (id, event_id, position, date_at) values ( 1, 1, 0, '2014-06-30'); insert dates (id, event_id, position, date_at) values ( 2, 1, 1, '2015-06-30'); insert dates (id, event_id, position, date_at) values ( 3, 1, 2, '2016-06-30'); insert dates (id, event_id, position, date_at) values

expect script, puting name of file in command -

i have problems expect script. when grep file need put line under , should : /opt/ericsson/arne/bin/import.sh -f bla_bla_bla.xml -val:rall but don't know how put file in beetween line. because when have put grep command in beetween in didn't work, maybe problem -val:rall have after? if know's how put name of file in file1 #!/usr/local/bin/expect -- set env(term) vt100 set env(shell) /bin/sh set env(home) /usr/local/bin set password ter set dul [lindex $argv 0] set var _cus_ipsec match_max 1000 spawn ssh mashost expect { "assword" {send "$password\r"} } expect "ran@rn23" send -- "cd /tih/opt/bla/tih/ \r" expect "ran@rn23" send -- "grep -il $dul * \r*" expect "ran@rn23" send -- "/opt/bl/arne/bin/imp.sh -f file1 -val:rall\r" expect "ran@rn03" send -- "/opt/bl/arne/b/imp.sh -f file1 -import\r"

google drive java api error 400 when changing file owner -

im trying change file owner, writer owner i'm still getting: com.google.api.client.googleapis.json.googlejsonresponseexception: 400 bad request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "bad request", "reason" : "badrequest" } ], "message" : "bad request" } and here's part of source code: //getting writer permission permission permission = service.permissions().get(fileid, permtochange.get(j)).execute(); permission.setrole("owner"); service.permissions().update(fileid, permtochange.get(j), permission).settransferownership(true).execute(); both accounts current owner , new owner has same domain. trying delete writer account, add new 1 , change ownership got same result.

How to set maximum number of wildcard characters in a regex? -

i have directory bunch of xmls, of contain 2 lines this: 31/02/2014 11:15 | bla bla bla target1 bla bla bla 31/02/2014 11:15 | bla bla target 2 bla bla bla bla the important thing find lines contain target1 , target2. these 2 lines next each other bla's can different each time, never more 100 characters. so i'm looking like: target1[greedy match (maximum 100)]target2 since target1 , target2 in consecutive lines, can check 1 newline @ middle of regex: (target1.{1,100}[\n\r].{1,100}target2)

java - Handle javax.el.ELException -

i'm trying handle javax.el.elexception happens within ajax update. thrown example when exception occurs in bound getter through el expression. have custom exceptionhandler in place never receives exception. tried fullajaxexceptionhandler of omnifaces, 1 wasn't able process either. what happens page rendered partly in browser point exception happened. to me looks jboss handling exception, since produces log line message of exception inside. i want able send browser default error page whenever exception occurs in ajax update.

ios - The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.) -

i trying upload file cloud through openstack api. , got sucess when uploading large file (> 1 gb) uploading stops error the operation couldn’t completed. (kcferrordomaincfnetwork error 303.) nsinputstream *istream = [[nsinputstream alloc]initwithfileatpath:filepath]; self.request.httpbodystream = istream; i not able debug issue. please tell me how can identify issue. thanks in advance

UITableView Lags Due a Particular Object -

in home page of app, have icarousel object scrolls images. under there uitableview - table view problem is. lately added sevenswitch object each cell in table view , since scrolling lags lot! code added in tableview:cellforrowatindexpath: method: cella.subscribed = [[sevenswitch alloc] initwithframe:cgrectmake(cella.frame.size.width-60, cella.frame.size.height / 2 - 12, 50, 25)]; cella.subscribed.offimage = [uiimage imagenamed:@"off.png"]; cella.subscribed.onimage = [uiimage imagenamed:@"on.png"]; cella.subscribed.thumbtintcolor = [uicolor colorwithred:(230/255.0) green:(230/255.0) blue:(230/255.0) alpha:1]; cella.subscribed.activecolor = [uicolor colorwithred:(204/255.0) green:(204/255.0) blue:(204/255.0) alpha:1]; cella.subscribed.inactivecolor = [uicolor colorwithred:(204/255.0) green:(204/255.0) blue:(204/255.0) alpha:1]; cella.subscribed.ontintcolor = [uicolor colorwithred:(204/255.0) green:(204/255.0) blue:(204/255.0) alpha:1]; cella.subscribed.is

Kendo Web UI Performance -

i using kendo web ui datepicker , numerictextbox web application , loading of context slow , takes 3 secs. after further investigation , found ajax call server gets data in 174ms , rest of time spent @ client alarming me. looking in details using console.time found 80% of time taken kendo web ui. the html dom loaded using jquery $.get ajax method. onsuccess document's div loaded html data , run kendo numerictextbox , datepicker. $(".currency").kendonumerictextbox({ format: "c", decimals: 3, spinners: false }); $(".datepicker").kendodatepicker(); the above 2 lines of code takes around 2194 ms. is there way of improving speed above lines? any appreciated. the problem not initializing kendodatepicker , kendonumerictextbox doing inside form. if remove <form> jsfiddle (like here see pretty fast. knowing , assuming need form, might replace form div element , 1 kendo initialization done, wrap new div form definition. e

html - No Padding at top when combine li, radio-input and label -

i have problem padding @ top of li's. working fiddle here: [http://jsfiddle.net/th3zq/9/][1] http://jsfiddle.net/th3zq/9/ what css-style solve problem? regards john check fiddle http://jsfiddle.net/th3zq/11/ . did not add padding in css. instead have added <br> inside <li> s. removed <br> , added padding in css become unique padding on sides. can adjust padding in css. html <div id="content"> <ul> <li id="q1" class="main-group">some text text text <ul class="antworten"> <li class="a1 answer"><label> <input type="radio" name="q1" />text a</label></li> <li class="a2 answer"><label> <input type="radio" name="q1" />text b</label></li> <li class="a3 answer"><label> <input type="radio&