Posts

Showing posts from May, 2014

d3.js - visualization created using dc.js not rendering the y-axis data correctly -

i using dc.js , crossfilter.js dimensional charting. chart not correctly displaying y-axis data i.e. showing 00000, 50000, 00000, 50000 alternatively in y-axis. doing console level logging of group , showing correct value. i have segregated problem jsfiddle clue on doing wrong? i think clipped because wide. try setting margins: https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#marginsmargins

c++ - How to get raw pointer from cusp library matrix format -

i need raw pointer cusp library matrix format. example: cusp::coo_matrix<int,double,cusp::device_memory> a(3,3,4); a.values[0] = 1; a.row_indices[0] = 0; a.column_indices[0]= 1; a.values[1] = 2; a.row_indices[1] = 1; a.column_indices[1]= 0; a.values[2] = 3; a.row_indices[2] = 1; a.column_indices[2]= 1; a.values[3] = 4; a.row_indices[3] = 2; a.column_indices[3]= 2; how can raw pointer row_indices, column_indices , values arrays? need pass them kernels , i'd avoid unnecesary data copying if possible. there multiple ways accomplish this. example, if wish start raw device data representation instead of cusp data representation, use methodology in cusp views functionality . if have cusp data already, , want convert raw data representation, can use fact cusp built on top of thrust . here's worked example: $ cat t346.cu #include <cusp/coo_matrix.h> #include <cusp/print.h> template <typename t> __global__ void my_swap_kernel(t *a, t *

tsql - Query throws exception in SQL Server but not MySQL (outer reference error) -

sql not strong suit pretty happy when came query. works fine when querying mysql database gives me error in sql server database. exact error is: each group expression must contain @ least 1 column not outer reference. i googled error , tried adjust query accordingly can't seem work. i've been stuck on week. give me pointers on it? maybe there better way this? server sql server 2012 btw if means anything. it should showing results below. ------------------------------------------------------------------------------------- category |total customer purchases|monthly limit|customer id|last transaction date| ------------------------------------------------------------------------------------- free items | 12 | 10 | 635 | 2014-03-01 food items | 03 | 10 | 635 | 2014-03-01 other items | 05 | 10 | 635 | 2014-03-01 here's query: select (select product_cat

java - Efficient Android Design and Use of Classes -

i don't have code need with, instead have question android design in general. in game making, have activity class, use getting resources (which passed view class) , creating view class, handles of game logic, controls, display, etc. doesn't seem efficient use activity class load of data passed class or rely on view class of work, best way use view , activity classes? its not wrong way. thing makes me leery said having lots of logic in view. android set mvc architecture, , there's lot of advantages following that. activity more or less controller, , various views view. when hear lot of logic in view classes makes me worries behavior tightly coupled graphical representation, make expanding or changing layout difficult.

django - relation error on adding new model class -

i have 2 model-classes inside models.py file : class certificate(models.model): comments = models.textfield(blank=true, default='') generic_certificate = models.foreignkey(genericcertificate, related_name='certificates_awarded') tag = models.foreignkey('tag', related_name='certificates_awarded', null=true, blank=true) class genericcertificate(commoninfo): certificate_type = (('c', 'system created'), ('u', 'user created')) certificate_icon = models.imagefield(upload_to='certificate/icons', default='defaults/certificate.png') certificate_type = models.charfield(choices=certificate_type, max_length=1, default='c') template = models.filefield(upload_to='certificate/generic_templates') they working fine in django admin , when adding 1 more model class starts giving error on hitting generic certificates option: included operation : sou

javascript - Other jquery elements not supported when I apply this script in my page -

i use many jquery elements in page toggle, accordion, show hide , lightbox when apply <script type="text/javascript" src="http://www.solutoire.com/experiments/mootools/mootools.js"> </script> my other jquery plugins not supported. use jquery.noconflict(); and check this topic

Is using MapServer to merge several MapLayers on runtime to use with Leaflet a good idea? -

my problem we´re doing project right have display huge image (containing chemical compounds , elements, not geo referenced) map within web-application (with leaflet ). image adobe illustrator-file, bunch of vector graphics. makes things easy, converted large .png (27.000x19.000 px) , used maptiler create needed mapressources leaflet, included within tilelayer . the problem is: user needs able dynamically add , remove different layers (== filter) of map show more or less informationes picture. first created layers within illustrator-file, exported every layer own transparent .png-file, maptiled , included own leaflet-layer. right now, have 6 filter-layers , 2 more base layers background , overlay. means when filters activated (which default), have 8 leaflet-layers stacked on top of each other @ once. can imagine, causes performance issues in browser, since leaflet has load , render 8 layers tiles (depending on screen size 25 @ once) every zoom or drag-action. still in point

datetime - Update MySQL Column Timestamp -

i have query: select `listingdeadline` `listings` `listing_type_sid` = 6 , `active` = 1; running give me result of 183 results of column listingdeadline in following format: 2014-03-28 00:00:00 2014-03-30 00:00:00 this column datetime type column users select date listing deadline , returns date , appends time stamp. default timestamp 00:00:00 i've changed 23:59:59. want update current listingdeadline timestamp results new value (23:59:59) 00:00:00 replaced 23:59:59 183 results. any 1 idea of query can add 1 above this? it seems question can interpreted altering query result. if so, try this. can used in update. select `listingdeadline` - interval 1 second listingdeadline `listings` `listing_type_sid` = 6 , `active` = 1;

calling a java method from a ruby class -

here trying call java method inside ruby function. while calling java function inside ruby class. getting atest.rb:9: dynamic constant assignment obj = java::sikuliautomation.new my ruby code require 'java' require 'c:/x/test.jar' class main def run obj = java::sikuliautomation.new obj.automation end end app = main.new app.run test.jar conatins method automation

security - Locking down SOLR on ColdFusion 9 -

this might belong on serverfault, please move if does. we discovered can list of solr indexes going to: http://example.com:8983/solr/ allows access solr admin each index. strikes as... bad thing. luckily though, locked down accessbile ip (our office ip via firewall), still means janitor can access our solr collections. not ideal. one way circumvent has been remove admin folder, still allows people access http://example.com:8983/solr/ isn't ideal. i've read through solr documentation on security , can't seem lock down access /solr/* . might case of looking @ wrong part of documentation. using code documentation: <security-constraint> <web-resource-collection> <web-resource-name>solr authenticated application</web-resource-name> <url-pattern>/core1/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>core1-role</role-name> </auth-constraint> </security

How to show div on textbox control using javascript? -

i stucked issue,as have captured mouseover event on textbox.here code of mouseovering; <script type="text/javascript"> window.onload=function(){ document.getelementbyid("dijit_form_textarea_0").attachevent("onmouseover",function(){ document.getelementbyid("div_1_1_1").style.display = 'block'; document.getelementbyid("dijit_form_textarea_0").setattribute("title",'hello world'); }); this code works fine , shows tooltip when mouse on over particular textbox. want show div on mouseovering instead of showing tooltip. how can accomplish task,can assist me? create div tip want, set position 'absolute' , set left/top place u want appear see example here

mysql - PHP number_format returns 1.00 -

i have stored in mysql number total(decimal 16,2) 1423.28 i display php after making calculations: function calculate_balance($total){ //get total paid function $total_paid = ... if ($total_paid == 0){ return $total; }else{ return $total-$total_paid } } $balance = calculate_balance($total); echo number_format($balance, 2); //returns 1.00 i have tried number_format((float)$balance, 2); number_format(floatval($balance), 2); update var_dump($balance) and got following output. string(8) "1,423.28" float(152) string(6) "252.00" string(6) "247.50" string(6) "247.50" string(6) "247.50" string(6) "549.90" string(6) "495.00" float(0) string(6) "284.76" float(265) it's working fine without number_format() value under 1,000. e.g.: if balance equal 252.00 echo $balance; output 252.00 your function returns 1,423.28 ? not float, float never contain com

php - Cutting a string when it hits a dot -

this question has answer here: php, file name without file extension 15 answers i have variable called image_name. example below $image_name = "hello.png"; i want cut string when see's dot. because want add randomised int name cant duplicated. example @ moment in code have $image_name = substr($image_name, 0, 10) . time() . rand(0, 9999); and test string above return like hello.png13953322416647 my aim have string name equal hello13953322416647.png - showing .png after timestamp , random number so know how cut string when hits dot in string , add @ end..? thanks guys i use pathinfo function. http://php.net/manual/en/function.pathinfo.php $path_detail = pathinfo( $image_name ); $new_image_path = sprintf( "%s%s%s%s", $path_detail['filename'], time(), rand( 0,9999), $path_detail['extension']);

linq to twitter - Incorrect DateTime returned using LinqToTwitter? -

i'm returning tweets linqtotwitter using twittercontext.status . however i've noticed createdat property value returned each tweet not same if compare createdat representation displayed on twitter.com actual tweet. the minutes part same, looks user's timezone offset not being applied value returned. therefore result maybe +8 hours off. is should expected result set?, or bug? if have apply offset, how go retrieving apply tweets returned? createdat, via api, utc time. twitter.com, web site, translates date local time.

objective c - Cocos2d CCSprite moves with CCLayer -

i bought ios game , changing graphics , adding new things. here problem: have player jumps 1 object another. when jumps camera follows movement , ccsprites i've added gamescene move camera. in other words adding sprites layer moves , moves. how can make sprites not move camera ? levels , loaded svg file.

vb.net - Memory Leaks causing OutOfMemory.Exception because of increasing the limit of handles -

my application contain forms. run on windows 7 , start observing handles in task manager. handles starts increasing , when reaches @ limit of 7000, application gets crash. uninstall windows update kb2670838 . in doing limit of handles not exceed 800 if open 10 forms @ same time. run application on windows 8. same problem occur. uninstall same update. there no effect on application , opening 2 forms limit of handles increase upto 7000 , application gets crash. suggest solution application run on windows 8 windows 7. thankyou. actually application contains many forms , 1 form contains many components. in initializecomponent() method, initialize components , in form close event dispose components i.e. mybase.dispose(). @ time of initialization, components occupy approx 600 700 handles , @ time of dispose, components release 100 handles , opening form again , again handles crosses range of 7000 , application gets crash. as have told u before scenario occur in windows 8 not i

css - Apply class depending on media query screen size -

i using twitter bootstrap. have btn-group . want btn-group , btn-group-justified classes added screens @ or above 768px , , btn-group-vertical class applied screens @ or below 767px . what's easiest way this? this jquery implementation. if can't change ids classes on buttons, best way can think of it. $(document).ready(function(){ var changewidth = function(){ if ( $(window).width() < 768 ){ $('.btn-group-justified').removeclass('btn-group-justified').addclass('btn-group-vertical'); } else { $('.btn-group-vertical').removeclass('btn-group-vertical').addclass('btn-group-justified'); } }; $(window).resize(changewidth); });

java.lang.ClassCastException: cannot be cast to java.lang.Integer -

i wanted create compareto method gives me error. can me ? package defaultpackage; public class huffmanentry implements entry<integer, string> { private string c; private integer freq; public huffmanentry(string c, integer freq){ this.c = c; this.freq = freq; } @override public int compareto(integer arg0) { if(getkey()<arg0){ return -1; }else if(getkey()>arg0){ return 1; }else{ return 0; } } @override public integer getkey() { return freq; } here's error: exception in thread "main" java.lang.classcastexception: defaultpackage.huffmanentry cannot cast java.lang.integer @ defaultpackage.huffmanentry.compareto(huffmanentry.java:1) there serious problems quality of "evidence" have provided us: the stacktrace seems exception thrown @ line 1 of huffmanentry.java , , impossible. the stacktrace seems code attemp

python - How to reverse sklearn.OneHotEncoder transform to recover original data? -

excuse lack of knowledge. have been dallying python less month. encoded categorical data using sklearn.onehotencoder , fed them random forest classifier. seems work , got predicted output back. there way reverse encoding , convert output original state? a systematic way figure out start test data , work through sklearn.onehotencoder source it. if don't care how works , want quick answer, skip bottom. x = np.array([ [3, 10, 15, 33, 54, 55, 78, 79, 80, 99], [5, 1, 3, 7, 8, 12, 15, 19, 20, 8] ]).t n_values_ lines 1763-1786 determine n_values_ parameter. determined automatically if set n_values='auto' (the default). alternatively can specify maximum value features (int) or maximum value per feature (array). let's assume we're using default. following lines execute: n_samples, n_features = x.shape # 10, 2 n_values = np.max(x, axis=0) + 1 # [100, 21] self.n_values_ = n_values feature_indices_ next feature_indices_ parameter calc

Validate a string in rails? -

how can validate if string? along lines of: validates :title, format: string i've discovered in order validate data inputting contains letters (i guess string in instance), can use following code, validates format of title letters, using regex (the stuff between //). validates :title, format: {with: /[a-za-z]/}

iphone - Is it possible to Redirect audio output to phone speaker or headset in iOS programmatically -

i developing application in want redirect audio output phone speaker, don't have idea how programmatically. any idea it? you cannot turn on/off speakers through app. however, can sense mute switch of device. can know current status of speaker. this question lead towards solution. for sake of completeness, let me paste answer here.. // "ambient" makes respect mute switch // must call once init session if (!gaudiosessioninited) { audiosessioninterruptionlistener ininterruptionlistener = null; osstatus error; if ((error = audiosessioninitialize (null, null, ininterruptionlistener, null))) { nslog(@"*** error *** error in audiosessioninitialize: %d.", error); } else { gaudiosessioninited = yes; } } sint32 ambient = kaudiosessioncategory_ambientsound; if (audiosessionsetproperty (kaudiosessionproperty_audiocategory, sizeof (ambient), &ambient)) { nslog(@"*** error *** not set ses

java - Issue Glassfish 4 doesn't appear glassfish-web -

i'm trying create descriptor file java web application project. project using: netbeans 8.0 & glassfish 4 when try create glassfish descriptor file. netbeans shows dialog window going create file called sun-web.xml instead of glassfish-web.xml. i looking on internet , found first 1 sun-web.xml created version older 3, , version 4 should create file name glassfish-web.xml. i'm following tutorial person using same tools have. in tutorial can create glassfish-web.xml file. another error raise when click finish button intention of create sun-web.xml file , error popup raise show me message: "deployment configuration project not found. deployment descriptor version not set properly" can't me please ??? thank lot!! you should able use sun-web.xml file fine, might change in couple of ways example when want add security role mapping, netbeans won't able automatically fill in security role names web.xml, if fill them in manually , corre

audio - How to record perfect loops in iOS and Xcode -

i've been struggling year trying pin down problem , represent others see. i've been writing app depends on 'garageband' recording. is, want record user 8 beats, , want them able loop this. playing metronome user @ same time (user wearing head phones hearing metronome, recording mic on device) i can manage turn on recording 4.8 seconds (.6*8 beats), , timer says ran 4.8 seconds, audio recording bit shorter 4.8. it's 4.78, or 4.71 causes loop go out of whack. i've experimented avaudiorecorder,audioqueue, , audiounits thinking 1 latter methods might result in solving problem. i using nstimer fire off every .6 seconds playing short blip metronome. after 4 beats, metronome timer's function, turns on recorder metronnome waits 4.6 seconds stops recording. i'm using time intervals time how long metro runs (looks pretty tight @ 4.800xxx) , comparing duration of audio file different. i wish attach project, guess i'll have settle attaching h

.net - how i can change file permission in php or magento? -

i have 1 application running on 2 platform i.e .net , php. product created .net(on windows) server , saved on php(on linux) server. want copy file programmatically when accessing file fails.. permission denied. gave 777 permission both side while creating , accessing. know solution? http://www.php.net/chmod attempts change mode of specified file given in mode.

sqlite - Crash when using NSReadOnlyPersistentStoreOption -

i using read sqlite database located in mainbundle app. in persistentstorecoordinator loading database following code: nsdictionary *storeoptions = @{nsreadonlypersistentstoreoption : [nsnumber numberwithbool:yes]}; nserror *error = nil; _persistentstorecoordinator = [[nspersistentstorecoordinator alloc] initwithmanagedobjectmodel:[self applicationmanagedobjectmodel]]; if (![_persistentstorecoordinator addpersistentstorewithtype:nssqlitestoretype configuration:nil url:[[nsbundle mainbundle] urlforresource:@"applications" withextension:@"sqlite"] options:nil error:&error]) { nslog(@"unresolved error %@, %@", error, [error description]); abort(); } in ios7 code crashing both in simulator, , device following error: coredata: error: (14) i/o error database @ /var/mobile/applications/4b81aefe-03e6-4156-b52d-3452515facaf/myapp.app/applications.sqlite. sqlite error code:14, 'unable open database file' 2014-03-22 20:45:34.346 g

javascript - How to share the $scope variable of one controller with another in AngularJS? -

i have this: app.controller('foo1', function ($scope) { $scope.bar = 'foo'; }); app.controller('foo2', function ($scope) { // want access $scope of foo1 here, access bar }); how accomplish this? you use angular service share variable acrosss multiple controllers. angular.module('myapp', []) .service('user', function () { return {}; }) to share data among independent controllers, services can used. create service data model needs shared. inject service in respective controllers. function controllera($scope, user) { $scope.user = user; $scope.user.firstname = "vinoth"; } function controllerb($scope, user) { $scope.user = user; $scope.user.lastname = "babu"; }

python - how to capture subprocess error -

in python, run exe made using fortran. use subprocess module. exe accesses , writes several files. if make files readonly, see following trace in python console. i tried using try , except statements. not capture error. tried using p.stdout.readline() . unsuccessful. is there systematic way capture sort of errors. code: import subprocess p = subprocess.popen('c:\\tgssr\\test.exe' , shell=true, stdout=subprocess.pipe) traceback: forrtl: severe (9): permission access file denied, unit 6, file c:\test\mar22_ssout\rawreadlog.dat image pc routine line source test.exe 0116dc40 unknown unknown unknown test.exe 0113d42f unknown unknown unknown test.exe 0112ae97 unknown unknown unknown test.exe 0112a1da unknown unknown unknown test.exe 0110d746 unknown unknown unknown test.exe 010

java - GWT: google plus Get -

i following sample code posted here gwt project: google plus sample demo after implementing it, shows login window (if logged out). , once login, calls getme() method intended. however, code (within getme): plus.people().get("me").to(new receiver<person>() { @override public void onsuccess(person person) { println("hello " + person.getdisplayname()); getmyactivities(); } }).fire(); does not work @ all. i have google+ account. should technically return name. if not way fetch/get user information, there way can fetch user email, name , avatar?

vb.net - How to correctly draw to map coordinates in gdi+ -

i have large scanned map want use in order display location of moving target i load map picture box inside panel the panel set auto-scroll. picture box size mode set auto_size in order calculate transformation let user sample 3 points calculate affine transformation matrix [x' y' 1] = [x y 1] * [a b 0 c d 0 e f 1] i know transformation successful because mouse hover event displays correct coordinates: private sub picmap_mousemove(byval sender object, byval e system.windows.forms.mouseeventargs) handles picmap.mousemove if _calibsuccess dim curpoint(0) pointf curpoint(0).x = e.x : curpoint(0).y = e.y dim genericgraphics drawing.graphics = creategraphics() dim mat drawing2d.matrix = new drawing2d.matrix(mdlglobal._georefparams(0), mdlglobal._georefparams(3), _ mdlglobal._

c# - Set Content-MD5 in get request -

i have following code: httprequestmessage message = new httprequestmessage(httpmethod.get, uri); byte[] md5 = {my hash}; message.content.headers.contentmd5 = md5; the problem is, message.content null . the client use of type system.net.http.httpclient now question, how can send httpcontent in get request? my solution is, created own header. planned use content-md5 caching, created own caching header.

Why php has two different operators for addition? -

i've came c# , found annoying php operators . , + reason have 2 different operators same purpose, addition? so if there reason why php has these two, why c# doesn't? sorry, kind dumb question, me looks redundant , annoying. php has 'dynamic' or 'type not known until runtime' variables. i.e. interpreter and/or programmer cannot know until run time type of information in variable. now, let assume have 2 variables , both contain character strings can interpreted numbers. i.e. $foo = "2014" , $bar = "0301"; now assume + plus sign has work out want do? do want these treated numbers , added together? giving 2315. or 'sortable' date field of "20140301' i.e. yyyymmdd? there no way '+' operator know , correct thing in circumstances. hence need 'concatenation' operator '.'. the '+' operator converts numbers , adds. the '.' operator converts string , concatenate

java - Data or Incoming Request Validation Framework or Best Approach -

hi fellow programmers, i wondering best way perform validation of requests received on web service? know there might several ways requirement have around 1100 clients sends requests on published web service. real problem here every client has own validation rules example 1 client company name should not more 10 characters , should alphanumeric , other clients there's no requirement of company name being alphanumeric needs plain string less 30 characters. on , forth. fields needs validation more 50. should have database save validations rules per client , these validation rules applied upcoming requests client. can point me in correct direction? should use , how should it? best way perform these kind of validations? framework available? advance.

php - Is it good practice to always catch an exception in the higher-level object? -

as project gets bigger , bigger, bit confused types of exceptions should thrown , should caught, e.g. how organize internal exceptions vs exception messages should shown end user. keep confusion down, best practice catch exception in higher-level object? take example: if have database class inserts row database, , class called object processes data, , in turn data processing object called controller, correct catch errors database class in processing class, (possibly) rethrows error caught in controller class? or can error thrown in database class caught in controller class? additionally, if 1 method in processing class called method in same class, , first throws error, ok catch exception in same class? or should deferred higher-level class that's calling it? are there other tips on how structure , organize exceptions in large projects many levels of classes? an exception should thrown in exceptional event, i.e. if wrong , code cannot continue is. e.g. database

sql - Browse subcolumns, but discard some -

i have table (or view) in postgresql database , want following: query table , feed function in application subsequent n-tuples of rows query, satisfy condition. can n-tuple listing using cursor, don't know how condition checking on database level. for example, query returns: 3 2 4 2 0 1 4 6 2 and want triples of numbers. here, be: (2,4,2) (4,2,0) (4,6,2) obviously, cannot discard odd numbers query result. instead using cursor, query returning arrays in similar manner acceptable solution, don't have idea how use them this. of course, check @ application level, think it'd cleaner on database level. possible? with window function lead() ( as mentioned @wildplasser ): select * ( select tbl_id, i1 , lead(i) on (order tbl_id) i2 , lead(i, 2) on (order tbl_id) i3 tbl ) sub i1%2 = 0 , i2%2 = 0 , i3%2 = 0; there no natural order of rows - assuming want order tbl_id in example. % .. modulo operator sql fiddle.

ruby on rails - Cannot find User with provided user_id parameter -

i'm pretty new rails , trying learn framework creating twitter clone app. can`t understand error message code more or less same 1 have in sessions controller. i'm trying save new post in db , redirect users show page. so here's code: def create @user = user.find(params[:user_id]) @post = post.new(posts_params) if @post.save redirect_to @user , notice: "you have written new tweet" my error message: activerecord::recordnotfound in postscontroller#create couldn't find user without id the tweets saved in db. i'm having problems redirect. works when write in id manually though. this because not sending user_id post requests. pretty sure tweet not associated user now. have use authentication library such devise persist user login. if use library, can use current_user method instead of doing @user = user.find(params[:user_id] doing above code not because can manipulate user_id in post form data post tweet user. i

bit manipulation - Simple bitwise operation in Java -

i'm writing code in java using short typed variables. short variables 16 bits unfortunately java doesn't have unsigned primitive types i'm using 15 lower bits instead ignoring sign bit. please don't suggest changes part i'm quite far in implementation... here question: i have variable need xor. in c++ write myunsignedshort = myunsignedshort ^ 0x2000; 0x2000 (hex) = 0010000000000000 (binary) however, in java, have deal sign bit i'm trying change mask doesn't affect xor... mysignedshort = mysignedshort ^ 0xa000; 0xa000 (hex) = 1010000000000000 (binary) this isn't having desired effect , i'm not sure why. can see i'm going wrong? regards. edit: ok guys right, bit wasn't causing issue. the issue comes when i'm shifting bits left. i accidentally shift bits sign bit. mysignedshort = mysignedshort << 1; any ideas how avoid new prob if shifts msb nothing happens @ all? or should manual test? theres lot of shift

Chrome WebSocket returns "unexpected error 200" -

it looks websocket creation problem, should not happening chrome. tested different browsers (including chrome) different machines (same os same nw config) , ok. how possible? i struggling similar issue chrome , safari 3 years ago. in case was, @ end, issue of websockets versions basically there 2 main protocols of websockets: hixi , hybi, hybi becoming successor you mentioned same config 1 chrome browser works , 1 gives error. can please check versions of chrome on both scenarios? know long shot, if "broken" 1 running old version, bellow 14 around 2011, according chrome version history - might it btw, server using?

android - Calling webservice when uninstalling app -

i have app webservice. when uninstall app phone want call webservice before uninstallation completes.how can it? i have searched couldn't it. thanks in advance! in android can't make application aware being uninstalled.. have read; detect if app uninstalled as problem, keep record of active users in web service. after period of inactivity, assume these applications have been uninstalled.

plot - Gnuplot bad data on line 1 -

well, getting error gnuplot> plot "plot_error.p" ^ bad data on line 1 when trying execute plotting script plot_error.p on following datafile ( tesc_error.dat ) 2 0.02373300 0.00187922 3 0.12182900 0.01080161 4 0.30066000 0.02936487 5 0.88415600 0.07882007 6 1.70864800 0.14576794 7 4.11814900 0.44127670 8 8.79967900 0.84273207 9 22.09179700 2.25049799 10 54.13644000 5.28557289 11 164.75478299 20.67593118 12 376.32501997 39.98897077 13 807.50995700 82.47956624 the script is set encoding iso_8859_1 set terminal postscript eps enhanced color solid set xrange[1:14] set yrange[0:900] set title "1d mfpt" set xlabel "{/symbol g}" set ylabel "t_{esc}" unset key set output "tesc_error.eps"

php - Constructor Injection in Restler -

is possible pass along arguments api class sake of constructor injection? example, in index.php have following: $r->addapiclass('contacts', ''); and contacts.php looks this: class contacts { private $v; public function __construct(validation v) { $this->v = v; } } how restler? restler 3 rc5 has dependency injection container called scope responsible creating new instances of class name, comes in handy purpose. once register contacts class dependency using register method, lazy instantiated when asked for <?php include '../vendor/autoload.php'; use luracast\restler\scope; use luracast\restler\restler; scope::register('contacts', function () { return new contacts(scope::get('validation')); }); $r = new restler(); $r->addapiclass('contacts', ''); $r->handle(); by using scope::get('validation') can register validation if has dependencies

using macros in C to convert multiple arguments into one -

i'm brand new c, , i'm trying following: i have function move(int x, int y) want able move(center) i'm trying " #define center x/2, y/2 " what right way this? move(center) so want able call move on variable named center ? use struct: struct point { int x; int y; } ... void move(struct point p) { // read p.x , p.y } ... struct point center; center.x = 20; center.y = 20; move(center); i'm not sure intent #define center x/2, y/2 part... did mean #define center width/2, height/2 ? can center.x = width / 2 , center.y = height / 2 . edit: if can't re-define move try like void my_move(struct point p) { move(p.x, p.y); }

Serialize a Tree of Java Objects into Custom XML -

imagine tree of java objects, i.e. top level object of class contains properties in turn objects of other classes , on until reach fundamental types integer or string, etc. example: class car { private door _leftdoor; private door _rightdoor; } class door { private string _name; } by serializing top level object of class car , see xml document, example, this: <object type="car"> <property type="door" identifier="_leftdoor"> <object type="door"> <property type="string" identifier="_name">i left door!</property> </object> </property> <property type="door" identifier="_rightdoor"> <object type="door"> <property type="string" identifier="_name">i right door!</property> </object> </property> </object> by way, notice how fragment plugged other hie

loops - Summarize across a thousand variables for each observation in Stata -

i have made loop creates variable, expectedgpa . so have 1,000 variables each observation, labeled expectedgpa1 , expectedgpa2 ... expectedgpa1000 . i want average , standard deviation expectedgpa s each observation. so if have this joe 1 2 1 2 4 sally 2 4 2 4 3 larry 3 3 3 3 3 i want variable returned gives joe 2 sally 3 larry 3 any help? first, future questions: please post code showing you've tried. question shows no research effort. second, clarify terminology: you created 1000 variables, each 1 corresponding expected gpa . each observation corresponds different person. want, result, three variables . 1 person's id , 2 the mean , sd of gpa (by person). interpretation, @ least. one solution involves reshaping data: clear set more off input /// str5 id exgpa1 exgpa2 exgpa3 exgpa4 exgpa5 joe 1 2 1 2 4 sally 2 4 2 4 3 larry 3 3 3 3 3 end

jasidepanels - uitableview not reload again in half view like facebook Half view -

i have made application, in have used uitableview in half view facebook, when go half view using swipe, uitableview not reload, reloads when run first time,so if knows it, please tell me. thanks i have subclassed jasidepanel , in subclass override method show below: - (void)toggleleftpanel:(id)sender { [((myleftpanelviewcontroller *)self.leftpanel) myreloadmethodinmyleftpanelviewcontroller]; [super toggleleftpanel:sender]; } this works when using left navigation button navigate left panel, think similar approach work swipe. figured out looking in header file jasidepanel , tracing code.

java - Generating Table of Contents using XMLWorker -

i generating pdf using itext , xmlworker. there problem need generate toc pdf page no. having mt section headings in list. list can generate toc without page no. our requirement need page no also. below list containing section details. list<string> sectionlist=new arraylist<string>(); sectionlist.add("section1"); sectionlist.add("section2"); sectionlist.add("section3"); sectionlist.add("section4"); sectionlist.add("section5");` my clob object is string pdfstring="<h1>section1</h1><p>some content section1</p>" + "<h1>section2</h1><p>some content section2</p>" + "<h1>section3</h1><p>some content section3</p>" + "<h1>section4</h1><p>some content section4</p>" + "<h1>section5</h1><p>some content section5</p>&q

web services - How to automate downloading a files using java program -

i need download files multiple links page (may more 100 files separate links) automatically. know url login , have credentials. i'm willing in java program automation. way go downloading location page through login site. is curl command helpful this? please advise me this. you can use wget can download log files: wget -r --no-parent --user=user --password=password --no-check-certificate <url> you can pass headers in --header, e.g. --header "cookie: jsonsessionid=3433434343434" you can pass post data using --post-data 'email=$email&password=$passwrd' or can use following httpclient in java: here examples of httpclient login , passing post/get/headers information first whole html page string either parse string links files or convert java objects using xml object mappers https://github.com/fasterxml/jackson-dataformat-xml once links of files download files using httpclient public void savefile(string url, string filen

html - "display: table-cell" has no constistent alignment -

Image
once between div tags, html tag (eg headings, breaks), contents no longer align same. example: html.displayfor (...) should end justified. how can fixed? <div class="table"> <div class="row"> <div class="cell"> <h3>heading 1</h3> <hr /> <div class="row"> <div class="cell">label 1</div> <div class="cell">html.displayfor(...)</div> </div> <div class="row"> <div class="cell">label 2 more text</div> <div class="cell">html.displayfor(...)</div> </div> <br /> <h3>heading 2</h3> <hr /> <div class="row"> <div class="cell">label 3

android - how to solve error to play any audio/video file through media player? -

here io exception error logcat.... 03-25 09:41:17.950: d/dalvikvm(10906): gc_for_alloc freed 42k, 7% free 2629k/2800k, paused 54ms, total 60ms 03-25 09:41:17.962: i/dalvikvm-heap(10906): grow heap (frag case) 3.167mb 512016-byte allocation 03-25 09:41:18.030: d/dalvikvm(10906): gc_for_alloc freed 2k, 6% free 3126k/3304k, paused 64ms, total 64ms 03-25 09:41:18.149: d/dalvikvm(10906): gc_concurrent freed <1k, 6% free 3126k/3304k, paused 12ms+8ms, total 119ms 03-25 09:41:18.289: d/dalvikvm(10906): gc_for_alloc freed <1k, 6% free 3126k/3304k, paused 36ms, total 36ms 03-25 09:41:18.349: i/dalvikvm-heap(10906): grow heap (frag case) 6.637mb 3640620-byte allocation 03-25 09:41:18.439: d/dalvikvm(10906): gc_concurrent freed 0k, 3% free 6681k/6860k, paused 30ms+5ms, total 99ms 03-25 09:41:19.089: d/gralloc_goldfish(10906): emulator without gpu emulation detected. 03-25 09:41:24.129: d/dalvikvm(10906): gc_concurrent freed 515k, 8% free 7537k/8172k, paused 6ms+7ms, total 301ms 03-25 0