Posts

Showing posts from February, 2011

html5 - splash screen issue with android + phonegap -

i working phonegap+sencha touch application. i have added splash screen in android follow, super.setintegerproperty("splashscreen", r.drawable.splash); then have set autohidesplashscreen property false follow in config.xml, <preference name="auto-hide-splash-screen" value="false" /> still hide automatically after seconds , want make splash screen visible second want. there solution ? appreciated. in advance. in mainactivity.java, can set timer value in super.loadurl() method. this: super.loadurl("file:///android_asset/www/index.html",10000); this show splashscreen 10 seconds. can increase value wish.

javascript - Upload a large file (1GB) with node and express -

trying upload large file node js instance using express , fail large files. following errormessage: error: request aborted @ incomingmessage.<anonymous> (/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js:107:19) @ incomingmessage.eventemitter.emit (events.js:92:17) @ abortincoming (http.js:1892:11) @ socket.serversocketcloselistener (http.js:1904:5) @ socket.eventemitter.emit (events.js:117:20) @ tcp.close (net.js:466:12) /server/upload/ buffer.js:194 this.parent = new slowbuffer(this.length); ^ rangeerror: length > kmaxlength @ new buffer (buffer.js:194:21) @ fs.js:220:16 @ object.oncomplete (fs.js:107:15) 31 jul 14:01:04 - [nodemon] app crashed - waiting file changes before starting... what can prevent error when don't want chunk data? hope can solve ;-) if analyse error message buffer.js:194 this.parent = new slowbuffer(this.length); ^ rangeerror: length >

deployment - sonar/deploy is empty and got "FAIL - Application for the context path /sonar could not be started" on Tomcat -

i installing sonar3.6.2 on apache tomcat/7.0.42 server encounter issue in webapp startup processing. following explains steps... i have configured sonar.properties file such : sonar.jdbc.username: admin sonar.jdbc.password: admin sonar.jdbc.url: jdbc:oracle:thin:@192.168.1.125:1521/devorcl sonar.jdbc.driverclassname: oracle.jdbc.oracledriver and copied ojdbc6.jar file ./extensions/jdbc-driver/oracle/ well, execute ./build-war.sh , sonar.war file , build/ folder. so, when deploy sonar.war apache-tomcat-7.0.42/webapps/ folder, sonar/ folder create in , contains same files , directories build/ . but in tomcat server, when start sonar webapps following message appears me : echec - l'application pour le chemin de contexte /sonar n'a pas pu être démarrée in english: fail - application context path /sonar not started here log find in apache-tomcat-7.0.42/logs/catalina.out : jul 31, 2013 2:41:22 pm org.apache.catalina.startup.expandwar copy severe: er

symfony - swiftmailer send email using gmail with custom domain -

in symfony2.3 using swiftmailer. i have google apps address myname@abc.com , normal gmail address myname@gmail.com when using: mailer_transport: smtp mailer_encryption: ssl auth_mode: login mailer_host: smtp.gmail.com mailer_user: myname mailer_password: pymass the configuration works great , sends emails gmail address using myname@abc.com mailer_user correct password doesn't work. any ideas? the configuration sending (what assume is) google apps account differs gmail account. swiftmailer parameters should this: mailer_transport: smtp mailer_host: smtp.gmail.com mailer_user: myname@abc.com mailer_password: pymass auth_mode: login port: 587 encryption: tls make sure include entire email address port , encryption protocol. i derived solution this article few months back. also, small note: encryption not mailer_encyption . can read more swiftmailer parameters symfony here .

jquery - FancyBox inside a html form -

i have normal html form. inside form have several fields. inside form have lightbox div. inside light box have submit button. looks this: <form action="path" method="post"> name: <input type="text" name="name" /><br/> <a href="#fancybox">link open fancybox</a> <div id="fancybox" style="display: none;"> <input type="text" name="captcha" /> <input type="submit" value="submit" /> </div> </form> when click on link open fancy box , click submit button. doesn't work. form isn't submitted. any ideas whats going on? here jsfiddle of situation jsfiddle what : add id or class form (a selector play with) add id or class submit button like : <form id="myform" action="http://jsfiddle.net" method="post">name: <input ty

javascript - Comparison Operators - Greater than or Equal to - Not Working -

just started using jquery recently. (fairly recently, suppose...) doing wrong here? var userdate = new date(); if(userdate.gethours() => 12) { var post = $('p[title="test"]'); post.text('would @ time?'); } the condition flipped. var userdate = new date(); if(userdate.gethours() >= 12) { var post = $('p[title="test"]'); post.text('would @ time?'); }

angularjs - How to sort an angularFireCollection? -

i'm having trouble sorting larger arrays angularfirecollection binding: $scope.offers = angularfirecollection(new firebase(url)); while having in template code: <tr ng-repeat="offer in offers | limitto:100 | orderby:'createdtimestamp':true"> while offers.length < 100, new items correctly displayed on top. after 100 items, sorting stops working @ all. the issue expression order. "offer in offers | limitto:100 | orderby:'createdtimestamp':true" first gets first 100 elements of offers , orders. want order, limit, want use string "offer in offers | orderby:'createdtimestamp':true | limitto:100" . can see mean in following jsfiddle, first list limits array , tries ordering while second orders, limits: http://jsfiddle.net/qe5p9/1/ .

php - jQuery Selection does not work -

in html document have got table empty table body, gets automatically filled jquery when document loaded. table body generated php script, jquery gets content simple request. here php code... <?php // ... // ... // take @ following 2 lines, // other code not important in case. while ($tabledatarow = $tabledata->fetch_assoc()) echo '<tr><td>'. $tabledatarow['id']. '</td><td>'. $tabledatarow['name']. '</td><td><a href="#" class="delete-row" data-id="'. $tabledatarow['id']. '">delete</a></td></tr>'; ?> the output be... <tr><td>1</td><td>nadine</td><td><a href="#" class="delete-row" data-id="1">delete</a></td></tr><tr><td>2</td><td>nicole</td><td><a href="#" class="delete-row&quo

php - Do mysql_list_fields for a Join Query -

i looking populate array of columns being viewed in query lets say $sql='select a.tutorial_id, a.tutorial_author, b.tutorial_count tutorials_tbl a, tcount_tbl b a.tutorial_author = b.tutorial_author'; function getcoloumns($sql) { $result = mysql_query("show columns (". $sql.")); if (!$result) { echo 'could not run query: ' . mysql_error(); } $fieldnames=array(); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $fieldnames[] = $row['field']; } } return $fieldnames; } i cant seem right. out there can me out. in advance. show columns not allow subselect statement according mysql documentation . you instead go combination of original query, mysql_num_fields() , mysql_field_name() : function getcoloumns($sql) { $result = mysql_query( $sql ); if (!$result) { echo 'could not run query: ' . mysql_error(); // return func

PHP support for Mssql on windows server -

my client wants upgrade website php4 latest version. but first have check website on php4 sql databse. i googled not getting exact information below - does php4 supports sql database properly? is continue sql server , php5 in future ? php support database including mssql. all need enable removing semicolon php.ini regards alok sportsafter

Delete rows in a range using vim -

i've got large text file (+100k long rows) i've been using vim edit, remove rows in given range i.e delete rows 500 50000 there commands this? almost every editing command can have range specified in form :<from>,<to><cmd> so want probably: :500,50000d

system verilog - Declaration of random packed associative array -

i wrote code initialize packed associative array in following fashion. int msize = $urandom_range(20) ; bit [0:3] [0:msize] mem [int] ; but, showing error : "illegal operand constant expression" alternative one. the dimensions of packed portion of array must consistent, decided @ compile time. assignment of msize decided @ run time. make msize parameter assigned @ compile time. alternatively , if want mem have random msize @ run time, mem should defined as: bit [0:3] mem [int] []; before accessing element should put: if(!mem.exists(lookup_id)) mem[int_key_address] = new[msize]; read arrays in systemverilog in § 7 of ieee std 1800-2012 , free ieee website.

javascript - Ajax post opens a new window after submitting -

i'm trying submit form , response using ajax, when submit form new window opened values typed function works , should, it's new window problem here html code : <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="chat_style.css" rel="stylesheet" type="text/css"> </head> <body> <div id = "refresh" class="refresh"></div> <form method="post" action="save.php" name="chat_send" onsubmit="sendchatdata(); return false;"> <input id="sender" name="sender" type="hidden" value ="<?php echo $sender ?>"> <?php echo "$sender:" ?> <input name="texta" type="text" id="texta"/> <input name="submit" type="submit" value="send" /> </form&g

MySQL how to extract data from one column using Substring and put to another column under same ID within same table -

let's have table people like id | name | extracted ----------------------------------------- 1 | roger | ----------------------------------------- 2 | anthony | ----------------------------------------- 3 | maria | ----------------------------------------- we use select substring(name, 1, 3) people.name name '%thon%' it find "anthony" , extract 3 first chars - result : ant how put result against same id table looks like id | name | extracted ----------------------------------------- 1 | roger | ----------------------------------------- 2 | anthony | ant ----------------------------------------- 3 | maria | ----------------------------------------- try update people set extracted = left(`name`,3) `name` '%thon%'

oracle11g - How to set dbms_session.set_identifier from Entity Framework -

i trying implement audit trail in web application backed oracle database, have audit trail triggers in place work flawlessly, when user alters data either via sql client toad or when manually use oracle.dataaccess.client via // rest omitted brevity // var command = new oraclecommand(); command.connection = conn; var useridsql = new stringbuilder(); useridsql.appendline("begin"); useridsql.appendline("dbms_session.set_identifier('username');"); useridsql.appendline("end;"); command.commandtext = useridsql.tostring(); command.executenonquery(); // rest of insert / update / delete code // what doesn't work when try same overriding savechanges() in dbcontext class. i assume entity using different above ado.net example on how manages connections , hence reason update happening on wrong database session hence dbms_session not visible trigger. i did tr

java - RequestMapping with annotation vs parameter -

i thinking general requestmapping question. without choosing specific mvc framework, comparing annotation based request mapping simple parameter checker mapping, better? lets want create web service, should handle example "add" , "remove" operation. using annotations this: @path("/add") public void add(string addable) {} @path("/remove") public void remove(string deletable) {} using parameter this: @path("/operation") public void dooperation(operation op) { string type = op.gettype(); if ("add".equals(type)) { add(op); } else if ("remove".equals(type)) { remove(op); } } in second example, lets operation object built json object. idea have general operation, has type parameter , calling same request (/operation in case) , actual request type inside json object. i know first 1 looks better, there other reason why better solution? has better performance or else?

plsql - Handle two different queries with one ref cursor -

i have 2 select queries , wanted open cursor both of them ? v_str1:='select rowid ' || p_tblname|| 'where '|| p_cname||'='''|| p_cvalue || ''''; v_str2:='select count ( * ) v_cnt ' || p_tblname|| 'where '|| p_cname||' = '''||p_cvalue||''''; ..... open ref_cur_name v_str1 loop if v_cnt = 1 exit; else execute immediate 'delete '|| p_tblname|| 'where rowid = rec.rowid'; end if; v_cnt := v_cnt - 1; end loop; first query select statement , other puts count v_cnt . need execute both of these queries . there way use both these queries ? also there syntax error after open statement i.e . @ loop. use execute immediate execute immediate 'select count ( * ) v_cnt &

ruby - Rails 4 form remote update div issue -

i'm having problems update div after submitting form rails 4. here relevant part of code: view: _details.html.haml = form_tag(url_for(save_answer_path(format: :js)), remote: true) (some html code ....) = submit_tag t('app.bouton.send'), id: 'sendbutton' %div#divlogs = render partial: 'logs' controller: def save_answer code ... respond_to |format| format.js end end js: save_answer.js.erb $('#divlogs').html("<%= escape_javascript(render partial: 'logs') %>"); when submit, called correctly i'am getting incorrect output. want update div, instead page have on js file, content of partial. example: my url after submitting: http://domaine/controller/save_answer.js what on screen: $('#divlogs').html("<p>this should appear on div </p>"); does know going on? solution: as @vladkhomich said in comments above, missing js file rails.js. you can dow

jquery - How can I prevent my tab-navigation from resetting on reload? -

should out there able me or point me right direction, appreciate lot! i created wordpress-site uncle’s rental business. i’m still amateur javascript/jquery , php. can see page of holiday apartment here: click here! as can see in center-top, there tab-menu showing apartments house in different categories/tabs (amount of persons). now, visitor chooses click on f.e. 5-persons appartment, when gets new site of 5-persons apartment, tab-navigation gets resetted , shows 2 person category again. here problem: logically thinking should show 5 persons-tab, , not resetted on every reload… is there way ask database, kind of apartment is, can show right tab? the tab-navigation created of theme-shortcode. can tab somehow stay on same tab clicked instead of being resetted everytime? how go this? thanks lot in advance! edit: here's minified javascript: (function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.chil

java - Better JLabel movement with KeyListeners -

i'm having slight problem movement of jlabel using keylisteners. when click key move label, moves little, pauses second, moves. how can make movement more smooth? frame.addkeylistener(new keyadapter(){ public void keypressed(keyevent e) { if(e.getkeychar() == 'w'){ movey -= 10; label.setlocation(movex, movey); } if(e.getkeychar() == 'a'){ movex -= 10; label.setlocation(movex, movey); } if(e.getkeychar() == 's'){ movey += 10; label.setlocation(movex, movey); } if(e.getkeychar() == 'd'){ movex += 10; label.setlocation(movex, movey); } } }); jframe default never react keyevent listened keylistener jframe isn't focusable jcomponent , need use focusable contianer e,g, jpanel , again wrong decision, because required set pernament focus - setfocusable(true) don't

Will the Google Cast extension work on the Beta Channel on my Chromebook? -

the google cast extension not work on chromebook pixel had pinned beta channel of chromeos. once did recovery , reverted stable channel on chromebook, google cast extension works. i 100% beta channel (almost certainly) not officially supported, i'm hoping part of being forward-looking extension eventually/soon "seems work" status on beta channel -- because today's beta channel leads tomorrow's stable channel.

matplotlib - Use 3d object as marker in 3d scatter plot - Python -

with below code, i'm trying model bowl built out of cans. each marker can, best way go this? i'd appreciate suggestions, thanks. import pylab import numpy np math import pi, sin, cos import matplotlib.pyplot plt mpl_toolkits.mplot3d import axes3d fig = plt.figure() ax = fig.add_subplot(111, projection='3d') numcanshigh = 24 startcannum = 15 hcan = 41 dcan = 85 rcan = dcan/2.0 # rise options: 0,1,2,3 baserise = 3 toprise = 2 changeh = 8 z = np.linspace(0, hcan*numcanshigh, num=numcanshigh) n=[startcannum] in range(1, changeh): n.append(n[i-1] + baserise) in range(changeh,len(z)): n.append(n[i-1] + toprise) r = [i*rcan/(pi) in n] theta = [2*pi / in n] totalcans = 0 in range(len(z)): j in range(int(n[i])): totalcans+=1 x9 = r[i]*cos(j*theta[i]) y9 = r[i]*sin(j*theta[i]) z9 = z[i]

c# - xna charge power on how long the key is pressed -

i working on shooting game. in number of shoot fix. make variable based on how long pressed keyboard key. more power should generated if key pressed longer. here code. { // create projectile worldentities.add(new sphere(graphicsdevice, 0.1f, 0.2f, character.eyeposition() + character.looktowards(), 0.8f, color.blue)); // add gravity projectile (worldentities[worldentities.count - 1] rigidbody).acceleration = new vector3(0f, -10f, 0f); // calculate launch velocity vector3 launchvelocity = character.looktowards() * 10f; // set particle velocity launch velocity (worldentities[worldentities.count - 1] rigidbody).velocity = launchvelocity; // reset timer timer = 1f; } have variable power multiplier, cause velocity 0% @ first press, , 100% when has been held down maximum time float power; const float maxtime = 1000; //1 second in upda

stl - C++ Unable to convert base class to derived class when registering callback -

i’d create map of callbacks different objects of same hierarchy i'm getting following error: class responsebase { public: virtual bool parse() = 0; }; class myresponse : public responsebase { public: bool parse() { return true; } void sayhello() {} }; typedef std::tr1::function<void (responsebase*)> mycallback; typedef std::map<int, mycallback> mycallbacks; mycallbacks mycallbacks; void registercallback(int ntype, mycallback mycallback) { mycallbacks::iterator iter = mycallbacks.find(ntype); if (iter == mycallbacks.end()) mycallbacks[ntype] = mycallback; else iter->second = mycallback; } void callback0(responsebase *presponsebase) {} void callback1(myresponse *pmyresponse) {} int main() { registercallback(0, callback0); // ok registercallback(1, callback1); // error c2664: 'void (myresponse *)' : cannot convert parameter 1 'responsebase *' 'myresponse *' return 0; } but i'd

java - Querying mongodb dbref inner field -

i need hide user related data isactive flag set false. there many collection in have used user collection of type dbref (around 14 collections) , each collection contains more 10 million records. let me explain more of example. suppose have 2 collections: user contact user collection contains following fields: firstname (string) last name (string) isactive (boolean) contact collection contains following fields: contacter (user) declared of type dbref. contactee (user) declared of type dbref. contactstatus (string) now want fire query fetch contacts contactstatus = "confirmed" && contacter.isactive = true && contactee.isactive = true in terms of mongodb, query this: db.contacts.find({"contactstatus" : "confirmed", "contacter.isactive" : true, "contactee.isactive" : true}); but when run query in mongo shell, returns 0 record. so question here 1) possible fire query on dbref's in

xcode - testing ipad app on device using firewire cable rather than USB -

i trying find out if can test app written in xcode on ipad using firewire cable rather usb cable. random question know working in remote area in africa , need cable sent me. firewire cable on offer - know if work? have seen this? don't think work. https://discussions.apple.com/thread/2537899?start=15&tstart=0 specifically these lines: 3rd post down by: michael fryd current idevices no longer have circuitry charge or communicate off fw pins. when plug idevice fw style charger not hurt idevice. higher fw voltage on connector pins not connected inside ipad.

windows 8 - Brother Label Printer c# program with visual studio 2012 for windows8 -

i want make simple program prints sth (just wnt write sth ) i ve added interop.bpac.dll (found samples bin folder) ve wrote code private void buttontry_tapped_1(object sender, tappedroutedeventargs e) { bpac.documentclass doc = new documentclass(); if(doc.open("templatefile.lbx")) { doc.getobject("field1").text = "hello"; doc.getobject("field2").text = "world"; doc.startprint("", printoptionconstants.bpodefault); doc.printout(1, printoptionconstants.bpodefault); doc.endprint(); doc.close(); } } and gives error "interop type 'bpac.documentclass' can not embedded.use applicable interface instead." im trying print ql700 ll try other thermal receipt printers later , couldnt templatefile.lbx whats , program search file? thanks :) change embed interop types false

perl - change my json string in a loop -

right have json created select mysql , looks this: $sth->execute() or die "sql error: $dbi::errstr\n"; while (my $row = $sth->fetchrow_hashref ){ push @output, $row; # print $row->{image}; $photo = $row->{image}; $file = "$photo"; $document = { local $/ = undef; open $fh, "<", $file or die "could not open $file: $!"; <$fh>; }; $encoded= mime::base64::encode_base64($document); } with json looking this: {"mydata":[{"favorited":null,"date":"2013-07-31","preferredmeetinglocation":"meet here","description":"clothes desc","image":"/var/www/pictures/photo-7h1sisxq.jpg","id":"31","title":"clothing ","price":"12","category":"clothing","isbn":null}]} and want in place of s

asp.net mvc 4 - Mvcsitemapprovider 4.0.1 not displaying routes -

i'm new asp.net. i've installed mvcsitemapprovider version 3 without problems when try install version 4 it's not working. the first thing tried add xmlsitemapcontroller.registerroutes(routetable.routes); global file. following documentation says use mvcsitemapprovider.web . when returns xmlsitemapcontroller doesn't exist in current context. if change use mvcsitemapprovider.web.mvc works, when going sitemap.xml doesn't show of data mvc.sitemap , shows following: <?xml version="1.0" encoding="utf-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://localhost:42370/</loc></url></urlset> i'm not receiving other errors can see. happens on current , new projects , i'm using visual studio 2013 preview. updated 4.0.2 , it's working now.

xml - What does this XSLT code do? -

what do? correct think xslt code doesn't anything? .... <xsl:template match="/*[1]"> <xsl:apply-templates /> </xsl:template> .... it template matching root element of name , applying templates child nodes of root element. wouldn't call "doesn't anything", although built-in templates suffice same root element , other things ... crucial tell whether template needed.

swing - Java Example: Enter Key. Java Novice -

thank taking time read i'll make simple. problem have have program changes 1 type of temperature , converts another. thing want add program when person clicks button enter shows the new temperature in box when person clicks "enter" on keyboard. code below: import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.text.decimalformat; import java.util.inputmismatchexception; public class testlab { static string celciusstring = "celcius"; static string fahrenheitstring = "fahrenheit"; static string kelvinstring = "kelvin"; static string celcius1string = "celcius2"; static string fahrenheit1string = "fahrenheit2"; static string kelvin1string = "kelvin2"; private jlabel in = new jlabel("input scale"); private jlabel out = new jlabel("output scale"); private jlabel in1 = new jlabel("input");

jquery - TypeError: 'undefined' is not a function (evaluating '$.supersized') -

i'm using wordpress site. i'm including script in header. when script loads, error: typeerror: 'undefined' not function (evaluating '$.supersized') supersized full width background plugin have on site. have no idea causing or means. i feel deleted file or jquery line in css, can point me in right direction?

How do I escape a backslash in the following regex c# -

here function, i'm trying replace string in file, c# tells me regex malformed. ideas? public void function(string filename, string path) { string pathtoammend = @"$serverroot\pathpath"; string newpath = @"$serverroot\" + path; file.writealltext(filename, regex.replace(file.readalltext(filename), pathtoammend, newpath)); .... } it works if change strings to: string pathtoammend = @"$serverroot\\pathpath"; string newpath = @"$serverroot\\" + path; but have 2 slashes , want 1 slash. a \ special escaping character in regular expressions. have escape interpreted literal \ , not escape sequence. $ special character (an end anchor ), you'll want escape well. string pathtoammend = @"\$serverroot\\pathpath"; using @ create verbatim string means don't have escape \ sake of c# compiler. still have escape \ in regular expression pattern. without verbatim string be: string pa

Can a NuGet package declare a dependency without adding that dependency to the project? -

i've created nuget package contains custom msbuild tasks named mycompany.msbuild . these tasks have dependency on newtonsoft.json. means after package installed in project, newtonsoft.json.dll have in same directory mycompany.msbuild.dll . i accomplish bundling own copy of newtonsoft.json.dll in package, wonder if there's better way means won't have update package whenever new version of newtonsoft.json comes out. if declare newtonsoft.json dependency , nuget install package project when installs package, isn't want have happen. how can specify dependency in package without having nuget install , add project references? additionally, how can copy package's assembly own package's folder after installed? a package "hidden" dependency absolutely undesiderable in opinion... i know it's not real answer but... have considered use javascriptserializer instead of newtonsoft.json? it's bit slower package absolutely self-contained

C# WPF - GridLength GridUnitType.Auto -

can explain difference between using: gridlength length = new gridlength(0, gridunittype.auto) and gridlength length = new gridlength(1, gridunittype.auto) my limited knowledge of leads me believing these both identical solutions due auto being states..."auto", therefore making double value redundant. most examples have seen show gridunittype.auto being preceded 1 rather 0, seems me either option works same? is case or can shed light on if/how these different i think understanding correct, when value gridunittype.auto used, first value passed constructor redundant, size determined content object. it makes sense in context of gridlength structure constructor retain parameter (even though it's not used in instance), allows second parameter type contain values describe available states of gridunittype . from documentation : the enumerated type gridunittype can contain following values: auto - size determined size properties of conten

php - how to check if values exist inside a multidimensional array -

i have array this: array ( [206] => array ( [1] => array ( [formatid] => 1 [format] => cd [formatseourl] => cd ) ) [556] => array ( [] => array ( [formatid] => [format] => [formatseourl] => ) ) [413] => array ( [3] => array ( [formatid] => 3 [format] => casete [formatseourl] => casete ) ) ) ...and specific key want values, before need validate if there values. code build dont know how validate if there values inside array... ive tried isset, empty, count, array_key_exists no success... know im close... $key = 556; //if there no formats in array, dont bother create ul if (?????????formats exist in $array[$key]) { ?> <ul><?php foreach ($array[

Sublime: current file in console python -

in sublime console 1 can execute arbitrary python code. how can select current file buffer execute commands on it? in "on fly" plugin. edit i wasn't clear in question. don't want execute python code i'm programming, , i'm aware of sublimerepl. want manipulate text i'm writing (being code or not) python, perhaps using sublime api, search, replace, manipulate text , on in sublime plugin, one-off, you'd elisp in emacs. your best bet use sublimerepl , available through package control . st2 console runs internal python version 2.6, , can't use third-party modules. sublimerepl runs python interpreter have installed on machine, , acts command-line version. utilizes full syntax highlighting , completion capabilities of st2, , allows transfer bits or whole files of code repl.

qt - Replacing items in a QTableWidget -

if create new qtablewidgetitem , insert/set cell on qtablewidget has existing item, previous itemy deleted or there memory leak? need retrieve existing item , change properties? when insert qtablewidgetitem qtablewidget using qtablewidget::setitem() table takes ownership of item, means manage you. if call setitem() column , row has item, table delete old item you. no memory leak. you're safe!

Overwriting a line in CSV file with C++ -

i'm writing payroll program in c++ , need able read lines in file, calculations, , overwrite read lines in file. there function/way can overwrite specific lines, insert new lines, add onto end of existing file? there no c++ functionality "insert" or "remove" text in text-file. way read existing text in, , write out modified text. if new text fits in same space old one, need overwrite existing text - , of course, can add spaces before/after comma in .csv file, without becoming part of "field". if new data longer, won't work "overwrite in place". adding end relatively easy using ios_base::ate modifier. inserting in middle still involves reading until find relevant place, , then, if new text longer, have read following lines before can write new one(s) out.

expressionengine - How to .htaccess 301 redirect only if the final URL segment is empty -

i'm using expressionengine , generating url when viewing specific category: domain.com/index.php/template_group/template/category_url_indicator/foo_category/ i redirect visitors if delete specific category final segment of url. example, if made url this: domain.com/index.php/template_group/template/category_url_indicator/ i tried .htaccess 301 redirect redirecting shorter url redirected longer url. is, if put in .htaccess: redirect 301 http://www.domain.com/index.php/template_group/template/category_url_indicator http://www.domain.com this redirected longer url become http://www.domain.com/foo_category/ - not required... suggestions welcome - thanks! david. try using redirect match instead, along begin/end boundaries: redirect 301 ^index.php/template_group/template/category_url_indicator$ http://www.domain.com

asp.net - How do I insert values into BIT datatype? -

we have checkbox on 1 of our forms. if user checks box , clicks save button, have value of 1 or true inserted table. if however, box not checked, rather inserting null, insert 0 or false. any idea how solve this? thanks alot in advance how checking non null input: insert mytable (mybitfield) values (case when @mycheckboxparameter null 0 else 1)

r - Trying to label bar chart ggplot2, get "Error: Aesthetics must either be length one, or the same length..." -

i'm using bar chart show income distribution of parking meters in city. data frame includes columns parking meter id, annual revenue meter, , decile (1-10) meter falls based on total revenue. command looks this: > rev <- ggplot(parking, aes(x=decile, y=revenue)) > rev + geom_bar(stat="identity") and result want, i'd add total revenue each decile atop each bar in graph, , don't know how. tried this: > aggrev <- aggregate(revenue~decile, data=parking, sum) > totals <- aggrev$revenue > rev + geom_bar(stat="identity") + geom_text(aes(label=totals)) but error message: error: aesthetics must either length one, or same length dataproblems:totals. i checked length(decile) , length(totals), , values 4600 , 10, respectively. understand why happening, why can't add 10 characters 10 bars? or chart display bar totals automatically, maybe using "identity"? i've decided run this: ggplot(aggrev, aes

javascript - Nested collection-Form, append to nearest class -

Image
hello have been trying make dynamic collection can post server, after struggeling found guide; http://jarrettmeyer.com/post/2995732471/nested-collection-models-in-asp-net-mvc-3 great written havent got work needs. works fine exept 1 "little" annoying thing. first information im trying achive; my classes looks this; qpack has list of questions question has list alternatives the interface have created looks this; and markup. the "add question"-button works great , markup match, thing dosent work wen click on "add alternative" being added first question. markup fine seen in second picture. the function responsible append looks this; function addnestedform(container, counter, ticks, content) { var nextindex = $(container + " " + counter).length; //var nextindex = $(counter).length; // orginal var pattern = new regexp(ticks, "gi"); content = content.replace(pattern, nextindex); $(container).append(c

javafx 2 - How do I make a java class that inherits from another one which is loading an fxml file -

i have custom interface created in scene builder , want reuse in variation created child class. problem seems won't inherit methods marked @fxml. there way extend class loads fxml instead of copying entire class? example parent class: public class browser extends stackpane implements initializable { public browser() { fxmlloader fxmlloader = new fxmlloader(getclass().getresource("fxml/browser.fxml")); fxmlloader.setroot(this); fxmlloader.setcontroller(this); try { fxmlloader.load(); } catch (ioexception exception) { throw new runtimeexception(exception); } @override public void initialize(url url, resourcebundle rb) { } // adds new tab. @fxml private void addtab(actionevent event) { browsertab tab = new browsertab(); tab.getengine().load(initialtab.getaddress()); if (tabs.gettabs().size() >= tabmax + 1) { baseapp.shownotify("you may open maximum of " + tabmax + " tabs."); } else { tabs.gettabs().add(tabs.

How to use Google safe browsing lookup API -

i've stumbled onto google safe browsing lookup api , admit seems bit above head, still learn how use it. i've read through get-started documentation, still confused on begin. i've created api key access it, gave me link. i've pasted link google chrome, , downloaded file, opened in google chrome on win 7 machine. this stuck, api? how paste url's api see if malicious or not? so, if you're still wondering 6 months later api way of interacting site not through browser. don't need worry if you're using chrome or firefox since browser you. however, know how website bar have small google maps box map of area? application (website) sent get request google maps api. simplest way @ home terminal or command line. that's type in url you're trying check.

java - How does doGet() support bookmarks? -

reading below link , note "doget() allows bookmarks". http://www.developersbook.com/servlets/interview-questions/servlets-interview-questions-faqs.php : search "it allows bookmarks" can tell how , use of ? all parameters of get request contained in url when requesting resource using get request, can formed using request url itself. consider example www.somesite.com.somepage.jsp . generates get request because asking resource somepage.jsp . if asking resource, get request. get requests used retrieve data. any get request calls doget() method of servlet get requests idempotent, i.e. calling same resource again , again not cause side effects resources. hence, get request can have bookmarks edit :- as suggested jerry andrews, post methods not have query data unlike get requests form resource of url. hence not bookmarked.

excel - exit for and keep looping the upper level for -

i want keep looping outside after exiting inside in if statement, logic should right don't know how code it. did , gives me "next without for" error. ideas? here code: for inrcounter = 2 inrnum exrcounter = 2 exrnum 'add missing column data input sheet existing sheet lastcofthisr = sheet1table.cells(exrcounter, columns.count).end(xltoleft).column 'searching address if sheet1table.cells(inrcounter, 1) = sheet2table.cells(exrcounter, 1) , sheet1table.cells(inrcounter, 2) = sheet2table.cells(exrcounter, 2) , sheet1table.cells(inrcounter, 3) = sheet2table.cells(exrcounter, 3) if lastcofthisr < incnum lastcofrowcounter = lastcofthisr + 1 incnum sheets("sheet1").cells(exrcounter, lastcofrowcounter) = sheets("sheet2").cells(inrcounter, lastcofrowcounter) next lastcofrowcounter 'found

c++ - How do you know when an input stream has reached the last word in a line? -

i'm reading input ifstream in c++. input comes bunch of words separated tabs, i'm reading in "word1 word2 word3" stream >> w1 >> w2 >> w3; need know when i've reached final word in line, how go that? number of words variable, should even. also, last word contain \n, or \n last word? the simplest (and usual) solution read lines using std::getline , , parse line using std::istringstream : std::string line; while ( std::getline( std::cin, line ) ) { std::istringstream s( line ); std::vector<std::string> words; std::string word; while ( s >> word ) { words.push_back( word ); } // ... }

centos - xinetd - unable to write to a file -

running centos. xinetd.d/clhtest entry follows: service clhtest { disable = no port = 8020 socket_type = stream protocol = tcp wait = no user = charrison passenv = path server = /home/charrison/bin/clhtest } in debugging need write file. set server process open /home/charrison/log/foo.txt 1 of first steps (note user=charrison ), doesn't - , assume tries to. when launch server program command line opens file successfully. i suspect umask parameter may needed, don't know defaults to. any hints?

ios - Using a Long Press Gesture only if certain conditions are met -

i trying create long press gesture presents second view controller, once press has been held 3 seconds. however, want second view controller presented if device in accelerometer orientation entire 3 seconds. is, if gesture not held long enough or device tilted much, gesture dismissed , user must try again. // in firstviewcontroller.h #import <uikit/uikit.h> #import <coremotion/coremotion.h> @interface firstviewcontroller : uiviewcontroller @property (nonatomic, strong) cmmotionmanager *motionmanager; @end // in firstviewcontroller.m #import "firstviewcontroller" #import "secondviewcontroller" @implementation motionmanager; - (void) viewdidload { [super viewdidload]; self.motionmanager = [[cmmotionmanager alloc]init]; uilongpressgesturerecognizer *longpress = [[uilongpressgesturerecognizer alloc]initwithtarget:self action:@selector(handlelongpress:)]; longpress.minimumpressduration = 3.0; [self.view addgesturerecogni

android - ORMLite does not support GregorianCalendar to be mapped -

i'm going use ormlite have found useful... however, have found disadvantage. i have class has gregoriancalendar type attribute, mapped follows: @databasefield(datatype = datatype.date_string) private gregoriancalendar fechanacimiento; when run app, gets crashed message in logcat: 07-31 20:52:47.629: e/androidruntime(11808): fatal exception: main 07-31 20:52:47.629: e/androidruntime(11808): java.lang.runtimeexception: unable start activity componentinfo{com.joninazio.euskofest/com.joninazio.euskofest.ui.menuprincipalactivity}: java.lang.illegalargumentexception: field class java.util.gregoriancalendar field fieldtype:name=fechacreacion,class=usuario not valid type com.j256.ormlite.field.types.datestringtype@40dca268, maybe should class [b 07-31 20:52:47.629: e/androidruntime(11808): @ android.app.activitythread.performlaunchactivity(activitythread.java:2308) it seems gregoriancalendar not supported ormlite can seen here: http://ormlite.com/data_types.shtml ,

Breadcrumb in rails -

what's best way include breadcrumbs in rails? gretel gem making breadcrumb in rails. easy use, can find tutorial on same page. hope helps.

html - Javascript <tbody> swapping not working -

i've got couple tables content should change based on clicking buttons (in case, links). i've used javascript code elsewhere successfully, though 1 parameter in switchid() function (there 1 table mess around with). keep researching examples of , seem passing variables correctly, doing wrong? code doesn't work on chrome or ie: edit: per comments, able whittle javascript section down single, smaller function, should same thing. have made change below. still doesn't work, though. i changed "array" , "x" variables "jonarray" , "jonx" avoid chances of 1 of being reserved word. <!doctype html> <html> <body> <script type="text/javascript"> var toptable = new array('english','spanish'); var bottomtable = new array('japanese','italian'); function switchid(jonarray,jonx) { for(var i=0;i<jonarr

git push having weird behavior? -

so i'm in process of learning git , i'm using sourcetree gui. have remote repository on server a(not bare repo working one). cloned remote repo onto local machine , created new file called "blah.txt" , added, committed changes local repo. then after setting git config receive.denycurrentbranch ignore , pushed remote repo local repo. however, after push, can't see file created(blah.txt) in remote repo. however, when clone same remote repo different folder onto local machine, blah.txt appears again. can explain whats going on? git push pushes changes .git directory in remote repo, not update files in working directory of remote repo. you can git reset --hard in remote repo update files, if there uncommitted edits files, lose changes. (you can make git hook runs git reset --hard if want files automatically updated every time pull received.)