Posts

Showing posts from April, 2013

python - nested if statements based on values in an array -

i try check several modules of numbers based on values of array. array = [1,2,3,4,5] number = 10 now want automate following: if 10%1 ==0: if 10%2 == 0: if 10%3 == 0: if 10%4 == 0: if 10%5 ==0: print "10 dividable numbers in array" i want make number of nested if statements based on length of array , number check if 10 dividable out of array. there way loops? thanks. use all : array = [1,2,3,4,5] number = 10 if all(number % x == 0 x in array): print "%s dividable %s" % (str(number), str(array))

c# - Passing value from view to controller -

ok, asked similar question , got answers back. however, did not express problem accurately give go here: this view @using (html.beginform()) { <h3 class="editable">@model.title</h3> <input type="submit" value="submit"> } the <h3> has class "editable" in case means can edited inline-editor. @model.title is properties database able change inline-editor . this code generate same result: @using (html.beginform()) { <h3 class="editable">@model.title</h3> <input type="text" id="testinput" name="testinput" /> <input type="submit" value="submit"> } controller: [httppost] public actionresult faq(string testinput) { page.title = testinput; return view(); } allthough, not use inline-editor like. is there maybe way treat <h3> if textbox allowi

android - display ProgressBar ontop of ListView -

Image
asking simplest question, have searched lot related problem didn't find solution. have layout in android application in i'm using listview progressbar . task in doing in asynctask class. want show progress bar in centre of activity before loading list. can tell me i'm going wrong or changes required solution. in advance. how tried activity_main: <progressbar android:id="@+id/progressbar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_gravity="center_horizontal" android:visibility="invisible" /> <listview android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="fill_parent" > </listview> mainactivity: public class gettingalerts extends listactivity { // initialization ipaddress ipaddressobject =

ubuntu - Cassandra not coming up after installing dse-full -

i had working 3 node cassandra cluster , found during installation didn't install dse. installed dse-full & opscenter in of 3 nodes. after installation found none of cassandra node rebooted cluster nodes. after reboot when tried run caassandra service faced following exception: fatal exception during initialization org.apache.cassandra.exceptions.configurationexception: saved cluster name db cluster != configured name test cluster @ org.apache.cassandra.db.systemkeyspace.checkhealth(systemkeyspace.java:542) @ org.apache.cassandra.service.cassandradaemon.setup(cassandradaemon.java:246) @ com.datastax.bdp.server.dsedaemon.setup(

codeigniter - Extending CI_Model for use with report database -

i trying add separate report database application extending ci_model , setting correct database use based on if database defined. report database replicated version of regular database performance reasons. is proper way? in application/core/my_model: <?php class my_model extends ci_model { function __construct() { parent::__construct(); include apppath.'config/database.php'; //if have reporting database load , use reporting functions if (isset($db['reports'])) { $this->report_db = $this->load->database('reports', true); } else { $this->report_db = $this->load->database('default', true); } } } ?> you can use both of databases within code. have define in config/database.php database.php $active_group = 'default'; $active_record = true; $db['default']['hostname'] = 'loc

Send variable from javascript to php and receive it back as a link for file download -

i need send variable javascript php file receive link file download. variable send list.php: <a href="javascript:filesave(<?php $val ?>);">pdf</a> <script language="javascript" type="text/javascript"> function filesave($fid) { $.post( "getfile.php", { id: $fid }) ... ... </script> link recieved getfile.php: <?php if (isset ($_post['id'])) { $link = "./pdfs/vers".$_post['id']; } ?> i want without page reload or redirect. can i? if list.php , getfile.php on same server, can use ajax. in javascript function filesave($fid) { $.ajax({ type: 'post', url: 'list.php', data: { 'id': $fid },success: function(data){ // process after received data getfile.php } }); in php if (isset($_post['id'])) { header("content-type: text/plain; charset=utf-8"); $link = "./pdfs/vers".$_p

scala - an error in spark sbt assembly -

in spark installing readme,i write command './bin/spark-shell', got hint follwing: found multiple spark assembly jars in /opt/spark-0.9.0-incubating-bin-hadoop1/assembly/target/scala-2.10: spark-assembly-0.9.0-incubating-hadoop1.0.4.jar spark-assembly_2.10-0.9.0-incubating-hadoop1.0.4.jar please remove 1 jar. i ever try remove 1 of them ,but fail success. if can deal ,please tell me. thanks. all need cd assembly/target/scala-2.10 dir, , use sbt compile again. this caused incompatible between different compile method, may used maven , sbt both?

php - Search User Specific information -

new php please specific. once user logs in come form submit data. user able search data entered them in past month. edit or delete if wish. code use search please. below have (search not working @ all) <h1>welcome!</h1> <form action="<?php echo $_server['php_self']; ?>" method="get"> search: <input type="text" name="search"> <input type="submit" value="submit"> </form> <?php // check if form value // submitted, if not // assign default value if(isset($_get['search'])){ $s = $_get['search']; }else{ $s = "%"; } //echo $s; // connects database mysql_connect("localhost","sample","qwerty") or die("error " . mysqli_error($link)); // selects of databases use mysql_select_db('crm'); // create , runs query $sql = "select * hours employee_id 'rhilfi'"; //

Not enable to connect salesforce account to docusign connect -

i'm trying connect docusign account salesforce account, developer version. my docusing account > preferences > connect in stage, have configure salesforce docusign eventhough clic on link, no configuration appears!!! have problem how resolve this? due trial version?? you want configure docusign salesforce app inside of salesforce, auto configure you're docusign connect (the feature pushes information salesforce). please see install , configure section of guide: link here

delphi - How do I make the compiler choose the BinaryWriter.Write overload I want? -

i using binary readers , writers read / write data file. example this: mywriter.write(ord(tmyenum(2))); i expect write down smallint read with myreader.readsmallint but in ide see writes down byte. how force writer write type want? cast smallint smallint(someenum)

java - JavaFX WebView's edit box accepts ENTER key event -

Image
i wondering, how possible can make javafx webview accept enter key event? currently, after finishing input username & password, pressing enter nothing. i'm not sure whether injecting javascript code choice, have no idea html content is. html content originated google. check documentation here . should help. if documentation doesn't help, see this question example. if want more specific help, please post sample code how you're trying solve problem. solution : javafx hmtleditor doesn't react on 'return' key

PHP adding or subtracting elements from array -

i have query string. example: ?filters=1,2,3,4 it gets turned array: $filters = explode(',', $_get['filters']); you push new value on $filters = array_push($filters, $new->filter); then turn query string http_build_query($filters); or, remove value $filters = array_diff($filters, [$new->filter]); then turn query string http_build_query($filters); i'm looking elegant solution remove item if exists or add item if not exist. alternative solutions welcome. thank you. hopefully i'm understanding correctly " i'm looking elegant solution remove item if exists or add item if not exist. ". also, not sure if elegant may spark other ideas: $filters = in_array($new->filter, $filters) ? array_diff($filters, [$new->filter]) : array_merge($filters, [$new->filter]);

git - Visual Studio Team Services with GitHub -

Image
i'm looking setup ci workflow inhouse (closed source ) project. i'm using github git/issue tracking. application desktop application ( no cloud / server deployments ). therefore workflow should be commit master on github notify ci via github webhooks run msbuild run tests build release i idea of hosted ci system can't figure out if visual studio team services requires total commitment or can use ci , notify of checkins github via normal github hooks. i'm not interested in migrating issue tracking , git hosting vs team services. my specific question. there hook mechanisms within visual studio team services pulling remote git repo's when github webhooks received? automated builds github repo available in new version of our build system in visual studio team services. able preview in brian harry's latest keynote on november 12, 2015. it's last demo. hope work out you! you can import github repo git repo in visual studio team s

matrix - Display label on gnuplot value in heatmap -

base on gnuplot example "heat map non-zero pixel values written labels" in here: http://gnuplot.sourceforge.net/demo_cvs/heatmaps.html i have data: 6 5 4 3 1 0 3 2 2 0 0 1 0 0 0 0 1 0 0 0 0 0 2 3 0 0 1 2 4 4 0 1 2 3 4 6 and gnuplot: set terminal pngcairo enhanced font "arial,10" fontscale 1.0 size 500, 350 set output 'heatmaps.png' unset key set view map set xtics border in scale 0,0 mirror norotate offset character 0, 0, 0 autojustify set ytics border in scale 0,0 mirror norotate offset character 0, 0, 0 autojustify set ztics border in scale 0,0 nomirror norotate offset character 0, 0, 0 autojustify set nocbtics set rtics axis in scale 0,0 nomirror norotate offset character 0, 0, 0 autojustify set xrange [ -0.500000 : 4.50000 ] noreverse nowriteback set yrange [ -0.500000 : 4.50000 ] noreverse nowriteback set cbrange [ 0.00000 : 5.00000 ] noreverse nowriteback set palette rgbformulae -7, 2, -7 splot 'heatmap.txt' matrix using 1:2:3

android - NullPointerException in startIntentSenderForResult -

i want upload image googledrive, , use example github(quickstart) .i invoke method uploadfiletodrive , locates in help-class, extends mainactivity. void uploadfiletodrive(final bitmap bitmap) { drive.driveapi.newcontents(mainactivity.mgoogleapiclient).setresultcallback(new resultcallback<contentsresult>() { @override public void onresult(contentsresult res) { outputstream outputstream = res.getcontents().getoutputstream(); bytearrayoutputstream bitmapstream = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.png, 100, bitmapstream); try { outputstream.write(bitmapstream.tobytearray()); } catch (ioexception e1) { clients.prt("firstexception"); } metadatachangeset metadatachangeset = new metadatachangeset.builder() .setmimetype("image/jpeg").se

php - Best way to receive variables from database -

i have custom wordpress table following contents: account_info id | account_id | wp_title | wp_url 1 | 12345 | website | website.com what best (or fastest) way results? option 1: global $wpdb; $sql = "select id, wp_title. wp_name account_info"; $results = $wpdb->get_results($sql); if(!empty($results)) { foreach($results $r) { $id = $r->id; $wp_title = $r->wp_title; $wp_name = $r->wp_name; } } option 2: $id = $wpdb->get_var("select id account_info"); $wp_title = $wpdb->get_var("select wp_title account_info"); $wp_name = $wpdb->get_var("select wp_name account_info"); when talking "best" , "fastest" - these aren't things need take consideration. readibility key future developers looking @ code. option 1 shows that, if result set isn't empty, loop around them , set variables. option 2 framework specific , , isn't b

android - Cannot save previous data on a table with values -

public void move_to_another_fragment() { fragment fragment = new itemfragment(); fragmentmanager fragmentmanager = getfragmentmanager(); getactivity().getactionbar().settitle("items"); fragmentmanager.begintransaction() .replace(r.id.frame_container, fragment).addtobackstack(null) .commit(); } i used above code move fragment b fragment a.in fragment have table data when come frgment , move frgmant b need show table previous value.can explain how start fragment b previous data you can save data of fragment before changing fragment b. , in createview function of fragment b. use data saved fragment generate view of fragment b. as activity same across both fragments, can store data in class variable of activity. hope helps.

c# - Add image to Crystal Report using return path from database -

i have crystal report. need add logo image report using path return stored procedure. this thread might old can someone. 1) if path static (means everytime not going changed based on condition), drag , oled object on report , in format object option of same (oled object), specify path of image. 2) can assign path parameter value if need change value database. assign path of database parameter , parameter bind path object.

Mongodb : How to find documents in which fields match an ObjectId or a string? -

i have documents in collection in mongodb : {_id : objectid('533af69b923967ac1801e113'), fkey : '533aeb09ebef89282c6cc478', ... } {_id : objectid('5343bd1e2305566008434afc'), fkey : objectid('5343bd1e2305566008434afc'), ...} } as can see field fkey can set string or objectid . i documents match '533aeb09ebef89282c6cc478' or objectid('5343bd1e2305566008434afc'). but if run : db.mycollection.find({fkey : '533aeb09ebef89282c6cc478'}) i first document of collection. is there way configure mongodb in order documents match request without checking type ? thanks help. pierre there 2 options here. you use mongo's $or operator : db.mycollection.find({ $or: [ { fkey: '533aeb09ebef89282c6cc478' }, { fkey: objectid( '533aeb09ebef89282c6cc478' ) } ] }) the $or operator performs logical or operation on array of 2 or more <expressions> , selects documents sa

java - XML serializer error -

i getting following error when prepare document , return. please find code below public static document requestparammissing (string params, string codeexception, string message, string apimethod, exception e, subscriberid, string udid, stringbuilder listparams, string requestid, string apiurl){ document doc = null; string errorcodenumber = ''; documentbuilderfactory docfactory = documentbuilderfactory.newinstance(); documentbuilder docbuilder = docfactory.newdocumentbuilder(); doc = docbuilder.newdocument(); element rootelement = doc.createelement("error"); doc.appendchild(rootelement); element errorcode = doc.createelement("code"); element errormessage = doc.createelement("message"); if(codeexception.equals('requestexception')){ errorcodenumber = '1000'; errorcode.appendchild(doc.createtextnode('1000')); errormessage.appendchild(doc.createtext

html - Level 2 submenu always visible -

i have spent whole day looking through various examples , still can't figure out way of setting 2 level submenu invisible. got template of net , trying customise it. here navigation bit css file (i know looks ugly ): ) #navigation { height: 35px; line-height: 35px; float: right; position: relative; z-index: 20; } #navigation ul { list-style: none; list-style-position: outside; font-size: 13px; text-shadow: rgba(255,255,255,0.5) 0px 1px 1px; } #navigation ul li { float: left; position: relative; padding-right: 2px; background: url(images/navigation-border.png) no-repeat right 0; } #navigation ul > li.last { background: transparent; width: auto; float: left; padding-right: 0; } #navigation ul > li.last { border-radius: 0px 5px 5px 0px; -moz-border-radius: 0px 5px 5px 0px; -webkit-border-radius: 0px 5px 5px 0px; -o-border-radius: 0px 5px 5px 0px; border-right: 1px solid #d7e1e8 !important; } #navigation ul > li.first { border-radius: 5px 0px 0px 5px ; -moz-border-radi

Multiple fadeIn/fadeOut effects in one audio file with ffmpeg -

i have problem add several fade effects 1 audio file. when try use command this: ffmpeg -y -i /home/user/video/test/sound.mp3 -af "afade=t=in:ss=0:d=3,afade=t=out:st=7:d=3,afade=t=in:st=10:d=3,afade=t=out:st=17:d=3,afade=t=in:st=20:d=3,afade=t=out:st=27:d=3" /tmp/test.mp3 then output audio file has fadein , fadeout applied once. next effects don't applied. there possible way apply several fade effects same audio file? also, difference between ss , st parameter in command? take here: ffmpeg volume filters volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame complete command: ffmpeg -i movie.wav -filter volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame modified-movie.wav

c# - Passing action and controller values from view to another partialview -

i have multiple index views different grid in each of these views, of them uses same popup control. dont want make partial view foreach index view have. put popup partial view in shared folder. but have html.beginform('action','controller') in popup partialview, , these values different in each grid. how can pass these view of grid partial view of popup? the grid view: //code resumed @html.devexpress().gridview( settings => { settings.name = "testmastergrid"; settings.column.add("id"); settings.column.add("name"); settings.column.add("email"); //command column wich calls popup control } the popup partialview: //code resumed using (html.beginform("actionineedtogetfromthegridview", "controllerineedtogetfromthegridview", formmethod.post)) { html.devexpress().textbox( textboxsettings => { text

Concat two ByteBuffers in Java -

how can concat 2 bytebuffers 1 bytebuffer? the following doesn't work: bytebuffer bb = bytebuffer.allocate(100); bytebuffer bb2 = bytebuffer.allocate(200); bb.allocate(200).put(bb2); system.out.println(bb.array().length); the length of bb still 100 . something bb = bytebuffer.allocate(300).put(bb).put(bb2); should job: create buffer large enough hold contents of both buffers, , use relative put-methods fill first , second buffer. (the put method returns instance method called on, way)

c++ - how to return index of element in vector -

given vector vector<classx *> myvec; how return index i of 1 of elements in following function; size_t nearestelement(classy const& p){ size_t i(0); double d = distance(myvec[i]->position(), p); (auto const& element : myvec){ if(distance(element->position(), p) < d){ = ???; // index of current element } return i; } } where position() function defined in classx , distance not std::distance function, function defined self. change range based regular for, or add indexing variable current for: int index = 0; (auto const& element : myvec){ if(distance(element->position(), p) < d){ = index; // index of current element } index++ ...

spring - Swagger endpoint not accessible -

i have spring mvc project uses gradle build project. i used steps described here in project. the build.gradle file has following entry swagger: compile (libraries.swagger){ exclude group:'org.slf4j', module:'slf4j-log4j12' exclude group:'org.slf4j', module:'slf4j-api' exclude group:'junit', module:'junit' } the configuration swagger done in project build.gradle below: swagger: "com.knappsack:swagger4spring-web:0.3.3" my controller documetation end point is: import com.knappsack.swagger4springweb.controller.apidocumentationcontroller; import com.wordnik.swagger.model.apiinfo; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; /** * example of how might extend apidocumentationcontroller in order set * own requestmapping (instead of default "/api") among other po

eclipse - LibGdx getUserData() method -> PC CPU 100% -

okay haven't seen that. i'm doing game in libgdx. i've set up, contact listener on world object have 4 methods in class ( begin contact, end contact, presolve, postsolve) @override public void begincontact(contact contact) { fixture f1 = contact.getfixtureb(); float fl = (float) f1.getbody().getuserdata(); // more code goes here } if run game, cpu increase around 8%. if run second time go around 20%, third time around 30% , 100% ( closed instances of game ). game not running cpu stay @ 100%. can fix closing , reopening eclipse. i went step step in code , if comment line float fl = (float) f1.getbody().getuserdata(); everything works okay. if run 10 instances of game @ same time, cpu won't go above 30%. any ideas? my computer specs: intel pentium quadcore q6600 2.4ghz, 4gb ram... it's not possible process keep running, after you've terminated it. it might close w

android - How to get attributeset value as "@color/desktop_purple" -

i have 2 apks, such packagea, packageb; meanwhile create custom-view named homesuite here xml layout: <linearlayout style="@style/page_linearlayout" android:layout_margintop="@dimen/hometopfragment_layout_margintop" android:layout_weight="16" > <com.my.example.view.homesuite android:background="@color/desktop_purple" android:layout_marginright="2dp" android:layout_weight="1" /> <com.my.example.view.homesuite android:background="@color/desktop_grey" android:layout_marginright="2dp" android:layout_weight="1" /> <com.my.example.view.homesuite android:background="@color/desktop_light_green" android:layout_weight="1" /> </linearlayout> here constructor: public homesuite(context context, attributeset attrs, int defstyle) { super(context, attrs, defst

ssrs 2008 - sql reporting services how-to: mask a parameter -

i have requirement allow users pull report customers using customer's credit card number parameter. security want mask field, common on many e-commerce sites. i'm pretty sure not out-of-the-box capability of reporting services. i'm hoping can accomplished adding vb report. not sure though. anyone have idea how can done in reporting services? as far know there no masked input parameters in ssrs 2008. i'm not sure if custom code way go. haven't wold how you're delivering reports, custom app or website reportviewer may best bet solution. in addition reportviewer control, can place own (masked input) controls user input parameter , send value in code behind. an important note though, think how deal credit card numbers. ask questions this one (top comment: "if have ask question, shouldn't storing credit card numbers. outsource if @ possible ") on our sister site security.stackexchange.com if you're unsure. in case, know ssrs i

load balancing - Windows NLB not balanced -

i set nlb cluster given 2 servers (ws 2008 r2). each server has 1 nic card set static ip address. assigned cluster internet name (mycluster), , assigned static ip address. third box acting client sending tcp data (over wcf) cluster's ip configured (static ip). observing nlb cluster nlb manager @ 1 of nodes - both nodes green, started. however, able see traffic coming in 1 of nlb servers. when suspend it, see traffic going other nlb server, , on. expecting traffic split equally between them. can't figure out missed, tips please? if need more detailed information please ask, not sure how detail put in here. thanks/. by default, port rule created filtering mode of multiple host use single affinity. in other words, multiple requests same client directed same host. see traffic going both hosts try accessing cluster multiple clients. set affinity "none", can lead other problems. there's information on affinity parameter , how use in nlb file.

java - How to handle a static final field initializer that throws checked exception -

i facing use case declare static final field initializer statement declared throw checked exception. typically, it'd this: public static final objectname object_name = new objectname("foo:type=bar"); the issue have here objectname constructor may throw various checked exceptions, don't care (because i'd know name valid, , it's allright if miserably crashes in case it's not). java compiler won't let me ignore (as it's checked exception), , prefer not resort to: public static final objectname object_name; static{ try{ object_name = new objectname("foo:type=bar"); }catch(final exception ex){ throw new runtimeexception("failed create objectname instance in static block.",ex); } } because static blocks really, difficult read. have suggestion on how handle case in nice, clean way? if don't static blocks (some people don't) alternative use static method. iirc, josh bloch reco

ios - Bounds vs Frame when making a custom view and initializing it -

i'm having difficulties understanding difference, , when use what. i know textbook definitions. have searched lot regarding topic. answers here on helpful extent, feel still don't understand properly. let's have acustomview.m, , when place ui elements within view, use bounds, makes sense because it's in it's own coordinate system, but, when initialize view using initwithframe: in view-controller, should use self.view.frame or self.view.bounds ? both work, different results. i want understand this, appreciated. the bounds of uiview rectangle, expressed location (x,y) , size (width,height) relative own coordinate system (0,0). the frame of uiview rectangle, expressed location (x,y) , size (width,height) relative superview contained within. so difference question of representation.

c# - Yield return request never returns -

currently i'm having problem courotine. yield return never goes anywhere.. doesn't want return in webplayer build. in editor works fine, no problems yielding @ all. ienumerator i'm starting. public ienumerator createchannel(string channelname) { string urlrequest = "http://hiddenforsecuritypurposes.com/game/addchannel.aspx?channelname=" + channelname; www request = new www(urlrequest); yield return request; //it never reaches here.. runs ienumerator, yield return never returns itself. print("it got yielded"); } again, quick note. work out in editor, not in webplayer, i'm exporting game to. is webplayer , domain trying reach on same url/server? if not, need put crossdomain.xml root of server trying reach. in case http://hiddenforsecuritypurposes.com/crossdomain.xml

assembly - Difference between memory and register -

i saw assembly code like, mov [eax], ebx the above line, mentioned [eax] memory , ebx register. so, here difference between [eax] , ebx . happen in above instruction. in syntax, brackets around register means memory location used (as source or destination, according instruction) starting address specified @ register (eax in case). example, if eax contained 1344 before instruction, value ebx copied logical memory addresses 1344-1347 (because 4 byte copying). i hope enough untangle them in mind:) , please notice more complex cases possible (e.g. mov [eax+ecx],ebx forms destination address sum of 2 register values).

CouchDB not Working on Android Emulator -

i making android app uses couchdb database storage.i able run app on real device,but when run app on emulator force closes error messages as:- 04-23 10:37:12.810: d/dalvikvm(319): vfy: dead code 0x0005-0036 in lcom/couchbase/lite/storage/sqlitestorageenginefactory;.createstorageengine ()lcom/couchbase/lite/storage/sqlitestorageengine; 04-23 10:37:12.820: d/androidruntime(319): shutting down vm 04-23 10:37:12.820: w/dalvikvm(319): threadid=1: thread exiting uncaught exception (gro up=0x4001d800) 04-23 10:37:12.840: e/androidruntime(319): fatal exception: main 04-23 10:37:12.840: e/androidruntime(319): java.lang.noclassdeffounderror: java.util.serviceloader 0 4-23 10:37:12.840: e/androidruntime(319): @ com.couchbase.lite.storage.sqlitestorageenginefactory.createstorageengine(sqlitestorageenginefactory.java:25) 04-23 10:37:12.840: e/androidruntime(319): @ com.couchbase.lite.database.open(database.java:813) 04-23 10:37:12.840: e/androidruntime(

c# - Converting a string with commas to double and int are different. Why? -

i migrating old mfc gui c#. i building form-based gui when i've got unexpected exception converting string integer type. assumed work same converting string double. string str = "1,000"; double dthou = convert.todouble(str); // ok int ithou = convert.toint32(str); // raises exception conversion double gives correct value: 1000.0. int conversion, able solution : convert.toint32() string commas . but curious if there reason behind this. or, missing something? i able find similar, not duplicate question : number parsing weirdness [edit] after learning culture issue. i in kind of culture-shock because until now, in korea, both floating point number , integer numbers expressed "," thousands group , "." decimal point (at least in real world, in korea, mean, think... ). guess have accept current settings of ms visual studio , carry on. [edit2] after sleeping on issue. i think it's more of inconsistent handling of formatted st

how to delay PHP script until Mysql insert query is committed -

in website developing users have sign or register. when users submits form registration user should logged automatically username... now, insert data mysql database followed retrieving same data database select statement problem select statement executed faster insert (or something) , results in fatal error... want php script retrieving data wait until insertion committed... how can ? first check whether query has been executed or not. $result = mysql_query('select * 1=1'); if (!$result) { die('invalid query: ' . mysql_error()); }

eclipse - java.lang.NoClassDefFoundError: com/sun/tools/javac/Main -

i have app deployed on heroku. imported , runned locally. please me error. can't figure out , solve this. error when run app. in heroku don't have error. java.lang.noclassdeffounderror: com/sun/tools/javac/main @ net.integrio.db.factory.compiled.compiler.compile(compiler.java:14) @ net.integrio.db.factory.compiled.implementationclassbuilder.buildclassfor( implementationclassbuilder.java:56) @ net.integrio.db.factory.compiled.implementationcache.getcompiledfactory( implementationcache.java:28) @ net.integrio.db.factory.compiled.compiledfactorysupport.<init>(compiledfactorysupport.java:92) @ net.integrio.db.factory.compiled.compiledfactorysupport.<init>(compiledfactorysupport.java:84) @ net.integrio.db.factory.compiled.compiledfactorysupport.<init>(compiledfactorysupport.java:68) @ com.getworkers.messages.incoming.incomingmessagesfactory.<init>(incomingmessagesfactory.java:13) @ com.getworkers.utils.cron.incomingmessag

xorg - How to change _NET_WM_NAME (X Library) -

i try use http://xkbind.sourceforge.net/ (useful displaying keyboard state in window title) on mint maya (based on ubuntu 12.04) but xkbind change wm_name property here xkbind.c code fragment if(xgetwindowattributes(dpy, window, &wa)) { xselectinput(dpy, window, wa.your_event_mask&~propertychangemask); xsync(dpy, false); xsetwmname(dpy, window, p_tp); xselectinput(dpy, window, wa.your_event_mask); } what function should used change _net_wm_name property too? example xkbind gvim xprop output wm_name(string) = "lat::[no name] - gvim" _net_wm_name(utf8_string) = "[no name] - gvim" straightforward call of xchangeproperty() should trick: xchangeproperty( display, win, xinternatom(display, "_net_wm_name", false), xinternatom(display, "utf8_string", false), 8, propmodereplace, (unsigned char *) utf8_buffer, count);

.net - How can I create an Excel sheet view for user input in C#? -

i wanted create view same excel sheet of rows , columns in user can give inputs , should grow dynamically cell should filled program internally , should read only. making windows form application using c#. there way in c#? there several tools aid in doing task. telerik , infragistics 2 of them. http://www.telerik.com/ http://blogs.telerik.com/aspnet-ajax/posts/13-07-30/create-excel-asp-net-grid http://www.infragistics.com/products/windows-forms/infragistics-excel/ this article may useful too. http://support.microsoft.com/default.aspx?scid=kb;en-us;304662

java - Dozer unable to map Collection<Interface> member -

i have object contains collection: public class wrapper { private collection<base> bases = new linkedlist<base>(); public collection<base> getbases() {return bases;} public void setbases(final collection<base> bases) {this.bases = bases;} } the implementations of interface quite simple: public class baseone implements base { } public class basetwo implements base { } when run simple test: @test public void testcopyother() { final wrapper wrapper = new wrapper(); wrapper.getbases().add(new baseone()); final wrapper copy = dozer.map(wrapper, wrapper.class); } i exception: org.dozer.mappingexception: java.lang.nosuchmethodexception: com.usamp.biddingtool.model.service.impl.base.<init>() @ org.dozer.util.mappingutils.throwmappingexception(mappingutils.java:82) @ org.dozer.factory.constructionstrategies$byconstructor.newinstance(constructionstrategies.java:261) @ org.dozer.factory.constructionstrategies$b

php - Exploding string to array, then searching array for multiple results -

background users on website can give profile 'keywords', each separated ', '. example: green apples, bananas, red apples, pears this stored in database string. i have livesearch page users can search users keyword. on search, page suggests keywords user types. example, user may type: apples and page suggest green apples , red apples . method when input sent keywordsearch.php , page searches following: $search_string_w = '%'.$search_string.'%'; $stmt = $dbh->prepare('select `keywords` `users` `keywords` ?'); $stmt->execute(array($search_string_w)); while($results = $stmt->fetch(pdo::fetch_assoc)) { $result_array[] = $results; } this gets row of user has keyword. however, want display each individual keyword search suggestions, if keyword appears multiple times. if (isset($result_array)) { foreach ($result_array $result) { $keyw = explode(', ', $result['keywords']); $keyk

r - Knitr kable() output not displayed correctly when there are parenthesis in column title -

i have linear model, want print coefficient table in knitr chunk inside r markdown file. produce html file r markdown file. > model <- lm(speed ~ dist, cars) this coefficient table is not displayed correctly when place in {r results='asis'} knitr chunk. table displayed plain text in html page. > kable(xtable(model)) | | estimate| std. error| t value| pr(>|t|)| |:-----------|---------:|----------:|--------:|--------:| |(intercept) | 8.2839056| 0.8743845| 9.473985| 0| |dist | 0.1655676| 0.0174945| 9.463990| 0| this coefficient table is displayed correctly when place in {r results='asis'} knitr chunk. table displayed html table in html page. > kable(data.frame(xtable(model))) | | estimate| std..error| t.value| pr...t..| |:-----------|---------:|----------:|--------:|--------:| |(intercept) | 8.2839056| 0.8743845| 9.473985| 0| |dist | 0.1655676| 0.0174945| 9.463990| 0|

java - Foreach loop can cause thread concurrency? -

i've heard shouldn't use foreach loop can avoid because can cause thread concurrency, mean thread concurrency, , true ? so when should use for-each loop? any time can . beautifies code. unfortunately, cannot use everywhere. consider, example, the expurgate method . program needs access iterator in order remove current element. the for-each loop hides iterator, cannot call remove . therefore, for-each loop not usable filtering. it not usable loops need replace elements in list or array traverse it . finally, it not usable loops must iterate on multiple collections in parallel . these shortcomings known designers, made conscious decision go clean, simple construct cover great majority of cases. emphasis mine. unless clear mean exactly, indicate you're wrong.

php - FFMPEG 2 Channel AIF files = fail -

i wonder if has solution aif files "2 channels", not compile in ffmpeg. if take same aif file , open in editor , recompile stereo (l r), works expected. my ffmpeg command , console output: $ ffmpeg -i input.aif -ar 44100 -ab 128k -acodec libmp3lame -ac 2 -y output.mp3 ffmpeg version 2.0.1 copyright (c) 2000-2013 ffmpeg developers built on mar 2 2014 19:58:58 gcc 4.6 (ubuntu/linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-version3 --enable-shared --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.102 / 55. 18.102 libavformat 55. 12.100 / 55. 12.100 libavdevice 55. 3.100 / 55. 3.100 libavfilter 3. 79.101 / 3. 79.101 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc

ios - Copy UImages from photo library to another directory -

i want copy picture photo library directory in app, every thing works fine attached code here when try copy lot of images app crashes think because attached code done single thread each image needs thread, if there many pictures copy app crashes. need same code here not in thread means app should blocked until image copied directory , if 1 have idea appreciated. loop saving each image. for (int = 0; i< countt ;i++) { nsurl *referenceurl = [self.tosavearray objectatindex:i]; alassetslibrary *assetlibrary=[[alassetslibrary alloc] init]; [assetlibrary assetforurl:referenceurl resultblock:^(alasset *asset) { alassetrepresentation *rep = [asset defaultrepresentation]; byte *buffer = (byte*)malloc(rep.size); nsuinteger buffered = [rep getbytes:buffer fromoffset:0.0 length:rep.size error:nil]; nsdata *data = [nsdata datawithbytesnocopy:buffer length:buffered freewhendone:yes];//this nsdata may want n

Bower hangs after checkout step of Install command. -

i'm github enterprise user , i'm using bower point internal repository manage dependencies. i have set repo , included bower.json file in root directory. looks this: { "name": "axis", "main": "axis.js", "version": "0.0.0", "authors": [ "nick randall" ], "description": "chart axis", "keywords": [ "d3", "d3.chart", "axis" ], "license": "mit", "ignore": [ "**/.*", "node_modules", "bower_components", "test", "tests" ], "dependencies": { "d3": "~3.4.6", "d3.chart": "~0.2.0", "lodash": "~2.4.1" } } i'm trying install repo above dependency in new project using "bower install org/axis" , process hangs aft

json - Javascript :: generate new variable in a closure and use it through an object instance -

h! have fetch json data remote file , grab values variables accessibles instance of object created "v". with code "undefined" (i'm trying minimize as possible antipatterns) var func = function (url) { this.url = url; }; func.prototype.fetch = function () { // fetching json content var res = new xmlhttprequest(); res.open('get', this.url, true); res.onreadystatechange = function () { if (res.readystate == 4) { if (res.status == 200) { // object want access outside var obj = json.parse(res.responsetext); this.ip = obj.ip; } } res.send(null); }; }; var v = new func("http://ip.jsontest.com/?callback=showmyip"); v.fetch(); //now "undefined" console.log("ip " + v.ip); i hope i've been clear. me please? thanks in advance. the problem res.open asynchronous call. not data immedia

google spreadsheet - If column includes a certain value, turn top cell red -

i want function can check 1 column value , if @ least 1 value found top cell should become red. intent visualize function of top cell in said column: if cell in column "a" = "x" cellbgcolor = red else cellbgcolor=white i don't mind doing in 2 steps, i.e. if value found type "x" in cell , use conditional formatting paint cell. please try: =match("x",a:a,0) with applies to range: a1.

java - How should I access class members in beforeExecute and afterExecute hooks in ThreadPoolExecutor? -

i extending threadpoolexecutor class. inside want set member value in beforeexecute (thread t, runnable r) , afterexecute (runnable r, throwable t). not sure how so. can me that? presumably, want access instance field of runnable instances. access them need downcast runnable actual class of runnable class, , access fields via downcast reference. or better still, make fields private , access them via getter / setter calls on reference. this awkward if runnable anonymous inner class. in case, may need turn named class: either nested, inner or top level. on other hand, if talking static fields or methods of runnable implementation class, can use them ... provided access modifiers allow this.

ios - What's the difference between CLBeacon and CBcentralManager -

i want detects beacon/ibeacon devices near iphone's proximity. not sure class should use should use clbeacon , clbeaconregion , start monitoring region or should use cbcentralmanager , scanforperipheralswithservices which api suited best use case ? i have tried find online it's not documented anywhere although ibeacons use bluetooth low energy (ble), not treated ble peripheral in ios. handled via corelocation framework, classes need cllocationmanager , clregion , clbeacon . refer core location programming guide cbcentralmanager ble peripherals such heart rate monitors, fitness trackers (or else can think of want exchange data peripheral)