Posts

Showing posts from August, 2010

Javascript Hoisting -

Javascript Hoisting - quite interesting thing discovered me js learner, consider next code. this.init = function (e) { var container = e.container; // slider var slider = $("#div1").slider({ orientation: "horizontal", step: 1, slide: function () { console.log(e.container); // not null console.log(container); // null } }); }; here's how it's called: lib.init({ container: $("#container") }); i know can utilize on("slide", {container: container}, function(event, args){...})) bind slide event , pass external info it. - explain why values returned 2 console.log different? wonder if technique technically sound replacement on approach? first of all, amazed getting null container . want see logs if can post secondly, here's explanation of why won't work, not of why null : this has nil hoisting you executin...

Wordpress custom posts on magento -

Wordpress custom posts on magento - i'm trying display wordpress custom posts on magento, fishpig extension (full integration). there's no documentation on extension web site. cannot seem able figure how this. any help? [edit] ok, i'm looking : i've created custom posts on wordpress backend named 'slides'. utilize them on magento homepage, create slider. on 1 hand, when on fishpig template, see unique $post->getpost(), like, example, had details of type of post use. know can not done way, certainly should predefined fishpig method (that can't find), or create new one. on other hand, in fishpig layout time, there's possible action : <action method="settitle"><title>latest posts</title></action> i tought can configure in way post type wanted display.. sorry, i've not online url show project, i'm still in before part of project.. thx i think looking here is: <action method=...

java - Creating a bar with HTML in a JLabel -

java - Creating a bar with HTML in a JLabel - i want create jlabel has text. behind text there should bar. width of bar should depend upon external parameters. possible to basic html back upwards of jlabels? mockup perhaps, not go way, utilize jprogressbar create bar, because supports string painted on it. see this question more details. in short: // when initializing: yourprogressbar.setstringpainted(true); // when want update it: yourprogressbar.setvalue(thecurrentvalueasint); yourprogressbar.setstring(thecurrentvalueasstring); // can string. java html swing jlabel

r - How to calculate percentage change from different rows over different spans -

r - How to calculate percentage change from different rows over different spans - i trying calculate percentage alter in cost quarterly info of companies recognized gvkey (1001, 1384, etc...). , it's corresponding quarterly stock price, prccq . gvkey prccq 1 1004 23.750 2 1004 13.875 3 1004 11.250 4 1004 10.375 5 1004 13.600 6 1004 14.000 7 1004 17.060 8 1004 8.150 9 1004 7.400 10 1004 11.440 11 1004 6.200 12 1004 5.500 13 1004 4.450 14 1004 4.500 15 1004 8.010 what trying add together 8 columns showing 1 quarter return, 2 quarter return, etc. way 8 quarters. have been able calculate 1 quarter homecoming each prccq using delt function of quantmod , ddply of plyr , , able 2 quarter homecoming using same code altering k . ddply(data, "gvkey", transform, deltacol = delt(prccq,k=2)) however, equation not allow me go higher k=2 without giving me error of differing number of rows 2,3. i've tried using many alt...

c# - Exception "The specified entity is not contained in this EntitySet." but Entity is contained -

c# - Exception "The specified entity is not contained in this EntitySet." but Entity is contained - i have exception " the specified entity not contained in entityset. " . when datasource, see entity in there. here code : class1 item = (class1)dg.selecteditem; if (item!= null) { class2 item2= new class2(); item2.att1= item.att1; item2.att2= item.att2; item2.att3= item.att3; mydatasource.dataview.remove(item2); } i want delete object of datasource, have attributes of selected item in datagrid. when watch on datasource, item2 appears, why can't delete datasource? same class, same attribute. don't understand. i found this, , works : if (item!= null) { class2 mypiece = mydatasource.dataview.oftype<class2>().where(ores => ores.att1 == item.att1).firstordefault() ; mydatasource.dataview.remove(mypiece); } basically need delete same item, creati...

iphone - Calling UIAlertView clickedbutton at index Programatically -

iphone - Calling UIAlertView clickedbutton at index Programatically - i trying phone call uialertview's delegate method programatically. here code:- if([vc respondstoselector:@selector(alertview:clickedbuttonatindex:)]) { // manually invoke alert view button handler [(id <uialertviewdelegate>)vc alertview:nil clickedbuttonatindex:0]; } it works fine on ios5.0 not working on ios6.0 , comments or suggestions welcomed :) here finish method detail:- twtweetcomposeviewcontroller *vc = [[[twtweetcomposeviewcontroller alloc] init]autorelease]; // settin initial text [vc setinitialtext:status]; [vc setcompletionhandler:^(twtweetcomposeviewcontrollerresult result) { if(result == twtweetcomposeviewcontrollerresultdone) { nslog(@"tweeted sucessfully"); } }]; if([delegate iskindofclass:[uiviewcontroller class]]){ [(uiviewcontroller *)delegate presentmoda...

vb.net - Automatically refresh -

vb.net - Automatically refresh - i want inquire how auto refresh/update listview using timer in vb.net.. give me thought or steps, or code. here's code in timer: private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load conn.open() timer1.enabled = false timer1.interval = 5000 dim strquery string = "select * " & _ "from software " dim mycommand new odbccommand(strquery, conn) dim myreader odbcdatareader myreader = mycommand.executereader listview1.items.clear() if myreader.hasrows = true 'listview1.beginupdate() while myreader.read dim listview listviewitem listview = listview1.items.add(myreader("log_type").tostring()) listview.subitems.add(myreader("log_desc").tostring()) listview.subitems.add(myreader("log_details").tostring()) listview...

javascript - How to store HTML id as a js variable? -

javascript - How to store HTML id as a js variable? - i writing webpage have 200+ links per page. each link has unique id matches id in frame. want run onmouseover function alter text color of both links across frames. here's i've got far. <html><head><title>test</title> <script> function hey() {var id=//help please; document.getelementbyid(id).style.color = "red";} function bye() {var id=//help please; document.getelementbyid(id).style.color = "black";} </script> </head> <body> <a id="1" class="word" onmouseover="hey()" onmouseout="bye()">hello</a> <a id="2" class="word" onmouseover="hey()" onmouseout="bye()">world</a>.... </body></html> any thoughts? pass id function: <html><head><title>test</title> <script> f...

iphone - iOS specific media queries -

iphone - iOS specific media queries - does know of way target ios devices using media queries? i'm looking way give iphone (1,3g,3gs,4,4s,5) user 1 experience, ipad (1,2,3,mini) user another, , else (desktop, android, windows phone, bb) default experience. i sense options limited since many phones share similar widths , parameters. know of utilize in media queries specific iphones , specific ipads? i've far locked downwards iphone 5 next code: @media screen , (device-aspect-ratio: 40/71){} and iphone 4 , 4s with: @media screen , (-webkit-min-device-pixel-ratio : 2) , (orientation:portrait), screen , (min-device-pixel-ratio : 2) , (orientation:portrait){} @media screen , (-webkit-min-device-pixel-ratio : 2) , (orientation:landscape), screen , (min-device-pixel-ratio : 2) , (orientation:landscape){} i've seen similar questions on here, haven't found 1 has addressed specific utilize case. this utilize in email i'm unable utilize javascri...

algorithm - How to find and return bottom-most(Deepest Node) node of a binary tree? binary search tree? -

algorithm - How to find and return bottom-most(Deepest Node) node of a binary tree? binary search tree? - i have binary tree status there single node in deepest level. nodes in tree have parent property (as left, right, data) is possible determine node @ deepest level in improve o(n )? if tree binary search tree (right->data > parent->data, left->data < parent->data) instead of binary tree? i can there using breadth-first approach gets job done in o(n) both binary tree , binary search tree wanted know if there improve approach. even balanced tree you'll have check every sub-tree find deepest node, like: struct result{ node *node; int level; }; result getdeepest( node *root ){ if( root == null ){ result result = {null, 0}; homecoming result; } result lresult = getdeepest( root->left ); result rresult = getdeepest( root->right ); result result = lresult.level < rresult.level ? rresult : lr...

postgresql - Postgres 9.2 - add conditional constraint check -

postgresql - Postgres 9.2 - add conditional constraint check - i'm using postgresql 9.2 , need add together conditional constraint on column. want create sure column false when 2 other columns have value. gid | int_unsigned | not null default 0 realm | character varying(255) | not null default ''::character varying grant_update | smallint_unsigned | not null default (0)::smallint grant_delete | smallint_unsigned | not null default (0)::smallint example: alter table node_access add together constraint block_anonymous_page_edit check (grant_update = 0 (gid = 1 , realm = 'nodeaccess_rid')); what supposed create sure grant_update equal 0 when gid 1 , realm = nodeaccess_rid. however, think rather doing want, it's trying create columns mimic these values. in essence, it's trying create sure grant_update 0, gid 1, , realm nodeaccess_rid. error is: error: check constraint "block_anonymous_page_edit...

stringtokenizer - Hidden char StringTokeneizer/split in Java? -

stringtokenizer - Hidden char StringTokeneizer/split in Java? - i have text file , each of line that author-title-kind i have java programme parsing file , must returns books author "example" . read line @ time, , split string stringtokeneizer or split() . 3 items: author, title, kind . check if first item string equal "example". problem false, , never true. there hidden character comparing ends false? maybe should check "example-" , or "-example" ...or else? remember string.split() takes regular look separator , not string. utilize apache commons stringutils.split() if want basic string splitting simple string. java stringtokenizer

javascript - Using KineticJS along with box2dweb -

javascript - Using KineticJS along with box2dweb - how utilize kineticjs along box2dweb can have collision detecting possible? like, how can set circular boundary around image rendered through kineticjs , apply physics through box2dweb? are there tutorials on or codes can help me? or there efficient way can collision detection kineticjs itself? what is: set box2d “world” – think of world room on earth (or other planet) add “bodies” world – bodies moving or stationary objects behave according physics have assigned them. for each box2d body, assign kineticjs “skin” – skins “pretty” kineticjs shape objects drawn on canvas kineticjs. example, in game skin might soccer ball. put box2d world in motion , hear box2d “tick” event – tick event fired when box2d has figured out physics occurred during specified length of time. @ point box2d knows position , rotation of each box2d body in box2d world. in box2d tick event, check position/rotation of each box2d body , draw ...

ruby on rails - Find objects in model by relative condition -

ruby on rails - Find objects in model by relative condition - i`m new ror. please help me: have 2 models: class user < activerecord::base belongs_to :game end and class game < activerecord::base has_many :users, :foreign_key => "game_id" end game objects have many users. need find game objects, users.count == 1. please help. a bit long worked me: game.joins(:users).where("(select count(users.game_id) users users2 users2.game_id = games.id) = 1") you can utilize includes() or joins() depending on want do. ruby-on-rails

android - Storing complex object graphs in Parcelable? -

android - Storing complex object graphs in Parcelable? - existing parcelable examples rather trivial. if have complex object graph next questions arise questioning feasibility: is there way prevent object beingness written multiple time parcel? are there best practices limit depth of object graph while writing? to give illustration first question, object references b, in turn references a. cycle leads writes a, b, a, b, a, ... until stackoverflowerror because there not seem way reference object written. for sec question let's have long graph a->b->c->d->e, , want serialize additional depth of 2, a->b->c. did writing custom writetoparceldeep method, of course of study not convenient standard writetoparcel. java serialization preserve reference , write object once. current devices much more powerful ones past , i'm not sure performance gain justifying writing parcelable biolerplate code complicated 1 in example. i'll maintain using...

javascript - mustache js - Can't access array value using tables -

javascript - mustache js - Can't access array value using tables - i having problem mustache.js accessing values of json array , need help. the problem when want access values using table. shows [object object] , when should show array content. below working , non-working example: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="https://raw.github.com/janl/mustache.js/0.7.2/mustache.js"></script> </head> <body> <div id="template" style="display:none"> <p>works not need:</p> <p>{{#numbers}} {{.}} {{/numbers}} </p> <p>doesn't work:</p> <table> <tr> {{#numbers}} <th> {{.}} </th> {{/numbers}} </tr> </table> </div> <div id="rendered"></div> <script> v...

iphone - Download File from Amazon S3 Bucket in Titanium -

iphone - Download File from Amazon S3 Bucket in Titanium - i know method download file object amazon s3 bucket using appcelerator titanium. can help me this thanks in advance var downloadingfileurl = "url of file need downloaded" //file path downloaded file saved var filesavingpath = titanium.filesystem.getfile(titanium.filesystem.applicationdatadirectory,"file_path"); //define http client var myhttpclient = ti.network.createhttpclient(); //on success of downloading myhttpclient.onload = function(){ //write file desired path filesavingpath.write(httpclient.responsedata); }; //open url download myhttpclient.open("get", downloadingfileurl); //send request myhttpclient.send(null); iphone ios amazon-s3 titanium titanium-mobile

javascript - Appending input box with jquery, the maxlength property is not being obeyed? -

javascript - Appending input box with jquery, the maxlength property is not being obeyed? - the next code creates maxlength property can view via debugger, it's not limiting info length ? var myrow = '<tr><td></td><td><input maxlength="128" class="myclass" type="text" name="mydata[' + + ']" /></td></tr>'; $('#mytable tr:last').after(myrow); javascript jquery html forms validation

gwt - Access values from widgets in GXT -

gwt - Access values from widgets in GXT - i new sencha gxt framework gwt, how can values gxt generated textfields in order send server? class="lang-java prettyprint-override"> import com.extjs.gxt.ui.client.widget.layout.flowlayout; import com.extjs.gxt.ui.client.widget.layout.formdata; import com.extjs.gxt.ui.client.widget.layout.formlayout; public class form extends layoutcontainer{ textfield<string> lastname = new textfield<string>(); lastname.setfieldlabel("last name"); fieldset.add(lastname, formdata); } on client side how can entered values lastname textfield ? use lastname.getvalue(); as per gxt textfield api gwt gwt2 gxt

individual page performance in netbeans -

individual page performance in netbeans - hi iam chandrashekhar, iam using netbeans 7.2.1. have facing 1 problem in this. jsp file has 4000+ lines. while iam trying modifying file hanged. can please 1 help me. thanks in advance try reinstalling net-beans work!! or right-click on toolbar of net-beans7.2.1 add together click on memory add together memory tool on toolbar , double-click on tool release garbage collection netbeans-7

performance - The limitation when getting blob data from oracle -

performance - The limitation when getting blob data from oracle - i trying download blob info oracle jdbc . in order know average response time of getting blob data, using jmeter phone call getting blob info java programme 1 or multiply threads.but got unusual response time not understand. i tried tests below.(the blob info size 1m) 1.getting blob info jmeter in 1 thread 2.getting blob info jmeter in 2 thread 3.getting different blob info in same table jmeter in 2 thread 4.getting different blob info in different tables jmeter in 2 thread. .from test 1 , 2,i found response time of test 2 twice of test 1 can not understand this(my server has 4 cores , nobody using that). uncertainty there lock when same blob info tried test 3. response time same test2.and tried test 4 create sure whether there lock when access same table,but response time of test 4 same test3. i think oracle can create deal lot users' request @ same ti...

xml - How to PHP DomDocument creating attributes? -

xml - How to PHP DomDocument creating attributes? - i've been smacking head against wall 2 days trying figure out how php encode xml want. tried simplexml , found out there serious limitations, using domdocument fulfill needs. problem quite basic, proper syntax? i retrieving code database, rendering xml. xml construction has in same exact format 1 going post. issue when comes attributes. output has 3 attributes need repeated twelve times different values. problem trying figure out how render attributes, code necessary. here xml: <inits> <version>18.05.04_ep1</version> <source>live</source> <lowid>265067</lowid> <highid>265068</highid> <ql>300</ql> <name>ofab shark mk 1</name> <inits slider="def&gt;===========][&lt;agg" percent="100" init="430" /> <inits slider="def&gt;==========][=&lt;agg" percent="90" init="...

sql - Searching for record(s) in a table that has over 200 Million Rows -

sql - Searching for record(s) in a table that has over 200 Million Rows - which type of index should used on table? inserted (one month) empty table. place non clustered composite index on 2 of columns. wondering if merging 2 fields 1 increment performance when searching. or not matter? should working identity column has primary key clustered index? you should index field(s) used in clause people query table. don't worry primary key - has index. sql

c# - How can I format a date? -

c# - How can I format a date? - //this month int (e.g. 4) datetime dlastmonth = datetime.today.addmonths(-1); int ilastmonth = dlastmonth.year; how can create above code output 01, 02, etc... instead of 1, 2, 3... i'm confused question, if want format string (01, 02, 03 etc) use: var formatted = ilastmonth.tostring("d2") console.writeline(formatted); c# .net date format

c# - How to trace every method called -

c# - How to trace every method called - i have existing project find out calls beingness made , maybe dump log file. i had at thread, didnt help much. tried postsharp, , illustration shows how accomplish it. need add together attribute every darn method. beingness existing project, in-numerous methods not feasible option. is there other means can trace calls made? use profiler in tracing mode. see how phone call each other , time spent. besides commercial profilers there free ones. managed code there np profiler quite good. if want go deeper can utilize windows performance toolkit gives total info accross threads , how interact each other if want know. difference stacks ranging kernel until managed frames. if not plenty can instrument code tracing library (either automatically postsharp, ....) or manually or macro each source file. have made little tracing library quite fast , highly configurable. see here. unique feature can trace thrown exception autom...

c# - How do I send one of the "new" messageboxes? -

c# - How do I send one of the "new" messageboxes? - how send this: i remember in desktop c# messagebox.show(all arguments); i don't know how google question because know nil them.. help? that's not messagebox , it's "toast". here's basics - http://code.msdn.microsoft.com/windowsapps/toast-notifications-sample-52eeba29 c# windows-8

c# - Catch ANY error of streaming video (VLC ActiveX) -

c# - Catch ANY error of streaming video (VLC ActiveX) - i have investigated methods have utilize via c# code or javascript of vlc player activex , cannot see existing or working methods help info if there error of playing of streaming video. i have used playing property see show when connection net turned off during playing , shows true . :( wow! to create clear need command streaming errors of vlc player activex in order re-start streaming if there error automatically seems api done take direct user input only. this link http://wiki.videolan.org/.net_interface_to_vlc does't help. my question: there method/property indicate streaming video error? afaik there no alternative accomplish inquire when using vlc streaming part... there commercial options allowing tight command including error handling/notification: if commercial library alternative take @ http://www.visioforge.com/media-player-sdk-net.html another commercial alternative leadtools m...

android - Add a view to a listView and to a scrollView -

android - Add a view to a listView and to a scrollView - i seek add together view scrollview , layout (linear or relative doesn't alter anything) in same controller relativelayout header = (relativelayout)((layoutinflater)getsystemservice(context.layout_inflater_service)).inflate(r.layout.frame_header, null); mlistview.addheaderview(header); mlayout.addview(header); but when that, crash with java.lang.classcastexception: android.widget.linearlayout$layoutparams cannot cast android.widget.abslistview$layoutparams moreover, when assign view listview or layout works perfectly.. anyone has thought solve problem? a view can have 1 parent, want not possible. android android-listview android-linearlayout

Mule ESB - How to create a HTTP request with POST method (sending parameters along) -

Mule ESB - How to create a HTTP request with POST method (sending parameters along) - short: want post couple of parameters (like user=admin, key=12345678) using post method php page (like localhost/post-debug.php). script read $_post values , whatever. my questions are: 1. how can illustration below work? 2. how can create map payload post parameters json encoded payload , send php script? below isolated case trying running (the parameters "read" http endpoint). calling straight browser next url: http://localhost:8081/httppost?user=admin&key=12345678 the underlying xml: <?xml version="1.0" encoding="utf-8"?> <mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="ce-3.3.1" xmlns:xsi=...

JQuery code after each ajax call -

JQuery code after each ajax call - i have customized long sharepoint library editform dividing 5 sections. code used given marc anderson @ http://sympmarc.com/2011/08/18/taming-long-sharepoint-list-forms-using-jquery-to-break-them-into-sections/, though customized little suit needs. the problem facing have 3 fields on page cascading lookups [implemented 3rd party server solution]. whenever alter value of 1 of these lookup fields, alter options available in other list boxes break section construction created above jquery code. standard rows , columns appear in sequence should header rows created jquery appear @ bottom of page. i tried using window.load instead of document.ready , made few other modifications. success got first lookup field works fine now, sec , 3rd still break section structure. there improve way create sure jquery code runs after each ajax phone call , after ajax response handlrers have completed execution? if there improve way accomplish same thing,...

Grails Custom Scaffolding get access to controller name -

Grails Custom Scaffolding get access to controller name - i trying write custom src/templates/scaffolding/controller.groovy , wondering if there way access controller name? right seems can "model" class. reason need customizing render prefix templates directory based on controller. for instance have controller named authoradmincontroller , need customize list utilize /admin/user/** directory. let me know if have questions. getting ready how customize defaultgrailstemplategenerator not sure if right route go. example: class useradmincontroller { static scaffold = user } currently in controller.groovy classname='user' have no access controller. i don't think can, way scaffolding works template always generating class named domainclassnamecontroller (i.e. usercontroller in example), gets loaded new classloader , metaclass of real controller ( useradmincontroller ) gets new actions added delegate instance of generated userc...

linux - Debian bash script works fine from command line; fails in crontab -

linux - Debian bash script works fine from command line; fails in crontab - i'm trying utilize dreamhost api (see here) update dns entry using crontab. have written next bash script: #!/bin/bash dh_api_key=<my api key> dh_domain=<my fq subdomain> dh_url="https://api.dreamhost.com/?key=$dh_api_key&record=$dh_domain&type=a" ip_addr=`ifconfig eth0 | grep "inet addr" | grep -o "\([0-9]\{1,3\}\.\?\)\{4\}" | head -n 1` old_ip_addr=`wget -q -o - ""$dh_url&cmd=dns-list_records"" | grep $dh_domain | grep -o "\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}"` dh_url="https://api.dreamhost.com/?key=$dh_api_key&record=$dh_domain&type=a" dh_url_add="$dh_url&cmd=dns-add_record&value=$ip_addr" dh_url_del="$dh_url&cmd=dns-remove_record&value=$old_ip_addr" echo $ip_addr echo $old_ip_addr if [ "$ip_addr" == "$old_ip_addr" ] ec...

design - How to use open closed principle for web page operations invocation in java? -

design - How to use open closed principle for web page operations invocation in java? - i have web page users can fill in , submit forms: <form id=email... send email .... <input type="hidden"id="method" value="sendemail"... /> ............. <form id=writeindatabase info ............ <input type="hidden"id="method" value="writeindatabase"... on server side: if (method.compareto("sendemail")==0) { dosendemail(.... } else if (method.compareto("writeindatabase")==0) { dowriteindatabase(.... .............................. i don't architecture because violates open close principle. possible refactor prepare that? thanks. you can utilize reflection in structured, secure manner, or, command pattern. reflection: create map<string, method> maps each acceptable method name reflection method object can invoke after looking up. command p...

Ubuntu Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory -

Ubuntu Tomcat7 java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory - i'm trying set jdbc datasource in tomcat 7 under ubuntu 12.x, added next context.xml file: <resource name="jdbc/myds" auth="container" type="javax.sql.datasource" maxactive="5" maxidle="2" maxwait="5000" driverclassname="org.postgresql.driver" username="usr" password="***" url="jdbc:postgresql://localhost:5432/db" /> obviously, using right , tested database user id , password. when restart tomcat, error: feb 05, 2013 1:10:01 pm org.apache.catalina.core.namingcontextlistener addresource warning: failed register in jmx: javax.naming.namingexception: not create resource mill instance [root exception java.lang.classnotfoundexception: org.apache.tomcat.dbcp.dbcp.basicdatasourcefactory] i googled, , found out jdbc driver has copied $catalina_home/lib folder...

Display 2d matrix on the page using a servlet -

Display 2d matrix on the page using a servlet - i have scenario, wherein need display matrix box in browser output. taking input page, business logic , output of logic matrix need show on page. can see output in console in browser see matrix in 1 line. please help me out. piece of code using servlet : out.println("matrix"); (int = 0; < n; i++) { (int j = 0; j < n; j++) {`enter code here` out.print(matrix[i][j] + " "); } out.print("\n"); } browsers want see html instead of text. add together newlines out.print("<br/>") , or add together out.print("<pre>"); first output, or output content-type header saying content text/plain. servlets

json - jquery dynamic select list does not populate automaticaly in Codeigniter -

json - jquery dynamic select list does not populate automaticaly in Codeigniter - my limits. can not create work: want create dynamic select list jquery , json populate info database see fetches info in firebug console not populate select box. here's view: <div class="control-group"> <label class="control-label" for="inputpassword">grad</label> <div class="controls"> <select name="city" id="city" class="update"> <option value="">odaberi</option> <?php if (!empty($results)) { ?> <?php foreach($results $row) { ?> <option value="<?php echo $row->city_id; ?>"> <?php echo $row->city_name; ?> </option> <?php } ?> ...

mongodb - Mongoengine: How to append a new document to an Embedded ListField document? -

mongodb - Mongoengine: How to append a new document to an Embedded ListField document? - i append new listfield embeddeddocument existing listfield embeddeddocument document. in other words appending new document list belongs a document in list. my model: post can contain several comments, each comment can have several likes: class post(document): txt = stringfield() comments = listfield(embeddeddocumentfield(comment)) class comment(embeddeddocument): comment = stringfield() comment_id = objectidfield() likes = listfield(embeddeddocumentfield(like)) class like(embeddeddocument): user = referencefield(user) date = datetimefield(default=datetime.utcnow,required=true) my code: (it's not working 'append' command dosen't exists, 'set' exists) def appendnewlike(): user = {..} target = objectid(commentid) newlike = like(user=user) product.objects(comments__comment_id=target).update(append_comments__s__likes=...

ios6 - Xcode skipping Starting Number in Build Identifier -

ios6 - Xcode skipping Starting Number in Build Identifier - i developing ios app name 101brainexercises. product name in project build settings 101brainexercises. buildidentifier name com.neurotrain.-01brainexercises. if give product name brainexercises101 works fine i.e., com.neurotrain.brainexercises101. am using xcode 4.5.2 , ios6 sdk help appreciated -- thanks. the project name restricted rfc 1035 (domain names - implementation , specification), specifically: <domain> ::= <subdomain> | " " <subdomain> ::= <label> | <subdomain> "." <label> <label> ::= <letter> [ [ <ldh-str> ] <let-dig> ] <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str> <let-dig-hyp> ::= <let-dig> | "-" <let-dig> ::= <letter> | <digit> <letter> ::= 1 of 52 alphabetic characters through z in upper case , through z in lower case <digit> ::...

SQL Server distinct not being used properly -

SQL Server distinct not being used properly - i'm trying select 1 business relationship using sql server getting next error: error: text info type cannot selected distinct because not comparable. error code: 421 with next statement: select distinct ad.*, acc.companyname, acc.accountnumber address advertisement bring together addresslink al on al.addressid = ad.id bring together business relationship acc on acc.id = al.parentid acc.accountnumber '11227' what have done wrong? edit: new query: select address.id, address.streetaddress1, address.streetaddress2, address.city, address.state, address.postalcode, address.classtypeid, account.companyname, account.accountnumber, addresslink.id addresslinkid, addresslink.addresstypeid address bring together addresslink on address.id = addresslink.addressid bring together business relationship on addresslink.p...

java - How to read a string containing a '\' using opencsv? -

java - How to read a string containing a '\' using opencsv? - when i'm reading csv-file using opencsv doesn't work when encountering '\' @ end of string. makes " part of string, instead of '\' want to. guess there must method add together '\' escape '\'-character instead? without having manually edit csv-file. have searched not found anything. to clarify problem, looks this: csv-file "a", "b", "c", "d" "value 1", "value 2", "value 3", "value 4" "value 5", "value 6\", "value 7", "value 8" my code looks (not really, shows problem): string infile = "in.csv"; csvreader reader = new csvreader(new filereader(infile)); string[] line; while ((line = reader.readnext()) != null) { (int = 0; &lt; line.length(); i++) { system.out.println(i + " " + lin...

Transitive Test Dependencies and Maven Dependency Cycles -

Transitive Test Dependencies and Maven Dependency Cycles - i have 3 modules a, b, c. has compile/default dependency on b, b has test dependency on c , c has compile/default dependency on a. maven detects cycle, b's tests (not non-test code) dependent on c , neither c nor dependent on b's tests. is there reason why maven still detects cycle? there way resolve it? you can break 1 of projects in api , implementation. you create b-api project. link against b-api compilation. can add together b runtime dependency if required. should out of loop. the b-api project should provide interfaces implemented b. code against interfaces , wire against implementation @ runtime. maven maven-dependency-plugin

java - long running CallableStatement execute without wait -

java - long running CallableStatement execute without wait - i have stored procedure requires ~3 hours execute. , not want wait until procedure homecoming value or wait until callablestatement execute() method executed. there such possibility in jdbc? or should utilize methods trigger or execute in new thread? thanks. was set reply thought i'd check dupes , found: is asynchronous jdbc phone call possible? this reply gives lots of recommended patterns workaround "limitation". me, set recommend take @ threading solution, perhaps using threadpoolexecutor if require mulitple io-bound calls (although you'd need wary of clogging db sessions). java oracle jdbc

javascript - SwipeJS remove space around slides -

javascript - SwipeJS remove space around slides - i'm trying remove whitespace / padding around slides swipejs slideshow on website building. have figured out how rid of top , side borders there still white border @ bottom cannot life of me figure out how rid of. here link project: http://mnice.mydevryportfolio.com/wcoilmobile/ if needs style.css or swipe.js files can post well. if utilize debugging tool on page can see height set 106 instead of 103 same height first image. help appreciated! ![here seeing debugger turned on][1] javascript height padding swipe

.net - SOAP with Attachments -

.net - SOAP with Attachments - i need send soap (with attachments) message via http post 3rd party. contents of soap header need customised , additional info sent attachment. both soap header (the kid elements within specific) , attachment need signed , included in soap header. there no wsdl available no proxy code can generated. the way can think of doing @ moment build message scratch manually i.e. build contents of soap header series classes (with help of xsd.exe), add together signature, serialise xml, insert manually constructed mime message , similar attachment. while give me total command on contents of message feels long winded way of doing .net gives me free. so guess question is, there improve way of doing this? can give me pointers on begin? i've been looking wcf don't believe supports attachments or custom soap headers - correct? .net soap

Would this be a reliable way to deal with rounding errors when multiplying floating point numbers in Javascript? -

Would this be a reliable way to deal with rounding errors when multiplying floating point numbers in Javascript? - i adding client-side sub-total calculations order page, volume discount show user makes selections. i finding of calculations off 1 cent here or there. wouldn't big deal except fact total doesn't match final total calculated server-side (in php). i know rounding errors expected result when dealing floating point numbers. example, 149.95 * 0.15 = 22.492499999999996 , 149.95 * 0.30 = 44.98499999999999. former rounds desired, latter not. i've searched on topic , found variety of discussions, nil satisfactorily addresses problem. my current calculation follows: discount = math.round(price * factor * 100) / 100; a mutual suggestion work in cents rather fractions of dollars. however, require me convert starting numbers, round them, multiply them, round result, , convert back. essentially: discount = math.round(math.round(price * 100) * math....

How to test for asynchronous HTTP requests in ruby using EventMachine -

How to test for asynchronous HTTP requests in ruby using EventMachine - i'm getting messages of rabbitmq queue , each message url want create request to. i'm using amqp gem subscribe queue , uses eventmachine, i'm using the em-http-request library create http requests. according documentation here: https://github.com/igrigorik/em-http-request/wiki/parallel-requests next issue asynchronous http-requests: eventmachine.run { http1 = eventmachine::httprequest.new('http://google.com/').get http2 = eventmachine::httprequest.new('http://yahoo.com/').get http1.callback { } http2.callback { } end so when subscribe rabbitmq queue have next code: x = 0 eventmachine.run connection = amqp.connect(:host => '127.0.0.1') channel = amqp::channel.new(connection) channel.prefetch(50) queue = channel.queue("http.requests") exchange = channel.direct("") queue.subscribe |metadata, paylo...

php - how to show/hide submit button on array checkbox -

php - how to show/hide submit button on array checkbox - how can apply http://jsfiddle.net/8ybu5/24/ codes shown below. hides submit button checkbox checked or unchecked form load... foreach($results $result) { <input type ='checkbox' name ='studid[]' value='". $result['studid']."' id='checky' > echo ' ', $result['fname'],' ',$result['mname'],' ',$result['lname'],'<br/>'; } <input type="submit" name="select" value="select" id='postme' > foreach($results $result) { <input type ='checkbox' name ='studid[]' value='". $result['studid']."' class='checky' > echo ' ', $result['fname'],' ',$result['mname'],' ',$result['lname'],'<br/>'; } <input type="submit" name=...

ruby - Iterate through files in rails directory, do something with filename? -

ruby - Iterate through files in rails directory, do something with filename? - in rails project construction have created folder pages under path db/pages . iterate through html.erb files in db/pages directory , dosomething filename of each of these files. should happen when run rake db:seed have placed code in seeds.rb below attempted code: source_path = "/db/pages" dir.glob("#{source_path}/*.html.erb").each |html_page| dosomething html_page end this seems doing nil when run rake db:seed. have gone wrong? try prepending rails.root: dir.glob("#{rails.root}#{source_path}/*.html.erb").each |html_page| an more right approach be: source_path = rails.root.join('db', 'pages') dir.glob("#{source_path}/*.html.erb").each |html_page| ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.1

php - ajax call on CodeIgniter page returns result "an empty string" -

php - ajax call on CodeIgniter page returns result "an empty string" - i've got ajax script in index.php of ci application. trying homecoming simple string @ point testing. i'm using next code this: <script> $(document).ready(function() { $.ajax({ type: 'post', url: 'index.php/loader/opc_client', datatype: 'json', cache: false, success: function(data) { console.log(data); $('#opc-results').html(data.test); } }); }); </script> the url in phone call standalone file it's own controller. when access file straight in browser it's loaded , returns expected results. next php code: <?php echo json_encode("test"); ?> i can see post results in firebug after function fired firebug window displays "an empty string" under post in console view. any clues...

c# - Sending text with SendMessage to another program that has changing control id's and class names that are the same -

c# - Sending text with SendMessage to another program that has changing control id's and class names that are the same - details: started coding in c# , remaking programme made in autoit3. programme pulls text html , sends programme clicks buttons. didn't create other programme values beingness sent to. can access controls/handles/id using spy++. problem: problem have ran using sendmessage send text controls in program. problem have same class name. in autoit used "edit4". 4th text box class name "edit" in given window. going utilize getdlgitem , controlid found out controlid changes according spy++. not think possible anymore. workarounds: thinking of finding first text box findwindowex , using getwindow , gw_hwndnext find next, , on. approach seems poor , inaccurate. thought of getting array of controls in program/window, filtering array class name, using instance of command looking for. there has improve way approach this. sendin...

joomla2.5 - Joomla Change Featured field default to Yes -

joomla2.5 - Joomla Change Featured field default to Yes - in joomla add/edit article there featured field default selected no want select yes default in joomla\administrator\components\com_content\models\forms\article.xml i modify code per requirement <field name="featured" type="list" label="jfeatured" description="com_content_field_featured_desc" default="0" > <option value="0">jno</option> <option value="1">jyes</option> </field> to <field name="featured" type="list" label="jfeatured" description="com_content_field_featured_desc" default="1" > <option value="0">jno</option> <option value="1">jyes</option> <...

javascript - JSON structure to populate options for SELECT -

javascript - JSON structure to populate options for SELECT - in question asked here, see next code can used adding options select function getresults(str) { $.ajax({ url:'suggest.html', type:'post', data: 'q=' + str, datatype: 'json', success: function( json ) { $.each(json, function(i, optionhtml){ $('#myselect').append(optionhtml); }); } }); }; can please tell me, format of json should be, on php server side. like, how should created, so parsed correctly "$('#myselect').append(optionhtml);" ?? that code parse json, array of strings markup. [ "<option value='...</option>", "<option value='...</option>", "<option value='...</option>", ... ] this pretty much defeats purpose of json though. it have been improve if json contained ...

Why stackoverflow's google prettifier works with , e.t.c tags in or tag? -

Why stackoverflow's google prettifier works with <body>, <html> e.t.c tags in <code> or <pre> tag? - i asked question before why <code> tag not back upwards <html>, <head>, <body> tags. reply got not supported. few days back, in meta.stackoverflow.com, saw question stackoverflow's code highlighter (some issue). someone, answered google prettifier. noticed , remembered it. google prettifier, recommends utilize <code> or <pre> tags code prettifying. how stackoverflow's code tag back upwards html tags display code? the <code> element back upwards arbitrary content. have encode html int here, this: <code> &lt;html&gt; html document &lt;/html&gt; </code> that's stackoverflow if type <html> html document </html> html