Posts

Showing posts from July, 2010

c# - How to place a windows form in screen coords and close it on command? -

i working on c# console program on windows move window, part of trying create transparent box @ target destination give user visual confirmation of new location. facing 2 main problems: i want place form in screen coordinates i want able close window after user has confirmed decision. currently have code in library console client calling this: public static void createbox(rect rectangle) { form f = new form(); f.name = boxname; f.backcolor = color.blue; f.formborderstyle = formborderstyle.none; f.bounds = new system.drawing.rectangle(rectangle.left, rectangle.top, rectangle.right - rectangle.left, rectangle.bottom - rectangle.top); f.topmost = true; f.opacity = 0.5; application.enablevisualstyles(); task.run(() => application.run(f)); } and after searching questions on here have come attempt close form later: public static void removebox() { form f = application.open...

php - Using the javascript function without repeating it -

the following <div> section duplicating , below javascript function, want use again , again. share ideas if possible. <?php $new_material = ["a","b","c"]; //array pass in foreach foreach ($new_material $mat) { ?> <div class="row " id="row2"> <div class="row " id="row2.1"> <div class="col-xs-2"> <label>material name</label> </div> <div class="col-xs-3"> <label>brand</label> </div> <div class="col-xs-2"> <label>category</label> </div> </div> <div class="row " id="row2.2"> <div class="col-xs-2"> ...

swing - Trouble drawing with MouseDragged in Java -

there's problem drawing or setting size of jpanel when drag mouse, location setted click , size depending of drag position(x , y) drawing resizable rectangle(jpanel). private void panelmousedragged(java.awt.event.mouseevent evt) { rsx = (int)mouseinfo.getpointerinfo().getlocation().getx(); rsy = (int)mouseinfo.getpointerinfo().getlocation().gety(); rectangulodefault.setbounds(rx,ry,rsx-rx,rsy-ry); } private void panelmousepressed(java.awt.event.mouseevent evt) { rx = (int)mouseinfo.getpointerinfo().getlocation().getx(); ry = (int)mouseinfo.getpointerinfo().getlocation().gety(); rectangulodefault.setlocation(rx,ry); } but when drag mouse in negative coordinate of click(start of drawing) disappear. here better explain http://i.picasion.com/resize80/49c88c55d4c11c53c020acfcc4fc2f45.png but when drag mouse in negative coordinate ...

javascript - Cannot read property 'settings' of undefined when i click submit button -

i don't know why i received error when changed code php (from html). when extension of file html, code working fine <?php?> <html lang="en"> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="css/manual.css"> <!-- optional theme --> <!-- latest compiled , minified javascript --> <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <!-- latest compiled , minified javascript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js">...

Why the Google Analytics API is eating the "\" in my filter query? -

Image
i playing google analytics api , found interesting. today came problem can't solved. i sending filter this: 'filters':'ga:pagepath=~^/q-\d+/\d+$' it's working in query explorer not working code. after tests found query wrong when it's sent. here "network" panel of chrome debugging tool: as in picture, \d became d , guess reason data not correctly showing up. how can fix this? here code: var o ={ 'ids': 'ga:' + profileid, 'start-date': $('#startdate').val(), 'end-date': $('#enddate').val(), 'metrics': 'ga:pageviews,ga:uniquepageviews', 'dimensions': 'ga:pagepath', 'sort':'ga:pagepath', 'filters':'ga:pagepath=~^/q-\d+/\d+$' }; gapi.client.analytics.data.ga.get(o) .then(function(response) { thanks, you need escape backslash symbols: 'filters':'ga:pagepath=~^/q-\\...

ios9 - Not able to register for push in iOS -

for reason, in ios9, in methods:bool parsecheckpermissionforremotenotifications(void) , void parseregisterforremotenotifications(blockboolaction completion), cannot reach parse servers. in ios8, works fine. i've tried remaking ssl certificate , provisioning profile , adding exceptions nsapptransportsecurity. have idea why happening?

ios - Swift PrepareForSegue NSIndexPath error -

i want prepare segue via: override func prepareforsegue(segue: uistoryboardsegue?, sender: anyobject?) { if segue?.identifier != "fromopenchatstologin" { if let controller: chatviewcontroller? = segue?.destinationviewcontroller as? chatviewcontroller { if let cell: onlineusercell? = sender as? onlineusercell { let user = oneroster.userfromrosteratindexpath(indexpath: tableview.indexpathforcell(cell!)!) controller!.recipient = user } } } } where onlineusercell custom cell. also, that's userfromrosteratindexpath: class func userfromrosteratindexpath(indexpath indexpath: nsindexpath) -> xmppusercoredatastorageobject { return sharedinstance.fetchedresultscontroller()!.objectatindexpath(indexpath) as! xmppusercoredatastorageobject } so, when select cell crashes with: fatal error: unexpectedly found nil while unwrapping optional value on line: let user = oneroster.userfromr...

jquery plugins - export yajra datatable all data to csv -

i'm not able find solution saving records csv using yajra datatables. currently i'm getting paginated records displaying on current screen (10 records), need records i'm using yajra datatables buttons extension. my current code : $('#export-table').datatable({ dom: 'bfrtip', processing: true, serverside: true, responsive: true, autowidth:false, aasorting: [[6, 'desc']], ajax: '{!! route('export.data') !!}', aocolumns: [ {mdata:'name', name: 'name'}, {mdata:'address', name: 'address'}, {mdata:'phone', name: 'phone'}, {mdata:'cell_phone', name: 'cell_phone'}, {mdata:'email', name: 'm.email'}, {mdata:'company', name: 'company'}, {mdata:'date_taken', name: 'date_taken'} ], buttons: ['csv'] }); need save recor...

Which is better MySQL and Mnesia in Ejabberd? -

hi working on ejabberd have 10k 20k concurrent user. better mysql , mnesia . or need use combination on them or other database. mnesia not intended store large volume of data. should type of data requires quite large storage (several tens of thousands of record) , use mysql type of data. example, may relevant move roster , pubsub mysql. you decide prepare large growth , put can directly in mysql.

jquery - Add value in span using JavaScript -

i want add 500 using onclick function in span 1000 means onclick @ check box sapn value 1500 js function add() { if (document.form1.checkbox1.checked == true) { // code here sum 500 in 1000 } } html <form name="form1" style="color: green ; font-size: 150%" action="#"> <input type="checkbox" name="checkbox1" onclick="add()" />500 <br /> <span>1000 </span> </form> </body> if don't want use jquery, the following can used. function add(element) { var form = document.getelementsbyname("form1")[0]; var val = form.getelementsbytagname('span')[0].innerhtml; if (element.checked == true) { form.getelementsbytagname('span')[0].innerhtml = parseint(val) + parseint(element.value); } else { form.getelementsbytagname('span')[0].innerhtml = parseint...

oop - Java: Encapsulating if-return statement in a method call for cleaner, more concise code? -

i'm learning java studying books on code design. i wondering, possible in java have if statement encapsulated in method call allows 1 somehow exit parent method if boolean false? what i'm wondering if if can further distill following code public void addstock (string stock) { boolean stocknameisvalid = teststringforvalidstockname(stock); if (stocknameisvalid == false){ joptionpane.showmessagedialog(getparent(), "invalid text entered. stock ticker names may include upper-case alphabetical letters.", "invalid text entry error", joptionpane.error_message); return; } boolean stockalreadyexistsinpanel = testforstockexistenceinlistingpanel(stock); if(stockalreadyexistsinpanel == true){ joptionpane.showmessagedialog(getparent(), "the same stock cannot entered twice list of stocks being watched.", "redundant stock error", joptionpane.error_message); return; } controller.addstockt...

javascript - Drupal 7, how to push a div below the js files -

i need push div right above end of body tag, there allways scripts above , need below of them tried: i tried use hook_page_build push them allways comes above js files. i tried page_alter i gave 999... weight see if happens nothing i tryed put in drupal_add_js(' .. '), wrapping them "". any ideas ? thank you a solution use template file https://api.drupal.org/api/drupal/modules!system!html.tpl.php/7 , add div there. https://www.drupal.org/node/1089656 - generic documentation templates in case, might copy html.tpl.php sites/all/themes/[yourtheme]/templates/ , modification there have div you'd like. if use sub-theme of main theme, copy html.tpl.php main theme, instead of drupal core.

c# - imagebutton is not visible when I run my code in browser -

Image
i have used image button shows calendar on clicking. while run code image linked image button not visible, visible in design mode. using visual studio 2008 , c# coding. the screenshot of design mode shown below : the html code image button : <asp:imagebutton id="imagebutton1" runat="server" height="28px" imageurl="~/app_data/call.jpg" onclick="imagebutton1_click" style="margin-right: 0px" width="49px" /> and when run code in browser image associated imagebutton not visible. screenshot of imagebutton shown below :

xml - Why does PHP SimpleXML children() returns null for empty tag? -

we have following sample xml: <xml> <call> <branchid>2</branchid> <item_main_display>1</item_main_display> <workstation_id>1</workstation_id> <formatted_ticket_number>203</formatted_ticket_number> <queue_letter></queue_letter> <service_id>17</service_id> <service_name>konsultanti queue</service_name> <isflashing>false</isflashing> <workstation_name>servicepoint_d924</workstation_name> <calltime>1442583923157</calltime> <timestamp>1442583923</timestamp> <eventtime>2015-09-18t17:45:23.114+0400</eventtime> </call> </xml> using followin php code try access xml nodes; $xml=simplexml_load_file("sample.xml"); $xmlstr=""; $xmlstr.="<xml>"; foreach($xml->children() $child1) { ...

c++ - QTcpSocket in a thread doesn't always send data instantly -

i have server handles every client connection in separate thread. test it, implemented simple "echo" service: type message client, sent server, server sends back, , client displays it. as send short packets, use single write , read current tests, never had split packets. the client uses write() , readall() , works time (verified packet sniffer tool) what observe time, server sends packets @ every second occasion. for example: the client sends "abc" the server receives it, sends back. write() function returns 3. the client receives nothing. check packer sniffer, no packets sent the client sends "def", several seconds, or minutes later the server receives it, sends back. write() function returns 3. the client receives both "abc" , "def" messages. 90% of time 2 separate packets, 10% of time "abcdef". on rare occasions, 1 message enough. of time, however, second message needed send both first , second mes...

java - JFileChooser Save Dialog shows overlaping open and save button text -

Image
i'm using following code display save file dialog. final jfilechooser fc = new jfilechooser(); retval = fc.showsavedialog(jinternalframe); when select folder/drive once jfilechooser opens, save , open button overlaps few seconds , goes off hover on button. how resolve this?

java - Cannot resolve symbol "LayoutInflater inflater,ViewGroup container" -

i have method "displayeventinvitationlist" have parameters "inflater,container" when call method "displayeventinvitationlist(layoutinflater inflater,viewgroup container)" in "onoptionsitemselected" getting error cannot resolve symbol "inflater,container".please suggest me code how solve problem. public boolean onoptionsitemselected(menuitem item) { log.d("onoptionsitemselected", "yes"); switch (item.getitemid()) { case r.id.all: //i getting "cannot resolve symbol" here displayeventinvitationlist(layoutinflater inflater,viewgroup container); return true; case r.id.event: displayeventlist(); return true; case r.id.invitation: displayinvitationlist(); return true; default: return super.onoptionsitemselected(it...

ruby - Rails before_filter different arguments -

i have controller actions use 1 method different arguments. can refactor somehow use before_filter ? def usd_cash transaction_currency("usd cash") end def usd_bank transaction_currency("usd bank") end def rub_bank transaction_currency("rub bank") end private def transaction_currency(currency) @transactions = transaction.where(location: "#{currency}") end you use metaprogramming, not readable have: %i( usd_cash usd_bank rub_bank ).each |method| define_method method transaction_currency(method.to_s.split('_').instance_eval {first.upcase + ' ' + last}) end end

html - Jquery length property always returning 0 -

i have form elements added via ajax in table below. <tr> <td></td> <td> <input id="cde[0]" name="cde[0]" class="required" value="30-09-2015"> <input type="hidden" id="cddbe[0]" name="cddbe[0]" value="2015-09-30"> </td> <td> <input id="cqtye[0]" name="cqtye[0]" class="required number" value="30"> </td> <td> <input id="cremarke[0]" name="cremarke[0]" value="remarks 1"> </td> </tr> there may many rows of elements in table. i trying find if element exists before getting value using jquery.length property below var nor=$('#commite tr').size()-2; var c="cqtye["+nor+"]"; if($('#'+c).length){ console.log("element exists"); } but .length false. ...

Why reusing emptied array in Javascript not possible? -

this question has answer here: how return response asynchronous call? 21 answers how return value asynchronous callback function? [duplicate] 3 answers i programmed in few programming languages, time time have experience javescript. here situation: have array global variable (myarray). need refill myarray data db when event happens. wrote myfunction, in myarray emptied remove eventual older data, filled again new data. if don't delete array content, works, (of course) array may contain older data , grow each time function called, , don't want that. what don't understand following: if delete content of myarray when myfunction starts, i cannot refill again ... here simplified version of code, help: myarray = []; // global variable // in myfunction //first e...

java - Hide String Array Value in Spinner -

i using 2 spinners , populating both using same string array : final string[] arraymonths = { "january", "feburary", "march", "april", "may", "june", "july", "august", "september", "october", "november","december" }; now make small change, don't want show december in spinner1 , january in spinner2 . so have make change in code done ? code adapter = new arrayadapter<string> (connectedspinnersstartend.this, android.r.layout.simple_spinner_item, arraymonths); spinner1.setadapter(adapter); it's easier think. first step moving array arraylist, gives more flexibility, , submit arrayadapter instead of array arraylist<string> mlist = new arraylist( arrays.aslist(arraymonths)); mlist.remove("december"); adapter = new arrayadapter<string> (connectedspinnersstartend.this, android.r....

mysql - Selecting posts together with optional taxonomy -

i want select (wordpress) posts eventual brand , brand_id (both same taxonomy). if there no brand set, post should selected anyway these 2 fields set null . this query work, it's excluding posts missing brand: select p.id post_id, p.post_title title, p.post_content body, brand.name brand, brand.term_id brand_id, unix_timestamp(p.post_date) date_added wp_posts p inner join wp_term_relationships brand_rel on brand_rel.object_id = p.id inner join wp_term_taxonomy brand_tax on brand_tax.term_taxonomy_id = brand_rel.term_taxonomy_id , brand_tax.taxonomy = "product_brand" inner join wp_terms brand on brand.term_id = brand_tax.term_id p.post_type = 'product' , p.post_status = 'publish' group post_id; changing inner join left join , posts - none of brands (both brand , brand_id null ): select p.id post_id, p.post_title title, p.post_content body, brand.name brand, brand.term_...

django nginx setup issues -

in following trying configure http://uwsgi-docs.readthedocs.org/en/latest/tutorials/django_and_nginx.html the following conf file below placed in project directory , have linked same in sites-enabled of nginx directory. now when access http://127.0.0.1:8000/app1/files?path=/ end 502 bad gateway , nginx error log says 2015/09/21 14:07:41 [error] 8023#0: *7 connect() failed (111: connection refused) while connecting upstream, client: 127.0.0.1, server: 127.0.0.1, request: "get / http/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "127.0.0.1:8000" but able access link http://127.0.0.1:8000/media/a.jpg doing wrong here , how can access django application # mysite_nginx.conf # upstream component nginx needs connect upstream django { # server unix:///path/to/your/mysite/mysite.sock; # file socket server 127.0.0.1:8001; # web port socket (we'll use first) } # configuration of server server { # port site se...

c# - reading files using generic array ref -

i working on small program has save , open functionality bunch of variables. variables of various types, int - string - double , arrays i implement function can cope different data types let's have following variables int var_int_1 = 1; double var_double_1 = 2.2; string var_string_1 = "three"; int[] arr_int_1 = new int[5]; the saved file looks this var_int_1: 1 var_double_1: 2.2 var_string_1: "three" arr_int_1: arr_int_1_00: 1; arr_int_1_01: 2; my open-function this public bool open(string filename) { try { string line; using (streamreader file = new streamreader(filename)) { while ((line = file.readline()) != null) { extract_value_from_stream("var_int_1", line, ref var_int_1); extract_value_from_stream("var_double_1", line, ref var_double_1); extract_value_from_stream("var_string_1", line, ref var_string_...

php - SQL Delete statement not working -

include_once 'dbfunction.php'; getdbconnect(); mysqli_query("delete crewlist id = $_get[crew_id]") or die (mysqli_error()); echo 'delete success'; header ('location: crewlisting.php'); this code doesn't work, when replace crew_id actual primary key via hard coding delete function works use ( mysqli procedural ) in dbfunction.php should be <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "mydb"; // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } ?> and insert page should be <? include ("dbfunction.php"); //include db connection $id = $_request['crew_id']; $sql = "delete crewlist id = '$id' "; if (mys...

OpenOffice Basic - Finding Number of Data Points in Column -

i need find number of data points within single column , place value in given cell on openoffice calc spreadsheet. here code far i'd appreciate if can tell me i'm going wrong or missing. thanks. const data_col = 1 'column number data const data_row_start = 2 'start row data 'this function finds number of data points in data column data_col 'the aim of function determine number of data points in column 'you need make use of constants data_row_start (= 2) , data_col (= 1) 'in function. specifically, function uses information first data point in row data_row_start (= 2) , in data in column data_col (= 1). function findnumberofdatapoints() long dim data_col double dim data_row_start double dim count double dim row integer count = 0 row = data_row_start while activesheet.cells(data_row_start,data_col)<>"" row = row + 1 count = count + 1 wend if activesheet.cells(data_row_start,data_col)...

linux - i3blocks (i3wm) - use a sudo command -

i'm configuring i3blocks i3wm, , can't seem able execute sudo command like: [update-notifier] label=update command=sudo ~/.i3/scripts/update-notifier.sh interval=once inside update-notifier.sh file have this: apt-get update && apt-get upgrade plus echo formatting i3blocks bar. i've tried this: command=sudo ~/.i3/scripts/update-notifier.sh , without sudo apt-get -> script doesn't launch command=sudo apt-get update && sudo apt-get upgrade -> command isn't executed command=~/.i3/scripts/update-notifier.sh sudo apt-get -> script launch, i3bar formatted, apt-get isn't executed. do have sudo configured doesn't ask password user apt-get command? maybe command running asks password , fails. i abled accomplish you're trying allowing user run apt-get sudo without password adding /etc/sudoers file: <my-user> <my-host> = (root) nopasswd:/usr/bin/apt-get and adding block command property set s...

java - How to check for the same ID, and then increment for that particular id? -

i have hashmap, let's call hashmap , in method whereby i'll pass in string called id . have object, let's call userobject . want write output csv file, using below code: for (userobject user: hashmap.get(id)) { system.out.println(id); writer.println(id + "," + user.gettime() + "," + user.getlat() + "," + user.getlng()); // csv } but id may have multiples of same one. wanna whenever 1 id used for loop, there'll counter increments one. so, when same id used again, increment increase. however, when different id being used, increment operation. mean whenever loop running want count how many instances same id run. how can so? can't seem figure out logic. p.s system.out.print(id) line of test code, output 1 chunk of ids. **edit: logic work sql's count function, i'm not using sql, need in pure java not sure if understand correctly, if want count elements in hashmap, can try this. ...

jquery - Javascript multidimensional array undefined error -

Image
i'm having trouble creating multidimensional array im putting counties , places in county. example of im trying do: [ 'hedmark' => [ 1 => 'elverum', 2 => 'hamar ], 'oslo' => [ 1 => 'oslo' ] ] the code im using this: var $query_place = []; // each checked county $.each($('.county input:checkbox:checked'), function () { $query_place.push({ county: $(this).val(), postal: [] }); }); // each checked postal $.each($('.postal input:checkbox:checked'), function() { $query_place[$(this).attr('data-county')].postal.push(); }); the error im getting in console this: typeerror: $query_place[$(...).attr(...)] undefined is there im forgetting here? or have done wrong? you have implement code this var $query_place = []; // each checked county $.each($('input:ch...

Propel - how can I set column name for PHP same as in DB automatically -

i used propel 2 , want have column-names php same in dhe db. used schema.xml this: <?xml version="1.0" encoding="utf-8"?> <database name="timetable" defaultidmethod="native"> <table name="entry" phpname="entry"> <column name="id" type="integer" required="true" primarykey="true" autoincrement="true" /> <column name="date" type="date" required="true" /> <column name="timebegin" phpname="timebegin" type="time" required="true" /> <column name="timeend" type="time" required="true" /> <column name="description" type="varchar" size="128" required="true" /> <column name="expert_id" type="integer" required="true"/> <column name=...

android - Find out the coordinates using slope and start point -

i trying achieve task resize line after taking length input user.so have old length,old points(p1 ,p2) , have find new p2 after taking new length user.i here pasting code have tried resize line using slope not working.i totally new in canvas part kind of search hint appreciable.thanks in advance. method find out angle between previous points : public double calculateangle(){ if(selectedshape!=null){ innwall shape = (innwall)selectedshape; if(shape!=null) return calangle(shape.y2-shape.y1, shape.x2-shape.x1); } return -1; } method find out coordinates public void calcoordinates(double length){ innwall shape = (innwall)selectedshape; if(shape!=null){ double angle = calculateangle(); log.e(tag, "cal angle"+(int)calculateangle()); log.e(tag, "cal length"+(int)length); log.e(tag, "x coodinatee"+shape.x1+length*math.cos(angle)); log.e(tag, "y coodinatee"+shap...

css - Groupped .className + media query? -

due effect splits page , lets resize 1 of containers. have add more styles responsive, add resizable container class representing current breakpoint (xs,sm,md,lg) like this if ( ui.position.left <= 480 ) { /* represent it's width, using drag function of draggable */ clase = 'xs'; } else if ( ui.position.left <= 768 ) { clase = 'sm'; } else if ( ui.position.left <= 992 ) { clase = 'md'; } else { clase = 'lg'; } $('.element').removeclass('xs sm md lg').addclass(clase); for example: @media (max-width: 320px) h2 { font-size:12px; } } and have add: .xs h2 { font-size:12px } is there way not have duplicate styles? (i have several blocks) something won't work .xs, @media (max-width:320px) { h2 { font-size: 12px } } you can use postcss , plugin https://...

linux - MPI run on external network -

i'm new mpi , wrote program calculate large factorials on multiple processors. tested program on local network 2 machine. ie. laptop , pc , working perfectly. now trying run program on internet on friend's pc. installed perfectly. configure router port forwarding , can ssh user account. i'm using mpicc compile program , works , copied executable file external machine through scp . problem when run command mpirun -hostfile hostlist -np 2 fname . process stucked , blinking cursor on terminal. can explain me why happening? thanks. as didn't provide code snippet, i'll list may reason, there others too, best way debug code, , see stuck the reasons can several code issue, wrong handling of special cases network issue, wrong configuration specific port, firewall configuration etc. etc

cassandra - Starting node gives error saying another node is down -

i adding new node , joined cluster until below error triggered in log. says "a node required move data consistently down /10.x.x.3)". found node still live , running. tell suggest solution this? error 10:25:56 exception encountered during startup java.lang.runtimeexception: node required move data consistently down (/10.x.x.3). if wish move data potentially inconsistent replica, restart node -dcassandra.consistent.rangemovement=false @ org.apache.cassandra.dht.rangestreamer.getallrangeswithstrictsourcesfor(rangestreamer.java:244) ~[cassandra-all-2.1.8.689.jar:2.1.8.689] @ org.apache.cassandra.dht.rangestreamer.addranges(rangestreamer.java:132) ~[cassandra-all-2.1.8.689.jar:2.1.8.689] @ org.apache.cassandra.dht.bootstrapper.bootstrap(bootstrapper.java:72) ~[cassandra-all-2.1.8.689.jar:2.1.8.689] @ org.apache.cassandra.service.storageservice.bootstrap(storageservice.java:1143) ~[cassandra-all-2.1.8.689.jar:2.1.8.689] @ org.apache....

java - Hibernate UPDATE Query setting other values to NULL -

i having following table storing blog posts in mysql: +-----------+--------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-----------+--------------+------+-----+---------+----------------+ | postid | int(11) | no | pri | null | auto_increment | | posttitle | varchar(250) | yes | | null | | | postdate | datetime | yes | | null | | | ownerid | int(11) | yes | mul | null | | | postvote | int(11) | yes | | null | | +-----------+--------------+------+-----+---------+----------------+ i want use hibernate update query update postvote . here java method same: @put @consumes({ mediatype.application_json }) public void updatevotes (posts p) { session ses = hibernateutil.currentsession(); transaction tx = null; try{ tx =ses.begintransaction(); ses.createquery("update posts set postvote=...

How to pass multidimensional array from PHP to Javascript? -

i trying array value json string, , work json_decode php. <?php $jsoncontent=file_get_contents('http://megarkarsa.com/gpsjson.php'); $jsondecoded=json_decode($jsoncontent,true); foreach($jsonencoded['bms'] $p){ echo ' id: '.$p['id'].' tipe: '.$p['type'].' '; echo "<br>"; ?> the php code works, , give result of array json string. , javascript code <script> var bmsdata = <?php echo $jsondecoded ?>; alert(bmsdata["1"].id); // check, want see id of row 1 </script> but nothing shown up. doing right far? or missing pass value php javascript? suggestion appreciated. this 1 should work, lookup json @ http://megarkarsa.com/gpsjson.php ;) <script> var bmsdata = <?php echo json_encode($jsondecoded); ?>; alert(bmsdata.bms["1"].id); // check, want see id of row 1 </script> you forgot 'bms' key ;)

sql - Get specific time from getdate() -

i'm facing issue when trying add condition in sql request want add condition i.e date between dateadd(day, datediff(day, 0, getdate()), 0) , current date until 23:59:59 . how can specify second part of condition? thank you. you can predicate: somedate < dateadd(dd, 1, cast(getdate() date))

xamarin.forms - Could not install package 'NuGet.Client 3.2.0' -

i'm working restful webservice, getting error while adding package "system.net.http"; "the 'system.net.http 4.0.0' package requires nuget client version '3.0' or above, current nuget version '2.8.5.0'. " so, resolve above error i'm trying install "nuget client" "add package" option in xamarin studio, time i'm facing issue is; "could not install package 'nuget.client 3.2.0'. trying install package project targets 'portable-net45+win+wp80+monoandroid10+xamarinios10+monotouch10', package not contain assembly references or content files compatible framework. more information, contact package author." please resolve issue. xamarin studio not support nuget 3. supported in visual studio 2015. it not possible upgrade xamarin studio supports nuget 3 @ time. installing nuget.client nuget package not upgrade nuget in xamarin studio. i instead @ using microsoft.net.http nu...

click on a table row and redirect to view using jquery and laravel 5 -

there table rendering list of persons columns this: <table> <tr> <th>first name</th> <th>last name</th> <th>age</th> </tr> <tr class="person"> <td class="fname">john</td> <td class="lname">doe</td> <td class="age">30</td> </tr> </table> and more other. when user clicks on row, new view more data selected preson should loaded, using jquery. like: //main.js: $(document).ready(function(){ $("#person").click(function(){ var lname = $(this).children("lname").val(); $.ajax({ url:'profile', type: 'get', data: 'lname' : lname, datatype: 'json', success: function(result){ } }); } }); //routes.php: route::get('pro...

javascript - bug IE 11 with overflow auto -

there bug on ie 11 when empty html in div , remove class in list javascripts. div loses syle css "overflow:auto" , guard great height there no bug on navigator. sample: <!doctype html> <html> <head> <title>css</title> <style> div { margin: 5px; } ul { margin: 5px; max-height: 200px; overflow: auto; } ul li.selected { font-weight: bold; } .dest { width: 500px; min-height: 21px; max-height: 120px; overflow: auto; border: 1px solid #ccc; background-color: #f9f9f0; padding: 3px; } .dest span { display: block; background-color: #fff; float: left; border-radius: 2px; border: 1px solid #ccc; margin: 2px; padding: 0px 2px 0px 2px; line-height: 21px; height: auto; } </style> <script> window.onload = function(){ document.getelementbyid("btclear").onclick = function(){ document.getelementbyid("dest").innerhtml = ""; }; ...

qt - What is the scope of a C++ class added to a QList -

i wrote small piece of code prove myself bad practice indeed bad practice. i'm not seeing result expected. have qlist storing objects rather pointers objects. here class: class test{ public: test(int value){val=value; printf("created test %d\n",val);} ~test(){ printf("deleting test %d\n", val); val=0;} void print(){printf("test %d!\n", val);} int val; }; and have list of these test functions follows: class myclass { ... qlist<test> _test_list; void do_test_init(); void do_test(); ... }; void myclass::do_test_init() { for(int i=0; < 10; i++) _test_list.append(test(i+100)); } void myclass::do_test() { for(int i=0; < 10; i++) _test_list[i].print(); } the output see is: created test 100 deleting test 100 created test 101 deleting test 101 created test 102 deleting test 102 created test 103 deleting test 103 created test 104 deleting test 104 created test 105 deleting test 105 created test 106 deleting ...

java - How to save a word docx file using Apache poi. Change to saxon9he instead of saxon9pe -

i use latest apache poi 3.13-beta1 version. , error like: exception in thread "main" org.apache.poi.openxml4j.exceptions.openxml4jruntimeexception: fail save: error occurs while saving package : null @ org.apache.poi.openxml4j.opc.zippackage.saveimpl(zippackage.java:507) @ org.apache.poi.openxml4j.opc.opcpackage.save(opcpackage.java:1441) @ org.apache.poi.poixmldocument.write(poixmldocument.java:202) caused by: java.lang.nullpointerexception @ com.saxonica.config.verifier.loadlicense(verifier.java:141) @ com.saxonica.config.professionalconfiguration.loadlicense(professionalconfiguration.java:391) @ com.saxonica.config.professionalconfiguration.islicensedfeature(professionalconfiguration.java:367) @ net.sf.saxon.identitytransformer.transform(identitytransformer.java:36) @ org.apache.poi.openxml4j.opc.streamhelper.savexmlinstream(streamhelper.java:80) @ org.apache.poi.openxml4j.opc.internal.marshallers.zippartmarshaller.marshallrelationshippart(zi...

c# - Can't update SQL database -

i'm creating website in asp.net (in c#) campaigns listed datalist (seperated each other using <div> in datalist each campaign listed block). i can't update specific column in campaigns table via c# because can't find scalar variable @camp_id (the id of campaign). i'm using command update: sqlcmd = "update campagnes set camp_status=2 camp_id=@camp_id"; someone knows how make possible update 'camp_status' 2 using 'camp_id' 'camp_status' of specific campaign (and not others in datalist) updated? edit: whole code i'm using: sqlconnection conn = new sqlconnection(); sqlcommand cmd = new sqlcommand(); string sqlconn; string sqlcmd; sqlconn = @"data source=my-ip,1433;initial catalog=dbname; integrated security=false;user id=sa;password=password"; sqlcmd= "update campagnes set camp_status=2 camp_id=@camp_id"; conn.connectionstring = sqlconn; cmd.connection = c...