Posts

Showing posts from April, 2014

how to join Between four tables on mysql -

i have 4 tables mysql database, how join between them users: userid|username 1 | mark 2 | jon awards_user : awardid|userid 1 |1 2 |2 cat : catid|catname 1 | english 2 | computer awards : awardid|catid|awardname|awardlink 1 |1 |best1 |pic link 2 |2 |best2 |pic link resulte : userid|username|catid|catname|awardid|awardname|awardlink okay , try : works shows 1 result, when there member holds award ، want show awards, if there no 1 holds them . $all_awards = $db->query_read(" select * " . table_prefix . " users,awards_user,cat,awards awards_user.awardid = awards.awardid , awards_user.userid = users.userid , awards.catid = cat.catid "); create table `awards` ( `id` int(10) unsigned not null auto_increment, `forumid` int(10) unsigned not null, `name` varchar(100) not null default '', `link` varchar(100) not null default '', primary key (`id`) ) engine=my...

javascript - HTML5 Projekktor Video Player Works / Plays only once -

i need sort out matter banal 1 of ( beginner...) so, trying use jquery datepicker projekktor launch video according particular date. (i have folder store daily timelapse videos....) everything works ok far below script, i.e. calendar loads properly, , "picked date" starts correct video. the point works once, i.e. when click on date, nothing happens unless refresh page , click again on same other date. what did not understand? thank in advance i'm struggling since 2 long evenings on this. kind regards daniel dubai uae <script type="text/javascript"> $(function () { $("#datepicker").datepicker({ dateformat: "dd-mm-yy", inline: true, onselect: function (value, date) { var date = value; var camera = "dubai"; var prefix = date + "_" + camera; var video_mp4 = "./medias/videos/" + pr...

Use variable from a function in another PHP -

i have question. how do rescue variable $row in function listargeral(). can use function editargeral() . tried do, nothing happened here's tried do: <?php include ('banco.php'); class geralcontrole { private $consulta; private $row = array(); public function geralodao() { $novaconexao = new banco(); $this->consulta = $novaconexao->conectar(); } public function listargeral() { $this->geralodao(); echo '<table border="1" cellspacing="2"> <tr> <td>id</td> <td>cpf</td> </tr>'; if ($resultado = $this->consulta->query("select * cadastro")) { while ($this->row = $resultado->fetch_row()) { echo '<tr> <td>'.$this->row[0].'</td> <td>'.$this-...

How to organize my JavaScript unit tests when using QUnit, PhantomJS and JSCover -

i trying set automated unit tests javascript code using phantomjs , qunit, , generate code coverage jscover - described here: http://julianhigman.com/blog/2013/07/23/testing-javascript-with-qunit-phantomjs-and-jscover/ the thing page, , others have seen on subject, assume have single html page load , run of qunit tests in project. in case have 50 javascript source files, , corresponding .js unit test file each. going go down route of having separate html page per unit test file, during development run tests specific file in-browser individually. apart overhead of having maintain 50 (admittedly basic) html files, not sure how make work nicely jscover (without generating 50 coverage reports). is best practice me include of 50 unit test files single html page? i choose include 50 unit test files in single html page. you can use qunit modules break tests groups if don't want run of tests of time. can run tests 1 module @ time using drop-down list @ top-right of q...

qt - How to set stylesheet for the current item in QTableView -

Image
when qtableview edit control visible current item shylesheet of edit takes place. when there no active edit control in qtableview current item styled using qtableview { selection-background-color: } how set different style current item? qt style sheets support sub-controls , pseudo states, can use improve customization. (see http://qt-project.org/doc/qt-5/stylesheet-reference.html#list-of-pseudo-states ) in case can use ::item sub-control , :focus pseudo state (the "current" pseudo state doesn't exist, :focus same). this example can use: qtableview::item:focus { selection-background-color: yellow; } see http://qt-project.org/doc/qt-5/stylesheet-examples.html#customizing-qtreeview

How do I format the x-axis on Python Ggplot? -

i need format dates on x-axis ggplot python bar chart. how can it? use scale_x_date() format dates on x-axis. p = ggplot(aes(x='date'), data) + geom_bar() + scale_x_date(labels='%m-%y') this gives number of month , year, example, 01-1990 can try other formats.

java - Why Hibernate Envers is ignoring my custom RevisionEntity? -

i'm developing application using jpa 2.1 (supported hibernate 4.2.11) spring 4.0.2. using envers auditing changes in project entities. working fine. problem comes when try use custom revision entity envers documentation says: http://docs.jboss.org/hibernate/core/4.1/devguide/en-us/html/ch15.html#envers-revisionlog we have made custom class , custom listener pointed in documentation seems totally ignored hibernate. custom classes: @entity @revisionentity(auditingrevisionlistener.class) public class auditedrevisionentity extends defaultrevisionentity { private string username; public string getusername() { return username; } public void setusername(string username) { this.username = username; } } public class auditingrevisionlistener implements revisionlistener { private static log log = logfactory.getlog(auditingrevisionlistener.class.getname()); @override public void newrevision(object revisionentity) { auditedrevisionentity reventity = ...

Laravel 4 authentication logout error -

i'm working on log-in/log-out authentication routine laravel 4 project , have hit snag on log-out. i've got user table set username, email , password (as id , timestamps columns). if browse protected page, can log in fine system dialog, logging out generates error. here relevant routes: route::get('/logout', function() { auth::logout(); return view::make('logout'); }); route::get('spotlight', array( 'before' => 'auth.basic' , function() { return view::make('spotlight'); } )); and here's error when go /logout: [2014-05-29 17:33:56] production.error: exception 'illuminate\database\queryexception' message 'sqlstate[42s22]: column not found: 1054 unknown column 'remember_token' in 'field list' (sql: update `users` set `updated_at` = 2014-05-29 17:33:56, `remember_token` = kizhayfkznr0qwntsu0fhxwdws37kkaqo1oms1otnj6dj...

perl - Searching within Hash of Hashes -

say have array , multidimensional hash. want recursively whether values in array exist keys in hash. there better way doing follows? (example edited perl maven perl maven ). note couple of things more: in example below, foobar , mathematics exist in hash %grades ; the main question in post how find more efficient way search @ first level, second level, etc. etc., given real example has 7 levels; note that, idea try tighten search possible. best if elements in array found, order, in hash (i.e. having @array=("foobar","mathematics") values @ $myhash{"foobar"}{"mathematics"} ; if fails, whether "foobar" or "mathematics" exist @ second level of hash, i.e. $myhash{"otherkeys"}{"mathematics"} or $myhash{"otherkeys"}{"foobar"} ). example: #!/usr/bin/perl use strict; use warnings; use data::dump; @subjectsandnames=("foobar","thatbar","mathematics...

html - Holding data in contenteditable tables -

if have simple html table, enabling contenteditable on table data. possible have formula across table (for example: cell 1 column 1 + cell 2 column 1 = cell 3 column 1) , contenteditable change variables in formula , updata totals? i playing little bit contenteditable : http://jsfiddle.net/nmhms/440/ below simple function can use desired results. , here updated fiddle http://jsfiddle.net/nmhms/441/ plus can add infinite number of columns , rows , dynamically put total in last row function updatetotal(){ var totalcols=$("#table tr").eq(0).find("td").length-1; var toalrows=$("#table tr").length-1; var cellvalue=0; for(var col=0;col<=totalcols; col++){ for(var row=0;row<=toalrows; row++){ if(row!=toalrows) cellvalue+= parseint($("#table tr").eq(row).find("td").eq(col).text()); if(row==toalrows){ $("#table tr...

javascript - Making an ajax request multiple times -

i have 3 "sources," each of needs have ajax call made. however, because ajax asynchronous, can't put in loop. @ same time, can't async: false because it's bad have browser hang. thus, decided have ajax called multiple times in it's success callback, , construct kind of artificial loop. problem is, it's not working (i'll explain error later on in question). here's relevant code. counter: 0, load: function(source, start_month, end_month, start_year, end_year) { start_month = parseint(start_month) + 1; end_month = parseint(end_month) + 1; var parsedate = d3.time.format("%y-%m-%d").parse; if(source == 0) { $.ajax({ datatype: "json", url: ... data: { ... }, crossdomain: true, success: function(raw_data) { posts.counter++; if(posts.counter < 4) { alert(posts.counter)...

Creating XML nodes with SOAP and PHP -

i need generate soap request looks this: <s11:envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'> <s11:body> <ns1:savequote xmlns:ns1='http://domain.com/bdb/'> <ns1:clienttype></ns1:clienttype> <ns1:claims> <ns1:claimhistory> <ns1:nature></ns1:nature> </ns1:claimhistory> </ns1:claims> <ns1:vehicles> <ns1:vehicle> <ns1:province></ns1:province> </ns1:vehicle> </ns1:vehicles> </ns1:savequote> </s11:body> </s11:envelope> i have : $url = 'http://somedomain.com/soapurl.asmx?wsdl'; try { $client = new soapclient($url); $savequote = array('clienttype' => $clienttype); $claims = array('nature' => $nature); $vehicles = array('province' => $province) $response = $client->__soapcall( 'savequ...

actionscript 3 - Override parent class instance variable in subclass -

in php it's trivial override properties of class in subclass. instance: class generic_enemy { protected $hp = 100; protected $str = 5; //... } class boss_enemy extends generic enemy { protected $hp = 1000; protected $str = 25; } which extremely convenient because at-a-glance can see in ways subclass differs parent class. in as3 way i've found through getters, isn't elegant @ all: public class genericenemy { private var _hp:uint = 100; private var _str:uint = 25; public function hp():uint { return _hp; } public function str():uint { return _str; } } public class bossenemy extends genericenemy { override public function hp():uint { return 1000; } override public function str():uint { return 25; } } is there nicer way of doing aligns php approach? specifically: let's i'm writing api let developer spin off own enemies. rather document have override hp , str properties rather ex...

Configuring Gradle for iosched 2013 source from Android Studio -

Image
android developer noobie here. i got latest iosched 2013 source , resolved of issues , edited gradle file accordingly (at least think on right track). i can launch app in avd. resolved by: running sdk manager , including libraries figured out editing gradle file below. when go build > clean project , says gradle invocation completeed succesfully but following lines underlined within android studio: compile 'com.google.android.apps.dashclock:dashclock-api:+' compile 'com.google.code.gson:gson:2.+' exclude group: 'org.apache.httpcomponents', module: 'httpclient' compile 'com.google.apis:google-api-services-plus:+' gradle source: /* * copyright 2013 google inc. * * licensed under apache license, version 2.0 (the "license"); * may not use file except in compliance license. * may obtain copy of license @ * * http://www.apache.org/licenses/license-2.0 * * unless required applicable law or agreed in wri...

postgresql - pgadmin import issue? -

i trying import following csv file imported pgadmin. csv file: "id";"email";"password";"permissions";"activated";"activation_code";"activated_at";"last_login";"persist_code";"reset_password_code";"first_name";"last_name";"created_at";"updated_at" "11";"test.teset@gmail.com";"$2y$10$gnfdfvcgqhqzcgkoilukfeskycupzk1akjvk6pdxt1dmmjoocuypi";"";"t";"xy56hncfheacawzuhleyhvvbxxmoamr57ifyehxiud";"";"2014-05-27 08:47:33";"$2y$10$g0lnastma/kewuhndfwleojqeyo9magvvilfijms/kpripadfbwhm";"";"";"";"2014-05-27 07:51:07";"2014-05-27 08:47:33" "5";"test@gmail.com";"$2y$10$dxodoi520pddcmisxcs/ouih.4k/87lexeqrzvul2k/uth2humpny";"";"t";"4k8s1tbgrpfamcnozvep19moqkcapq0la8...

c# - Window Closing Event and KeyPress -

<window closing="window_closing"></window> assuming keys used close window. there way determine keys used? i know can keydown event need in closing event. thank you! rather trying determine cause of closing event disable keystrokes, disable methods closing until "secret" keystroke entered. use keydown event intercept , record keystrokes, , have set flag if secret combination entered, , call close() . in closing event, set e.cancel = true unless flag set. here's simple example: bool _allowclose = false; void onkeydown(object sender, keyeventargs e) { if (detectsecretcombo(e)) //implement see fit. { _allowclose = true; close(); } } void onclosing(object sender, closingeventargs e) { _e.cancel = !_allowclose; }

php - htaccess add page name to url with query string -

i new , need htaccess redirect: the source url: http://example.com/?p=1955 need convert to: http://example.com/index.php?p=1955 we changed home page index.php index.html , source url no longer works. idea check if there ?p query string on url , if redirect index.php?p=... any ideas on how accomplish or other suggestions appreciated it. try adding in htaccess file in document root: rewriteengine on rewritecond %{query_string} ^p=([0-9]+) rewriterule ^$ /index.php [l]

.net - How to allow garbage collection on object with event handler connected to COM object -

i have class provides adapter com object. here's simplified version of it: public class documentwrapper { private comdocument doc; public documentwrapper(comdocument doc) { this.doc = doc; this.doc.onclose += onclose; } private void onclose() { this.doc.onclose -= onclose; this.doc = null; } public bool isalive { { return this.doc != null; } } } the problem onclose event handler keeping both objects alive. both objects should have same lifetime, when 1 goes away other should too, i.e. nobody keeping 1 alive , expecting other go away. i did experimenting weak references: comdocument com = createcomdocument(); var doc = new docwrapper(com); weakreference weak1 = new weakreference(com); weakreference weak2 = new weakreference(doc); gc.collect(2, gccollectionmode.forced); gc.waitforpendingfinalizers(); gc.collect(2, gccollectionmode.forced); if (weak1.target != null) console.writeline("com not collec...

ios - UITableView and Navigation Controller -

i trying simple navigation controller controlled uitableview. whenever select 1 of rows supposed go next slide , animate there. whenever implement code, animation goes halfway, freezes, , disappears. - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { description* desc=[[description alloc] init]; [tableview deselectrowatindexpath:indexpath animated:yes]; [self.navigationcontroller pushviewcontroller:desc animated:yes]; } can help? in advance. i don't know if same problem, similar happened me. problem backgroundcolor of uiview of pushed uiviewcontroller clear, cause animation weird because can see pushing uiviewcontroller underneath. setting backgroundcolor on uiview of pushed uiviewcontroller (in case, in white) solved problem

Ruby garbage collection and Puma -

when using mri ruby 2.1.2 puma (say 1 worker 8 threads), when gc run? run parent worker process when threads become idle, or run parent process needed, when threads busy processing requests? and how behaviour different in ruby 2.0 (without deferred gc). also asked here . its been answered on github issue . it runs whenever vm decides run it. puma nothing control nor can really.

c++ - template lambda sometimes doesn't compile -

i implement generic visitor pattern trie data structure. below extracted minimal fragment makes trouble compilers: #include <functional> struct node { size_t length; }; template<typename n> class c { public: size_t longest = 0; std::function<void(const n )> f = [this](n node) { if(node->length > this->longest) this->longest = node->length; }; }; int main() { node n; n.length = 5; c<node*> c; c.f(&n); } it compiles g++ (ubuntu/linaro 4.7.2-2ubuntu1), ubuntu clang version 3.4-1ubuntu3 , apple llvm version 5.0 (clang-500.2.79). icc (icc) 14.0.2 says: try_lambda_t.cc(15): error: "this" cannot used inside body of lambda if(node->length > this->longest) this->longest = node->length; i found similar post: class non-static lambda member can't use default template paramers? story resulted in bug report resolved in g++ 4.8.1: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54764 howeve...

python - What do? __init__() takes exactly 3 arguments (1 given)? -

this question has answer here: __init__() takes 3 arguments (1 given) 1 answer here's error gives me along code lines specified. apologies past post. traceback (most recent call last): file "h:\users\daniel\desktop\final project\gold hunter.py", line 352, in <module> main() file "h:\users\daniel\desktop\final project\gold hunter.py", line 346, in main score = game() file "h:\users\daniel\desktop\final project\gold hunter.py", line 195, in game pirate = pirate() typeerror: __init__() takes 3 arguments (1 given) actual code main() line 352 score = game() line 346 pirate = pirate() line 195 pirate constructor gives me error nameerror: global name 'dx' not defined class pirate(pygame.sprite.sprite): east = 0 def __init__(self, screen, dx): self.screen = screen pyg...

Incremental Google OAuth with Asp.Net Owin Oauth -

i'm looking solution doing incremental authorization against google's api's asp.net's owin oauth libraries. i know how set scope specific api's, incrementally , can see how set on globally. doc on google oauth incremental auth... https://developers.google.com/accounts/docs/oauth2webserver#incrementalauth current vb code... public sub configureauth(app iappbuilder) dim googlecreds = new googleoauth2authenticationoptions() { .clientid = "xxxx", .clientsecret = "xxx" } googlecreds.scope.add("https://www.googleapis.com/auth/analytics.readonly") app.usegoogleauthentication(googlecreds) ' add way specify googledrive, youtube, google+ scopes ' example code doesn't work add 2nd google oauth listener googlecreds.scope.clear() googlecreds.scope.add("https://www.googleapis.com/auth/drive.file") googlecreds.authenticationtype = "googledriv...

r - Time Series Analysis - for negative values? -

Image
i trying see trend based on sales figure based on months amount 14997.816 26460.718 19607.54 -7612.395 78424.35 4565.6275 5338.02 8650.41 24390.235 9691.5975 168614.2575 887.25 12748.9 7651.5315 402818.9605 1912.45 113.5 11175.6245 23481.0465 10052.49 26962.1625 56399.7825 9751.879 3577.967 25698.45 24844.565 10339.175 165261.7405 460.8935 8383.212 date 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 6/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 7/1/2010 df <- read.csv("----file path-----") df$date <- as.date( df$date, '%m/%d/%y') require(ggplot2) ggplo...

oop - Javascript: Internal array is not reset to outer objects -

how grant access inner properties of objects in right way? break application: i have object handles array (simplified here): function listmanager() { var list = [], add = function (element) { list.push(element); }, clear = function () { list = []; }; return { add: add, clear: clear, list : list }; }; but when using it: var manager = new listmanager(); manager.add("something"); manager.clear(); console.log(manager.list.length); // <= outputs "1"! stepping through code shows, within clear method, list becomes new array. outside listmanager list ist not cleared. what doing wrong? this because clear sets value of var list , not .list on object returned listmanager() . can use this instead: function listmanager() { var list = [], add = function (element) { this.list.push(element); }, clear = function () { ...

python - reverse words in a sentence pythonic -

i trying write pythonic code reverse words in sentence ex: input: "hello there friend" output: "friend there hello" code: class solution: def swap(self, w): return w[::-1] def reversewords(self, s): w = self.swap(s).split() return ' '.join(for x in w: swap(x)) i having bit of trouble getting work. need on return statement you're calling swap/split in wrong order. use instead: w = self.swap(s.split()) then return shouldn't need comprehension: return ' '.join(w)

javascript - Append JS to not include a % character -

i have 1 json value writing html , css following js: $('#team2-keyplayer2-rating').css('width', data[team1].keyplayers.keyplayer1.rating); $('#team1-keyplayer1-rating').html(data[team1].keyplayers.keyplayer1.rating); the first command working great. it's controlling % of css bar. second command writing value html. ie: "90%" my issue dont want show "%" when writing html. there way delete % writing html without deleting % json? or can use replace data[team1].keyplayers.keyplayer1.rating.replace('%', '')

ios - UINavigationController's interactivePopGestureRecognizer not working -

i trying implement custom id <uiviewcontrolleranimatedtransitioning> object when pushing 1 particular view controller on navigation controller's navigation stack. however, have discovered, doing prevents uinavigation controller using default interactive transition, even on view controllers not use custom transition . i have no idea why occurring. after further investigation, have found returning nil method - (id <uiviewcontrolleranimatedtransitioning>)navigationcontroller:(uinavigationcontroller *)navigationcontroller animationcontrollerforoperation:(uinavigationcontrolleroperation)operation fromviewcontroller:(uiviewcontroller *)fromvc toviewcontroller:(uiviewcontroller *)tovc somehow disables default interactive transition well. how can continue using uinavigationcontroller's default interactive transition in instances, while us...

javascript - json.net serialization error using custom objects -

i getting error when calling asp.net mvc action method returning jsonnetresult. using following code that. this see in response body. reason struggling < , > text. { "archivedemailsdata":[ { "id":294455, "date":"2009-09-10t15:20:00", "subject":"testing fix in 2.20.8.0 - quotes or single 'quote' , char < and="">" }] } original text of object subject "testing fix in 2.20.8.0 - quotes or single 'quote' , char < , >" string using angularjs make call same thing when using jquery. your json invalid , should following: { "archivedemailsdata": [ { "id": 294455, "date": "2009-09-10t15:20:00", "subject": "testing fix in 2.20.8.0 - quotes or single 'quote' , char < , >" } ...

webserver - exposing a sparql endPoint publicly? -

i have website power tomcat server. application tap on triplestore make public trough sparql endpoint @ www.mywebsiteaddress/sparql. what configuration need on webserver ? i use jena fuseki on background running on port 3030 , webserver on port 80. my idea that, when webserver request on port 80 ..../sparql redirect fuseki sprql endpoint this more of webservice / access control problem sparql related. however, since sparql endpoints supposed created per sparql spec, think valid question, i'm sure people encounter again in future. so, answer question, "public" means headers set in order allow request hit endpoint when not coming same domain. there, can allow types of interactions endpoint. if wanted kinda allow everything, set following headers: 'access-control-allow-origin: *' "access-control-allow-credentials: true" 'access-control-allow-headers: x-requested-with' 'access-control-allow-headers: content-type' '...

javascript - buttons added to table won't fire handler -

in table, i'm trying include edit button @ end of each row. idea user click 1 of these alter row's content. can build , populate table fine, cannot buttons fire off handler. here's code snippet: window.onload = function (){ // bunch of stuff happens correctly... while (!rs.eof) { var orow = oticketstable.insertrow(); (j=0; j < field.length; j++) { var ocell = orow.insertcell(); ocell.style.fontsize = "10"; ocell.style.fontweight = "normal"; ocell.style.border = "thin black solid"; ocell.innertext = rs(field[j]); } var ocell = orow.insertcell(); ocell.style.border = "thin black solid"; var obtn = document.createelement("button"); ocell.appendchild(obtn); obtn.innerhtml = rs('idnum'); obtn.onclick = function () { alert("obtn.onclick"); } rs.movenext(); } rs.close (); delete rs; var btn = document.create...

java - Setting different Character Images -

im creating flappybird mock, 4 player each player has different image, have managed set image first 1 cant seem set them others. i have class bird set first image , have main class created 3 other birds, not sure alter images , how should. appreciated. public bird(int x, int y) { this.x = x; this.y = y; this.color = color.red; this.radius = 30; this.gravity = 6; this.isalive = true; this.score = 0; try { this.read = imageio.read(new file("src/images/41.png")); } catch (ioexception ex) { logger.getlogger(paintingpanel.class.getname()).log(level.severe, null, ex); } } public class flappybird extends timertask implements keylistener{ private bird flappya; private bird flappyb; private bird flappyc; private bird flappyd; well considering path image same in code. i'm not sure understand issue if want have different image each flappy...

osx - Accessing the windowing system on Mac -

i have exhaustedly searched web way or tutorial or documentation or manual use directly quartz compositor, windowing system mac... here's want: when program using qt example, create widget becomes window in app , paints etc..., want code widget directly. i've been programming. want use lowest level of graphical programming can in computer, no matter how complicated may be. i'm beginning quartz compositor because i'm using mac. in advance.

javascript - Use HTML5 to resize an image before upload -

i have found few different posts , questions on stackoverflow answering question. implementing same thing this post . so here issue. when upload photo, need submit rest of form. here html: <form id="uploadimageform" enctype="multipart/form-data"> <input name="imagefile[]" type="file" id="takepicturefield" accept="image/*" onchange="uploadphotos(\'#{imageuploadurl}\')" /> <input id="name" value="#{name}" /> ... few more inputs ... </form> previously, did not need resize image, javascript looked this: window.uploadphotos = function(url){ var data = new formdata($("form[id*='uploadimageform']")[0]); $.ajax({ url: url, data: data, cache: false, contenttype: false, processdata: false, type: 'post', success: function(data){ ... handle error... ...

xmlwriter - Rewrite existing attribute value from Xml String? -

is possible rewrite existing attribute xml string? if have: $xml_str = "<root> <nodea attr1="value1"></nodea> </root>"; //rewrite $xml_str how can find nodea , @ same time rewrite value1? // save xml string physical path file_put_contents($xml_save_path.ds.$xml_filename, $xml_str); you can use simplexml parse xml in php. here's simplified version value1 , replace value2 echo new xml. $xml_str = "<root> <nodea attr1='value1'></nodea> </root>"; $doc = simplexml_load_string($xml_str); $doc->nodea['attr1'] = 'value2'; echo $doc->asxml();

ios - iPhone Accelerometer Values -

my question iphone accelerometer. accelerometer measure acceleration or movement of iphone? mean if hold iphone , go 0mph 60mph, expect measure of acceleration increase in value 0 60, once reach 60, expect value return 0 since "no longer accelerating" moving @ constant speed. if accelerometer measure motion, expect register 0 60 , continue provide change in value move forward @ 60mph. sorry, looked @ few books, programmed code (values seemed small give recognizable result on short distances or speeds), , lot of web searches, , trying answer question. thanx! a couple of points: the accelerometer never reads 0 because gravity , acceleration (and thing too). if ever reads 0 in deep doo-doo - have been cast adrift in space, or else in free-fall plunging towards ground. when go 0 60, acceleration not "register 0 60". isn't acceleration is. isn't speed; it's rate of change in speed. lamborghini or vw bug? both go 0 60 acceleration might...

OSX : split Groovy script into multiple files -

on osx, can create executable groovy script follows: file: somescript.groovy #!/usr/bin/env groovy println "hello!!!!"; chmod +x ./somescript.groovy how use same approach, split cmd-line app multiple files? (as many ruby cmd-line gems do). i need quick light-weight, easy modify scripting, @ same time being able split files 10 or 20 classes. if create separated logics in groovy classes (ex. utils.groovy) statics methods. class utils{ static helloworld(){ println “hello world!" } } then in script can write …mylogic… helloworld() …mylogic… groovy load automatically utils.groovy class if it’s in same dir of script

javascript - JqueryMobile Getting details about Item Clicked -

i have 3 level hierarchy.the first 2 levels collapsible whereas final 1 list.when click list have pass data list item clicked , name of parent , grand parent. unable data item clicked .the js code (read below code also) var commodity; var variety; var grade; var content; var jsons ='[{"turmeric":[{"bulb":["grade 2","grade 1"]},{"finger":["grade 1"]}]}]'; var data = $.parsejson(jsons); var nextid = 0; $.each(data, function(key, value){ $.each(value, function(key, value){ //runs each commodity commodity = key; var data1 = value; $(document).on("pageinit", function() { nextid++; content = "<div data-role='collapsible' data-collapsed-icon='arrow-r...

Setting a URL or URI as an Array Codeigniter -

i have been reading url helper , uri user guide in codeigniter, not sure if can have, url or uri link array. example $data['action'] = $this->url->link('admin/dashboard'); or example $data['action'] = $this->uri->string('admin/dashboard'); or example $data['action'] = $this->uri->segment('common/dashboard'); not sure correct way. the right way is: $data['action'] = site_url("admin/dashboard");

java - how to accept keyboard shortcuts when jframe is not in focus? -

i made application using java takes , stores screenshots in specified folder. set shortcut ctrl+k take , save screenshot , managed make application minimize system tray when minimize button of jframe pressed, problem keyboard shortcut assigned doesn't works jframe either minimized or put in background other application, possible make d application work when jframe not in focus? please help! thanks! (i making application windows only) for woud use 3th party lib jnativehook(i use often) can use global listener nativehook here examples how use examples

java - How can I include a JFreeChart servlet image in a JSP -

i have seen several examples of using servlet dynamically generate chart using jfreechart, , subsequently including image in jsp using img tag. example: <img src="/mychartservlet" width="400" height="300" border="0" alt="" /> my servlet generates image using jfreechart works great, , can see image if call directly in browser in: http:/myurl/mychartservlet?id=274 the problem jsp not display image. in fact, jsp not invoking servlet. know because not see debug entries in log appear when servlet called. in servlet using jfreechart chartutilities.writechartasjpeg() method write image output stream of response, because not want write image disk. mentioned servlet works fine when called directly. what missing? or there better way this? maybe plain old object can generate chart , can include in jsp? appreciated. you're going right way. may having kind of relative path issue context you're in. tr...

java - How do you display a large amount of text in an Android layout? -

i need display terms , conditions pdf in layout. not essential actual pdf displayed. is, need text within pdf displayed correctly, in paragraphs. using textviews seems obvious option; however, feel both copy pasting each paragraph different textview or copy-pasting 1 , writing out \n escape sequence after every paragraph take long (it long document)... not mention have manually put in html tags bold words. so how can display large amount of text in layout without having manually hardcode of paragraphs? thought there support display pdf, after research looks that's not possible if user's device doesn't have pdf reader installed? i think multiline scrollable textview job you. can set size of text view fixed, half screen if want, , user can scroll in portion. see making textview scrollable on android

ios - XCode bot takes so long to integrate -

i build ci server , use xcode bot build project. have 1 question why bot take long integrate (over 30 minutes). seems xcode bot has check out source code build each integration. normal build scratch after cleaning project takes 15 minutes. second integration faster first time little bit. wonder happens when xcode bot integrating. check out new source code each integration or update old source? why takes time?

c++ - How can I draw the smallest circle from the convexity defect points OpenCV -

i've been using opencv hand recognition , got code can able find contours, convex hull & defect points. i'm having trouble drawing smallest circle(just outline) defect points. know how use specific points defects points draw circle outline. btw i'm using xcode 5.1 & sorry bad english. thank you! #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv/cvaux.h> using namespace cv; using namespace std; mat image, gray_image, blur_image, binary_image; int thresh = 90; int main( int argc, char** argv){ namedwindow("window", cv_window_autosize); image = imread("/users/jamesbond/desktop/hand.png"); cvtcolor(image, gray_image, cv_bgr2gray); medianblur(gray_image, blur_image, 11); canny(blur_image, binary_image, 90, 180, 3); vector<vector<point> > contours; vector<vec4i> hierarchy; findcontours(binary_image, contours, hierarchy, cv_retr_tree, cv_c...

ios - Can't pass object by reference to another view controller -

i trying pass object reference (or pointer object) view controller. how trying pass it: secondviewcontroller* ctrl = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil andparam:&self.sharedlocationhandler]; and init @ second view controller: - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil andparam:(ttlocationhandler**)aparam { [self.sharedlocationhandler.locationmanager startupdatinglocation]; return self; } error getting: address of property expression expected what did wrong here? you cannot not pass pointer property properties getter-setter methods... pass pointer variable... check answer more details

ios - SpriteKit - Stop an object bouncing -

how stop , object falls top of screen bottom of screen bouncing. here code object: - (sknode*)addrock { skspritenode* rock = [skspritenode spritenodewithimagenamed:@"asteroid"]; rock.position=cgpointmake ([self makerandomxwbetween:0 and:self.size.width],self.size.height); rock.name = @"rock"; rock.physicsbody = [skphysicsbody bodywithrectangleofsize:rock.size]; rock.physicsbody.usesprecisecollisiondetection = yes; rock.physicsbody.allowsrotation = no; [self addchild:rock]; return self; } thanks in advance help. best regards, louis. you need set restitution property of skphysicsbody. rock.physicsbody.restitution = 0.0; according apple's documentation : this property used determine how energy physics body loses when bounces off object. property must value between 0.0 , 1.0. default value 0.2.

git - Compiling a project that uses old-versioned Giraph with Maven -

i have project developed group , uses old-versioned giraph. the project made based on giraph project itself; project structure , files same giraph, except .java sources more complex map-reduce graph operation defined in giraph-examples. project extension of giraph project, maven used compile , package project, building tool giraph project. i can't find version of giraph project based on exactly, find compiling project requires 0.2-snapshop of giraph-parent, , quite old one. current problem there's error when try mvn verify; mvn message printed on screen following : [info] scanning projects... [info] ------------------------------------------------------------------------- [info] reactor build order : [info] [info] apache giraph parent [info] apache giraph core [info] apache giraph hive i/o [info] apache giraph examples [info] apache giraph accumulo i/o [info] apache giraph hbase i/o [info] apache giraph hcaatalog i/o [info] [info] -------------------------------...

Android: Multiple Notifications as single list in Status Bar -

i trying notify user based on criteria. multiple notifications being shown in status bar want group notification in single notification , when user clicks in status bar , want retrieve notifications in group. possible? or have maintain pendingintents of notifications? appreciated. example, if birthdays of 2 friends come on same day, 2 notifications should shown. want combine these notifications i.e. instead of 2 notifications in status bar, want one, when user clicks on it, should have information 2 notifications. possible? please see code below displaying notifications. public void displaynotification(birthdaydetail detail) { notificationcompat.builder builder = new notificationcompat.builder(this.context); builder.setsmallicon(r.drawable.ic_launcher); builder.setcontenttitle(detail.getcontactname()); builder.setcontenttext(detail.getcontactbirthdate()); intent resultintent = new intent(this.context, notificationview.class); ...

wordpress doesn't remember uploaded images -

Image
i'm having problems on page image uploader. uploading images works fine. when i'm on page , want add image there, don't see images uploaded library. result, images uploaded multiple times , have multiple copies of same image in media library. is here familiar problem? appreciate help! screenshots of overall settings of custom fields: check screen-shot , change setting according image. you can find setting here:-- wp-admin --> custom fields --> edit field groups --> select field --> find library hope you...

php - Get Posts Based on Category Wordpress -

i have 2 categories in wordpress. 1 events , 1 news. have fetch posts in 2 categories in same page. there 4 posts in news category. , events can add user. have display first 8 events based on date of post. writing both categories using 2 queries , moving array. i've coded given below: $event_title = array(); $event_author = array(); $event_content = array(); $event_thumbnail = array(); $event_counter = 0 ; $arg = array( 'numberposts' => 8, 'offset' => 0, 'category' => 17, 'orderby' => 'post_date', 'order' => 'asc', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending, private', 'suppress_filters' => true ); $events = new wp_query( $arg ); if ($events->have_posts()) : while ($events->have_posts()) : $events->the_post(); $event_title[$event_counter] = get_the_title(...

javascript - convert csv to excel with space delimeter -

i have csv file delimeter space of following format. 1 26/apr/2014 15:49:07 9421131317 21:28 6.60 ** 2 26/apr/2014 16:10:57 9421131317 07:51 2.40 ** i want convert in excel file, every record in separate cell. have tried various online tool convert excel converted single cell. is there way convert date, time , mobile number in separate cell using excel. you can let excel figure out datatypes without code. try this: open csv file excel select column a go data > text columns choose delimited > next choose space , unselect rest press finish video on youtube

ios - -productRequest:didReceiveResponse returns empty products array in real store, works in sandbox -

i had update app approved. versioned added in app purchases. app works perfect in sandbox mode , apple did approve both iap , app , in app purchases fails in app. i think crash occurs because response.products from: - (void)productsrequest:(skproductsrequest *)request didreceiveresponse:(skproductsresponse *)response { } returns empty array , that: skproduct *product = [[products filteredarrayusingpredicate:[nspredicate predicatewithformat:@"productidentifier == %@", _model.packageid]] firstobject]; returns nil. can't price of skproduct. think actual app crash these lines since product , payment nil. skpayment *payment = [skpayment paymentwithproduct:product]; [[skpaymentqueue defaultqueue] addpayment:payment]; i read other blog posts can take 24 hours before iap becomes available. true? need worry bugs regarding iap's in app when works in sandbox mode , apple approved it? it turned out indeed apple problem. got response apple stating can ...

java - How do I parameterize my Class parameter in this case? -

i have following utility class , method: public class ksoaputility { public static ksoapobjectparseable parseobject (soapobject soapobject, class clazz) { ksoapobjectparseable obj = null; try { obj = (ksoapobjectparseable)clazz.newinstance(); } catch (exception e) { e.printstacktrace(); } if (obj != null) { string[] propertynames = obj.getpropertynames(); (string propertyname: propertynames) { obj.setproperty(propertyname, soapobject.getpropertyasstring(propertyname)); } } return obj; } } i call method follows: instruction instruction = (instruction)ksoaputility.parseobject(instructionsoapobject, instruction.class); note "instruction" class implements interface called "ksoapobjectparseable". it works fine, in utility class eclipse warns: class raw type. references generic type class should parameterized correctly so, however, if parameterize method argument f...

jquery - long polling php foreach loop data -

i wondering if possible or how can ajax update data php foreach outputted data using long polling. far code set following. <?php if ( $posts ) { foreach ( $posts $post) : $postid = $posts['id']; $request_posts_comments = regular_query( "select a.from_who, a.dateposted, a.topostid, a.commenttext, b.firstn, b.lastn, c.defaultphoto comments inner join users b inner join userprofiles c on a.from_who = b.id , b.id = c.user_id a.topostid = :postid", ["postid" => $post_idr], $conn); ?> <div class="divwrap"> <div class='posttext'><?php echo $post['posttext']; ?></div> <div class='postcomments'> <?php for...