Posts

Showing posts from February, 2010

ios - Stuck at application upload to appstore in mavericks -

i stucked while uploading app store, message " your application being uploaded... " i have tried steps mentioned here: xcode stuck @ “your application being uploaded” things did, my firewall protection off changed #https.proxyport=443 proxy port https.proxyport=80 in net.properties. tried upload application loader stucked @ "authenticating itunes store..." deleted old certificate,and provisioning profiles, got new ones. none of them working. system configuration follows: os : 10.9.2 xcode :5.0 java : upgraded jdk 6 jdk 7 jdk folders @ jdk folders @ /system/library/java/javavirtualmachines/ , /library/java/javavirtualmachines -1.6.0.jdk , -jdk1.7.0_25.jdk ( have tried 1.6 alone , 1.7 alone also). when run java -version terminal - java version 1.7.0_25 ( have tried version 1.6) jre version: system preferences - > java -1.7 i have tried upload 2 different places still no luck. are there other methods solve issue? or system configurations

javascript - How to check if my form is valid after click on `add_button` and if is not than change color of input/select? -

html: <select id="id_myselect" name="myselect"> <option value="0">---------</option> <option value="1">1</option> <option value="7">2</option> <option value="10">3</option> </select> <select id="id_book" name="book"> <option value="0">---------</option> <option value="1">book1</option> </select> <input id="id_number" name="number" type="number" /> <div id="add_button">add</div> how check if form valid after click on add_button , if not change color of input/select? my try jquery: if($( "#id_myselect option:selected" ).val() == 0){ $("#id_myselect").addclass( "error" ); } else if($( "#id_book option:selected" ).val() == 0){ $("#id_book").

sql server - Removing special characters and numbers in sql table field -

i have table in sql server 2008 column contains field string , special characters abc;#34;pqr. want function remove special characters , numbers field ;so output abcpqr. try declare @str varchar(400) declare @expres varchar(50) = '%[~,@,#,$,%,&,*,(,),.,!,0-9]%' set @str = '(remove) ~special~ 10 *characters. 3 5 string 1 in sql!' while patindex( @expres, @str ) > 0 set @str = replace(replace( @str, substring( @str, patindex( @expres, @str ), 1 ),''),'-',' ') select @str reference

javascript - How to re-render views using Angular JS -

i want re-render views present on page.i have header, footer , body view. in header view have dropdown in user can select language preference. on clicking on language prefrence view should re-render. possible in angular? in backbonejs call render function again on particular event. there same kind of functionality provided angularjs? thanks in advance header template (language prefrence dropdown code) <li class="dropdown"> <a id="dlabel" role="button" data-toggle="dropdown" data-target="#"> language preferences<b class="caret"></b> </a> <ul class="dropdown-menu dropdown-manual"> <li id="english" ng-click="englishconversion()">english</li> <li id="french" ng-click="frenchconversion()" >french</li> </ul> </li> is there inbuilt function can call in engli

pointer argument receiving address in c++? -

int y=5; int *yptr = nullptr; yptr = &y; i understand pointer stores address of y. , calling *yptr dereferences y. if have call void function: int main() { int number = 5; function( &number ); } void function( int *nptr) { *nptr = *nptr * *nptr; } if function takes pointer argument, how can call function use address? understand nptr stores addresses why couldn't defined as. void functions (int &ref) { ref = ref * ref; } my main question be: why function receiving address argument need pointer parameter receive address? by using pass-by-reference parameter, force function not copy value of parameter itself, instead, use actual variable provide. so, more clear view, see below: void function( int number ) { cout << number; } function( myint ); // function copy myint, local variables stack but, using pass-by-reference method, this: void function ( int & number ) { cout << number } function( myint ); // fu

Static variable behaving like a global variable in C -

i have 2 files. 1.c , 2.c there static variable defined in 1.c. able access , modify static variable in 2.c using keyword extern variable in 2.c. how possible? if static variable can accessed in other files this, purpose of scope of static variables. 1.c static int block_no; 2.c extern int block_no; block_no = 5; the way if you've somehow put both identifiers in same translation unit (such if 2.c #include "1.c" ). the relevant portion of standard 6.2.2 linkages of identifiers (a) , starting /2 : 2 in set of translation units , libraries constitutes entire program, each declaration of particular identifier external linkage denotes same object or function. within 1 translation unit, each declaration of identifier internal linkage denotes same object or function. each declaration of identifier no linkage denotes unique entity. 3 if declaration of file scope identifier object or function contains storage-class specifier static, identifier

java - Has anyone used IAX24 J library for incoming calls -

i trying implement iax based voip application android, , using androvoip open source library dialing , receiving incoming calls, in androvoip there no listener incoming calls although registration iax successful. tried using japanese client iax24j built njiax still unable receive incoming calls. https://github.com/kmamykin/iax24j/ https://github.com/russellb/androvoip i looking know how zoiper , iaxagent beta playstore doing incoming calls. looking library project implement in application.

scala - How to make use of a shared session for multiple database operation in slick? -

i'm using slick, , have question slick session. i'll give example first, order class contains line items, order can either fetch line items or remove 1 of line item, , order can price self. below pseudocode: class order{ def getlineitems= database withsesison{ //get line items db repository } def removelineitem(itemid: string) = database withtransaction{ implicit ss: session => //remove item db //price order } def priceorder() = database withtransaction{ implicit ss: session => //getlineitems //recalculate order price each line item } } so when try remove line item, create new session , transaction, , invoke priceorder, create new session , transaction, priceorder invoke getlineitems, create new session. from slick document, know each session opening jdbc connection, in 1 method invocation create 3 database connection, it's waste of connection resource. there way use 1 connection finish operation?

ubuntu - SystemTap semantic error, unable to find member 'mnt_parent' -

i installed systemtap. when wanted use stap -o send result file, got error: sudo stap -o a.out b.stp semantic error: unable find member 'mnt_parent' struct vfsmount (alternatives: mnt_root mnt_sb mnt_flags): operator '->' @ /usr/share/systemtap/tapset/dentry.stp:104:54 source: if (@cast(vfsmnt, "vfsmount")->mnt_parent == vfsmnt) i confused language systemtap uses. can 1 me? the error message seems pretty clear; specified file trying reference member of struct vfsmount (mnt_parent) not appear exist. that file part of systemtap distribution, it's not fault. problem version of systemtap old kernel. (newer kernels break apis/abis time, dependent tools must play catch-up periodically.) please try newer version.

javascript - How to orient custom canvas shape on position -

in attempt learn javascript, i'm making asteroids game. it's finished, wanted cool space ship. i found canvas shape instruction, creates flying saucer, , put inside draw() function -- ship.prototype.draw = function(ctx) { ctx.fillstyle = this.color; ctx.beginpath(); ctx.moveto(28.4, 16.9); ctx.beziercurveto(28.4, 19.7, 22.9, 22.0, 16.0, 22.0); ctx.beziercurveto(9.1, 22.0, 3.6, 19.7, 3.6, 16.9); ctx.beziercurveto(3.6, 14.1, 9.1, 11.8, 16.0, 11.8); ctx.beziercurveto(22.9, 11.8, 28.4, 14.1, 28.4, 16.9); ctx.closepath(); ctx.fillstyle = "rgb(222, 103, 0)"; ctx.fill(); // draw saucer top. ctx.beginpath(); ctx.moveto(22.3, 12.0); ctx.beziercurveto(22.3, 13.3, 19.4, 14.3, 15.9, 14.3); ctx.beziercurveto(12.4, 14.3, 9.6, 13.3, 9.6, 12.0); ctx.beziercurveto(9.6, 10.8, 12.4, 9.7, 15.9, 9.7); ctx.beziercurveto(19.4, 9.7, 22.3, 10.8, 22.3, 12.0); ctx.closepath(); ctx.fillstyle = "rgb(51, 190,

ios - How to display images on button action -

Image
i have 10 uiimages . when click uibutton displaying under uiscrollview. need implement the uibutton like **next**, if uibutton is clicked first time, displays first uiimage`, after that, on click displays next image. if click button, previous image should displayed. int currentindex = 0; int max_count; nsmutablearray *imagename = [[nsmutablearray alloc] initwithobjects: @"spices.jpg", @"spice_powder.jpg", @"turmeric.jpg", @"whynani_img3.jpg", @"spice_blends.jpg", @"products1.png", nil]; currentindex = currentindex + 1; if(currentindex > max_count) { currentindex = max_count; } (int = 0; i<[imagename count]; i++ ) { uiimageview *mmageview = [[uiimageview alloc] initwithframe:cgrectmake(200,200,350

c# - How fields of reference type can be nonvolatile? -

here msdn says volatile : the volatile keyword indicates field might modified multiple threads executing @ same time. fields declared volatile not subject compiler optimizations assume access single thread. ensures the up-to-date value present in field @ times . the volatile keyword can applied fields of these types: reference types. this state implies fields of reference type not volatile default. think it's ok treat reference-type field field of value type containing address of object. becomes similar int type. joe albahari gives examples . but!... unlike usual value types gc moves objects memory when compacts heap , changes references accordingly. hence 'the up-to-date value' must there. , if how concept of volatility apply reference types? this state implies fields of reference type not volatile default. sure. no field treated volatile default because volatile comes possibility of sizable performance cost. i think

javascript - Accessing html form fields with an external application -

i created command line tool expedite html form filling. uses brute force approach in sends tab keys window , writes info config file. unstable want refactor set form fields using javascript. i've looked writing firefox addon this. able hard-code each field id , write config file. issue need functionality in ie. is there way external application (ie cmd line tool) can write html fields using javascript? i've tried recreating entire html page form fields filled in java. try send normal destination using http post. ran authentication issues because forms require log in. my other idea looking web service tricks. may unrelated, have no idea. why not try selenium? stop reliance on hard coding have pretty free reign on dom. correct me if i'm wrong, though.

java - method overloading in same class with different params name -

i have method in super class protected int discount(int amount) and method in subclass protected int discount(int amount1) is method in subclass going overload or not??? no, method overloading works if have different type or number of arguments. variable names don't matter

Salesforce Static Resource Javascript And CSS -

i have requirement need create sf installable , trying keep few static resources possible. in fact, trying have 1 big static resource. facing problem. have put css files in 1 large file , have accessed the files within in following way: <apex:stylesheet value="{!urlfor($resource.jqueryresources, 'first.css')}"/> <apex:stylesheet value="{!urlfor($resource.jqueryresources, 'second.css')}"/> <apex:stylesheet value="{!urlfor($resource.jqueryresources, 'third.css')}"/> <apex:stylesheet value="{!urlfor($resource.jqueryresources, 'fourth.css')}"/> if in same file (i.e. jqueryresources) if keep few javascript files, unable access these files as: <apex:includescript value="{!urlfor($resource.jqueryresources, 'javascript.js')}"/> i making work this <apex:includescript value="{!$resource.javascriptresource}"/> where javascriptresource name of stan

Unable to change background color in android xml file -

whenever trying change background color using <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@android:color/somecolor"> am getting error: failed parse file e:\adt\sdk\platforms\android-18\data\res\color\somecolor.xml i have cleared project , restarted several times have been unsuccessful in getting rid of error. try this: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/somecolor"> edit and make sure set color properly. should set in strings.xml . <color name="somecolor">#ffff0000</color> or can set android:backgr

c# - OpenXML Spreadsheet get column ordinal index -

i'm creating excel export using openxml libraries. able set cell reference using default cell references e.g. a1. as want dynamically populate data across columns wondering if it's possible use numerical co-ordinate reference e.g. cells[1, 1]? so instead of doing like: cell cell = insertcellinworksheet("a", 1, worksheet); i do: cell cell = insertcellinworksheet(columnindex, rowindex, worksheet); i seem find lot of examples using excel grid reference ("a1") nothing numerical representation. many andy update i have found way of getting column headers via answer here calculates column name based on numerical index. this gets column fine, can step through code , can see cycling through columns z, aa, ab etc. finding when iterating through columns if builds past column z error message excel found unreadable content in...do want recover contents of workbook? if trust source of workbook, click yes. this code sets cells: int columni

java - Dynamically change cell color in Excel -

i'm using poi library deal excel file, want change forgroundcolor of particular cells. i'm not satisfied list of indexedcolors want create own substituting 1 existing (in case hssfcolor.blue), problem - saves color last iteration (all cells have same color). the code (convdata - 2 dim double array, normalized 255): hssfpalette hssfpalette = excelfile.getcustompalette(); cellstyle cellstyle = excelfile.createcellstyle(); hssfpalette = excelfile.getcustompalette(); cellstyle.setfillpattern(cellstyle.solid_foreground); (int i=0; i<convdata.length; i++) { row row = excelsheet.createrow(i); (int j=0; j<convdata[i].length; j++) { cell cell = row.createcell(j); hssfpalette.setcoloratindex(hssfcolor.blue.index, convdata[i][j].bytevalue(), convdata[i][j].bytevalue(), convdata[i][j].bytevalue()); cellstyle.setfillforegroundcolor(hssfpalette.getcolor(hssfcolor.blue.

c# - How to not specify the data type of arguments? -

i want adapter function. parent class want datatable , while derived class may pass in anything. i'm setting data type object , cast it. not think pretty. class parent { protected void add(datatable dt) { ... } // real business logics public virtual void addraw(object anything) {} } class child1 : parent { public override void addraw(object anything) { mytable1 t = (mytable1) anything; // pseudo code datatable dt = new datatable(); foreach(row r in t) { dt.addrow(r); } this.add(dt); } } class child2 : parent { public override void addraw(object anything) { mytable2 t = (mytable2) anything; ... } } i've background javascript , python . it's common such things in "weak type" languages, , within can pass anywhere. i've used <t> , delegate in c# before. cannot think of way using them here. what's c# way of doin

android - Loading custom url in webview -

in app, loading "http" url in webview. url loaded correctly, there internal url's loaded protocol "sheet://". while loading url error "protocol isn't supported". can please how fix this? how load url's protocol "sheet://" ? ps: using shouldoverrideurlloading method load url. this code using public boolean shouldoverrideurlloading(webview view, string url) { if(url.contains("sheet://")){ intent url_intent = new intent ( intent.action_view,uri.parse(url)); url_intent.addcategory(intent.category_browsable); startactivity(url_intent); return false; }else{ view.loadurl(url); return true; } } thanks & regards, perhaps host php file, header? <?php header("location: sheet://link_to_your_file.extention"); ?>

Creating and saving Excel document From VBA in Word -

i want able run macro in word document create excel document , save spreadsheet in shared folder. this code have far: public sub monthly_commission_extract() dim objexcel dim objdoc dim objselection dim saveas1 string saveas1 = ("\\stnlinasshd01\p403759\month end\monthly commission extract\1st save") set objexcel = createobject("excel.application") set objdoc = objexcel.workbooks.add objexcel.visible = true set objselection = objexcel.selection activeworkbook.saveas filename:=saveas1, fileformat:=-4158, createbackup:=false application.displayalerts = true end sub the code giving me error: run-time error '424': object required at following piece of code: activeworkbook.saveas filename:=saveas1, fileformat:=xltext, createbackup:=false please advise how around this. objexcel.activeworkbook.saveas not activeworkbook.saveas anything "belongs" excel must prefixed objexcel application reference.

c - a simple fork program -

#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main () { pid_t child_pid; printf ("the main program process id %d\n", (int) getpid()); child_pid = fork () ; if (child_pid != 0) { printf ("this parent process, id %d\n", (int) getpid ()); printf ("the child's process id %d\n",(int) child_pid ); } else printf ("this child process, id %d\n", (int) getpid ()); return 0; } i have written simple fork program create process , when run program output follows : the main program process id 3322 child process , id 0 now point , why isn't if block getting executed in, in parent process return value of fork() not equal 0 why not getting output if block ? the following code have @ least 2 problems: #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main () { pid_t child_pid; printf ("the main program process id %d\n&qu

Reading Json Data in Javascript / php (Format issue) -

i have code reads json data below (this code works well): var data = [{"id":1, "start":"2011-10-29t13:15:00.000+10:00", "end":"2011-10-29t14:15:00.000+10:00", "title":"meeting"}]; var output = ''; $.each(data, function(index, value){ output += '<li>' + value.title + '</li>'; }); ive changed data (see below) , reason it's not working var data = {"users":[{"firstname":"peter","lastname":"tosh"},{"firstname":"mike","lastname":"marsh"}]} var output = ''; $.each(data, function(index, value){ output += '<li>' + value.firstname + '</li>'; }); i know data format different ... i'm forgetting something? $.each(data.users, function(index, value){ output += '<li>' + value.firstname + '</li>'

php - Sublime Text / code parse error for no reason, hidden characters -

i have had problem years, not today. prompted me ask question once , all. sometimes (today every logic) trivial php code fails parse error. php right, way there no mistake , when writing exact same code again works without whining. copy , pasting code not work, has typed again in full. today, have meticulously typed down every character line failing , removing old one, have script working. example: 1 foreach ($_post['data_positions'] $k => $v) { 2 3 } threw parse error on line 1. bumped code down row 2 , wrote exact same line 1 again (i check several times every character same), removing line 2, , works. example: 1 if (is_numeric($k)) { 2 3 } also fails on row 1. when retype it, works. copy , pasting line again not work. i 100% code fine, leads me believe it's kind of encoding issue , parts of code attributed bad encoding (like pasting formatted text email). i'm using sublime text (but have had same types of mistaken parse erro

rule - jena reasoning on 2 dataset and add new entity in consequence -

i have result binding in jena query solution(say sol1: user=u1, location=loc1, locationtype=type1 ) , want use dataset extend result binding using set of jena rules. in fact, having sol1 , having loc1 location:ispartof loc2 loc2 rdf:type loc2type in dataset, want add new solution result set: sol2: user1=u1, location=loc2, locationtype=loc2type for that, need add solution set dataset, write rule @prefix pre: <http://jena.hpl.hp.com/prefix#>. [rule1: (?sol pre:user ?a) (?sol pre:location ?b) (?sol pre:lcationtype ?c) (?b location:ispartof ?d) (?d rdf:type ?type) -> (sol2 pre:user ?a) (sol2 pre:location ?d) (sol2 pre:locationtype ?type) ] inference based on above rule.afterward extract solutions dataset need query dataset with @prefix pre: <http://jena.hpl.hp.com/prefix#>. select * {?sol pre:user ?a. ?sol pre:location ?b. ?sol pre:lcationtype ?c.} now problem is 1) there way prevent adding solutions big dataset writing resoning rule on 2 datasets? 2)how

android - Pusher Java Client : Failed to subscribe to a presence channel as well as a private channel at a time -

i using pusher java client (pusher-java-client mdpye) develop android application using pusher push notification. can subscribe presence channel after connecting pusher. once subscribed presence channel, when try subscribe private channel well, showing error: invalid signature: expected hmac sha256 hex digest of xxx:yyyy, got xxxxxxxxxxxxx (possibly authentication error). the point if there problem in authentication, not have been able connect first presence channel. so, can problem? code snippet: authorizer = new httpauthorizer(endpointurl); pusheroptions options = new pusheroptions().setencrypted(true).setauthorizer(authorizer); pusher = new pusher(pusher_key, options); pusher.getconnection().bind(connectionstate.all, this); string socketid = pusher.getconnection().getsocketid(); string selfjson = authorizer.authorize(presence_channel_name, socketid); presencechannel = pusher.subscribepresence(presence_channel_name, presenceeventlistener); notificationchannel = pusher.subsc

php - Hiding URL parameter with Mod-Rewrite -

i not sure if possible. have following url structure http://www.my-domain.com/layouts/page.php?artist=artist-name&link=1234 which shows in address bar as http://www.my-domain.com/artists/artist-name/1234 in .htaccesss file have rewriteengine on rewriterule ^artists/([^/]*)/([^/]*)$ /layouts/page.php?artist=$1&link=$2 [l] what hide last variable (the 1234) showing in address bar still available process on target page. address bar show http://www.my-domain.com/artists/artist-name if not possible can save variable (the 1234) cookie .htaccess file remove variable isn't shown in address bar? can pick on target page cookie. try using (.+) . in manner: rewriterule ^artists/artist-name/\d+-(.+) /artists/$1 [r=301]

php - WordPress ajax call custom query_vars -

This summary is not available. Please click here to view the post.

javascript - how get the current value of input on knockout focusout -

im new knockout.js. wanted value of input on focus out. focus out event trigger function change items on observable array variable. here's code: <input placeholder="enter caption" type="text" data-bind="event:{focusout: $parent.modifyphotocaption(id, $(this).val())}" /> however, $(this).val() doesn't work, nor this.val. wanted value of current input immediately. thanks help. update: i think havent gave lot of details. reason why wanted value immidiately because there lot of input text: <input placeholder="enter caption" type="text" data-bind="event:{focusout: $parent.modifyphotocaption(id, $(this).val())}" /> <input placeholder="enter caption" type="text" data-bind="event:{focusout: $parent.modifyphotocaption(id, $(this).val())}" /> <input placeholder="enter caption" type="text" data-bind="event:{focusout: $parent.modifyphotoc

c++ - XNextEvent Doesn't works for some reason -

i'm trying catch keypress events using xlib. reasons xnextevent not working. i'm not receiving errors, looks program stuck on line of "xnextevent" call. here code: #include <iostream> #include <cstdio> #include <cstdlib> #include <x11/xlib.h> #include <x11/xutil.h> using namespace std; int main() { xevent event; keysym key; char text[255]; display *dis; dis = xopendisplay(null); while (1) { xnextevent(dis, &event); if (event.type==keypress && xlookupstring(&event.xkey,text,255,&key,0) == 1) { if (text[0]=='q') { xclosedisplay(dis); return 0; } printf("you pressed %c key!\n", text[0]); } } return 0; } this not how x11 windowing system works. read this carefully. key point : the source of event viewable window pointer in. you not create window, therefo

Get number of facebook shares/likes for a url from a specific date to a specific date -

i making campaign in specify need number of likes week . eg 500 likes 3/3/2014 3/9/2014 . want likes/shares done url in website between date . know how total number of likes/shares , use following code that. https://graph.facebook.com/fql?q=select url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count link_stat url='http://www.example.com' but how specific date specific date ?

Zigbee Over Air Download -

i trying implement zigbee oad using cc2530. can please tell me steps followed implement oad functionality.. p.s. have gone through " on air download.pdf " , "developers note - on air download.pdf" provided zstack documents. zoad.exe fails join network.. some time ago implemented ota using msp430/cc2520 , z-stack. chose on oad latest proprietary solution ti. when using ota instead of oad use ota server, works good, enough @ least development. unless need oad, take ota, seemed me better documented and, except making code fit memory , using non-supported external nv memory, rest pretty easy. hope helps

c# - How to pass in a mocked HttpClient in a .NET test? -

i have service uses microsoft.net.http retrieve json data. great! of course, don't want unit test hitting actual server (otherwise, that's integration test). here's service ctor (which uses dependency injection...) public foo(string name, httpclient httpclient = null) { ... } i'm not sure how can mock ... .. moq or fakeiteasy . i want make sure when service calls getasync or postasync .. can fake calls. any suggestions how can that? i'm -hoping- don't need make own wrapper .. cause that's crap :( microsoft can't have made oversight this, right? (yes, it's easy make wrappers .. i've done them before ... it's point!) you can replace core httpmessagehandler fake one. looks this... public class fakeresponsehandler : delegatinghandler { private readonly dictionary<uri, httpresponsemessage> _fakeresponses = new dictionary<uri, httpresponsemessage>(); public void addfakeresponse(

ios - How does UIProgressView get information on animation duration? -

i'm working on circular progress view , it's working quite cool. i'd make more flexible, user use normal uiprogressview paired nstimer . cannot figure how make equivalent of: setprogress:(float)progress animated:(bool)animated ? i'm testing hardcoded values , durations it's animating nicely, surely can somehow achieved inform on exact duration value? got camediatimingfunction put inside method updating cgpath if (self.continuous) { cabasicanimation *animation = [cabasicanimation animationwithkeypath:@"strokeend"]; //animation.duration = 0.5; animation.fromvalue = [nsnumber numberwithfloat:prevvalue]; animation.tovalue = [nsnumber numberwithfloat:_value]; animation.removedoncompletion = no; animation.fillmode = kcafillmodeforwards; animation.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout]; [self.progresslayer addanimation:animation forkey

web - Generating pages that require complex calculations and data manipulation -

what's best approach generating page results of complex calculation/data manipulation/api calls (e.g. 5 mins per page)? can't calculation within rails web request. a scheduled task can produce data, should store it? should store in postgres table? should store in document oriented database? should store in memory? should generate html? i have feeling of being second-level ignorant subject. there known set of tools deal kind of architectural problem? thanks. i suggest following approach: 1. once receive initial request: you can start processing in separate thread when receive first request input calculation , send token/unique identifier request. 2. store result: then start calculation , store result in memory using tool memcached. 3. poll result: then request fetching result should keep polling result generated token/unique request identifier. adriano said can use ajax (i assuming getting requests web browser).

performance - Qt for iOS QPainter::drawText hangs for a few seconds first time it is called -

i'm using qt ios 5.2 , when trying draw text using qpainter, hang on call few seconds (5 seconds on iphone4 , around 3 on osx). after first time, won't block anymore if call again. qimage image(qsize(200, 200), qimage::format_argb32_premultiplied); image.fill(qt::transparent); qpainter painter(&image); qpen pen(d->textcolor); painter.setpen(pen); qfont font(d->fontfamily, d->fontsize); painter.setfont(font); qdebug() << "before draw text"; painter.drawtext(qrect(0, 0, 200, 200), flags, d->text); //blocking call qdebug() << "after draw text"; i'm using same example in windows(qt5.1) , i've never had problems, same code runs smoothly. i had execute code in thread won't block application, i'll need see text application launched. i've tested qstatictext no luck. is experiencing same problem? there workaround?

android - Show menu in Google Glass -

hi having problem creating menu on regular cards in immersion. have far: i have cardscrolladapter implements onitemclicklistener this: private class examplecardscrolladapter extends cardscrolladapter implements onitemclicklistener { @override public int findidposition(object id) { return -1; } @override public int finditemposition(object item) { return mcards.indexof(item); } @override public int getcount() { return mcards.size(); } @override public object getitem(int position) { return mcards.get(position); } @override public view getview(int position, view convertview, viewgroup parent) { view rowview = convertview; viewholder holder; if(rowview==null) { rowview = minflater.inflate(r.layout.card_layout, null); holder = new viewholder(); holder.maintext = (textview) rowview.findviewbyid(r.id.tvmaintext); holder.

filesize - Trying to identify and move pdf files listed in txt file from source'a' to dest'b' from batch script? -

i want move few 100 pdf files directory source containing 1000s pdf. have text file has pdf file names listed in separate lines. program has read file name text file , find in source folder, if file size 12 kb , older 2014, move destination 'b'. im working on windows 2008 r2. another option: batch file extract file names input file: for /f %%i in (inputfile.txt) call bat2.bat %%i batch file file size: for %%i in (%1.txt) echo %%~zi ...and continue here

python - pytables: order of rows retrieved from a table with .where(condition) -

i building large table (~10e9 rows) pytables. 2 of tables columns (say idx1 , idx2 ) indices. first index sorted. moreover, when creating table, inserting entries in order sorted idx1. want use .where query selecting data, make full use of indexing. my question is: when iterate through rows .where iterator, there way guarantee output sorted idx1 column value? alternatively, can assume iterator return rows in order entered in? case far me, didn't want presume. i tried looking in documentation, couldn't find on topic. know there itersorted method, not allow me use indexing; have emulate myself somehow. many in advance suggestions

java - Initiating objects in a for loop -

public static int askingamount() { system.out.println("how many persons there in company?"); scanner amounts = new scanner(system.in); amount = amounts.nextint(); system.out.println(amount); amounts.close(); return amount; } public static void makingpersons() { (int i=0 ; i<amount ; i++) { int personnumber=0; person person[i] = new person(); //<--- problem system.out.println("person"); } } in first method trying ask user how many persons , return amount. in second wanted create equal amount of person objects , name them person1, person2, person3 using variable "i" don't work. clues? define array outside loop class member: person[] person; then in askingamount initialize it: person = new person[amount]; and inside loop do: person[i] = new person();

css - While printing existing styling should not apply -

i have html table having class defines styling properties .table-bordered { -moz-border-bottom-colors: none; -moz-border-left-colors: none; -moz-border-right-colors: none; -moz-border-top-colors: none; border-collapse: separate; border-color: #dddddd #dddddd #dddddd -moz-use-text-color; border-image: none; border-radius: 3px 3px 3px 3px; border-style: solid solid solid none; border-width: 1px 1px 1px 0; } while printing table styling should not apply. instead following styling should apply. mixing both. @media print { table#addressbook { border: solid #000 !important; border-width: 1px 0 0 1px !important; } table#addressbook th,table#addressbook td { border: solid #000 !important; border-width: 0 1px 1px 0 !important; } } i using less.js create css . how can easiest way? if want exclude st

c++ - start-stop-daemon not sending SIGTERM -

i have simple daemon boils down to #include <unistd.h> #include <signal.h> #include <sys/stat.h> #include <fstream> #include <iostream> #include <boost/thread.hpp> bool running = true; std::ofstream log_output; void close_log_output() { log_output.close(); } void signal_handler(int) { running = false; } int detach_service() { if(pid_t pid = fork()) exit(pid < 0); umask(0); close(stdin_fileno); close(stdout_fileno); close(stderr_fileno); chdir("/"); log_output.open("/var/log/mydaemon.log"); std::cout.rdbuf(log_output.rdbuf()); std::cerr.rdbuf(log_output.rdbuf()); std::clog.rdbuf(log_output.rdbuf()); atexit(&close_log_output); signal(sigterm, &signal_handler); return (setsid() < 0); } int main(int argc, char **argv) { if(int err = detach_service()) return err; while(running) boost::this_thread::sleep(boost::posix_time::milliseconds(30));

javascript - Detect if a new page is being loaded -

is there way detect via javascript, whether new page being loaded. let me give example. another page being loaded after on link: <a href='http://google.com/'>click here</a> there's no page load after click here: <a href='#anchor'>click here</a> no page load here either: <a href='javascript:void(0);'>click here</a> yep, that's page load. href attribute not url of page being loaded: <a href='javascript:void(document.location="http://google.com/");'>click here</a> this has url in href, not load page. onclick attribute here illustrate problem. in real world, onclick event attached event listener , canceled event.preventdefault() somewhere else in code: <a href='http://google.com/' onclick='return false;'>click here</a> now imagine, next page takes long time load. need way detect whether new page being loaded, after click on link. or afte

grep recursively for a specific file type in Linux terminal -

can search term (eg. "onblur") recursively in folders in specific files (html files)? grep -rin "onblur" *.html this returns nothing. but, grep -rin "onblur" . returns "onblur" search result available files, in text(".txt"), .mako, .jinja etc. consider checking this answer , that one . also might you: grep file types recursively | commandlinefu.com . the command is: grep -r --include="*.[ch]" pattern . and in case is: grep -r --include="*.html" "onblur" .

get values from table with BeautifulSoup Python -

i have table extracting links , text. although can 1 or other. idea how both? essentially need pull text: "text extract here" tr in rows: cols = tr.findall('td') count = len(cols) if len(cols) >1: third_column = tr.findall('td')[2].contents third_column_text = str(third_column) third_columnsoup = beautifulsoup(third_column_text) #issue starts here. how can either text of elm <td>text here</td> or href text<a href="somewhere.html">text here</a> elm in third_columnsoup.findall("a"): #print elm.text, third_columnsoup item = { "code": random.upper(), "name": elm.text } items.insert(item ) the html code followin

c++ - Accessing property of class instance -

im trying box2d simulation printing out x & y floats screen in similar fashion helloworld example included library. i've managed both build , link library. i've got class defining ball should drop point on screen fall. when try velocity can't access members data. objects.h contents class ball { public: bool m_contacting; b2body* m_body; float m_radius; public: // ball class constructor ball(b2world* m_world, float radius) { m_contacting = false; m_body = null; m_radius = radius; //set dynamic body, store in class variable b2bodydef mybodydef; mybodydef.type = b2_dynamicbody; mybodydef.position.set(0, 20); m_body = m_world->createbody(&mybodydef); //add circle fixture b2circleshape circleshape; circleshape.m_p.set(0, 0); circleshape.m_radius = m_radius; //use class variable b2fixturedef myfixturedef; myfixturedef.shape = &circleshape; myfixturedef.density = 1; myfi

javascript - JS validation on MVC form -

im using mvc platform in php. the mvc takes database tabloes , displays them . has options create new entries. when 'create new' button clicked , form generated based on current page/table being viewed user. how put validation form cannot submited if fiedl empty. if nomral html page , know how validation , because mvc , forms generated each table , makes validation bit trickier . thanks if there ifo have missed , tell me. <? $class_obj=$_request['class_obj']; echo "<p class='p1'>create new ".$class_obj."</p>"; if (isset($_request['post_create'])) { post_create_message($_request['post_create'],$class_obj); } echo "<table class=table1><form id=form_create action=".$current_file_name."?here=".$here."&mode=confirm_create&class_obj=".$class_obj." method=post>"; $w_columns = myactiverecord::columns($c

Spring MVC Java config -

i want set simple response body spring webapp. problem simple given web error. my pom.xml is: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>pt.dummy</groupid> <artifactid>dummy</artifactid> <packaging>war</packaging> <version>0.0.1-snapshot</version> <name>dummy maven webapp</name> <url>http://maven.apache.org</url> <properties> <spring-framework.version>3.2.3.release</spring-framework.version> <tomcat.servlet.version>7.0.42</tomcat.servlet.version> <log4j.version>1.7.5</log4j.version> <java.version>1.7</java.version> <junit.version

jasper reports - The html component not overflowing -

Image
the jasperreports 's html component overflows width , prints in ireport . in application overflowing part sliced out , not showing up. please find following image understanding problem first image ireport , second 1 when printed through application.

Viewing tibco ems historical message -

tibco stores messages in data file or in database. need browse old messages posted topic or queue. ems provide api searching old/consumed messages? suppose have topic complexevent.topic @ time t1 publisher publishes message complexevent.topic, @ time t2 consumer consumes message. after 2 hours t2 need view messages posted between t1 , t1+ 10 (minutes) topic complexevent.topic. how can search old messages? ems not store copies of messages design : mom not dbms, , mom should optimized performance. for specific , punctual need such yours, create ems bridge (similar mq alias, see ems doc) destination(topic,queue) want log "destinationname.log" queue. way, current code , destination unaffected. after that, use java queuebrowser , messageselector search messages in log queue. see oracle documentation details. don't forget clean queue (you set message limit , overflow strategy). if performances critical, consider storing logging queues on different ems ins