Posts

Showing posts from March, 2010

java - Is there a method in hibernate to capitalize first letter of a string -

is there method in hibernate converts 1st letter of each word in string uppercase. ex: firstname middlename lastname to: firstname middlename lastname if not, please tell how in java, don't want use libraries. solution: solved using following hql query. string hql = "select concat(concat(upper(substring(personfirstname,1,1)), " + " lower(substring(personfirstname,2))), ' ', " + " concat(upper(substring(personmiddelname,1,1)), " + " lower(substring(personmiddelname,2))), ' ', " + " concat(upper(substring(personlastname,1,1)), " + " lower(substring(personlastname,2)))) " + " personmodel "; thanks. i have written java program solves problem using methods available in string class public static void main(string[] args) { string test = "firstname middlename lastname...

linux - Debian 8.5 fresh installation failed with “tasksel: apt-get failed (100)” error -

i installed debian 8.5 , installation process went great, after installation brick os, tried again fresh install . since installation failed every time. see 2 errors failed fetch packages (from security.debian.org) hash sum mismatch error. packages libreoffice-common_4.3.3 , gimp-data_2.8.14. error "tasksel: apt-get failed (100)". i tried different mirrors. did memory test , disk check. tried using other usb device, , re-download installation image. searched solution without results. any idea why? thanks.

matlab - Connecting points within a matrix via lines (hopefully for a road network) -

Image
to aid question provide following image basically image consists of 3 pcolor plots on top of each other (for purpose of question single red cell important). the magenta squares ones of interest me. in matrix magenta squares have been plotted, magenta coloured entries have values, , rest nans. centre cell of magenta squares (or part squares) have same value , smallest amongst of other magenta cells. my question is, there way connect centre cells of magenta squares form kind of interpretation of road or bridge network? wouldn't every magenta square connect every other magenta square ideally, overall task possible (of connecting points within matrix lines)? thanks, , if you're not quite sure mean please ask more info. edit: magenta squares randomly generated each script run (as terrain layer) hence why can't plot line against known start , end point this perhaps handled better existing matlab toolbox. primitiv tools possible. assuming have coordinate...

python - Connection error with Gunicorn / Nginx -

i learning nginx , configuring nginx.conf gunicorn. running gunicorn on port 8000 , nginx listening on port 80. works fine, gives "unable connect" error. here nginx.conf file user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; # dropping sslv3, ref: poodle ssl_prefer_server_ciphers on; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_pr...

xposed - Which API decides if the call is going through VoLTE or VoWiFi in Android? -

i want write xposed module can redirect volte calls through vowifi. want know method decides if call going through volte or vowifi , hook method , work done. basically using wifi want give network illusion device using mobile data , send calls through wifi note : new android programming. excuse me if question looks vague. so want give illusion connected wifi though on mobile data. the way check this: connectivitymanager cm = (connectivitymanager)context.getsystemservice(context.connectivity_service); networkinfo activenetwork = cm.getactivenetworkinfo(); boolean iswifi = activenetwork.gettype() == connectivitymanager.type_wifi; so can is, hook gettype method of connectivitymanager , in afterhook method return connectivitymanager.type_wifi the way calling param.setresult(connectivitymanager.type_wifi);//may need casting here in afterhook. read more connectivity here: https://developer.android.com/training/monitoring-device-state/connectivity-mon...

javascript - Call success callback on Backbone save request -

i want sync backbone model server , stuff when successful response received server. put request send , response statuscode 200 response body empty. success callback called when response not empty. backend team won't send me response. there better solution check status code inside error callback. more "correct"? here code: var settingservice = backbone.model.extend({ "url": "usersettings", "sync": function(method) { if (method === "create") { arguments[0] = "update"; } return backbone.sync.apply(this, arguments); }, }); var settingsview = backbone.view.extend({ initialize: function() { this.services = { "usersettingsservice": new settingservice() }; }, savesettings: function() { this.services.usersettingsservice.save({ "currency": "u...

Python calculate minimum distances between multiple coordinates -

i have files in 2 type: a: contains 1206 lines of coordinates (xyz) - protein chain b: contains 114 lines of coordinates (xyz) - bunch of molecule i followings: each line of calculate distance each line of b. 114 distance value each line of a. don't need of them, shortest each line of a. desired output: file 1206 lines, each line contains 1 value: shortest distance. important keep original order of file a. my code: import os import sys import numpy np outdir = r'e:\mta\aminosavak_tavolsag\tavolsagok' dirname, dirnames, filenames in os.walk(r'e:\mta\aminosavak_tavolsag\receptorok'): path, dirs, files in os.walk(r'e:\mta\aminosavak_tavolsag\kotohely'): filename in filenames: fileok in files: if filename == fileok: open(os.path.join(outdir, filename) , "a+") f: data_ligand = np.loadtxt(os.path.join(path, fileok)) data_rec = np.loa...

jQuery offset() incorrect in Chrome on Android -

i using jquery 1.9.1's offset() function try , position of when clicked. have found though values returned incorrect when using chrome on android or using chrome dev tools simulate nexus device. as long page isn't zoomed works expected if page zoomed values returned offset() out amount window scrolled horizontally , vertically. i can round adding on $(window).scrolltop() , $(window).scrollleft() values values returned offset() means out on other devices. the issue seems exist on android, have tested in chrome on ipad , offset() works expected regardless of whether zoom or not. is there way overcome other trying check user agent android chrome imagine unreliable.

pyenv - How to tell, from within a running script, what Python interpreter is running it? -

this question has answer here: find full path of python interpreter? 5 answers i output, in script, full path of python interpreter running it: #!/usr/bin/env python print("{}".format(full_path_of_interpreter_running_this_script) the script in path , run as: script.py can that? how? note: doing which python or type python in bash not me, because using pyenv , , pyenv doing shims magic. note: more identifying python executable, interested in identifying virtualenv being used, , thought knowing full path interpreter me in this. this gives full path command used run script: import sys print(sys.executable)

c# - Esri maps coordinate convert -

Image
i'm trying implement esri maps wpf project , can't head around coordinates use. old system used lat/long need same values esri. when mappoint object current position of map, x value 300464.16687909653 , y value 524877.02696703083 . need take these values , convert them lat , lon, convert them other way whenever necessary. i'm struggling finding can conversion, presumed there easy c# conversion methods lying around can't seem find them. can help? (just clear, i'm using .net sdk) with last comment got , @himbrombeere mentioned - coordinates wgs84 (world mercator) , wgs84 (gps). it's epsg:3395 , epsg:4326. you may try online coordinate converter yourself. next coordinate reference system (crs) dropdown box can click , display crs's parameters: epsg:3395 projcs["wgs 84 / world mercator", geogcs["wgs 84", datum["wgs_1984", spheroid["wgs 84",6378137,298.257223563, ...

python 3.x - numpy.loadtxt returns string repr of bytestring instead of string -

i'm having trouble reading data file containing mixed strings , floats numpy.loadtxt in python 3. python 2 works fine, want code work in py3. a simplified example: import numpy n strings = ['str1', 'str2'] parsed = n.loadtxt(strings, dtype='str') print('result:', parsed) which, when executed, gives different results py2 , py3. $> python2 mwe.py result: ['str1' 'str2'] $> python3 mwe.py result: ["b'str1'" "b'str2'"] python 2 gives strings expected, python 3 gives strings containing string representation of bytestrings. how can plain strings mess in python3? loadtxt has passed input string through asbytes function before parsing (it reads files bytestrings). how converts unicode buggy. genfromtxt appears handle better in [241]: np.genfromtxt([b'str1', b'str2'], dtype='str') out[241]: array(['str1', 'str2'], dtype...

python - Automatically creating hundreds of .fla files, who gather external ressources -

i'm looking create lot of .fla files automatically i'm not sure start. internal tool cartoon studio, work flash cc, each file flash scene episode (scene1, scene 2, scene 3 ...) , in each file, have .flv scene, .wav, .jpg, , specific template (folder , layers organisations , few stuff safe frame etc) every external elements in external folders a folder .flv a folder .wav a folder .jpg and named incrementially "video_sc1, video_sc2" "sound_sc1, sound_sc2" etc. so, there possibility create lot of .fla file (the same amount detected in .flv folder, example) "corresponding" stuff inside ? , obtaining "animfile_sc01.fla, animfile_sc02.fla ..." without doing manually (very boring , time-consuming) i python, , very little .jsfl, so, i'm not sure faisability of project ( use flash animation , graphics, not coding). have hint or tip show me ? thanks ! (ps: english not perfect, can explain better if needed) i've go...

javascript - Get characters in string at positions [1] and [2] -

i know can 1 character of string giving .charat() index position of character. but there method can give range (e.g. position 1 position 2 ) , respective characters? use substring() . var str = "hello world!"; var res = str.substring(1, 5); //'ello' result if want chars, split , array. arr = res.split('') //["e", "l", "l", "o"] result

java - Flink does not run my appliation due to invalidtypesexception when using java8 lambdas -

i using flink , java8. when using lambda functions tuples , generic types, compiler ends exception /library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/bin/java -didea.launcher.port=7536 "-didea.launcher.bin.path=/applications/intellij idea.app/contents/bin" -dfile.encoding=utf-8 -classpath "/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/charsets.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/deploy.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/ext/cldrdata.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/ext/dnsns.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/ext/jaccess.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/ext/jfxrt.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/contents/home/jre/lib/ext/localedata.jar:/library/java/javavirtualmachines/jdk1.8.0_102.jdk/cont...

bluetooth lowenergy - Why is BLE 4.2 faster than BLE 4.1 -

i've read tech spec , trying understand why ble 4.2 faster ble 4.1? can send larger packet size 20 bytes or connection interval faster? i trying understand makes ble 4.2 faster. the thing in bluetooth 4.2 gives higher throughout compared earlier length extension of link layer. makes possible send data pdus length of 251 bytes instead of 27 bytes limit before. meant large overhead if sent multiple packets due header sizes , time required between rx , tx packet , again tx rx. data sent 1 mbit/s on air. note both sides need support new feature , new max length must negotiated between devices before can used. here explain typical connection event while central writes multiple gatt write command packets of 20 bytes each. since transfer rate 1 mbit/s on air, takes 1 μs per bit transferred. link layer headers , footers in total 80 bits, consisting of following: 1 byte preamble + 4 access address (stuff identify packet correct destination). 1 byte containing flow/ack ,...

python sphinx - Paragraph tag not rendering in RestructuredText table cell -

Image
i define following table in restructuredtext: +-------------------------+--------------------+ | label |description | +=========================+====================+ | foo |two options: | | | | | |* thing 1 | | |* thing 2 | +-------------------------+--------------------+ | bar |bar something. | +-------------------------+--------------------+ when gets rendered in html (using sphinx ), " two options: " text gets wrapped in paragraph tag. " bar something. " text not rendered paragraph tag. when stylesheets applied, results in cell text looking different: is there way force same behavior both cases? sphinx' way change css declarations: add in conf.py line templates_path = ['my_template_path'] and add in my_template_path file layout.html. there can ...

mongodb - Where are mongo replication settings stored? -

after complete reinstall of mongo, has still remembered replica set configuration before; has stored this? i installed mongo on linux server, using our project's user account, directory owned user. set replication , had working fine. then, test out finer install points, removed whole mongo directory , did reinstall. entering mongo, found replication set before; appear mongo storing information somewhere. i have checked several areas might have been holding replica set config: first, in mongo directory, deleted. in traditional linux structure owned root, project user not have root access , mongo, run same, should not either. the project user's home directory. have .dbshell file containing command line history, that. did not see other files there related. some location specified in mongo configuration. have 2 paths mentioned in there, 1 system log ( systemlog.path ) , other storage ( storage.dbpath ), , both point mongo directory, deleted. does know mongo s...

performance - Simple Java program - profiling shows unexpected behavior -

Image
given extremely simple java program, shown below, start program , profile visualvm. public class test { public static void main(string args[]) throws interruptedexception{ thread.sleep(10000000l); } } as can seen below metrics, behind scenes keeps on ticking. possibly going on behind scenes here? included screenshot of "sampler" memory , looks if bunch of primitive arrays keep getting created, why this? you connected process visualvm. obviously, takes some work present fact jvm doing work :) in specific detail, data being collected , sent on jmx connection. garbage created.

mysql - how to include zeros in the count in only one single query -

Image
i have 1 table count, not using join. possible? select engagement_type name, count(engagement_type) y events group engagement_type order engagement_type but result 1 row count per engagement_type. want show count of accounts without engagement_type. these: will appreciate answers! thanks! if there lookup-table, engagementtypes , possible values of engagement types stored, can query table full list of types , left join events table in order corresponding count: select t1.engagement_type name, count(t2.engagement_type) y engagementtypes t1 left join events t2 on t1.engagement_type = t2.engagement_type group t1.engagement_type order t1.engagement_type

javascript - How to test if Canvas.toBlob() failed -

using canvas.toblob(callback, ...) , converting several large canvas elements (2048x2048 pixels) png. however, @ least in chrome, callback not called. there no errors generated in chrome devtools. my questions: is there way check if toblob() failed, aside timing out after x seconds? under conditions toblob() fail? how know condition not met / how error message? the code using: function trigger_browser_download(blob, filename) { "use strict"; var url = window.url.createobjecturl(blob); a.href = url; a.download = filename; a.click(); window.url.revokeobjecturl(url); }; function download_canvas(canvas, filename) { "use strict"; canvas.toblob(function(blob) { debugger; // not reached if(blob instanceof blob) { trigger_browser_download(blob, filename); } else { console.error("error generating blob"); } }, 'application/octet-binary'); } for(var = ...

c# - How can I deserialize a Json file with a header and details in Xamarin.Forms? -

{ "id": "007", "name": "james bond", "missions": [{ "year": "2006", "title": "casino royale" }, { "year": "2008", "title": "quantum of solace" }, { "year": "2012", "title": "skyfall" }, { "year": "2015", "title": "spectre" }] } have @ this: https://components.xamarin.com/view/json.net with libary easy you can deserialize: jamesbondobject oresult = (jamesbondobject) jsonconvert.deserializeobject(sresponse, typeof( jamesbondobject ) ); class jamesbondobject { int id; string name; mission[] missions; } class mission { int year; string title; }

linux - kill processes started in parallel -

i start app starting many processes, use script (bash) start it. the filemane : start.sh , use sudo ./start.sh run the script in start.sh is: #!/bin/sh sudo p1 > p1.txt && p2 > p2.txt && p3 > p3.txt to stop app use ctrl-c not processes stop. know find ps aux | less | grep ... , seems long , want know if there , easy wait stop processes. update sorry instead (only 1 & ) sudo f1/p1.py > logs/p1.txt & sudo f2/p2.sh > logs/p2.txt & sudo nodemon f3/p3.js > logs/p3.txt store pids, , set trap kill them when signaled or on exit: #!/bin/bash # ^^^^ - not /bin/sh, code uses arrays pids=( ) # define cleanup function cleanup() { pid in "${pids[@]}"; kill -0 "$pid" && kill "$pid" # kill process if it's still running done } # , set function run before exit, or when sigterm trap cleanup exit term sudo f1/p1.py > logs/p1.txt & pids+=( "$!" ) sudo...

javascript - "Open Link in new Tab" should not open the iFrame-source-page -

so let's have page www.aaa.com/iframe-of-page-b. inside of display page www.bbb.com iframe. my issue: when click "open link in new tab" on link inside iframe www.bbb.com opens new tab in browser. what accomplish: when clicking "open link in new tab" inside iframe, open page, looks 1 user sees iframe first, in case should open www.aaa.com/iframe-of-page-b www.bbb.com-iframe inside of , link, clicked. solution 1 generate links re-create iframe'd page. <a id="link1" target="_top" href="/my_iframe_page.html?my_frame=some_frame">link</a> then intercept click event via javascript "normal" clicks change inner frame. otherwise every time user clicks it, whole page (including outer frame) blink. solution 2 prevent links opening in new tab altogether <a id="link1">link</a> specify no href @ all. "open in new tab" browser menu won't work. make normal ...

android - RecyclerView with Glide causing NullPointer after scrolling up again -

here adapter class: @override public recyclerview.viewholder oncreateviewholder(viewgroup parent, int viewtype) { view view = inflater.inflate(r.layout.container_accommodation,parent,false); myholder holder = new myholder(view); holder.setisrecyclable(false); return holder; } @override public void onbindviewholder(recyclerview.viewholder holder, final int position) { myholder myholder= (myholder) holder; accommodation current = data.get(position); picasso.with(context).load("http://10.0.2.2:18180/aafs/accommodations/"+current.accommoid+"/accomm_images/"+current.accommomainimage.imagename) .error(r.drawable.error) .into(myholder.imageview); } here error when try scroll up again, scrolling down works fine. fatal exception: main java.lang.nullpointerexception ...

How to get a security hash algorithm for a certificate using Powershell -

i need list of certificates particular hash algorithm. first tried retrieving signaturealgorithm follows: get-childitem -recurse | select thumbprint, subject, signaturealgorithm which gave me system.security.cryptography.oid value of signaturealgorithm column i tried using friendlyname get-childitem -recurse | select thumbprint, subject, signaturealgorithm.friendlyname but above returned blank value signaturealgorithm how can retrieve readable value of signaturealgorithm ? , how select sha1 certificates using powershell ? select-object expecting names properties show (since didn't specify parameter, you're using 1st pos. -property ). there no properties called signaturealgorithm.friendlyname . if use calculated property, can design own property value property friendlyname inside object's signaturealgorithm -property. ex: get-childitem -recurse | select thumbprint, subject, @{n="signaturealgorithm";e={$_.signaturealgorithm.friend...

javascript - POP up triggered by a click -

i trying open popup clicking on button. please check below code , tell me why isn't working. using getreponse popup http://www.reussirlegmat.com/2499-2/ <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <button id="button" >show it</button> <script type="text/javascript" src="https://app.getresponse.com/view_webform_v2.js?u=baaue&webforms_id=7152504">{ "name": "myuniqueform2" } </script> <script> var myform = grwf2.get('myuniqueform2'), element = document.getelementbyid('button'); element.addeventlistener("click", function(){ myform.show(); }); </script> </body> </html> on website, has put <...

xcode - Sandboxed Mac OS App, saving files in a shared location? -

have sandboxed mac app. downloads files location, , want other files able edit , overwrite files. currently, i'm saving documents container via app: let path = manager.urlsfordirectory(nssearchpathdirectory.documentdirectory, indomains: nssearchpathdomainmask.userdomainmask).first! i modifying via preview , saving file. in osx 10.11 el capitan, fine. however, on mac os 10.12 sierra beta when user attempts save, warning: "the original document can't changed, duplicate changes has been created." the same problem occurs when saving application support. of course, make sense in many use cases sandboxed apps won't want other apps touching content. though there shared space in sandboxed apps can allow other apps modify contents?

node.js - Ignore change API during insert -

i have change api implementation in node application single table. so, change(insert, update , delete) change notification fire node driver. what disable change inserts(based on business condition). during insert table, if business condition satisfied dont want rethinkdb fire change notification node driver. is there way this. you can put .filter before call .changes (or afterward if want exclude changes based on old_val/new_val pair).

ios - How to observe the dealloc process -

Image
in app i'm downloading location data , showing them on map. there scenarios cannot understand why happening. sometimes, mapview(google map) class dealloc getting called , i'm unable see markers on map(i can still see current location). this how mapview setup in storyboard: [containervc] -embedsegue->[mapview] container vc root vc. and in rootvc class: @property (weak, nonatomic) mapvc *mapvc; - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender{ if ([[segue identifier] isequaltostring: @"embeddedmapvc"]) { self.mapvc = [segue destinationviewcontroller]; self.mapvc.delegate = self; } } and in mapvc class(all properties strong,nonatomic): -(void)viewdidappear:(bool)animated{ [super viewdidappear:animated]; [self setupmapview]; } - (void)setupmapview{ mylog(@"map view refreshed/setup"); //set map view self.infowindow = [[mymapinfowindow alloc] initwithframe:c...

sass - border size not matching for circle -

i have 2 divs same border; div { position: absolute; width: 200px; height: 200px; border: 6px solid transparent; } i want them circles, added border-radius: 50%; , after discovered borders don't match anymore why that? i guess trying match circles- noted when removed border last element body { background: #000; } body div { position: absolute; width: 200px; height: 200px; border: 6px solid transparent; border-radius: 50%; } body .first { border-color: cyan; } body .last { /*border-color: #000;*/ } <div class="first"></div> <div class="last"></div> i guess has how css renders pixels (because pixels discrete units)

cmake - CTest generate and submit gcov.tar to CDash after make <target> -

i have set cdash on local machine , i'm using ctest upload testing results cdash - generating .gcov-files containing branch coverage info , packing them gcov.tar beforehand (this modified version of example https://blog.kitware.com/additional-coverage-features-in-cdash/ ): cmakelists.txt: cmake_minimum_required(version 3.2) project(branch_coverage_example) add_executable(foo foo.cxx) include(ctest) add_test(name foo command foo) include(branchcoverage) branchcoverage.cmake within cmake modules path: if(${cmake_build_type} strequal "profiling") option(always_generate_branch_coverage_info "run gcov branch coverage part of target" on) if(always_generate_branch_coverage_info) add_custom_target(branchcoverage) add_custom_command(target branchcoverage post_build command ${cmake_ctest_command} -d experimentalsubmit -s cdash_tarball.cmake working_directory ${cmake_source_dir} commen...

php - Laravel 5.1 PHPunit error when testing urls with method call or visit -

i'm trying test controllers , routes on laravel 5.1 phpunit. i got error: .php fatal error: class 'pagocheque' not found this because on views instanciate object pagocheque. i have 2 questions: can test controllers o routes without calling views? if can't how can instanciate objects view needs instanciate work. my code is: class usertest extends testcase { use withoutmiddleware; /** * basic test example. * * @return void */ public function testexample() { $this->asserttrue(true); } public function testlistadomenu(){ $this->visit('/listpagocheques') ->see('listado'); } public function testurl(){ $response = $this->call('get', '/'); $this->assertequals(200, $response->status()); } } hope can give directions. thanks in advance. updated: class controller: public function listpagocheques() { $input = request::all(); return view('chequ...

javascript - Magnific Pop-up double load from external link -

we have implemented magnific pop-up our website internal links only. when user clicks external link (i.e. facebook, google) load without pop-up. in fact there second template besides 1 magnific pop-up same content (article) (external links). when user clicks external link (direct link content) first loads content without pop-up , on top of loads again content pop-up. how can eliminate on top second loading external links? example page

css - JQuery tooltip jumps rows in gridview when hovering over a tooltip cell - how to prevent? -

in following asp.net sample webform app (markup , code behind follows below along sample data) apply jquery tooltip, using webmethod, 1 cell in gridview 5 columns -- requirement "no paging" on gridview want scrolling gridview. datasource in sample contains 26 rows z. set height of div contains gridview height 300px scrollbar illustrate problem. tooltip works ok except 1) when hovering on cell tooltip (column 1 in sample) row expands , cells row pushed right of column 1 cell -- phantom cell added after cell(1). , ... 2) if scroll towards bottom of gridview -- towards zzz row (where aaa thru fff rows not visible) when hover on tooltip cell in column 1 gridview rows jump j row. how can prevent happening -- jumping of rows? possible prevent cells being pushed right when hovering on tooltip cell? prevent phantom cell appearing? how remedy this/these problems? jquery issue or css issue? --markup here <%@ page language="c#" autoeventwireup="true...

algorithm - javascript tree structure - traverse tree structure and show the sum the count attribute inside children -

so have tree stucture below have count attribute in leaf nodes. want sum count , put sum of counts against parent. parent1 , parent2 have sum of children. , continue on there, grantparent has sum of parent1 , parent2. have function traverse tree. getting count unable get. any ideas? javascript function transverse(element, result, issegmentdata) { if (element instanceof array){ element.foreach(function (item) { { transverse(item, result, issegmentdata); } }); } else if (element instanceof object) { if (element.hasownproperty("count")) { // sum count , provide parent } if (element.hasownproperty("childnodes")) { transverse(element.childnodes, result, issegmentdata); } } } tree structure [ { "nodeid": 66318, "nodename": "grand parent", "childnodes...

bash - Compare two alphanumeric variables mixed with special expression in shell script -

i want compare 2 alphanumeric strings , below bash expression think should job. i'm getting blank result. please advise. :~$ echo $tempnow $threshold +60.0°c +80.0°c :~$ res=`echo "$tempnow $threshold" | awk '{ if($1 > $2) print "exceeds"; else echo "normal" }'` :~$ echo $res :~$ there no echo in awk. you can use: echo '+90.0°c +80.0°c' | awk '{ print ($1+0 > $2+0 ? "exceeds" : "normal") }' exceeds echo '+60.0°c +80.0°c' | awk '{ print ($1+0 > $2+0 ? "exceeds" : "normal") }' normal also note use of +0 convert fields numeric values.

c# - Xamarin.Android : Gravity parameter in DrawerLayout.LayoutParams -

i'm trying create drawerlayout programmatically using xamarin.android , faced problem when trying add listview should dragable form left .. here code : drawerlayout mydrawerlayout = new drawerlayout(this); mydrawerlayout.layoutparameters = new linearlayout.layoutparams(viewgroup.layoutparams.matchparent, viewgroup.layoutparams.matchparent); setcontentview(mydrawerlayout); framelayout myframelayout = new framelayout(this); myframelayout.layoutparameters = new drawerlayout.layoutparams(viewgroup.layoutparams.matchparent, viewgroup.layoutparams.matchparent); myframelayout.setbackgroundcolor(android.graphics.color.gray); mydrawerlayout.addview(myframelayout); listview mylistview = new listview(this); mylistview.setbackgroundcolor(android.graphics.color.green); mylistview.layoutparameters = new drawerlayout.layoutparams( width: 240, height: drawerlayout.layoutparams.matchparent, ...

Undefined index, android doesn't send data to php code -

i wrote program send json android device server (xampp). tested php code using form , received data correctly. my app, on other hand, sends no data server. executing var_dump($_post) returns array(0) on server side. here's android code: public background(context context){ this.context=context; } @override protected string doinbackground(string... params){ string location_url ="http://192.168.1.90/server_connection.php"; try{ url url1=new url(location_url); httpurlconnection httpurlconnection =(httpurlconnection)url1.openconnection(); httpurlconnection.setrequestmethod("post"); // httpurlconnection.setrequestproperty("content-type", "application/json"); httpurlconnection.setdooutput(true); httpurlconnection.setdoinput(true); httpurlconnection.setrequestproperty("content-type", "application/json;charset=utf-8"); httpurlconnection.setre...

visual studio 2015 - How do I diagnose and remove an ambiguous reference in C#? -

(please feel free suggest more accurate title question.) in visual studio 2015 solution, have 3 projects (let's call them alpha, beta, , gamma) more or less same thing, differ in define different backends. both of these projects hot-plug class same namespace: alpha: namespace sharednamespace { public class sharedclass { // implement sharedclass using alpha's backend } } beta: namespace sharednamespace { public class sharedclass { // implement sharedclass using beta's backend } } gamma: namespace sharednamespace { public class sharedclass { // implement sharedclass using gamma's backend } } several projects use hot-plugged class, each referencing either alpha, beta, or gamma. 1 of them (let's call omricon ) used reference alpha, references gamma: // ... sharednamespace.sharedclass sharedclass; sharedclass.dothing(); // ... when attempt build omricon, however, c# compiler gives error cs0433: the...