Posts

Showing posts from May, 2013

ios - CoreData-Project with two entities -

this question has answer here: new core data, getting error in persistentstorecoordinator 1 answer i've 2 tableviews in app , user should able add objects both of them. 1 tableview works fine (there's 1 coredata entity ). when add entity , same things 1 tableview, xcode shows me error. the output is: unresolved error error domain=nscocoaerrordomain code=134100 "the operation couldn’t completed. (cocoa error 134100.)" userinfo=0x10333d80 {metadata={ nspersistenceframeworkversion = 419; nsstoremodelversionhashes = { buy = <883135e4 2884b0ed 4bb8fc1c 7d56c229 fbae3090 91be719d 73ac5d66 65e70b18>; }; nsstoremodelversionhashesversion = 3; nsstoremodelversionidentifiers = ( "" ); nsstoretype = sqlite; nsstoreuuid = "..."; "_nsautovacuumlevel" = 2; }, reaso

android - Toggle button for Mobile data -

in app having 2 toggle buttons, 1 wifi , other 1 mobile data. when applications start, if wifi on, toggle button on. but, if mobile data on, toggle button doesn't show that, it's still grey(no matter what's happening wifi). when press it, becomes green , mobile data still on... idea why? gprs.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { try { turndata(ischecked); //klasa za ukljucivanje gprsa } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } } }); and class mobile data void turndata(boolean on) throws exception { log.i("version:", "found gingerbread+"); final connectivitymanager conman = (connectivitymanager) getapplicationcontext().getsyst

ruby on rails - Link_to with colorbox jquery -

please tell me wrong. view: <div id='profile_galery'> <ul> <li class='big'><%=link_to image_tag(@profile.user.get_avatar(:large) ), @profile.user.get_avatar(:very_large), :class => 'colorbox'%></li> and js: $(document).on("ready page:change", function() { $(".colorbox").colorbox(); }); but when click on image doesnt show - after page reload works.

html - Create buttons dynamically in a div from a javascript function -

i have function returns data sql... i need create buttons in div called divresult here function function retrievedata(transaction, results) { for(var = 0; < results.rows.length; i++) { var data = results.rows.item(i)['nome']; alert(data); } } there answer on how create html elements using javascript here: creating dynamic button click event in javascript . ...i add simple comment don't have enough street cred yet.

Can a .NET Semaphore be shared between users on the same computer? -

i need restrict access shared resource between 2 users logged terminal server sessions (windows 2008 r2 x64). tests, appears 1 user cannot see named system semaphore created user. if try sharing semaphore within same user account, works. should able share across accounts? you need create global semaphore that's visible across sessions. prefix name global\ .

How to get value from page using WebDriver >> find elements -

how value hierarchy selenium webdriver , webelement? web page application telerik model. part of java code : public void changeelementsaveandverify() throws interruptedexception { driver.findelement(by.xpath(myprintertab.printertabiconleftpane)).click(); thread.sleep(5000); driver.findelement(by.xpath(myprintertab.showhidedriverdetailed)).click(); thread.sleep(5000); webelement select = driver.findelement(by.id("ctl00_contentplaceholder2_radgrid_driver_ctl00_ctl05_editformcontrol_preton_ucsettings_driver_treelist_ctl04_enabled_dropdown")); webelement innerelemt = select.findelement(by.tagname("div")); webelement innerelemt2 = innerelemt.findelement(by.tagname("ul")); list<webelement> alloptions = innerelemt2.findelements(by.tagname("li")); (webelement option : alloptions) { system.out.println(&

android - Is it possible to move ImageButtons with an onClick in a relative view? -

Image
my intension have button on screen when clicked move bunch of imagebuttons 1 "football formation" one. something along lines of this. to with each position representing different imagebutton, when try player2.setleft(200); it crashes program. if view isn't possible best way go it, or best off using different layout entirely?

wpf - Require reusable DataCell ControlTemplate for different binding sources -

(visual studio 2010) web examples, have overridden controltemplate of datagridtextcolumn include additional image binded viewmodel. <datagridtextcolumn.cellstyle> <style targettype="datagridcell"> <setter property="template"> <setter.value> <controltemplate targettype="datagridcell"> <grid name="root" background="{templatebinding background}"> <visualstatemanager.visualstategroups> <visualstategroup x:name="currentstates"> <visualstate x:name="regular" /> <visualstate x:name="current"> <storyboard> <doubleanimation storyboard.targetname="focusvisual" storyboard.targe

Windows Phone 8: Auto-Launch *.pptx fail -

i have code launching file on windows phone 8: string ppfile = @"assets\documents\test.txt"; var file = await windows.applicationmodel.package.current.installedlocation.getfileasync(ppfile); var success = await windows.system.launcher.launchfileasync(file); when have *.txt file windows phone 8 launching it. want launch "example.pptx" file, code doesn't work. there perhaps permission problems powerpoint file? the code specified correct launching file, either txt or pptx. both cases should work fine. could please verify in solution explorer build action pptx file set "content"? when adding txt file defaults content, pptx defaults none. adjusting content solve issue.

XCode import public key file generated with Java Security -

i have java generator public key this: final keypairgenerator keygen = keypairgenerator.getinstance("rsa"); keygen.initialize(1024); final keypair key = keygen.generatekeypair(); publickey pubkey = key.getpublic(); byte[] key = pubkey .getencoded(); fileoutputstream keyfos = new fileoutputstream("publickey.der"); keyfos.write(key); keyfos.close(); and on hand, have xcode,that use publickey.der encrypt data: nsstring *publickeypath = [[nsbundle mainbundle] pathforresource:@"public_key" oftype:@"der"]; if (publickeypath == nil) { nslog(@"can not find public_key.der"); return nil; } nsdate *publickeyfilecontent = [nsdata datawithcontentsoffile:publickeypath]; if (publickeyfilecontent == nil) { nslog(@"can not read public_key.der"); return nil; } certificate = seccertificatecreatewithdata(kcfallocatordefault, ( __bridge cfdataref)publickeyfilecontent); if (certificate == nil) { nslog(@"can not read certificate

java - FileSystemView get war file icon null pointer -

i using javax.swing.chooser.filesystemview system file icons , display them uploaded files in web application. it working various file types, when trying upload .war file, java returning null pointer exception . how can know if particular file type supported or not method? anyone had similar issue? this code using // gets 16x16 size image icon list view icon smallicon = filesystemview.getfilesystemview().getsystemicon(file); image smallimage = ((imageicon) smallicon).getimage(); i running code on windows 7 machine if makes difference. thanks :) edit : turns out problem wasn't icon. have line of code string contenttype = getservletcontext().getmimetype(file.getname()); which accepts file uploaded parameter , checks type of file. doing check if file image or not. case of war file returning null reason

r - Legend linetypes not displaying properly ggplot -

Image
i have following plot: ggplot(proba[108:140,], aes(c,four, color="a1")) + geom_line(linetype=1, size=0.3) + scale_x_continuous(breaks=seq(110,140,5)) + theme_bw() + theme(axis.line = element_line(colour = "black", size=0.25), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank()) + theme(axis.text.x = element_text(angle = 0, hjust = +0.5, size=6,color="black")) + theme(axis.text.y = element_text(angle = 0, hjust = -100, size=6, color="black")) + theme(axis.ticks=element_line(colour="black",size=0.25)) + xlab("\ntime-steps")+ylab("proportion correct\n") + theme(axis.text=element_text(size=8), axis.title=element_text(size=8)) + geom_line(aes(c,three, color="a2"), size=0.2, linetype=2) + geom_line(aes(c,one, color="a3"),lin

Good c++ coding style for global functions? -

i have global functions has same name member methods. both used in same scope. way distinguish them? adding prefix 'g' conventional? know conventional global variable not sure global functions. you don't need change function name use them. comments say, can qualify function e.g. void foo() { } class bar { void foo() { } void wibble() { ::foo(); } }; :: means in global scope

objective c - Importing XLS/CSV to Parse.com BaaS with Array and Dictionary data -

i using parse.com baas , using 'import' function create data tables existing xls/csv files. this works ok when cells in excel spreadsheet basic object types (numbers, strings, booleans) wanting import array , dictionary objects. i know parse import not support this, wondering if has developed workaround? i saw 1 posted converted csv file json file, did not share how did this. know rest api option have never used api , prefer not go down path right if can avoided. cheers

asp.net mvc - Autopopulate search results using jquery in MVC 3 -

i have textbox called "name" , when user types letter ,suppose "a" names beginning letter should listed , user can select name. is kind of listing possible using jquery in mvc 3 application? try jquery autocomplete can able use in asp.net mvc3 application. var availabletags = ["al", "ak", "az", "ar", "ca", "co", "ct", "de", "dc", "fl", "ga"]; $("#card_state").autocomplete({ source: availabletags }); @html.textboxfor(model => model.state, new { id = "card_state" })

sqlite - Load spatialite extension in RSQLite crashes R (OS X & Ubuntu) -

i running queries against spatialite database, , data directly r. this page suggests can this: library(rsqlite) sqldrv <- dbdriver("sqlite") con <- dbconnect(sqldrv, dbname = "/path/to/db.sqlite",loadable.extensions = true) spatialitestatus <- dbgetquery(con, "select load_extension('libspatialite.dylib')") but when do, r segfaults following: *** caught segfault *** address 0x0, cause 'memory not mapped' traceback: 1: .call("rs_sqlite_fetch", rsid, nrec = n, package = .sqlitepkgname) 2: sqlitefetch(rs, n = -1, ...) 3: sqlitequicksql(conn, statement, ...) 4: dbgetquery(con, "select load_extension('/usr/local/lib/libspatialite.dylib')") 5: dbgetquery(con, "select load_extension('/usr/local/lib/libspatialite.dylib')") in case, spatialite built source using homebrew, version of sqlite use. in libspatialite homebrew definition, says depends on sqlite > 3.7.3. homebre

error javascript code calculation -

pls consider calculation in javascript code below. example values: investmentfix = 200.00 investmentvar = 123.12 nrofparts = 5.00 ...the console shows strange result value 0200.00615.6. don't understand. noticed values 200.00 , 615.6, - latter result of investmentvar * nrofparts - in result value. i'd expect (and target get) result 815.6 (200+(123.12*5.00). what goes wrong? relate kind of format issue? javascript code: var result =0; result += (investmentfix + (investmentvar * nrofparts)); console.log(result); try following: result = parsefloat(0,10); result+=parsefloat(investmendfix,10)+parsefloat(investmentvar*nrofparts,10); console.log(result); this ensures javascript engine parses variables @ numbers instead of strings. parsefloat() syntax: parsefloat(mynumber,base);

jquery - String search with jsonpath -

i have huge json file more 20000 objects in it. query string in json file. however, using jsonpath , find exact matches? let's file like: { "store": { "book": [ { "category": "reference", "author": "nigel rees", "title": "sayings of century", "price": 8.95 }, { "category": "fiction", "author": "evelyn waugh", "title": "sword of honour", "price": 12.99 }, { "category": "fiction", "author": "herman melville", "title": "moby dick", "isbn": "0-553-21311-3", "price": 8.99 }, { "category": "fiction", "author": "j. r. r. tolkien", "title": "

actionscript 3 - Form thumbnail in PHP and send it to AS3 -

i'm making image gallery using as3. read given directory php, returning paths images in array. form thumbnails, serialize them, send as3 array, , create bitmaps data. please me through these steps: -resizing image in php , serializing it -forming bitmap in as3 serialized data as first requirement, thumbnail image code this: $source_image = imagecreatefrompng( www_root . 'img/' . $yourpath . '.png'); $source_imagex = imagesx($source_image); $source_imagey = imagesy($source_image); $dest_imagex = 200; $dest_imagey = 200; $dest_image = imagecreate($dest_imagex, $dest_imagey); imagecopyresampled($dest_image, $source_image, 0, 0, 0, 0, $dest_imagex, $dest_imagey, $source_imagex, $source_imagey); header("content-type: image/png"); imagepng($dest_image, www_root . 'img/' . "small" . $yourpath . '.png' ,9);

ocr - ABBYY Flexicapture connect to database -

i have run database queries in abbyy flexicapture connecting dll methods contained database calls. have ability connect directly in abbyy rules, if possible. relatively recent update added ability write rules in c#, i'm assuming it's possible this. i have added system.data .net reference in document definition properties, "the type or namespace name 'sqlconnection' not found (are missing using directive or assembly reference?" when run line of code: sqlconn = new sqlconnection("[my connection string]"); i have tried adding using system.data.sqlconnection above line , says sqlconnection not exist in system.data. has had success in doing this? try this: using system.data.sqlclient

php - How to add multiple add to cart buttons on one form -

i have 16 products, of have separate add cart buttons assigned them. when customer enters desired quantity , clicks add cart, product added shopping cart , customer directed corresponding paypal shopping cart. wondering if there way carry out same action without having make individual buttons each product? this code 1 of buttons: <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="93xbl9hz8d5mg"> <table> <tr><td><input type="hidden" name="add" value="1"></td></tr><tr><td> <input type="hidden" name="item_name" value="a

How to create and mount a volume in Qt -

my application client desktop app connects database server. app document management system allows user store files such .pdf .xlsx etc in database , keeps track of versions of documents. user can "check in" , "check out" documents. when user checks out file, downloaded database , copied user's hard drive. user accesses file, edits, , checks database. inside database, file stored in compressed, encrypted , base64 encoded form in text field. my objective ensure when file copied user's hard drive, encrypted, still allow user easy access it. best way visualize want consider how truecrypt works - allows user create encrypted binary file can mounted drive. example on windows, drive letter assigned volume , user can access files via computer example. my app uses botan library encryption. is possible achieve similar qt? if so, how? if not, recommend? many thanks. well, think talking reasonable requires 'core design' thoughts before going

java - Reflections bad or good practice for commands -

well, saw there questions , answers this, didn't satisfy me. let's example, have programmed console. it's nice jframe output , input txtfield/area. console should not used output, run commands. because need console , don't want change code of console programmed way: the console has 1 method register commands. console.registercommand(string command, string methodtoinvoke, object invokeobject); with method i'm able use console everywhere without need of changing or inharitance. whenever string command written console knows it's registered keyword , executes method via reflection. would or bad practice? on code styling , in performance! , better? i found quite neat use reflections way add actionlisteners menuitems in trayicon. edit to answer below: ok commands accept way do. in tray example wrote trayhelper class creates trayicon. there want add menuitems , actionlisteners without creating every object myself , add them tray. wrote method

graphics - Inkscape : How to ' crop ' something before 'saving' it? -

if open new inkscape document , type test and try save ( .svg ) the whole page saved. what want tiny icon reads ' test '. with no empty places around it. sort of "cropped" edition. you can file -> document properties or shift+ctrl+d then resize page content , click resize page drawing or selection now when save it, should have desired dimensions. cheers

uipickerview - Custom Picker View for iOS 6.1 -

i trying setup simple custom picker view has 2 components based on arrays. first array (used in component 0) defined as: onesscore = [[nsmutablearray alloc]init]; [onesscore addobject:@"5"]; [onesscore addobject:@"6"]; [onesscore addobject:@"7"]; [onesscore addobject:@"8"]; [onesscore addobject:@"9"]; the second array (used in component 1) defined as: tenthsscore = [[nsmutablearray alloc]init]; [tenthsscore addobject:@"0"]; [tenthsscore addobject:@"1"]; [tenthsscore addobject:@"2"]; [tenthsscore addobject:@"3"]; [tenthsscore addobject:@"4"]; [tenthsscore addobject:@"5"]; [tenthsscore addobject:@"6"]; [tenthsscore addobject:@"7"]; [tenthsscore addobject:@"8"]; [tenthsscore addobject:@"9"]; the using following code create custom view: - (uiview *)pickerview:(uipickerview *)picker viewforrow:(nsinteger)row forcomponent:(nsint

algorithm - Group numbers into closest groups -

Image
for example, have numbers 46,47,54,58,60, , 66. want make group them in such way make largest possible group sizes. numbers grouped if values within plus or minus 10 (inclusive). so, depending on number start with, example there can 3 possible outcomes (shown in image). what want second possible outcome, occur if started 54, numbers within 44 64 grouped, leaving 66 itself, , creating largest group (5 items). i realize brute force example, have long list of numbers , needs across thousands of numbers.. can tell me algorithms should reading or give me suggestions? you can sort array first. every th number can binary search find right number that's within ith number + 20 range, let position of such right index x. have find largest (x-i+1) ith numbers , done :) runtime analysis: runtime algorithm o(nlgn), n number of items in original array. a better solution: let's assume have array ar[] , ar[] has n items. sort ar[] in non decreasing order set max_resu

asp.net mvc - Creating a module for Orchard that stores data from the front-end -

code come later in front of development machine, though hoping in meantime can help.... i trying develop on orchard cms v1.6.1. @ moment in midst of trying develop module allow me place newsletter subscription view within footer (or anywhere else choose) on front end. i have followed several tutorials , seem show how store data admin - need store data on front end admin... looking on... so, far, module has "usual" driver/handler/editortemplates view/migrations/contentpart/contentpartrecord , can create subscription entry in admin - have content type setup , see module in admin. pick tutorial on modules , that's path followed - seem same in terms of creating module , storing data via admin.... with answers other questions managed module display on front-end - way of overriding display in driver , using shapehelper.displaytemplate() method. some strange things though - when front-end (with form displayed placement.info) page first loads blank entry in databa

c# - Entity Framework populate entity at starting -

i have project using entity framework. want check if database created , populate table resource directory? thanks really, asking 2 different questions. entity framework not database administration tool , such not have functionality directly loading data spreadsheet. if research each part of question separately, might have more luck. seeding data entity framework reading excel files c# reply comment: if (!context.postalcodes.any()) { ienumerable<postalcode> postalcodes = readpostalcodes(); foreach(var postalcode in postalcodes) { context.postalcodes.add(postalcode); } context.savechanges(); }

ffmpeg - What is the difference between M4A and AAC Audio Files? -

is there difference between m4a audio files , aac audio files or same thing different file extension ? .m4a files typically contain audio , formatted mpeg-4 part 14 files ( .mp4 container). .aac not container format , instead raw mpeg-4 part 3 bitstream audio stream encoded. note m4a not have contain aac audio, there other valid options well.

javascript - Dropdown menu (select) -- selecting an item and picture shows based on the selection -

i want 3+ selectors on page each showing different product images when item selected. if there 3 selectors, there 3 different divs show images. i'm having trouble code: <!-- selector mug --> <script type="text/javascript"> $(function(){ function changeimage(image) { // hide mainimages $('div.mainimage-mug > div ').hide(); // show selected image $('div.mainimage-mug > div.' + image).show(); } $('select.mug').change(function(){ // selected option var selected = $('select.mug option:selected'); changeimage(selected.val()); }); }); thanks! i prefer different approach. since dealing images , changing them on change of select,i prefer changing src of image rather using show hide method.it more simpler. <select onchange="change_image(this.value)"> <option value="red">red</option> <opti

sql - Am I doing this join right? Three way table join -

im trying join 3 tables in following format. select * inner join b (inner join (c on c.id=b.c_id)) on a.id=b.a_id; ive never used lookup table perform join (in case b). oracle throws error saying ora-00905: missing keyword 00905. 00000 - "missing keyword" *cause: *action: error @ line: 6 column: 11 any insight on im going wrong appreciated . thanks! rather try like select * inner join b on a.id = b.a_id inner join c on c.id = b.c_id

android - How to set the Z order of multiple SurfaceViews -

i have surfaceview live preview of camera, glsurfaceview draw opengl objects , last surfaceview show gui elements. i'm trying put glsurfaceview on camera's surfaceview , @ same time want gui's surfaceview above glsurfaceview . tried setzorderontop function, won't work more 2 surfaceview s. there way manage z order of multiple view s? is there way manage z order of multiple views? step #1: put them in container supports z-axis ordering, framelayout or relativelayout . step #2: later children higher in z axis earlier children, sequence children appropriate. for example: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:layout_width="match_parent" android:layout_height="match_parent&

java - Is there a differnt way of writing this code such that it doesn't use a loop -

i trying append string client program. made append statement in while loop. affects program, not sending message realtime onto jtextarea. how can make program such not use while loop or loop , continue accept messages client , output textarea in real time? perhaps if statement? while loop area while ((inputline = in.readline()) != null) for areas tffixmsg.append( inputline + "\n\n\n"); and tfcsvline.append(outputline+"\n\n\n"); it not show message on textarea until while loop done. how can make continue recieve messages client, , able output onto textarea in realtime try { while ((inputline = in.readline()) != null) { system.out.println ("server: " + inputline); tffixmsg.append( inputline + "\n\n\n"); int pos = inputline.indexof(inputline, 0); h.addhighlight(50, 60, defaulthighlighter.defaultpainter); if (inputline.trim().equals("

c - How do I put boundary conditions in 1D Heat Equation? -

Image
i trying solve problem of 1d heat equation, u[x,t] density of energy in uni-dimensional bar, in time t=0 energy concentrated in point x=0. want find solutions given time, t= 64, 128,256, etc. code (i removed comments because english not native language): #include <stdio.h> #include <math.h> #define d 0.1 #define t 1024 #define tol 0.0000000000000001 int x,t; double r,de,u[t+1], ua[t-1]; main() { u[0] = 1; for(x=1; x<=t;x++) u[x] = 0; t=0; { t++; for(x=0; x<=t; x++) ua[x] = u[x]; u[0] = ua[0] + 2*d*(ua[1]-ua[0]); for(x=1; x<=t; x++) u[x] = ua[x] + d*(ua[x+1]-2*ua[x]+ua[x-1]); } while(t<t); de = 0.0; for(x=0; x<=t; x++) { if(u[x]>tol) { printf("\n %d %1.20f", x,u[x]); de += x*x*u[x]; } else break; } printf("delta(t=%d) = %20.20f", t, sqrt(2*de)); } plotting data result in &q

visual c++ - Linker problems in C++ template -

i have function template in .h file , included in main file , used create excel chart. if write template function non-template method, well. when make function function template many unresolved external symbol errors calls within function template methods in excel namespace. in visual studio 2010 way. as example, if in myfunc.h have template<class t> void excelgraph(const std::vector<t>& xdata){ //calls various methods in excel namespace } and in main.cpp #include"myfunc.h" int main(){ std::vector<float> xdata(100,1); excelgraph(xdata); } then code generate linker errors. if myfunc.h looks likes this: void excelgraph(const std::vector<float>& xdata){ //calls various methods in excel namespace } and in main.cpp #include"myfunc.h" int main(){ std::vector<float> xdata(100,1); excelgraph(xdata); } then code compiles , runs fine. there many linker errors post, they're of form 1>excel_inte

hadoop - Is it possible/supported to do an Impala query with Java? -

i want run impala query in java on hbase table. couldn't find way though. can point me in right direction library or example or can run query, , results? i have tried using jsch run command on server, unfortunately that's giving me issues (no output appearing). i haven't used looks https://github.com/pauldeschacht/impala-java-client might meet needs

mysql - Copy/Update values from table_a to another row of table_b WHERE table_a.id = table_b.id AND table_a.name = table_b.name -

i want copy/update values table_a row of table_b table_a.id = table_b.id , table_a.name = table_b.name i have 2 tables price_drop_apps_temp , price_drop_apps have same structure create table if not exists `price_drop_apps_temp` ( `application_id` int(11) not null default '0', `storefront_id` int(11) not null default '0', `price_1` decimal(9,3) default null, `price_2` decimal(9,3) default null, `price_3` decimal(9,3) default null, `price_4` decimal(9,3) default null, `price_5` decimal(9,3) default null, `price_6` decimal(9,3) default null, primary key (`application_id`,`storefront_id`) ) engine=innodb default charset=utf8 collate=utf8_unicode_ci") the table price_drop_apps_temp contains updated application_id , storefront_id . i need copy table price_drop_app values column price_2 table price_drop_apps_temp column price_1 application_id , storefront_id match in both tables , on other columns. if price_drop_apps_temp has no ma

Java 7 / 8 in Android? -

android great mobile platform, uses java (for reason) popular programming language. java language evolving, moving forward, version 7 small language improvements has years , next year comes version 8 awaited lambdas. my question is: android run java 7 or 8 or take of constructs? update: non believers: in android kitkat 4.4 can use java 7 goodies: arm, switch on strings, diamond,etc. yeah! hope not take longer lambdas , java 8 features android works today java 7, according tools team, though have not tried yet. this, mean can compile android project java 7 compiler, , build tools accept java 7 compiler output. afaik, there 1 new bytecode added ( invokedynamic , or that), interpreters, not javac compiler. since java 8 not exist in final form, , since google not tend give out future details (particularly given in-flight litigation), know when rest of know, sometime after java 8 ships.

JavaScript returned by AJAX is not working. How to work with JavaScript? -

this page test1.asp <html> <head> <meta http-equiv="content-language" content="en-us"> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <title>new page 1</title> <script type="text/javascript"> function alex() { var xmlhttp; try { xmlhttp=new xmlhttprequest(); } catch (e) { try { xmlhttp=new activexobject("msxml2.xmlhttp"); } catch (e) { try { xmlhttp=new activexobject("microsoft.xmlhttp"); } catch (e) { alert("your browser not support ajax!"); return false; } } } xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate==4) { document.getelementbyid("alex").innerhtml =xmlhttp.responsetext;//get google destination map } } xmlhttp.open(

c++ - Parent Window is NULL in CFormView (MFC) -

i have cformview -derived class has button trying call showwindow on. however, call fails because m_hwnd variable null. why m_hwnd null? dialog has child style set in properties window, , i'm associating parent cframewnd form view. view intended modeless. code creates view: void cmainframe::switcheditview(cruntimeclass * pviewclass) { context.m_pnewviewclass=pviewclass; context.m_pcurrentdoc=pdoc; context.m_pnewdoctemplate=null; context.m_plastview=null; context.m_pcurrentframe=this; m_subsplitter.createview(0,1,pviewclass,csize(0,0), &context); // create new view , add splitter window } the constructor cformview-derived class: cdfamaneditviewproject::cdfamaneditviewproject() : cformview(cdfamaneditviewproject::idd) { // c_btnedit cbutton mfc control c_btnedit.showwindow(sw_show); // call fails on assert(::iswindow(m_hwnd) ) } you trying access edit control view constructor. view window has not been created yet when cons

flash - ActionScript 3 - Live streaming: how do you listen for multiple FMS URLs? -

sometimes have live streaming services breakdown. everyone helpless , live stream ends. if can listen multiple sources in 1 player, can play new source. i'm not planning on playing 2 @ once, having 1 or more backups can start using if 1 breaks down. i'm using random fms url rtmp live stream link example: rtmp://81.177.35.218/rtp/2 there more fms urls here work. also, if code looks bad, particularly under public function onmetadata(data) , feel free fix , edit it. this template, , 1 of few parts edited myself. i appreciate if reply contained same code edited. don't know i'm doing. package { import flash.accessibility.accessibility; import flash.display.sprite; import flash.events.*; import flash.net.netconnection; import flash.net.netstream; import flash.media.video; public class nslive10_7castwesttigerss extends sprite { private var nc:netconnection;

How can I retrieve only Android contacts that have an entry in the People app? -

i want include autocomplete textbox in android app adapter being list of user's contacts' display names, started this: private static final string[] contact_columns = new string[] { contactscontract.contacts.display_name, basecolumns._id }; list<string> contacts = new arraylist<string>(); contentresolver cr = this.getcontentresolver(); cursor cursor = cr.query(contactscontract.contacts.content_uri, contact_columns, null, null, null); while (cursor.movetonext()) { string name = cursor.getstring(0); contacts.add(name); } cursor.close(); arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.contact_list_item, contacts.toarray(new string[] {})); multiautocompletetextview txtfriends = (multiautocompletetextview) findviewbyid(r.id.newvisitfriends); txtfriends.setadapter(adapter); txtfriends.settokenizer(new multiautocompletetextview.commatokenizer()); the result of query, ho

Eager loading backreferences in ActiveRecord in Rails -

apparently in rails application activerecord running more sql queries like. have simple one-to-many relation. each package… class package < activerecord::base has_many :screenshots end …there several screenshots… class screenshot < activerecord::base belongs_to :package def image_url "/screenshots/#{self.package.name}/#{self.id}_#{size}.png" end end my first simple task show index page packages , screenshots. each package want show screenshots. path screenshot image determined package name. let's example , fetch package record "3dchess" package: pkg = package.includes(:screenshots).find_by_name('3dchess') as can see eager-load screenshots. activerecord runs these 2 sql queries: package load (1.4ms) select "packages".* "packages" "packages"."name" = '3dchess' limit 1 screenshot load (2.1ms) select "screenshots".* "screenshots" "screenshots&q

c# - Data modified show old value when called after update -

in app have method updates values of item this: foreach (var orderdetailinfo in _order.mlistorderdetail) { orderdetailinfo info = orderdetailinfo; var inventoryqry = in db.inventory i.invent_ide == info.minventoryid select i; inventory originalitem = inventoryqry.single(); inventory itemtomodify = originalitem; itemtomodify.invent_nb_in_stock = (orderdetailinfo.morderdetailquantity + originalitem.invent_nb_in_stock); db.entry(originalitem).currentvalues.setvalues(itemtomodify); db.savechanges(); } now if in table @ originalitem , value updated. before being updated, value 4, , order updated quantity 5. my problem when load data after upper code has run (so, after update invent_nb_in_stock column): var inventoryqry = inv in db.inventory inv.invent_ide == inventide select inv; return inventoryqry.single(); the item s

mysql - How can I update addressed id they look some what the same -

is there way try fix addressed in address column on database? so if have 2 records 123 main rd 123 main road i want make both same not matter 1 select long same? is there possible way in mysql? the table looks this create table address ( id int(11), address1 varchar(255), account_id int(11) ); id -> address1 -> account_id 10 -> 123 main rd -> 65 20 -> 123 main road -> 65 25 -> 8751 west 1st street -> 65 27 -> 4521 11th ave -> 65 so want compare addresses share same account_id , not of them if have 10 records same account_id want compare 10 addresses against each other , not database. it's wild guess if rows same account_id should have same address can following update address join ( select * address account_id = 65 order id desc limit 1 ) q on a.account_id = q.account_id set a.address1 = q.address1 here sqlfiddle

cookies - JavaScript Encrypt? -

how hash/encrypt string value in javascript? need mechanism hiding data in localstorage/cookie? it related security concern want protection data. there lots of encryption libraries javascript. here's first 1 came on google: http://crypto.stanford.edu/sjcl/ your user can gain access key, won't protect data user. if want hide things user, you'll have encrypt on server , never send key client.

linux - Get PID of a process as it opens -

how pid of process opens. lets run ./file.pl , ./file2.pl both these files create pid in /proc/ folder. how instantly know if process has been created when executable run. have file commands ready run gets green signal there new process in /proc/ folder. how do that? edit: please don't answer shell command. don't need know pid. need develop script can know right away have guest in proc department if start process via shell, start process in background: ./your_prog & get pid: echo $!

inheritance - C# prevent base class method from being hidden by new modifier in the derived class -

here's situation. in java can mark method final in base/super class , there no way derived class can mask method of same signature. in c# however, new keyword allows inheriting class create method same signature. see example below. need keep orignal.myclass public please don't suggest answer. seems lost feature moving java c# public class orignal.myclass{ public void mymethod() { // } } class fake.myclass: orignal.myclass { // how prevent following public new void mymethod() { // different } } edit: not duplicate. all answers seem suggest, it's not possible prevent method being hidden/shadowed in derived class. became apparent while migrating old java code c#. final method in java not let use same method signature in derived class. while it's great in scenarios c# allows method of same signature in derived class, have been great prevent such behavior if warranted. // how prevent following there no way pre