Posts

Showing posts from July, 2012

git - sync local nongithub repository with github repository -

i have github repository , have made amendments repository on machine , uploaded lasted version google drive. have new machine, , want github repository updated well. i thinking of first clone github repository , compare each file of latest version on google drive , replace old files , commit. is there easy way that? if have .git folder uploaded google drive, you're in situation. copied repository, not files. can keep working regular clone of repo. just download folder project new computer, open git client, pull changes remote, resolve merge conflicts, if any. , push back.

javascript - jQuery Uncaught TypeError: Cannot read property 'top' of undefined -

i keep getting following error : uncaught typeerror: cannot read property 'top' of undefined the issue relates line: posy = pos.top - $(window).scrolltop(), although it's not damaging bit of pain see. i have tried contents using : var postest = inf.offset().top; ends happening instead offset error. any ideas appreciated. $(document).on("mouseenter", ":has('.infotip.ifixed')", function() { var inf = $(".infotip.ifixed"); if (inf.length) { var itheight = $(this).children(".infotip").innerheight(), pos = $(this).children(".infotip").parent().offset(), posy = pos.top - $(window).scrolltop(), posx = (pos.left - $(window).scrollleft()) + 190, accuheight = (posy - itheight) + 150, divpos = { left: posx, top: accuheight }; $(this).find(".infotip.ifixed").css(divpos); } }); my definition inf wrong.

how to pass argument to autoIT script from python script -

in python scripting, need pass command line arguments autoit script. because in autoit script getting command line arguments , processing it. below autoit script using command line arguments , working fine: #include <array.au3> #include <winapishpath.au3> local $acmdline = _winapi_commandlinetoargv($cmdlineraw) _arraydisplay($acmdline) now using python script need pass command line arguments above autoit script. i tried using in python script: import os args = ("test","abc") os.execv("test.au3",args) but giving exception. this should work you. in autoit script, put piece of code in autoit's variable $cmdline contains parameters provided. , variable $par (feel free change name) storing parameter later use. $par = '' if $cmdline[0] > 0 if $cmdline[1] <> @scriptname $par = $cmdline[1] ;now, can use variable $par in script. endif endif put in python script parameter parameter w

c# - Can Interlocked.CompareExchange throw NullReferenceException? -

from https://msdn.microsoft.com/en-us/library/bb297966(v=vs.110).aspx [comvisibleattribute(false)] public static t compareexchange<t>( ref t location1, t value, t comparand ) t : class and nullreferenceexception address of location1 null pointer. but when use null reference location1 , don't errors: class { } class program { static void main(string[] args) { dest = null; src = new a(); // if dest null, replace src. interlocked.compareexchange(ref dest, src, null); } } is ok this? there danger throw nullreferenceexception in later versions of .net? as other answer says, it's ok have variable contain null -- it's reference variable being null , , can't happen in c#, or other managed languages matter. that said, can make interlocked.compareexchange throw nullreferenceexception working directly il. there have tricky if want remain in realm of managed, verifiable code: .meth

How to use Cages (or Zookeeper) to simulate transactions in cassandra - example codes needed -

please have use case need simulate acid-like transaction in cassandra , came across library called cages locking writes , reads operation in cassandra, got stuck @ point specified "lockpath". have read article @ link , not explicit enough zookeeper-novice me. appreciate step step explanation or simple example code, thank in advance.

jquery - javascript error "is not a function..." but libraries are loaded -

i'm trying use fancytree in durandal page. i've done before can't seem working , it's driving me mad. i have js debug stop point on $("#tree").fancytree... line , @ point code stops, have following 3 libraries loaded: jquery-1.12.1.js jquery-ui-1.11.4.js jquery.fancytree.js and yet there no "fancytree" prototype method showing element , system.js:109 typeerror: $(...).fancytree not function(…) on initialization line. in past has been caused lacking jquery-ui library, loaded here. what missing please? edited add more information. html largely irrelevant has <div id="tree"></div> there attached viewmodel contains: self.attached = function (vw, prt) { buildtree(vw); } and function buildtree(view) { // initialize fancytree $("#tree").fancytree({ checkbox: true, selectmode: 2, source: {url: "testdata/ajax-tree-ta

javascript - How to make a dropdown box(select element) to accept text search in html? -

i have drop down(select element) box. want able search options in same element typing. have tried datalist in html5, in typed value accepted input if there no value in options. want option chosen option list, should able find typing text. <select name="xyz"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> here if type "a" search option should chosen. if type "x" search should not accepted input. you can use <datalist> <input type=text list=browsers> <datalist id=browsers> <option value="firefox"> <option value="internetexplorer"> <option value="chrome"> <option value="opera"> <option value="safari"> </datalist>

c# - parallel.foreach and httpclient - strange behaviour -

i have piece of code loops on collection , calls httpclient each iteration. api httpclient calls, takes on average 30-40ms execute. calling sequentially, expected outcome, use parallel.foreach, takes longer. looking closely in logs, can see quite few httpclient calls take more 1000ms execute , time drops 30-40ms. looking in api logs, can see barely goes on 100ms. not sure why spike. the code using (var client = new httpclient()) { var content = new stringcontent(parameters, encoding.utf8, "application/json"); var response = client.postasync(url, content); _log.info(string.format("took {0} ms send post", watch.elapsedmilliseconds)); watch.restart(); var responsestring = response.result.content.readasstringasync(); _log.info(string.format("took {0} ms readstring after post", watch.elapsedmilliseconds)); } the parallel call this console.writeline("starting parallel..."); parallel.foreach(recipientcollections, recipie

ios - MNMBottomPullToRefresh how to load items without dragging -

Image
i working on table view using mnmbottompulltorefresh ,i trying modification in mnmbottompulltorefresh, in mnmbottompulltorefresh if drag table display new data want when reach @ bottom should load data automatically indicator below in picture,any 1 know how ?? i have implemented solution each api hit gives me 10 results these displays in table if user scroll every 7th (7,17,27,...) start download set of 10 records below code way not stuck user , increase performance.you can remove mbprogresshud. -(void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { nsuinteger rowindex=[self.arraytickets count]-3; if (indexpath.row>rowindex) { nsinteger pagecounttemp=(self.arraytickets.count/10)+1; if (self.pagecount==pagecounttemp) return;//no more data load; self.pagecount=pagecounttemp; self.isloadingmore=yes; //[mbprogresshud showhudaddedto:sel

Extrainfo column in Sybase audit table -

i'm using sybase ase 15.0 , when reading extrainfo column sysaudits_01 there missing values. manual says in case of update, previous value , current value appear in column. tested different scenarios of updates, inserts, deletes other words update/insert/delete nothing else appears. is there should turned on or able see values? any appreciated. l.e. using sp_audit 'cmdtext', 'sa', 'all', 'on' --user level using sp_audit 'cmdtext', 'sa', 'all', 'on' --user level

objective c - How to code drawing a straight line with two mouse clicks (OSX Mac App)? -

i'm trying make simple drawing app (osx mac app) , i'm trying figure out how user can draw line 2 mouse clicks, example, first mouse click (mousedown mouseup) mark origin point of line, , second mouse click (mousedown mouseup) mark end point of line. before user makes second click of end point, i'd line (before anchoring end point) shown live, kind of in photoshop. both objective-c , swift fine. so far i've got... var newlinear = nsbezierpath() override func mousedown(theevent: nsevent) { super.mousedown(theevent) var lastpoint = theevent.locationinwindow lastpoint.x -= frame.origin.x lastpoint.y -= frame.origin.y newlinear.movetopoint(lastpoint) } override func mouseup(theevent: nsevent) { var newpoint = theevent.locationinwindow newpoint.x -= frame.origin.x newpoint.y -= frame.origin.y newlinear.linetopoint(newpoint) needsdisplay = true } cheers! enum s associa

.net - c# Clear DataTable from memory -

i have general question regarding how securely clear sensitive data memory when not used more... i make sql query resulting in datatable dt.. when leave form call dt.dispose(); , gc.collect(); sure... but if make memory dump of process after this, can data of table. if have left context in should accessible... this can security issue, , i'm wondering how handled in c#/.net ? other objects... thanks in advance guidance

Search / retrieve single value from one to many relationships Core Data Swift -

Image
my data design allows 1 user have many votes; , each single record can have many votes. i'm struggling massively referencing , searching specific element relying on these in master view controller, i've fetch controller on record entity, , single var user entity (ie. device-user) inserted same managedcontext. assuming ok, when preparing segue detailed view controller, want pass in selected record (no problem); array of votes record (i think no problem, code below); , (here's tricky part) optional device-user's vote record (this question). let votesasset = record.votes controller.votes = votesasset?.allobjects as? [vote] let predicateforusersvote = nspredicate(format: "record.votes.user == user") let thisusersvoteforthisrecordasset = votesasset?.filteredsetusingpredicate(predicateforusersvote) controller.thisusersvote = thisusersvoteforthisrecordasset!.first as? vote what i'm trying iterate through user's votes in core da

jquery - How can I redefine a variable based on a functions result? (javascript) -

i have following: $('#country1').change(function() { var hrc = "yes"; if (classname == "hr") { var hrc = "yes"; return true; } else { var hrc = "no"; return false; } then pulling json sp list like: $('.submitdataaccounts').on('click', function() { var data = { __metadata: { 'type': 'sp.data.changeofaddresslistlistitem' }, "high_risk_country": hrc, }; this part works correctly else in form posts list if leave static variable @ top of page passes correctly not work if it's based on fuction. thanks, declare variable outside functions, global variable, , can acces everywhere in code. if give global variable value, redefined , gets value until value change.

android - Firebase Cloud Messaging issue with subscribe//unsubscribe from topic -

firebase cloud messaging (fcm) subscribetotopic(topic) , unsubscribefromtopic(topic) functions have backoff timer until work or timeout. if call subscribe (and wasn't successful) call unsubscribe (immediately successful) firebase handle them queued , end unsubscribe, or possible end subscribe because of backoff if called unsubscribe after? hope made sense. currently (v 9.2.0) fcm doesn't try cancel local operations when 2 opposite actions queued locally. that said, backoff mention not per single operation, whole queue sync task. means when device connected , backoff time trigger, fcm try perform queued operations possible, it's difficult device end in situation out of 2 queued operations, 1 succeeded while other got delayed. please note implementation detail valid in current release (v9.2.0). might change approach in future, if compatible other improvements have in pipeline.

android - Recyclerview with footer not able to delete last item -

i using recyclerview footer working fine. not able delete last item. suppose have 2 products in list if user remove 1 product 1 product remain in recyclerview not able delete remaining product. while have 1 item shows pack id null genericviewholder.removes.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { packid=currentitem.getcart_product_packid(); system.out.println("pack id"+packid); deletetocart(); } }); adapter public class headerfooteradapter extends recyclerview.adapter<recyclerview.viewholder> { private static final int type_header = 0; private static final int type_item = 1; private static final int type_footer = 2; private arraylist<cartmodel> idlistdata; private aquery aquery; context context; publi

javascript - Getting error while sorting records in descending order by Id with orderby clause in Angular js -

i trying display records in descending order of id property. but getting error below in browser console: [orderby:notarray] expected array received: {"name":"abc","emailid":"abc@yahoo.com","salary":4000} this code: <table> <tr> <td ng-repeat="item in user " ng-if="$odd" > </td> </tr> </table> <table> <tr> <td ng-repeat="item in user " ng-if="$even" > </td> </tr> </table> <tr ng-repeat="item in user | orderby: '-id' "> </td> function displaydata() { myservice.getlist().then( function (data) { $scope.user = data }, function (reason) { }) } json output: [ { "id":5,

c# - Xamarin Android: Shared MonoRuntime error -

i developing android app xamarin. tested in through emulator , in test cloud manually when trying run through vsts, getting: mono shared runtime not supported. can resolved changing project configuration or using release build. i checked android project file, shared mono runtime turned off. can tell me cause issue , how resolve it? i got it. aot tag in android solution set true. had disable , run on vsts.

bash - hadoop command stop working when used in shell script -

i have used -mv (move) command in shell script. running when tested. after runs fails results in script failure. why happen? i'm not getting answer it. hadoop fs -mv /user/abc/"$current_date" /user/xyz/itr2run"$run_index" using bourne shell run script #!/bin/sh.

dataframe - what is the best way to visualize a table on graph in r -

Image
i have following table(data frame): week24 week25 week26 under 0.5m 1824 1878 1955 0.5 1m 170 205 211 1to3 117 109 124 3to6 19 19 25 6to10 9 8 8 10to15 4 3 5 15to30 9 13 9 above 30m 19 32 28 i looking best way visualize on graph can have row names under 0.5m:above 30m in x axis . i have tried barplot() results not good how can make more informative? it's not clear me trying obtain. maybe adding legend graph way more descriptive. i've simple data frame show mean: df <- data.frame(z=c(1,2,3),y=c(2,3,1)) row.names(df) <- c("cat1","cat2","cat3") barplot(as.matrix(df), legend.text = row.names(df), args.legend = list(x = "right"), col = c("blue","green","red")) if want check better colours, check website: http://www

scala - Slick update fields based on its context -

i new in slick , scala , have following question. want find if there record on database based on same timestamp. table has (id, timestamp, steps, location, direction) 1.measurements.filter(_.timestamp === operated_item.timestamp) // measurements tablequery if record not exist want make creaton based on documentation in slick if record exists then: a. if steps there want update location , direction b. if steps not there, want update steps. how can these steps, right have that: def operation(user_id: long, operated_item: measure) = { val measurementsoperations = new measurementsoperations(db) val q = { c <- measurements.filter(_.timestamp===operated_item.timestamp).filter(_.steps =!= operated_item.timestamp) } yield (c.steps) val act = q.update(operated_item.steps) db.run(act) } i think have this: filtering , mixing monads in slick comprehension , cats but not know how create nests.

java - How to execute custom task when agent type differs from previous agent type in the resource in anylogic? -

Image
i'm building multi product manufacturing system anylogic 7. there multiple resource pools, each different number of resources. there multiple types of products - agent various parameters, 1 of them being producttype (string). i'm trying execute setup task (consisting on delay) whenever specific resource changes type of agent operating. if given resource finished operating product of type , receives product of type b operate, should execute setup task (toolkit changeover). i've tried using custom tasks trigger time or schedule based. any idea on how execute such function? thank in advance, luís have played around preparation , wrap-up branches? sounds wrap-up task resource should do: hope puts in right direction...

css - ng-model can i check its own value? -

i have been playing angular , in pickle. want check see if ng-model value greater 0 apply different css style. can done? `<span ng-model="users2" ng-hide="!myvar" ng-class="{'test2': users2 > 0}" style="font-size:28px; color:purple" >` any appreciated? thanks! you did right look @ jsbin also @ ngclass documentation further examples. if doesn't work problem. edit: i totally on seen mentioned in comments the  ngmodel directive binds input, select, textarea (or custom form control) property on scope. on span doesn't , isn't defined jsbin example

c++ - Visual Studio 15: 0xc000007b after adding existing files to Project -

this question has answer here: the application unable start correctly (0xc000007b) 15 answers i trying make application opengl , gstreamer. have couple of files linking gstreamer-libraries, now, not included main source file in way. program compiles fine, upon running, error message the application unable start correctly (0xc000007b). i got no more information error. but when excluding gstreamer-related files project, while leaving include- , library-directories in property page untouched, code compiles , runs without problems. i building win32 platform , have checked link correct versions of gstreamer libraries. furhermore, when trying run build x64 (also linking properly, believe), exact same error, when files excluded project. could tell what's wrong sparse information, or @ least explain why application won't run when add files not used?

Assert HttpBadRequest in ASP.NET Web API unit test -

i'm testing type of response webapi controller. can find both httpnotfoundresult httpokobjectresult nothing similar httpbadrequestresult . how assert this? it called badrequestresult . it seems they're renaming result types if github page. httpnotfoundresult notfoundresult example. update: confirmed they're renaming return types excluding http in return types. see guide reference: https://docs.asp.net/en/latest/migration/rc1-to-rtm.html

c# - XML-File i send to the API gets encoded, how to prevent that? -

i using api download xml file , read it, works perfectly. now want add , upload new version of xml-file, gets encoded , 1 cant read xml reader. looks this: %3c%3fxml%20version%3d%221.0%22%3f%3e%0d%0a%3c i know encode using httputility.urldecode , have better solution, because xml gets stored way on server not want. here code use send request: string test = xmlfile.insert(index, topic); // byte[] bytes = encoding.default.getbytes(test); // test = encoding.utf8.getstring(bytes); messagebox.show(test); iconsumerrequest getfilerequest = consumersession .request() .formethod("put") .foruri(new uri(apiendpoint + "/1/documents/" + documentid + "/upload")) .withbody(test) .signwithtoken(accesstoken); string getfileresponse = getfilerequest.tostring(); i use devdefined.oauth.framework . got it, gotta this: iconsumerrequest getfilerequest = consumersession .request() .formethod("put") .forur

function - Exception in thread "main" java.lang.StackOverflowError in recursion -

here function fact calculate factorial static biginteger fact(biginteger n) { biginteger f=biginteger.one; biginteger temp; if(n.compareto(biginteger.one) <= 0) return f; f=f.multiply(n).multiply(fact(n.subtract(biginteger.one))); return f; } input: 1 88888 output: exception in thread "main" java.lang.stackoverflowerror @ java.math.biginteger.multiplybyint(biginteger.java:1523) @ java.math.biginteger.multiply(biginteger.java:1490) @ codechef.fact(codechef.java:30) @ codechef.fact(codechef.java:30)..... 100 times how can code run te<=1000000000 ?? this main function: class codechef { public static void main(string[] args) { scanner sc = new scanner(system.in); int t=sc.nextint(); for(int i=0;i<t;i++) { int count=0; string te=sc.next(); biginteger n=new biginteger(te); te=fact(n).tostring(); for(int j=te.length()-1;j&g

linux - bash command fails in tomcat/java Runtime.getRuntime.exec(), but works from command line -

i have tomcat webapp runs process in shell because several of utilities not available in java. this code works on other machines , there mysterious problem on public server. string[] textanalysispipeline = { "/bin/sh", "-c", "/bin/cat " + inputfileloc + " | tee /tmp/debug1 | " + loadjar + " " + jaroptlookuploc + " " + opthfstloc + " 2>/dev/null | " + "tail -n+5" + // rid of header hfst-ol.jar produces " | tee /tmp/debug2 | cut -f 1-2" + // rid of "0.0" weights " | tee /tmp/debug3 | " + cgconvloc + " | tee /tmp/debug4 | " + vislcg3loc + " -g " + vislcg3disgrammarloc + // disambiguate constraint grammar " | tee /tmp/debug5 > " + outputfileloc}; log.debug("text analysis pipeline: "+textanalysispipeline[2]); process process = runtime.getruntime().exec(textanalysispipeline); process.waitfor();

Mysql performance with LIKE '%%' -

for given query, select * contacts name "%$name%" does mysql optimises query exclude condition when variable $name empty? when $name empty string, query executed as select * contacts or select * contacts name "%%" as alex k mentioned in comments, mysql won't optimise query. in case have null values in rows, query not return rows in result set, explains there check on each row. suggested, best have check on code , skip clause if search value empty.

php - WooCommerce: Disabling checkout fields with a filter hook -

i have try disable "required" property of several checkout fields @ same time using woocommerce_checkout_fields filter hook, no success. plugins not working either. code: // hook in add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); // our hooked in function - $fields passed via filter! function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_address_1']['required'] = false; $fields['billing']['billing_address_2']['required'] = false; $fields['billing']['billing_postcode']['required'] = false; $fields['billing']['billing_city']['required'] = false; $fields['billing']['billing_phone']['required'] = false; return $fields; } what wrong? how can achieve this? you need use unset() function purpose , can do-it way: add_filter( 'woocommerce_checkout_fields&

eclipse - UML metamodel not found in createing Acceleo project -

i new in acceleo. use eclipse mars. want getting start , learn this link . when want create new project , click add in field of metamodel uris didn't find uml metamodel. can do? the uml metamodel accessible acceleo if registered in global emf eregistry . means must either loaded emf plugin in eclipse environment or manually added global registry of running eclipse instance. for uml, quite simple, need install uml2 plugin. provides uml metamodel java code , .ecore many tools around uml. also, if want more details acceleo syntax, can use these links: language reference http://help.eclipse.org/mars/topic/org.eclipse.acceleo.doc/pages/reference/language.html operations https://wiki.eclipse.org/acceleo/ocl_operations_reference https://wiki.eclipse.org/acceleo/acceleo_operations_reference text production rules https://wiki.eclipse.org/acceleo/text_production_rules and small tutorial wrote (only part 1 @ moment): http://blog.genmymodel.com/build-your-own

Can Bluemix Geospatial Analytics access nested values? -

i'm working on uses geospatial analytics fencing, , payload sending in nested structures. can geospatial services read these nested values? if not, workaround? i'm thinking work around subscribe topic has nested value, flatten , publish again geospatial services. i'm asking experts here if have better solution it. example: { "gps" { id : <id>, lat : <lat>, lng : <lng> } } the geospatial analytics service on bluemix requires device id, latitude, , longitude attributes appear top level fields in json payload. if can change code publishes original message, best work around. if can't change original message, suggestion have application transform message work. should publish transformed message different topic , specify topic geospatial analytics service subscribe to.

android - How do we pass different value to another activity by selecting choice-based table row in a table -

i have created table containing dynamic table rows. each table row contain 5 textview containing data's region name ,regioncode ,target etc. have implemented table row onclicklistner,so user can select table row view more specific data in activity. problem each table row contain must diffrent regioncode passed activity. how pass activity.i tried using string array show null point exception. this code // if branchflag zonal else if(branchflag.equals("z")) { final list<namevaluepair> details = new arraylist<namevaluepair>(1); details.add(new basicnamevaluepair("branchcode", branchcode)); details.add(new basicnamevaluepair("branchflag", branchflag)); details.add(new basicnamevaluepair("finyr",finyear)); details.add(new basicnamevaluepair("month", month_number)); log.d("month_num", month_number); response = apc.posturl(retrieve_branch_mis_det

javascript - Issue with CSS display property -

i need show remove button when edit button clicked , in normal cases don't want show it. in normal case, remove button not showing up, when go , place/hover mouse on position remove button placed , click it(here cant see remove button), functionality happening happen when button clicked. when want show remove button, <?php if($something){ ?> <i class="fa fa-times-circle remove" style="margin-left: 5px; margin-top: 5px;" onclick="function('parameter')"></i> <?php } ?> when don't want show button, <?php if($someotherthing){ ?> <i class="fa fa-times-circle remove" style="margin-left: 5px; margin-top: 5px;display: none" onclick="function('parameter')"></i> <?php } ?> and javascript code when edit button clicked, $('.remove').css('display', 'inline'); just assign , remove click handler using jquery. it&#

ElasticSearch aggregation from a given array of values -

i need aggregate given array having ids in 1 query. explaination follows- i have array having sku ids array( [0] => 34, [1] => 67, [2] => 12 ) i have orders index in orders.sku_id present "_index":"orders", "_type":"orders", "_id":"249622367", "_score":1, "_source":{ "order":{ "id":"249622367", "sku.id":34, "gross_value":"310", "quantity":"1" } }, "_index":"orders", "_type":"orders", "_id":"249622364", "_score":1, "_source":{ "order":{ "id":"249622364", "sku.id":34, "gross_value":"510", "quantity":"2" } }, "_index":"orders", "_type":"orders

node.js - nodejs http request immediately after adding a new address result in EADDRNOTAVAIL -

//nodejs code var ip=<some_ip_address>; //for me 2001:250:401:3611:50c6:6b18:e8f7:f882 exec('powershell new-netipaddress '+ip+' -interfacealias wlan',(e,so,se)=>{ http.request({ host:'2404:6800:4005:805::200e',//just use google example family:6, localaddress:ip },(res)=>{ console.log('reachable'); }).on('error',(e)=>{ console.log(e); }) }).stdin.end(); then output {[error: bind eaddrnotavail 2001:250:401:3611:50c6:6b18:e8f7:f882] code: 'eaddrnotavail', errno: 'eaddrnotavail', syscall: 'bind', address: '2001:250:401:3611:50c6:6b18:e8f7:f882' } the 2nd time (actually testing address , since our dhcp-stateless broken) { [error: connect etimedout 2404:6800:4005:805::200e:80] code: 'etimedout', errno: 'etimedout', syscall: 'connect', address: '2404:6800:4005:805::200e', port: 80 } me can draw 2nd time

c# - WPF: Add multiple level with different types items to TreeView -

i have class (classa) contains 2 different types of lists, list of classbtypes , list of classc . classbtypes has own list of classb . i want achieve below structure treeview -- classaname -- -- classbtype1name -- -- -- classb1name -- -- -- classb2name -- -- classbtype2name -- -- -- classb1name -- -- -- classb2name -- -- classc1name -- -- classc2name i managed tree draw classa , classb , couldn't figure out how add classc tree resources . please check below source code. test.xaml.cs public partial class test : window { initializecomponent(); var = new list<classa>{new classa(), new classa()}; treeview.itemssource = a; } c# classes: public class classa{ // initiate obj public string name {get; set;} public list<classbtypes> btypes {get; set;} public list<classc> c {get; set;} } public class classbtypes{ public string name {get; set;} public

android - Get a string value out of a thread -

i have string variable, , set it's value inside thread, since it's using netwok operation. how can access values stored in strings ? public class homeactivity extends appcompatactivity { // initialize aws dynamodb client public static amazondynamodbclient ddbclient; public static dynamodbmapper mapper; public static aqua aqua; // app details public static string = "a"; public static string b; public static boolean c; public static string d; public static string e; public static string f; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); // initialize amazon cognito credentials provider cognitocachingcredentialsprovider credentialsprovider = new cognitocachingcredentialsprovider( getapplicationcontext(), "******", // identity pool id regions.**** // region ); // initialize aws dynamodb ddbclient

extjs - Why are my key events not working -

why key events not working in following example? 'blur' event works, none of key events work on textfield (i tried 'keydown'). i tried using 'control' construct on controller well, doesn't work either. ext.define('plus.view.mycontroller', { extend: 'ext.app.viewcontroller', alias: 'controller.mycontroller', control: { '#mytextfield': { blur: function() { alert("oink") }, keypress: function() { alert("moo") }, keyup: function() { alert("quack") } } } }); ext.define('plus.view.mainview', { extend: 'ext.container.container', items: [{ xtype: 'textfield', id: 'mytextfield', controller: 'mycontroller', listeners: { blur: function() { al

Camera access error on some android devices -

i wrote app utlizes phone's camera. on of devices tried worked fine application crashes on opening. little debugging showed there's problem when trying access camera. full error message: 06-14 23:15:01.550 21872-21872/bguproject.vlc e/androidruntime: fatal exception: main process: bguproject.vlc, pid: 21872 java.lang.runtimeexception: unable start activity componentinfo{bguproject.vlc/bguproject.vlc.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'android.hardware.camera$parameters android.hardware.camera.getparameters()' on null object reference @ android.app.activitythread.performlaunchactivity(activitythread.java:2434) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2494) @ android.app.activitythread.access$900(activitythread.java:157) @ android.app.activitythread$h.handlemessage(activitythread.java:1356) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ androi

ios - Support Watch OS 1.0 and 2.0 thows error -

Image
i have app , watchos 2.0 app. while want app support lower version of watch also. tried xcode 7 supporting watch os1 , os2 but error. this app contains multiple watchkit 2.0 apps. single watchkit 2.0 app allowed. i totally confused error because error says have 2 apps of watch os 2.0 while 1 of target watchos 1. how solve issue , support watch os. i use xcode 7.3.

javascript - Document.createElement("br") not working with multiple calls to appendChild -

html var x = document.createelement("p"); var br1 = document.createelement('br'); var br2 = document.createelement('br'); var t5 = document.createtextnode("cse"); var t6 = document.createtextnode("eee"); x.appendchild(t5); x.appendchild(br1); x.appendchild(t6); x.appendchild(br2); document.getelementbyid("new").appendchild(x); the output should like cse eee but output cseeee the issue here br element created. unique. @ first when append place in dom, sits in between t5 , t6 element. however, when append br element second time, places in different location in dom , why see result of cseeee followed 1 br element. you should either omit last one, or clone br element. var x = document.createelement("p"); var br = document.createelement('br'); var t5=document.createtextnode("cse"); var t6=document.createtextnode("eee"); x.appendchild(t5); x.appendchild(br);

nlp - How to convert text to phonemes? -

is there program can convert words respective phonemes? doesn't matter syntax/format used long consistent , reproducible. have lots of data convert cmu's text arpabet converter converted 100 of them. tried running "espeak [word] -x" espeak's code, i'd have wait program word before printing. also, can't install espeak on cluster i'm running data on.

oracle - Problems using clob as a parameter to a constructor -

i have following pl/sql code: create type testingclob object ( member_value number, constructor function testingclob( i_aclob clob ) return self result ); / create type body testingclob constructor function testingclob( i_aclob clob ) return self result begin member_value := 0; return; end; end; / declare l_test testingclob; begin l_test := new testingclob('some text'); end; but error ora-06550: line 5, column 18: pls-00307: many declarations of 'testingclob' match call ora-06550: line 5, column 4: the compilation of type works fine. appears cannot use constructor. know doing wrong? the parameter 'some text' should declared clob. declare l_param clob; l_test testingclob; begin l_param:= 'some text'; l_test := new testingclob(l_param); end; by default, system supplies default constructor accepts parameter corresponding each attribute, see https://docs.oracle.com/cd/b1378

postgresql - How to catch specific Postgres exceptions in Python psycopg2 -

default psycopg2 error messages broad. of time throws: psycopg2.operationalerror without additional information. hard guess, real reason of error - either incorrect user credentials, or fact server not running. so, need more appropriate error handling, error codes in pymysql library. i've seen this page, not help. when do except exception err: print(err.pgcode) it prints none. , errorcodes undefined. tried import it, failed. so, need help.

PagedResultList Instance in Grails 3.1.7 Unit Test -

is possible create pagedresultlist instance or mock? for background: i´m writing controller unit tests. if necessary stubbing service function calls. of functions have pagedresultlist return type. have inject pagedresultlist instance or null . in cases need instance because controller this: testfunction(){ def result = sampleservice.dosomething() if (result.empty) { variable = "it´s empty" } render variable } my test looking this: void "sample test"(){ given: controller.sampleservice = mock(sampleservice) pagedresultlist emptypagedresultlist = ????? when: controller.testfunction() then: 1 * controller.sampleservice.dosomething() >> emptypagedresultlist response.text == "it´s empty" } someone can me replace ????? pice of code fix issue? thanks in advance. yes, there couple options here: you use real pagedresultlist emptypagedresultlist - se

javascript - Manually set the focus on input element in angular js -

i create 1 input element , on click show list of items after selecting item list hide. but focus not on element down, so want manually set focus on input element when radio button list hide. here use following code, view <label class="item item-input item-stacked-label" ng-click="showdays()"> <span class="input-label black-text">days</span> <span class="input-ctrl"> <input type="text" id="days" readonly ng-model="data_day" focus-on="!daysflag"> </span> </label> <div ng-show="daysflag"> <ion-radio icon="ion-ios-checkmark" ng-model="data_day" ng-value="{{day}}" ng-repeat="day in days" ng-click="hidedayflag()">{{day}}</ion-radio> </div> controller $scope.days = [1, 2, 3, 4, 5, 6, 7]; $scope