Posts

Showing posts from February, 2010

Neo4j Multi-tenancy -

what best way achieve multi-tenancy in neo4j? i have seen tinkerpop , spring data. i'm have multiple clients , store client info in own database ensure security. i not want use labels or indexes solve problem. neo4j not support multi-tenant deployments @ time. can run multiple instances on same server, each 1 on different port. alternatively, can use managed hosting service graphenedb , provides secure independent instances. disclaimer: work @ graphenedb.

android - Out of memory during XML deserialisation -

i de - serializing xml in async task. @ particular instance getting out of memory error while de- serialization. know there flag called largeheap can use in application. there way find out avoid @ place. as per finding system.gc() not best solution fix it. can me through it. below code snippet. private hashmap<string, game> games = new hashmap<string, game>(); public void load(localdatabasehelper localdbhelper) throws exception { synchronized(gamelockobject) { gamedetaildao dao = new gamedetaildao(localdbhelper); //this fetch me entities databse arraylist<gamedetailentity> dbgamedetails = dao.getentities(null, null); (gamedetailentity gamedetail : dbgamedetails) { string gamelevel = gamedetail.getdetaillevel(); string gamexml = gamedetail.getgamedata(); game game = null; if(gamelevel.equalsignorecase("novice")) { game = job.deseria...

Variable Alphabetics Permutation Algorithm - Simple yet mind-boggling -

i came across apparently simple problem turned out mind boggling couldn't sleep 2 days. here problem: a variable consist of number of characters -> $i=5. need print every possible alphabetical combination $i=2 $i=5. the output $i=5 needs be: aa ab ac ... zz aaa aab ... zzz aaaa aaab .... zzzz aaaaa ..... zzzzz you need use only loops or foreach or while loops achieve (no functions used) , print output each string formed instead of saving in array. please not use loop inside of loop inside of loop because $i can 100 or 200. you can take array of alphabets 'a' 'z'. can please me out simple elegant solution this? before loop have array aa . in loop @ array. if array sequence of z replace contents sequence of a has length incremented 1. if new array has length larger maximum exit loop. otherwise @ tail of array, in form xz* , x letter except z , followed 0 or more letters z . replace tail of array ya* , y letter follows x , ie. y = x...

c# - Remove node from xmlDocument -

this question has answer here: removing nodes xmldocument 6 answers i trying remove nodes xml document based on input getting below error... the node removed not child of node. xmldocument document = new xmldocument(); document.load(filepath); if (document == null) throw new exception("unable load document."); foreach (string xpath in xpaths) { xmlnodelist oldchild = document.selectnodes(xpath, mgr); if (oldchild != null) { foreach (xmlnode child in oldchild) { document.removechild(child); } } } document.save(filepath); can me missign here. the removechild method working on direct child of node. trying remove inner (not first generation) node accessing root node - d...

Base R: add points() in a loop defined by group -

Image
i looking way generate different plots in base r adding points , lines manually plot. xy <- data.frame(name=c("name1","name1","name2","name2"), x_start_year=c(1984,1986,1899,1903), y_start_value=c(75,25,-90,-8),x_end_year=c(1986,1994,1909,1924),y_end_value=c(20,50,-15,-70)) xy name x_start_year y_start_value x_end_year y_end_value 1 name1 1984 75 1986 20 2 name1 1986 25 1994 50 3 name2 1899 -90 1909 -15 4 name2 1903 -8 1924 -70 is possible add points() plot values first row (starting point x_start_year/y_start value end point: x_end_year/y_end_value ) , plot again in same plot in same scheme values second row. after plot has been generated new group defined name starts , new plot should generated rows 3 , 4 in same scheme above. unl...

Does MS C# Implementation of String check ReferenceEquals of the immuteable base String first? -

suppose had string s. string = "this string"; strinb b = "this string"; string c = a; as understand string a , b not nescessarily share same immuteable base string. string c copy of a , points internally same immuteable string. if compare a , b equality, return true. @ least because represent same character sequence. if compare a , c equality, return true. did check characters or did compare pointers immuteable string first? edit: to answer how check equality: private void stackoverflowequals() { string = @"http://stackoverflow.com/questions/25932695/does-ms-c-sharp-implementation-of-string-check-referenceequals-of-the-immuteable"; string b = @"http://stackoverflow.com/questions/25932695/does-ms-c-sharp-implementation-of-string-check-referenceequals-of-the-immuteable"; string c = a; if (!(a == b)) throw new exception(); if (!(a == c)) throw new exception(); } ...

sql - Counting associations where child model's attribute = x -

trying count of driver's cars when manual transmission = true. (driver has_many cars; car belongs_to driver, etc.) my current code: <% @driver = driver.find(1) %> <% driver.cars.where("car.manual = true").count %> returns error: pg::undefinedtable: error: missing from-clause entry table "car" line 1: ...ars" "cars"."driver_id" = $1 , (car.m... ^ : select count(*) "cars" "cars"."driver_id" = $1 , (car.manual= true) when remove ".count", seem find relationship, because prints: #<car::activerecord_associationrelation:0x007fea6ddf4c88> i tried <%= @driver.cars.where(manual = true).count %> but returns count of driver's cars. i suspect problem "manual = true" syntax, i'm new writing queries i'm missing stunningly obvious. if can me figure out i'm going wrong, i'd ...

Updating a form entry in php/mysql with checkboxes? -

how can allow user submitting form, update entry on "re-submission" example 12345678910 (unique id) , submitted form selections, 12345678910 , re-submitted new selections what's function responsible "automatically" updating such kind of form entries. i know can use check if entry exists, how update if exists , insert in new row if doesn't ... function checkstudentid($studentid) { $con = connectvar(); mysql_select_db("database1", $con); $result = mysql_query( "select * table studentid='$studentid' limit 1"); if(mysql_fetch_array($result) !== false) .... // want add entry here since doesn't exist...with checkboxes // else , want update if exists } now i'm not positive if above code work...but have starters, if there other way or if method i'm using "wrong" , appreciate heads up...or if i'm trying possible (the way i'm doing it)... notes ...

Appcode Reformat Code JavaDoc style comments disagreeably -

appcodes 'reformat code' feature formats javadoc comments in disagreeable manner. this how have comments: /** * blabla * @return blibla array bli */ but 'reformat code' reformats to /** * blabla * @return blibla array bli */ - (nsarray *) bla.... does know how can tell appcode format comments like, or @ least how not touch existing comments?

ruby - How do I merge two hashes into a hash of arrays? -

http://codepad.org/wmyzqlis i'd merge these 2 arrays: a = { :a => 'a', :b => 'b', :d => 'd' } b = { :a => '1', :b => 'b', :c => 'c' } into hash looks this: {:a => ["a", "1"], :b => ["b", "b"], :c => [nil, "c"], :d => ["d", nil] } this doesn't work: p a.merge(b) { |k, v1, v2| [v1, v2] } # {:c=>"c", :a=>["a", "1"], :b=>["b", "b"], :d=>"d"} it's because hash#merge call block duplicate keys. a = { :a => 'a', :b => 'b', :d => 'd' } b = { :a => '1', :b => 'b', :c => 'c' } hash[(a.keys|b.keys).map { |key| [key, [a.fetch(key, nil), b.fetch(key, nil)]] }] # => {:a=>["a", "1"], :b=>["b", "b"], :d=>["d", nil], :c=>...

Ruby and Rails Error (Psych::SyntaxError) and -

after experiencing issues ruby.framework deleted , used pacifist reinstall , seemed solve previous issue. seem error when using ruby command. /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/psych.rb:370:in `parse': (<unknown>): mapping values not allowed in context @ line 2 column 7 (psych::syntaxerror) /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/psych.rb:370:in `parse_stream' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/psych.rb:318:in `parse' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/psych.rb:245:in `load' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/config_file.rb:333:in `load_file' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/config_file.rb:198:in `initialize' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/rubygems/gem_runner.rb:74:in `new' /users/brandoncontreras/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/ru...

ios - How to find out the file path of the image in Image Picker Controller call back -

in ios invokes image picker controller let user picks image phone. i have implemented callback when user finished picking photo: func imagepickercontroller(picker: uiimagepickercontroller!, didfinishpickingimage image: uiimage!, editinginfo: nsdictionary!) { } i know if possible me find file path of image user has picked? thinking after user picks photos, may exist app. want resume photos picked before in app. possible?

java - Finding a regex to return all special characters in a single group -

i want regex return special characters in single group. have made regex return characters using [^a-za_z0-9] 1 not return characters not being letter or digit in single group. for example if string checked today ~friday() expecting output ~() in 1 string can replace them in 1 go. but using regex provided getting: 0: [14,15] ~ 0: [21,22] ( 0: [22,23] ) try using replaceall method. below have code find fragments matching normal character sequence , replaces sequence empty string. string in = "today ~friday()"; string out = in.replaceall("[a-za-z0-9 ]+", ""); system.out.println(out); and result is: ~()

Simplifying Go Code -

i have 2 functions shown below similar, using different functions query db. since go doesn't encourage overloaading methods, redundancy acceptable? or should refactor them 1 function? comments welcomed. var getcustomers = func() ([]customer, error) { return nil, nil } var getcustomerbyid = func(int64) (*customer, error) { return nil, nil } func listcustomer(w http.responsewriter, r *http.request) *apperror { cus, err := getcustomers() if err != nil { return &apperror{err, "no customer found", 404} } res, err := json.marshal(cus) if err != nil { return &apperror{err, "can't display record", 500} } fmt.fprint(w, string(res)) return nil } func viewcustomer(w http.responsewriter, r *http.request, id int64) *apperror { cus, err := getcustomerbyid(id) if err != nil { return &apperror{err, "no customer found", 404} } res, err := json.marshal(cus) ...

ios - audio slow motion like default Slo-Mo Camera functionality using 240FPS -

i want implement slowmotion video defalut functionality of slo-mo in camera , used following code , worked fine video. in audio track of video not working properly. double videoscalefactor =8.0; compositionaudiotrack scaletimerange:cmtimerangemake(kcmtimezero, videoduration) toduration:cmtimemake(videoduration.value* videoscalefactor,videoduration.timescale)]; [compositionvideotrack scaletimerange:cmtimerangemake(kcmtimezero, videoduration) toduration:cmtimemake(videoduration.value* videoscalefactor, videoduration.timescale)]; scenario woking video slowmotion.but in audio slow-motion not working... please me.. i found solution of audio slowmotion double videoscalefactor =8.0; [compositionaudiotrack scaletimerange:cmtimerangemake(kcmtimezero, videoduration) toduration:cmtimemake(videoduration.value* videoscalefactor,videoduration.timescale)]; its working not working in avplayer h...

How to write a structure to excel in MATLAB -

Image
i have structure want write excel file. for example, want write structure excel. contains both textdata , numbers want write excel. >> a.textdata ans = sheet1: {'coco-cola' 'cce'} >> a.data ans = sheet1: [4 46.7100 46.2800 185.1200 -0.0092 -1.7200] the output should this: need guidance on how it. what have tried far: 1) xlswrite(filename,a); it gave me error: error using xlswrite (line 166) input data must numeric, cell, or logical array. 2) acell = struct2cell(a);xlswrite(filename,acell); it gave me error:an error occurred on data export in csv format. caused by: undefined function 'real' input arguments of type 'struct'. please try following: writetable(struct2table(a), 'parameters.xlsx'); here, structure

How realign segments of image in python? -

Image
this image like:- i want this.:- please look, in second picture button of image laved up. use software called option segment 20. don't have idea ho in python can please me ? using python 2.7 , new python please describe clear code example. have tried opencv vector spacing time give me wrong image. first off, need find objects (numbers) within image , save them in /objects folder. can using cv2.findcontours() in order find contours , bounding rectangle's coordinates cv2.boundingrect() method. import numpy np import cv2 im = cv2.imread('old_image.png') gray = cv2.cvtcolor(im,cv2.color_bgr2gray) blur = cv2.gaussianblur(gray,(5,5),0) thresh = cv2.adaptivethreshold(blur,255,1,1,11,2) contours,hierarchy = cv2.findcontours(thresh,cv2.retr_list,cv2.chain_approx_simple) i=0 cnt in contours: [x,y,w,h] = cv2.boundingrect(cnt) if h>60: cv2.rectangle(im,(x,y),(x+w,y+h),(0,0,255),1) im3=im[y:y+h,x:x+w] cv2.imwrite('...

html - What is the simplest or best way for preventing the background video from loading on mobile browsers? -

i have webpage loads video background. want prevent video loading on (at least some) mobile browsers. have disabled displaying video using @media tag, think doesn't prevent browser loading video. @media screen , (max-device-width: 800px) { #bgvid { display: none; } } i'd know how prevent video loading on mobile browsers. great if done without using javascript. turned out media tags enough prevent loading of videos on mobile browsers (for devices don't exceed specified width).

java - Didn't declare abstract class but is saying can instantiate anyways? -

i'm getting error won't allow me instantiate class within method, because says abstract. however, didn't declare class abstract don't know why this. suggestions? public class mytemps implements temperatures { public mytemps(string[] array) @override public listofstrings sublist(int fromindex) { if (fromindex>this.size()){ throw new indexoutofboundsexception(); } temperatures sub=new mytemps(10); } } you can't instantiate interface, need do new mylistofstrings(10);

java - How to handle a large number of Cron jobs with EJB? -

i'm writing website uptime monitoring tools ejb3.1 need check websites http response code every 1 minuet. therefore, need run many cron jobs in parallel in same time during 1 minuets. i'm using timer service now, problem is, how many timer service can make in code (programmatically) or best solution problem? there threadpooling have in normal (javase) application in ejb applications?

Parsing input into tokens using different delimiters in C++ -

so trying parse input data , break data string tokens, problem is, need different delimiters on same line , on different lines, @ same time. here example of need parse: input: <15> algorithm [binary tree] analysis heap <1> [binary search tree] analysis complexity algorithm [2-3 tree] <5> tree [b+ tree] [binary tree] <8> graph clique tree <5> tree [full binary tree] [complete binary tree] <-1> so above input, need take parse numbers inside angle brackets using delimeter <> have done , works in code. need parse data on lines using both dilemeter " " individual words, , "[]" delimeter words inside brackets need have spaces included. so have: // create file-reading object ifstream fin; fin.open("input.txt"); // open file if (!fin.good()) return 1; // exit if file not found // read each line of file while (!fin.eof()) { // read entire line memory char buf[maxchars]; fin.getline(buf, maxchars); cout <...

php - Unable to get rewriting workingly properly on nginx for laravel -

i looking configuring nginx allow laravel routes work correctly, have found numerous tutorials giving different ways no avail. following: nginx configuration laravel 4 seems quite close need, getting error no input file specified. when error log can see instead of route going eg /url/index.php/args instead being routed /url/args/index.php this nginx app configuration file, , it's need make work, and, nginx doesn't make use of .htaccess: server { listen 80; server_name laravel.dev; root /var/www/laravel/public/; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log /var/log/nginx/laravel.dev-access.log combined; error_log /var/log/nginx/laravel.dev-error.log error; error_page 404 /index.php; sendf...

javascript - jQuery: What is wrong here? -

this first question here. first of have @ code $("body").on("click", "#showstore", function() { $('#foo a[href="' + $('.container').children('a').attr('href') + '"]').remove(); }); html <div id="showstore">button</div> <div id="foo"> <a href="http://jsfiddle.net/">hello</a> <a href="http://google.com/">okay</a> </div> <div class="container"> <a href="http://jsfiddle.net/">bye</a> <a href="http://google.com/">see</a> </div> on clicking '#showstore' first 'a' being removed. how can make remove matched 'a' #foo? jsfiddle :: http://jsfiddle.net/xr3gjvxx/27/ selector in code targeting anchor tags under #foo , has changed anchor tags. change $('#foo a[href="' + $('.container')....

javascript - JS: how to find a specific string, then extract an integer? -

Image
i'm trying write userscript game i'm playing. uses piece of html code: <td valign="center"> <b>ten-leaf clover</b> (4 left in stock today) </td> this picture of we're talking about: the script should search string containing words "left in stock today", integer within string. (the '4' not constant, changes every day.) lastly, store integer variable, can replace '1' in input field. this: var clover = entercodehere $("input.text[name='quantity']").val(clover); you can used regex so: var texttosearch = $("td").innerhtml(); //you'll need better selector this. better use class or id var clover = parseint(texttosearch.match(/\d+\s*left in stock today/)[0].match(/\d+/)[0]); $("input.text[name='quantity']").val(clover); you may want check array isn't empty before taking first value if confident it'll there shou...

formatting - Change IDLE tab width/ indent width Python -

just minute ago opened idle start new python file. after had written function header, pressed tab (from column 0) , indented 2 spaces rather four. hasn't happened me before. how can change/ reset tab width 4 spaces? in idle preferences, under "fonts/tabs" there should "indentation width" preference, can change tab width 4 spaces.

c++ - Error C2664 using maps -

i'm trying use map pathfinding, i'm unfortunately not familiar them. i'm making assumption following error occurs on line in pathfinding.h : std::map<pathnode*, bool> mopenmap; "error 1 error c2664: 'std::pair<const _kty,_ty>::pair(const std::pair<const _kty,_ty> &)' : cannot convert argument 1 'pathnode *' 'const std::pair<const _kty,_ty> &' c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 600 1 pac3d" i figured work have seen others using in similar manner, either i'm doing wrong or that's not supposed work way, i'm thinking latter of two. does have pointers on how fix this? gladly post more code upon request. edit: use mopenmap.emplace(start, true); put first node inside, there on out it's currentnode, , both pathnode* the error need insert. according error inserting @piotrs pointer pathnode , need insert pair of (key, value) mopenmap.in...

ruby - Windows puma unable to load application due to backports Bad File descriptor -

i'm trying run puma project on windows 8 machine , keep getting error whenever try run bundle puma exec -p 4567 error bad file descriptor in part of backports code. ps c:\users\andrew\work\test> bundle exec puma -p 4567 dl deprecated, please use fiddle *** sigusr2 not implemented, signal based restart unavailable! *** sigusr1 not implemented, signal based restart unavailable! *** sighup not implemented, signal based logs reopening unavailable! puma starting in single mode... * version 2.9.1 (ruby 2.0.0-p576), codename: team high 5 * min threads: 0, max threads: 16 * environment: development ! unable load application c:/ruby200/lib/ruby/gems/2.0.0/gems/backports-3.4.0/lib/backports/1.9.1/io/open. rb:2:in `close': bad file descriptor - c:/ruby200/lib/ruby/gems/2.0.0/gems/backp orts-3.4.0/lib/backports/1.9.1/io/open.rb (errno::ebadf) c:/ruby200/lib/ruby/gems/2.0.0/gems/backports-3.4.0/lib/backports/1 .9.1/io/open.rb:2:in `open' c:/ruby200/lib/ruby/ge...

ios - How to dislay an image from Asset Catalog in Today Extension? -

i'm working on today extension ios8. app group set correctly , can use nsuserdefaults send simple bits of data extension (using this tutorial ). in storyboard extension, i've placed image onto storyboard , set image asset have in asset catalog. though appears in interface builder, when run app on device , simulator image doesn't display. what missing? make sure asset catalog included in target today extension.

android - How to publish a library project on maven? -

plain , simple. i have open-source library repository on github , users of android library demanding library published on maven central easier use. since not familiar maven not know do. unaware maven , it's advantage is. how can add maven support project? how can upload project maven central? there kind of detailed tutorial on need do? the easiest way maven central gradle using bintray. here how: http://blog.blundell-apps.com/locally-release-an-android-library-for-jcenter-or-maven-central-inclusion/

email - Define from php -

i have sendmail.php works great. when trying send mail 2 email adresses , 1 of come variable mail not send. when go: define("webmaster_email", "luka@luka.com, luka123@luka.com"); works fine, bet when try variable error, mail not send. $mail = "luka123@luka.com"; if (empty($mail)){ define("webmaster_email", "luka@luka.com"); } else { define("webmaster_email", "luka@luka.com, $mail"); } any idea? here send function $mail = mail(webmaster_email, $subject, $mail_salji, $headers); first thought must because cannot use variable in constant definition. when tested code: define("webmaster_email1", "luka@luka.com, luka123@luka.com"); echo webmaster_email1; $mail = 'luka123@luka.com'; define("webmaster_email2", "luka@luka.com, $mail"); echo '<br>'; echo webmaster_email2; i got result: luka@luka.com, luka123@luka.com luka@lu...

python - PyCharm show graphics -

i trying have pycharm show graphics, when run script nothing appears on screen. from pylab import * def main(): ion() t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) plot(t, s) xlabel('time (s)') ylabel('voltage (mv)') title('about simple gets, folks') grid(true) show() i using python 2.7.6, pycharm 3.4 , windows 7 x64. d:\python27\python.exe "d:/sletmig/python tests/pandas/chart.py" process finished exit code 0 i new python! add end of script: if __name__ == "__main__": main()

java - Robolectric Test an activity launched from a widget -

i've simple widget consists of image , button, button should launch activity. i'm trying write robolectric test test activity launched when button clicked i've 2 problems, firstly i'm getting npe when attempting click button: java.lang.nullpointerexception: can't shadow null @ org.robolectric.bytecode.shadowwrangler.shadowof(shadowwrangler.java:415) @ org.robolectric.robolectric.shadowof_(robolectric.java:1020) @ org.robolectric.robolectric.shadowof(robolectric.java:671) @ org.robolectric.shadows.shadowintent.fillin(shadowintent.java:454) @ android.content.intent.fillin(intent.java) @ org.robolectric.shadows.shadowpendingintent.send(shadowpendingintent.java:48) @ android.app.pendingintent.send(pendingintent.java) @ org.robolectric.shadows.shadowremoteviews$2$1.onclick(shadowremoteviews.java:61) @ android.view.view.performclick(view.java:4084) also i'm not sure how reference activity launched via button click. code test: @...

nopcommerce - How to handle AdminTabStripCreated event and use content from plugin? -

i using nopcommerce 3.40 i handle admintabstripcreated event add new tab plugin. my code like: public class admintabstripcreatedeventconsumer : iconsumer<admintabstripcreated> { public void handleevent(admintabstripcreated eventmessage) { if (eventmessage.tabstripname == "customer-edit") { string url="nop.plugin.ui.customertabs.views.test.customeradmin" string script = @"<style type=""text/css""> .k-link { font-weight: bold; } </style> <script language=""javascript"" type=""text/javascript""> $(document).ready(function () { var ktabs = $('#customer-edit').data('kendotabstrip')...

How can I prevent piracy of my Windows Phone 8.1 app? -

i'll releasing paid-for windows phone 8.1 app , want ensure users can't share app other phones. i've learned it's easy share app on android , iphone, have implement copy protection app each platform. is there build windows phone 8.1 prevent this? need build own custom copy protection mechanism? windows phone 8.1 is, @ moment, 100% safe point of view, application assemblies encrypted , can't reverse engineered. in wp7.x , in 8.0 prior gdr3 update (but samsung ativ s, because of bug in samsung diagnostic utility)

c# - How to send an HTTP request and don't process the response -

as service, server needs notify clients resource ready use. happen, give me url callback , when resource ready send http request callback url. what best way initiate http request , don't process response? var wc = new webclient(); wc.downloadstringasync(new uri(url)); in code example though ignore response completely, server still call thread download response (which couldn't care less...) once it's ready. i suggest package id: microsoft.net.http , use more modern httpclient library. question of whether 'await' response or not. if dont await fire , forget , achieve wanted behaviour: using system; using system.net.http; using system.threading.tasks; namespace consoleapplication1 { public class httphelper { public static async task waitforresponse() { using (var client = new httpclient()) { httpresponsemessage response = await client.getasync(new uri("http://google.com")); } } publ...

android - Set value of hidden field with corresponding data of item selected from AutoCompleteTextView -

i've autocompletetextview suggests name of place stored in mysql database calling api, when text changes, using ontextchanged . response json array many items place_name, id, location_key,query_type, request_type, etc.(each own different purpose). i've 3 hidden edittext field. on setonitemclicklistener , when user selects place name, want these 3 hidden fields have value automatically set location_key, query_type , request_type, need send along these 3 values place name required result api. once click on place_name field, hidden edittexts should values need send database. can obtained doing following: textmessage.addtextchangedlistener(new textwatcher(){ public void aftertextchanged(editable s) { if (textmessage == "//name of place") { edittext1.settext "//whatever need"; edittext2.settext "//whatever need"; edittext3.settext "//whatever need"; } } }); alternat...

Image conversion framework -

could recommend existing image conversion framework. need convert virtually image formats: raster , vector, ms office, pdf, psd etc. color precision must. thank you. (edited) any platform, language, windows preferred. backend, client platform irrelevant. know find multiple frameworks cover formats (already have), idea have few possible. color precision important image review system. imagemagick complete image conversion tool know, has lot's of features modify types of images. software works in cli , available platform. you can find lot of on their forum .

php - How can i simplify the new sessions i create for a model which is linked? -

i have login action in control. sessions created auth.user, not auth.town. need create sessions. have several fields in towns table, , not want create 50 lines. how can make easier ? need simplify . userscontroller : public function login() { if ($this->request->is('post')) { if (isset($this->request->data['userlogin'])) { $this->request->data['user'] = $this->request->data['userlogin']; } if ($this->auth->login()) { $this->session->write( 'auth.town.name', $this->user->town->field('name') ); $this->session->write( 'auth.town.country', $this->user->town->field('country') ); $this->session->write( 'auth.town.localisat...

OSGI Bundle implementing JPA Using DataNucleus 4.0.0 Release -

i trying implement jpa using datanucleus in osgi environment (apache servicemix). following guide mentioned here - http://www.datanucleus.org/products/datanucleus/jpa/osgi.html (section under name "jpa , osgi") per documentation here using datanucleus jpa jar. have deployed jar on servicemix follows - osgi:install mvn:org.datanucleus/datanucleus-jpa/2.1.7 osgi:start bundleid as jar export persistence provider,i have correctly changed provider in persistence.xml file org.datanucleus.jpa.persistenceproviderimpl (which exported above bundle) rather usual org.datanucleus.api.jpa.persistenceproviderimpl in normal j2ee jpa app. i have datanucleus core bundle running on servicemix, installed on servicemix using following - osgi:install mvn:org.datanucleus/datanucleus-core/4.0.0-release osgi:start bundleid please note: donot have datanucleus-api-jpa bundle running on servicemix, per documentation, datanucleus-jpa bundle export necessary classes , hence datanucleus...

sql - Eliminate mysql file sort in update query -

i have such table use implement queue in mysql: create table `queue` ( `id` int(10) unsigned not null auto_increment, `queue_name` varchar(255) not null, `inserted` timestamp not null default current_timestamp on update current_timestamp, `inserted_by` varchar(255) not null, `acquired` timestamp null default null, `acquired_by` varchar(255) default null, `delayed_to` timestamp null default null, `priority` int(11) not null default '0', `value` text not null, `status` varchar(255) not null default 'new', primary key (`id`), key `queue_index` (`acquired`,`queue_name`,`priority`,`id`) ) engine=innodb auto_increment=1 default charset=utf8 my problem mysql use filesort when run update. execution slow (5s 800k rows in table). describe update queue set acquired = "test" acquired null , queue_name = "q1" order priority, id limit 1; +----+-------------+-------+-------+---------------+-------------+---------+-------------...

clojure - ClassNotFoundException on use of another ns -

as simple question is, can't seem find right way different namespaces in same directory validly refer 1 another. have 2 files: project_root/src/babbler/core.clj : (ns babbler.core (:gen-class) (use '[clojure.string :only (join split)])) (defn foo [] "foo") and project_root/src/babbler/bar.clj : (ns babbler.bar) (use [babbler.core :as babble]) this file contains main method, specified in project.clj via :main babbler.bar my entire structure generated counterclockwise, with default leiningen template. the result of running lein repl this: exception in thread "main" java.lang.classnotfoundexception: babbler.core, compiling:(babbler/bar.clj:3:1) @ clojure.lang.compiler.analyze(compiler.java:6380) @ clojure.lang.compiler.analyze(compiler.java:6322) @ clojure.lang.compiler$vectorexpr.parse(compiler.java:3024) @ clojure.lang.compiler.analyze(compiler.java:6363) @ clojure.lang.compiler.analyze(compiler.java:6322) (...

php - Create File with Chart, and dynamic number of columns -

i creating xlsx-file, , want add column chart, displaying 2 values calenderweek. however, don't know how many charts (depending on items available) , how many calenderweeks i'll have display (depending on time-frame selected user). creating weeks , data-table not problem, working fine, iterating through data 2 nested foreach-loops, using setcellvaluebycolumnandrow(). my problem is, have dynamic number of columns , dynamic number of rows. need hint, how transfer $value = new phpexcel_chart_dataseriesvalues('number', 'worksheet!$c$9:$h$9', null, $numberofweeks); array_push($values, $value); into this: $value = new phpexcel_chart_dataseriesvalues('number', 'worksheet!$' . $start_column . '$' . $current_row . ':$' . $end_column . '$' . $current_row, null, $numberofweeks); array_push($values, $value); how create chart , dynamic number of columns? edit: within snippet, there missing "!...

maven multimodule project, override parent version -

borrowing example similar question , have 2 projects: parent project: a, sub project: b in a/pom.xml: <groupid>com.dummy.bla</groupid> <artifactid>parent</artifactid> <version>2.0</version> <packaging>pom</packaging> in b/pom.xml, have: <parent> <groupid>com.dummy.bla</groupid> <artifactid>parent</artifactid> <version>2.0</version> </parent> <groupid>com.dummy.bla.sub</groupid> <artifactid>kid</artifactid> i run tests on b follows, mvn test -pl b is possible override parent version, following? mvn test -pl b -dparent=1.0 you parent project version have dynamic using maven property can override system one. all child modules have inherit parent version , should not define theirs or process down broken. update parent poject descriptor below: <project> <modelversion>4.0.0</modelversion> <groupi...

Python Kivy ListView: How to delete selected ListItemButton? -

Image
i'm trying learn kivy building simple todo-list app suggested dusty phillips, author of book "creating apps in kivy". this code far: from kivy.app import app kivy.uix.boxlayout import boxlayout kivy.properties import objectproperty kivy.uix.listview import listitembutton class taskbutton(listitembutton): pass class todoroot(boxlayout): task_input = objectproperty() task_list = objectproperty() def add_task(self): self.task_list.adapter.data.extend([self.task_input.text]) self.task_list._trigger_reset_populate() def del_task(self): pass class todoapp(app): def build(self): return todoroot() if __name__ == '__main__': todoapp().run() and kv file: #: import main todo #: import listadapter kivy.adapters.listadapter.listadapter #: import listitembutton kivy.uix.listview.listitembutton todoroot: <todoroot>: orientation: "vertical" task_input: task_input_view t...

http - Android - Download and Open Pdf -

i have application downloads , opens pdf listview click listener. a file downloads , save phone has file size of 0 bytes therefore can not open. used tutorial code http://www.coderzheaven.com/2013/03/06/download-pdf-file-open-android-installed-pdf-reader/ here code. appreciated. public class openpdfactivity extends activity { textview tv_loading; string dest_file_path = "pdf-test.pdf"; int downloadedsize = 0, totalsize; string download_file_url = "http://www.education.gov.yk.ca/pdf/pdf-test.pdf"; float per = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); tv_loading = new textview(this); setcontentview(tv_loading); tv_loading.setgravity(gravity.center); tv_loading.settypeface(null, typeface.bold); downloadandopenpdf(); } void downloadandopenpdf() { new thread(new runnable() { public void run() { ...

error run php script in ubuntu server terminal -

i'm confuse right now..i make php script send sms gammu , put in home directory <?php mysql_connect("localhost","username","password") or die("failed"); mysql_select_db("database1") or die("database failed"); $not_send = mysql_query("select * outbox status=0"); while($sending = mysql_fetch_array($not_send)){ $msg_id = $sending['id']; $text = "gammu --sendsms text ".$sending['phonenum']." -text ".$sending['content']; $sms = shell_exec($text); if(preg_match("/ok/im", $sms)){ mysql_query("delete outbox id = '$msg_id'"); } } ?> i confirm $text output echo $text , when run in terminal php send_sms.php unexpected '(' can tell me whats wrong here??or cant put run php script outside /var/www/?? please me.. i solved problem thankx @zerkms..i dont quote $sending['content'] part in ...

c# - Keeping an Android app running in the background, preventing it from stopping/dying -

i've created app should keep working while in background. seems work fine time, if don't use phone extended period find has stopped working, , upon opening starts again. all searching leads me posts on how make app run in background, fine (i pulled whole part xamarin tutorial), reason decided stop after time. is there way force/ensure app continue running in background? user service , perform tasks want in that, services run in background if app closed background.

angularjs - Clever bulk update in Angular $resource -

here's i'd achieve: say have todo list , following changes: mark complete task 1 change name of task 2 mark complete task 2 change name of task 1 at present, system can achieve firing 4 http queries. there way angular can sync app server, every 20 seconds, able notice when change has been done on same item, , group changes same query. the clever bulk update like: update task 1, set complete=true, name= new name update task 2, set complete=true, name= new name has ever tried this? idea way should search find out more info kind of workflow?

The output of bitmap always show null in android form -

i have problem java class android upload file remote server. in form select file on gallery image on smartphone, output of bitmap show null , form start blocked. log.d("homeactivity.class", "output: " + bitmap); this beginning make me believe structure whole not correct. what missing ? what's wrong code? i appreciate can give me in working problem. public class homeactivity extends activity { button btnsend; spinner area; edittext description; imageview viewimage; button b, upload; bitmap bitmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); b = (button) findviewbyid(r.id.btnselectphoto); viewimage = (imageview) findviewbyid(r.id.viewimage); upload = (button) findviewbyid(r.id.button1); area = (spinner) findviewbyid(r.id.my_spinner_new); description = (edittext) f...

php - Using PDO to return a single set of values rather than an array -

a nice person on site helped me following script (and worked treat) <?php $db = new pdo('mysql:host=host;dbname=database', $user, $pass); $stmt = $db->prepare(' select yeast, rating, description, weblink, image, sideimage dowdb_yeast_selector fruit = :fruit order rating desc '); $stmt->bindparam(':fruit',$_post['fruit'],pdo::param_str,50); $stmt->execute(); how echo side image (not part of while loop)? i think (?) need echo '$row[sideimage]' // how simple i all of examples have looked @ far not fit needs :-( use pdo::fetchall, example; $stmt->execute(); $arrresults = $stmt->fetchall(); //$arrresults multidimensional //this echo first sideimage echo $arrresults[0]['sideimage']; if want echo values of sideimage (ie: rows), you'd have iterate through results; foreach($arrresults $arrrow) { echo $arrrow...

.net - Unable To Build Solution In Visual Studio Getting error 'child node 2 exited prematurely' -

i having issue building solution visual studio 2012, getting error child node 2 exited prematurely. i googled , found link error msb4166: child node exited prematurely. shutting down but have enough physical memory , virtual memory in system. this diagnostics report. unhandled exceptions process 2370776: ===================== 9/23/2014 9:22:35 microsoft.build.shared.internalerrorexception: msb0001: internal msbuild error: must not have both assembly name , assembly file/path. @ microsoft.build.shared.errorutilities.throwinternalerror(string message, exception innerexception, object[] args) @ microsoft.build.shared.assemblyloadinfo.create(string assemblyname, string assemblyfile) @ microsoft.build.shared.assemblyloadinfo.factoryfortranslation(inodepackettranslator translator) @ microsoft.build.backend.nodepackettranslator.nodepacketreadtranslator.translate[t](t& value, nodepacketvaluefactory 1 factory) @ microsoft.build.logging...