Posts

Showing posts from February, 2011

javascript - Target div in iframe -

i have link multiple effects happening, a description appearing onmouseover of image, opening iframe, targeting # specific div description on iframed page. and onclick div slide-toggling , opening iframe. (not important problem) i'm sure there better ways way did went i'm familiar with. works except problem /descriptions#456. div targeting #456 appears on firefox after mouseout , mouse in, other times seems point blank part of iframe page. on chrome targets #456 div without mistakes. firefox works maybe 60% of time. here unnecessarily complicated code using. <a id="slideup" class="description-div-name-1st-iframe-is-in" href="#" onmouseover='document.getelementbyid("1stiframeid").src="example.com/descriptions#456";' onclick='document.getelementbyid("2ndiframeid").src="http://www.example.com";'> as mentioned know there simpler way code doesn't bother me fact targeted di...

deployment - Azure Continuous Integration with user uploads -

i have configured online tfs account azure websites means when commit changes automatically deploys latest commit production. the problem having every deployment flushes old , replace new files including resources/images i.e. remove user uploaded images/files. is there way can exclude folders can put user uploaded images , files ci don't override it? it preferable store user data outside website's file system, leaving application code. you can use blob storage storing files, explained in this answer .

deleting properties in neo4j without any nodes -

i cleaning db , chose delete nodes reloaded. deleted nodes , links, , found db had 1024 properties left. have no nodes now. cannot delete properties. can help? are basing off web console? numbers notorious never being correct. it's impossible system have properties without nodes or relationships, neo4j use lazy delete system, properties aren't removed @ time deleted file store, should impossible system access them.

php - How can I convert a series of parent-child relationships into an array of there sequence? -

i have bunch of parent child id in array given bellow, child => parent array ( [1] => 0 ===>parent [2] => 1 [4] => 1 [5] => 4 [6] => 2 [7] => 0 ===>parent [8] => 2 [9] => 7 [10] => 2 [11] => 2 [12] => 2 [17] => 12 [18] => 17 [19] => 0 ===>parent [20] => 19 [21] => 20 [22] => 20 [23] => 20 ) and parsing tree is 0->parent ____________|___________________________ | | | 1(0's child) 7 19->0 parent's child[1]->[0],[7]->0,[19]->0 __|_______ | | | | 9 20 2 4 (2 & 4 1 parent's child) | | | 21,22,23 | 5 | 6,8,10,11,12 | 17 | 18 and want take 0 root element id , check child , gr...

php - Can't run jquery functions on forms added from jquery script -

i made script create login form if user not logged in. i've created form html() function (let me know if there better alternative). far working fine , form log user in once proper username/pass given. my problem that can't run jquery functions on these newly added forms if code added after fact. example, $('#usernamefield').attr('value', 'login'); will nothing. i'm doing wrong i'm not sure what. i've provided relevant code below (the section on submitting server removed). code creates form when user not logged in. want alert pop when click on username form, part doesn't work in example. //this create login form , submit data server , perform action based on results var loginform = function(){ $('.logindiv').html("<!-- form code start --><form id='login' method='post' accept-charset='utf-8'><input type='hidden' name='submitted' id='submitted' value...

file get contents - Php - character returned by file_get_contents -

i'm using file_get_contents retrieve content of external webpages , log received content txt file. the problem i've founded void in middle of page, , since part of page human written text exclude void present in page. so i've output this: lorem ipsum void sit avoidet, consectetur adipisici elit, sed eiusmod tempor so characters may returned "void" file_get_contents? thanks lot

php - Single Quotes not parsing -

i have simple form textarea when submitted updates rows in database! want user able enter single quotes reason not getting parsed! have parsing file.. <?php $sql = "select * testimonials id='$pid'"; $pid = $_post['pid']; $testtitle = htmlentities($_post['ts_tt']); $testbody = htmlentities($_post['ts_tb']); $compowner = htmlentities($_post['ts_co']); $ownertitle = htmlentities($_post['ts_ot']); $compname = htmlentities($_post['ts_cn']); $compwebsite = htmlentities($_post['ts_cw']); include_once "../php_includes/db_conx.php"; $sql = "update testimonials set testtitle='$testtitle', testbody='$testbody', compowner='$compowner', ownertitle='$ownertitle', compname='$compname', compwebsite='$compwebsite' id='$pid'"; if (!mysql_query($sql, $connection)){ die('...

Paramiko SSH python -

i´m trying simplest way make ssh connection , execute command paramiko import paramiko, base64 client = paramiko.sshclient() client.load_system_host_keys() client.connect('10.50.0.150', username='xxxxx', password='xxxxxx') stdin, stdout, stderr = client.exec_command('show performance -type host-io') line in stdout: print '... ' + line.strip('\n') client.close() ------------error----------------------- traceback (most recent call last): file "a.py", line 5, in <module> stdin, stdout, stderr = client.exec_command('show performance -type host-io') file "/usr/lib/python2.6/site-packages/paramiko-1.10.1-py2.6.egg/paramiko/client.py", line 374, in exec_command chan.exec_command(command) file "/usr/lib/python2.6/site-packages/paramiko-1.10.1-py2.6.egg/paramiko/channel.py", line 218, in exec_command self._wait_for_event() file "/usr/lib/python2.6/site-packages/para...

asp.net - Delete a row from gridvew using stored procedure -

i newbie asp.net . wish delete gridview row after clicking linkbutton on grid . attempting fetch primary key of gridview row clicked using datakeys , den pass delete stored stored procedure . exception of index out of range . please me how can ? here code gridview grid=(gridview)sender; linkbutton lnkbtndelete = (linkbutton)e.commandsource; gridviewrow grdvwrw = (gridviewrow)lnkbtndelete.namingcontainer; int pkey = convert.toint32(grid.datakeys[grdvwrw.rowindex].value.tostring()); sqlcommand cmd3 = new sqlcommand("usp_delete_notice", con2); cmd3.commandtype = commandtype.storedprocedure; cmd3.parameters.addwithvalue("@noticeid", pkey); int rowsdeleted = cmd3.executenonquery();`enter code here`

Python string.replace equivalent (from Javascript) -

i trying pick python , coming javascript haven't been able understand python's regex package re what trying have done in javascript build very simple templating "engine" (i understand ast way go more complex): in javascript: var rawstring = "{{prefix_helloworld}} testing this. {{_thiswillnotmatch}} \ {{prefix_okay}}"; rawstring.replace( /\{\{prefix_(.+?)\}\}/g, function(match, innercapture){ return "one rule all"; }); in javascript result in: "one rule testing this. {{_thiswillnotmatch}} 1 rule all" and function called twice with: innercapture === "helloworld" match ==== "{{prefix_helloworld}}" and: innercapture === "okay" match ==== "{{prefix_okay}}" now, in python have tried looking docs on re package import re have tried doing along lines of: match = re.search(r'pattern', string) if match: print match.group() ...

c# - display the value of datagridview in the textboxes present in another form -

how can use same data grid values in 2 different forms? i have grid view displays list of buses , starting location , destination , trip date time.. and have user home page user books seats , in user page have display contents of mentioned data grid view i used code public static string setvaluefortext1 = ""; public static string setvaluefortext2 = ""; public static string setvaluefortext3 = ""; public static string setvaluefortext4 = ""; public static string setvaluefortext13 = ""; and int = gv_bus.selectedcells[0].rowindex; setvaluefortext16 = gv_bus.rows[i].cells[2].value.tostring(); setvaluefortext1 = gv_bus.rows[i].cells[3].value.tostring(); setvaluefortext2 = gv_bus.rows[i].cells[4].value.tostring(); setvaluefortext3 = gv_bus.rows[i].cells[5].value.tostring(); setvaluefortext4 = gv_bus.rows[i].cells[6].value.tostring(); and in user home page have...

highcharts - stacked column charts appearing too thin -

i have following issues while working stacked column charts: firstly,look @ following chart: http://jsfiddle.net/qnuea/ if notice time range wide, columns appear thin. know setting pointwidth 1 option. chart should appearing if time interval range narrow follows: http://jsfiddle.net/qnuea/1/ the expectation x-axis interval must adjust itself. secondly, same chart above, if width of chart more (say 900 px or so), x-axis seems have lot of empty space before first tick. is there solution this? (i unable post more 2 jsfiddle links here.so not providing link issue) you need define pointrange timestamp http://jsfiddle.net/qnuea/3/

c# - HTTP response code on button click -

trying build c# application (my first, apologies if stupid question)i have button on form , when clicked check http connectivity webserver . there no errors in compile returning " connection error " private void button3_click(object sender, eventargs e) { httpwebrequest httpreq = (httpwebrequest)webrequest.create("http://www.mysite.com"); httpreq.allowautoredirect = false; httpwebresponse httpres = (httpwebresponse)httpreq.getresponse(); if (httpres.statuscode == httpstatuscode.ok) { messagebox.show("200 ok"); } else { messagebox.show("connection error!"); } // close response. httpres.close(); } can tell me doing wrong ? thanks sometimes website responses "found" , not "ok" if (httpres.statuscode == httpstatuscode.found || httpres.statuscode == httpstatuscode.found) [edit] ...

javascript - How to replace < and > with &lt; and &gt; with jQuery or JS -

i've been searching day or how js or jquery , found couple of solutions nothing solid yet. i want use this: <code class="codeit"> <h2> h2 </h2> </code> and want output be: <h2> h2 </h2> i know can achieve doing: <code class="codeit"> &lt;h2&gt; h2 &lt;/h2&gt; </code> ...but not manual search , replace on code in blocks , rather have done on fly in browser. possible? i'm pretty noob jquery i've tried .replacewith or javascript's .replace far i've not gotten need it. i'm either replacing whole tag or doing else wrong. my question is: how write simple jquery (or regular js) me replace < , > html entities &lt; , &gt; inside <code> tags. i appreciate help, thanks. update: i managed working nice how @prisoner explained, it's nifty, in particular case needed little extending because have more 1 block of code .codeit cla...

loops - Word Macro that would find and create hyperlink of simillar words -

so, code of macro (macro1): sub macro1() ' ' macro1 macro ' selection.find.clearformatting selection.find .text = "req" .replacement.text = "" .forward = true .wrap = wdfindcontinue .format = false .matchcase = true .matchwholeword = false .matchwildcards = false .matchsoundslike = false .matchallwordforms = false end selection.find.execute selection.moveright unit:=wdcharacter, count:=8, extend:=wdextend selection.copy activedocument.hyperlinks.add anchor:=selection.range, address:= _ "http://www.neki.com/req12345678", subaddress:="", screentip:="", _ texttodisplay:="req12345678" end sub the code works fine finding reqxxxxxxxx texts, pastes wrong texttodisplay , wrong ending of address. instead of req12345678 in both places should pastet same text copied before at: selection.copy....

charts - Javascript stockchart graph -

i pretty new javascript , trying execute stockchart work fine url: http://jsfiddle.net/2zbrt/2/ code excatly same url, minor changes made ensure jquery library called however keep getting error : (1) uncaught typeerror: cannot call method 'setdefaults' of undefined (2) uncaught typeerror: object [object object] has no method 'datepicker' code: function(chart){ // apply date pickers settimeout(function(){ $('input.highcharts-range-selector', $('#'+chart.options.chart.renderto)).datepicker() },0) }); // set datepicker's date format $.datepicker.setdefaults({ dateformat: 'yy-mm-dd', onselect: function(datetext) { this.onchange(); this.onblur(); } }); please me out, boss breathing heavily down neck as know , these 2 functions didn't define yet, said function undefine settimeout(function(){ ...

asp.net mvc 4 - Kendo Ui Editor -

Image
please see screen shot, editor renders there no icons on tool bar, checked editor.png in default folder. <textarea cols="25" rows="5" id="history" style="width:420px" name="history" placeholder="this history field" ></textarea> $("#history").kendoeditor({ tools: [ "bold", "italic", "underline", "strikethrough", "justifyleft", "justifycenter", "justifyright", "justifyfull" ] }); and screenshot check including css file: <link href="/styles/kendo.default.min.css" rel="stylesheet" type="text/css"/> and have file called sprites.png in /styles/default

css - Unable to locate element with cssSelector -

i trying reach div , click later. <div class="leaflet-marker-icon marker-cluster marker-cluster-small leaflet-clickable leaflet-zoom-animated" style="margin-left: -6px; margin-top: -6px; width: 12px; height: 12px; opacity: 1; transform: translate(702px, 396px); z-index: 396;" title="13 tracks listened in , ua"> here's i'm trying do: webelement cluster = driver.findelement(by.cssselector("marker-cluster-small")); here's i've tried do: webelement cluster = driver.findelement(by.xpath("//div[@class='leaflet-marker-icon marker-cluster marker-cluster-small leaflet-clickable leaflet-zoom-animated']")); none of ways work. first 1 throws "unable locate element" message. no error appears on second one, when do: cluster.click(); nothing happens. doing wrong? thanks. you should try answer on page how can find element css class xpath? . should able close first answer searching ...

symfony - Symfony2 ManyToMany inverse result -

i have 3 entities. users groups user_groups users entity contains users, groups contains groups , there manytomany relationship between these 2 entities user_groups. in users entity can groups assigned user: /** * @orm\manytomany(targetentity="groups", inversedby="users") * @orm\jointable(name="user_groups", * joincolumns={@orm\joincolumn(name="user_id", referencedcolumnname="id")}, * inversejoincolumns={@orm\joincolumn(name="group_id", referencedcolumnname="id")} * ) */ private $groups; this plain , simple, how can groups not assigned user? is there method "inverse result" of manytomany relationship? thank you! you can use not member of expression in querybuilder : ... ->andwhere(':user not member of g.users') ->setparameter('user', $user) ...

sql - Select all tuples of a Table, with a dummy column showing which tuples satisfy a condition -

if add condition in query gives me filtered results. need result in rows (filtered + unfiltered) shown additional (dummy) column tells me means(say boolean value) specific row met "where condition" . taking example where condition: where col1 = 2 use case add additional column indicating if condition met: select *, case when col1 = 2 'true' else 'false' end `dummy` your_table

friendly id - Rails friendly_id gem mass assignment issue -

i using "friendly_id 4.0.0" gem making url user friendly. below user model user.rb model class user < activerecord::base extend friendlyid friendly_id :name , :use => [:slugged,:history] attr_accessible :email, :lname, :name end below user_controller.rb file @user = user.new(params[:user]) respond_to |format| if @user.save format.html { redirect_to @user, notice: 'user created.' } format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end but getting can't mass-assign protected attributes: slug exception. try adding slug attr_accessible attr_accessible :email, :lname, :name, :slug still getting same error. attr_accessible :email, :lname, :name attr_accessible protect mass-assignment if try following work @user = user.new(params[:user]) @user.email = par...

java - how to push emement of hashmap in stack -

recently trying push hashmap element in stack in java every time push new element in stack elements in stack replaced pushed element. here code: state.previousstate = dotposcolor; state.pushstate(); state.getelement(); public void pushstate(){ undos.push(previousstate); log.d("test","first->"+undos.firstelement().tostring()); log.d("test","last->"+undos.lastelement().tostring()); redos.clear(); } recently trying push hashmap element in stack in java every time push new element in stack elements in stack replaced pushed element. i'm going use crystal ball , tell you declaring intermediate variable globally , when needs local . ie: for( loop stuff here ) { object o = hashmap.get("fwerin"); }

Post values from HttpPost in android -

can me or suggest example/ tutorial on how able post values website using json , httpost. trying submit values below website: ("dateobserved", _date); ("provinceid", "59"); ("informationtypeid", "3"); ("reporttypeid","3"); ("iscompetitor",_competitor); ("subbrands","91"); ("consumersegments","3"); its kinda hard me newbie in android apply have read in different post in so wanna ask example or tutorial me understand it. anyways, tried clientprotocolexception. dont know missed something. me please... httpparams httpparameters = new basichttpparams(); httpconnectionparams.setconnectiontimeout(httpparameters, 15000); httpconnectionparams.setsotimeout(httpparameters, 15000); httpclient httpclient = new defaulthttpclient(httpparameters); httppost httppost = new httppost("http://svr4.sampleserver.com:0727/api/report...

c# - ConvertTo not implemented in base TypeConverter -

i trying convert bitmap image byte[] array. code imagesourceconverter converter = new imagesourceconverter(); byte[] data = (byte[])converter.convertto(bitmapimage, typeof(byte[])); i getting following error while running code an exception of type 'system.notimplementedexception' occurred in system.ni.dll not handled in user code message convertto not implemented in base typeconverter. i getting how implement convertto method. can please tell me how can solve issue? get stream bitmapimage , pass memmorystream byte array. http://www.codeproject.com/articles/15460/c-image-to-byte-array-and-byte-array-to-image-conv

SharePoint C# Get list of sites and subsites on which user has permission (like Read, Contribute Visitor) -

using (spsite osite = new spsite(spcontext.current.site.url)) { foreach (spweb oweb in osite.rootweb.getsubwebsforcurrentuser()) { permission = string.empty; foreach (spgroup group in oweb.groups) { foreach (spuser u in group.users) { if (u.name == (username)) { foreach (sprole role in u.roles) { permission += role.name.tostring() + ", "; } } } // taking permission details of user } permission = " [" + permission.trimend(", ".tochararray()) + "]"; } } my final string variable have values [read, visitor] or [read] or [visitor, read] i wants have permissi...

Redirect to stdout in bash -

is there filename assignable variable (i.e. not magic builtin shell token &1 ) let me redirect stdout ? what want run in cron script: log=/tmp/some_file ... some_command 2>&1 >> $log echo "blah" >> $log ... conveniently, lets me turn off log noise redirecting /dev/null later when i'm sure there nothing can fail (or, @ least, nothing care about!) without rewriting whole script. yes, turning off logging isn't precisely best practice -- once script works, there not can conceivably go wrong, , trashing disk megabytes of log info nobody wants read isn't desired. in case unexpectedly fails 5 years later, still possible turn on logging again flipping switch. on other hand, while writing , debugging script, involves calling manually shell, extremely nice if dump output console. way wouldn't need tail logfile manually. in other words, i'm looking /proc/self/fd/0 in bash-talk can assign log . happens, /proc/self/fd/0 works f...

PayPal Rest API - historical data -

i'm wondering if new paypal rest api can used receive historical data. example getting list of sales made before rest api existed. i thought there way hook seems can sales made though rest api itself. am wrong? that's correct - transactions created (via rest api's) returned in get /payment call today. need use classic transactionsearch api call transaction created prior that.

awk: create a table from a file -

i have commandlog file , want select info in table format. input this: #################################################################################################### # starting pipeline @ mon jul 29 12:22:56 cest 2013 # input files: test.fastq # output log: .bpipe/logs/27790.log # stage results mkdir ./qc_graphics_results/ #################################################################################################### # starting pipeline @ mon jul 29 12:22:57 cest 2013 # input files: test.fastq # output log: .bpipe/logs/27790.log # stage statistics_graph_2 fastqc test.fastq -o ./qc_graphics_results/ mv .qc_graphics_results/*fastqc .qc_graphics_results/fastqc #################################################################################################### # starting pipeline @ mon jul 29 12:24:18 cest 2013 # input files: test.fastq # output log: .bpipe/logs/27790.log # stage gc_content [all] # stage dinucleotide_odds [all] # stage sequence_duplication [all]...

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...

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...

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"); ...