Posts

Showing posts from August, 2012

javascript - simulate click on dynamically added element -

i want simulate click on dynamically appended element. code used not work. don't know how can move forward script. used .trigger() method on load event of window. not work. code: $( function() { $.post("ajaxify.php", "name=heart", function(html) { $("#menu ul").append("<li>"+html+"</li>"); }); }); $(window).load( function() { $("#menu ul li").trigger("click"); }); when adding new 'li' elements menu, can trigger click on 1 list element: $('<li />').text('my text here').appendto('#menu ul').trigger('click');

sql - Manipulating Data in Joins -

Image
diagram: query join: select distinct c.customerid, c.firstname , sh.duedate, p.productid,p.listprice saleslt.customer c inner join saleslt.salesorderheader sh on c.customerid = sh.customerid inner join saleslt.salesorderdetail sd on sh.salesorderid = sd.salesorderid inner join saleslt.product p on sd.productid = p.productid order listprice desc output: desired result: for desired output: what add on existing query? what optimized way of doing query ? what time , space complexity sub query , join? i think want: select c.customerid , c.firstname , sh.duedate , max(p.productid) productid ,p.listprice saleslt.customer c inner join saleslt.salesorderheader sh on c.customerid = sh.customerid inner join saleslt.salesorderdetail sd on sh.salesorderid = sd.salesorderid inner join saleslt.product p on sd.productid = p.productid group , c.firstname , sh.dueda

pip - How to install python packages on python2.7 using yum -

here question: how install python packages on python2.7 using yum, yum default installs packages on 2.4 (the default python on redhat). or how can install yum on python2.7 make default installation python2.7 i don't think can that. yum packages set have been 'approved' redhat particular redhat version, , they've approved v2.4 version. so, you'll either have upgrade redhat, or use 'unapproved' packages. from experience, redhat slower approve new versions of packages other distributions, might want switch redhat-esque fedora or debian-esque ubuntu , tend update newer versions more quickly.

javascript - What is the difference between synchronous and asynchronous programming (in node.js) -

i've been reading nodebeginner , came across following 2 pieces of code. the first one: var result = database.query("select * hugetable"); console.log("hello world"); the second one: database.query("select * hugetable", function(rows) { var result = rows; }); console.log("hello world"); i they're supposed do, query database retrieve answer query. , console.log('hello world') . the first 1 supposedly synchronous code. , second 1 asynchronous code. the difference between 2 pieces vague me. output be? googling on asynchronous programming didn't me either. the difference in first example , program block in first line. next line ( console.log ) have wait. in second example , console.log executed while query being processed. is, query processed in background, while program doing other things, , once query data ready, whatever want it. so, in nutshell: first example block

Display a a related entity property value as a form label in symfony -

this stems question question has changed slightly: odd many-to-many form rendering symfony , doctrine my entities formula one-to-many formulacolor many-to-one color. formula (id, code, name) formulacolor (formula_id, color_id, percentage) color (id, code, name) a formula can have 1 or more colors , each color makes percentage of formula. i'm trying make formula edit type show percentage fields given formula , label or title each percentage field color->name label. showing percentage fields formula, want label each 1 color name. how can this? have somehow use querybuilder? i have formulaaddedittype looks this: public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('code', null, array( 'label' => 'code' )) ->add('name', null, array( 'label' => 'name' )); $builder->add('formulacolors

c - function using fopen() keeps opening the same file, even if given different filenames as parameters -

i'm trying open multiple files sequentially, using fopen(), printing contents , counting chars. in main() call function twice using different filenames function prints contents of first file twice . both files exist, of course, , calling function once print correct contents; tested both files. there seems problem when calling function multiple times. can please give me hint? wrong? my function: void open_and_read(char file_name[80]){ char c; int buf_length = 16384; char buf[buf_length]; char* buf_pointer; int = 0; file *file_pointer; file_pointer = fopen(file_name,"r"); buf_pointer = buf; if(file_pointer==null){ printf("error: file %s not opened!", file_name); } else { while(c!=eof && i<(buf_length-1)){ c = fgetc(file_pointer); *buf_pointer = c; buf_pointer++; i++; } buf_pointer--; *buf_pointer = 0;

php - Update details in cart widget without loading page by using ajax in Woocommerce -

i developing woocommerce widget show cart subtotal, cart total, cart items, , shipping total working fine want update shipping total cart total whenever toggle between shipping methods use of ajax. updates after page reload. there hook available purpose ? you can add_to_cart_fragments filter. my implementation updates number of items shown ajax can used update totals, etc well. normal code in template displays cart details: <a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>"> (<?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count); ?>)</a> this filter added in functions.php : // update items in cart via ajax add_filter('add_to_cart_fragments', 'woo_add_to_cart_ajax'); function woo_add_to_cart_ajax( $fragments ) { global $woocommerce; ob_star

Issue while using expect script in bash script -

i learned same site can embed expect script in bash script shown below: echo $hostname /usr/bin/expect -<<eod spawn ssh "-o stricthostkeychecking no " bmaddi@10.102.238.158 sleep 5 expect "$*" send -- "scp \"-o stricthostkeychecking no\" file user@hostname: \r" expect "$*" send -- "exit \r" expect eof eod when trying execute above script logs on host , stuff on there , come original host, facing following error: invalid command name "eod" while executing "eod " . not recognizing eod end of usage of expect script , hence abruptly ending there. can 1 please suggest solution issue. thank in advance.

ios - XEP 0055 (Jabber search) with iphone SDK -

i creating xmpp sample on ios. trying search user on xmpp. checked opernfire server , has search plugin enabled. gone through xep:0055 , found stanza. gone through this question did i done xmpp connection , login. here details regarding server: host name = 10.x.x.x; server name = abcd; the request format got xep 0055 link is: <iq type='set' from='romeo@montague.net/home' to='characters.shakespeare.lit' id='search2' xml:lang='en'> <query xmlns='jabber:iq:search'> <last>capulet</last> </query> </iq> i don't know characters.shakespeare.lit is. assume server name. created following request: <iq to="abcd" id="search2" xml:lang="en"> <query xmlns="jabber:iq:search"> <username>kapil</username> </query> </iq> but not getting response. tried replace to value following search.abcd

random - C# Dice game, turn this into a user typed input -

ive made dice "game" randomly chooses number , "rolls" see how many rolls takes same number. problem im having how can make pyöräytys typed in user. using system; using system.collections.generic; using system.linq; using system.text; namespace noppapeli { class program { static void main(string[] args) { int pyöräytys; int satunnainen; int luku = 0; random noppa = new random((int)datetime.now.ticks); int.tryparse(console.readline(),out pyöräytys); console.writeline("arvon numeron ja sitten koitan saada sen uudelleen"); console.writeline("haettava numero on: " + pyöräytys); console.readline(); { luku++; satunnainen = noppa.next(1, 7); console.writeline("numero on: " + satunnainen); if (satunnainen == pyöräytys)

php - Set value of an input control using JasperReports Web Services -

i using jasperreports server web services retrieve report pdf using php curl. unfortunately, report want generate uses value input control if don't provide value input control, report works every value 0. according official guide : jasperreports server web services guide page 24, says should use ic_get_query_data argument in url did , provided uri of data source , used p_param_name provide value of parameter can't work, seems report not using these values. thank in advance comment may ! you may consider using new run report mechanism (part of "restv2 services"). can supply input controls report query items in url. multi-select inputs can defined many times need selections made. for example, if send request http://[yourserver]:[port]/jasperserver/rest_v2/reports/uri/to/my_report.pdf?state=ca&state=ok&city=sacramento you report state control set "ok" , "ca", , city control set "sacramento" it may benefi

winforms - C# adding control from another class -

i want add form controls dynamically form class inherits form class. works fine not add controls @ run time. here sample code: namespace namespace1 { public partial class form1 : form { ..... } ....... }// end of namespace1 namespace namespace2 { public class1:form1 { public button button = new button(); public void method1() { button1.name="button1"; //flowlayoutcontrol1 public control on form1 flowlayoutcontrol1.controls.add(button1); } } }

Java synchronized vs deadlock example -

i not familiar threads , concurrent programming. looking simple snippet result in deadlock, here : public class testlock { private static class fun { int a,b; void read() {system.out.println(a+b);} void write(int a,int b) {this.a=a;this.b=b;} } public static void main (string[] args) throws java.lang.exception { final fun d1=new fun(); final fun d2=new fun(); thread t1=new thread() { public void run() { for(int i=0;i<5;i++) { synchronized(d2) { d2.read(); try { thread.sleep(50); } catch (exception ex) { ex.printstacktrace(); } synchronized(d1) { d1.write(i, i); } } } }; th

PDF contains a lot of white text, how to make it black (partial ghostscript solution already) -

gs -o res.pdf -sdevice=pdfwrite -c "/osetcolor {/setcolor} bind def /setcolor {pop [0 0 0] osetcolor} def" -f input.pdf this changes tables have white borders, (which step in right direction) i'd turn white font black. these big pdfs pdfedit no. said, above partial solution. the font white, background white, default colours (it's black colour scheme) on machine made on meant wasn't known author. swap wont work. i converted document post-script , used function (not sure called) turn black, worked, wrote in answer different question of mine similar title.

Serial port communication in Qt -

i new qt , need prepare project send hex commands rs232. qstring line contains 64bit binary data have convert hexadecimal , send through rs232 . qstring a=ui->combobox->currenttext(); qstring s1; s1="./calc "+a; qprocess p1; p1.start(s1); p1.waitforfinished(-1); qstring line ; //read qfile file("teleoutput.txt"); if (!file.open(qiodevice::readonly | qiodevice::text)) return; qtextstream in (&file); line = in.readall(); ui->plaintextedit->setplaintext(line); so, how convert 64 bit binary data in qstring line hexadecimal value , transfer through rs232? first of - should use qtserialport second of - qstring class, works actual string. qbytearray works raw data. when write qstring line = in.readall(); implicitly calls qstring(const qbytearray &ba) , uses qstring::fromascii . last of all, if want process 64bit integers, should this: quint64 d; qdatastream strea

unable to create SED command to make changes in lines other than starting with specific words -

i working on html project , have manipulate huge number of files, using sed, head & tail work got stuck @ point. strings delete <i><font color="#000000"> , <font color="#000000"><i> but not in lines starts <b><font color="#000000"><p align="justify"> , <p align="justify"> , </font></b><p align="justify"> ` by way have written 1 can't figure out whats problem it sed -rei '/^<b><font color="#000000"><p align="justify">relations.|<p align="justify">|</font></b><p align="justify">/! s/<font color="#0000ff"><i>|<i><font color="#0000ff">//g' any or suggestions appreciated. regards edit: after looking @ htmls again got know want edit 8th line till end except last line of files example line 1 <i>som

c++ - Coexistence among global operator<< and member operator<< -

does know how make these 2 overloaded operators coexist? #include<iostream> template< typename t > class a; template< typename t > std::ostream& operator<<( std::ostream& o, const a<t>& e ); template< typename t > class { a& operator <<( const a& e ); friend std::ostream& operator<< <>( std::ostream& o, const a<t>& e ); }; int main() { // program return 0; } // def a<t>::a& a::operator <<( const a& e ); // def std::ostream& operator<< <>( std::ostream& o, const a<t>& e ); error: $ g++ prov.cpp -o prov prov.cpp:13:33: error: declaration of ‘operator<<’ non-function prov.cpp:13:33: error: expected ‘;’ @ end of member declaration prov.cpp:13:36: error: expected unqualified-id before ‘<’ token i’m sorry bad english. reason write little. greeting , thanks! i think want: friend std::ost

asp.net mvc - What is the string format to display the zeros (minimum 3 digits) after the decimal point in cshtml view page? -

if value 3, should display 3.000, minimum 3 decimals. for eg., if value 2.05, displaying 2.05 is. but, needs display 2.050. code: <span class="column-nos">@html.label("", string.format("{0}", nos[i].conversion.tostring()), new {@class = "numbers-conversion-value"})</span> format values , not convert values string, drop tostring() string.format("{0:0.000}", the_value) your code should this: <span class="column-nos">@html.label("", string.format("{0:0.000}", nos[i].conversion), new {@class = "numbers-conversion-value"}) </span>

mysql - Values not passing to php with ajax -

i have following script : <script type="text/javascript" > $('form').each(function() { $(this).on('submit', function() { var first_firstname = $(".first_firstname", this).val(); var first_lastname = $(".first_lastname", this).val(); var second_firstname = $(".second_firstname", this).val(); var second_lastname = $(".second_lastname", this).val(); var teamname = $(".teamname", this).val(); var datastring = 'first_firstname='+ first_firstname + '&first_lastname=' + first_lastname + '&second_firstname=' + second_firstname + '&second_lastname=' + second_lastname + '&teamname=' + teamname; $.ajax({ type: "post", url: "data.php", data: datastring, success: function(){ window.settimeout(function(data) { $('#propspectdiv').html('team name added!'); $('#data').css("display","block")

PHP variable value from string -

how can value variable string ? $member_student = 3600; $selecteditem = "member_student"; $price = "$" . $selecteditem; print_r($price); //prints $member_student instead of 3600 i cannot use eval function. use curly braces denote variable : $member_student = 3600; $selecteditem = "member_student"; $price = ${$selecteditem}; print_r($price); // prints 3600

c++ - 2 statements creating objects with regular new expression, any difference? -

consider following class user-defined default ctor. class testclass { public: testclass() :data_(999) { } double getdata() const { return data_; } private: double data_; }; then create objects: testclass *p2 = new testclass(); testclass *p1 = new testclass; any difference using 2 statements above in condition? thank you, short answer: no difference. longer answer: §5.3.4,15 states that a new-expression creates object of type t initializes object follows: — if new-initializer omitted, object default-initialized (§8.5); if no initialization performed, object has indeterminate value. — otherwise, new-initializer interpreted according initialization rules of §8.5 direct-initialization. and §8.5,16 says if initializer (), object value-initialized . now value-initialization , default-initialization, defined §8.5,5-7: to zero-initialize object or reference of type t means: — if t scalar type (3.9), obj

multithreading - Printing a list array which uses threads to a text area in java -

i having problems storing , printing list array uses threads. want store list of threads in list array , print them text area can sorted user. code below array class , transaction class. import java.util.arraylist; /** * @author b00533474 */ public class array { arraylist<transaction> transactionlist = new arraylist<transaction>(); // variables private final transaction nexttransaction; public static int inint2 = tranacc.inint2; public static int inint3 = tranacc.inint3; public static string inint1 = tranacc.inint1; //public static void main(string[] args){ public array(){ nexttransaction = new transaction(inint1, inint2, inint3, 2000); transactionlist.add(nexttransaction); transactionlist.get(3); } /*public static void main(string[] args){ array ar = new array(); ar.add(nexttransaction); } * */ } the variables inint1 etc class called tranacc main gui of project. package bank

java - Bruteforce and matching gives reverse/wrong results -

Image
i've been making application 2 images can compared (2 pictures on smartphone). there use fast detector , freak descriptor on limited amount of keypoints (i filtered out 300 best ones according response). when try match bruteforce_hamming, gives 0 matches. matching happens with matofdmatch matches = new matofdmatch(); matcher = descriptormatcher.create(descriptormatcher.bruteforce_hamming); matcher.match(descriptors,descriptors1,matches); matofdmatch goedematches = new matofdmatch(); double max_dist = 0; double min_dist = 100; //if (descriptors.cols() == descriptors1.cols()) //{ for( int = 0; < descriptors.rows(); i++ ) { double dist = matches.toarray()[i].distance; if( dist < min_dist ) min_dist = dist; if( dist > max_dist ) max_dist = dist; } // should draw matches for( int = 0; < descriptors.rows(); i++ ) { matofdmatch temp = ne

properties - Passing a defined pom.xml property to @jboss.entity-command in java class -

i have project several entity beans , @ point have @jboss.entity-command name="informix-serial" in dev, database mysql in prd have informix. want pass property defined in pom.xml, associated profile when compile project. i've tried this: in pom.xml <profiles> <profile> <id>dev</id> <properties> <jboss.entity.command>mysql-get-generated-keys</jboss.entity.command> </properties> </profile> <profile> <id>prd</id> <properties> <jboss.entity.command>informix-serial</jboss.entity.command> </properties> </profile> </profiles> and in beans: @jboss.entity-command name="${jboss.entity.command}" the problem is, obviously, variable ${jboss.entity.command} not being resolved value. any light on subject appreciated. thanks in advance, ml

c++ - What's the correct way to initialize a member array with an initializer list? -

i have struct holds array, , i'd pass initializer list struct's constructor forwarded on array. illustrate, tried: #include <initializer_list> struct vector { float v[3]; vector(std::initializer_list<float> values) : v{values} {} }; int main() { vector v = {1, 2, 3}; } which resulted in error : error: cannot convert ‘std::initializer_list<float>’ ‘float’ in initialization i tried using parentheses instead of braces v gave error: error: incompatible types in assignment of ‘std::initializer_list<float>’ ‘float [3]’ my main motivation trying avoid following warning clang generates: template <int n> struct vector { float v[n]; }; template <> struct vector<2> { float x, y; }; int main() { vector<2> v2 = {1.0f, 2.0f}; // yay, works vector<3> v3 = {1.0f, 2.0f, 3.0f}; // results in warning in clang++ vector<3> u3 = {{1.0f, 2.0f, 3.0f}}; // must use 2 b

sql server 2008 - Another Multipart Identifier Could not be bound -

there million of these questions; have just started working sql , can't seem drag answer out of them. don't understand context enough; promise i'll keep simple. use [metrics] insert dbo.tblsplitdata(splitstring) select * dbo.splitstringcomma(dbo.tblrawdata.delimitedstring) i "multipart identifer not bound" dbo.tblrawdata.delimitedstring portion of query. i've checked spelling (i used ide suggestions insert names, think it's good) , i've gotten statement work in following format: use [metrics] insert dbo.tblsplitdata(splitstring) select * dbo.splitstringcomma('1,2,3,4,5') often "from" statement identified being problem (not identifying tables involved) i'm not sure know how implement that. if delimitedstring data stored in table dbo.tblrawdata need select table , apply delimitedstring column split string function. seems want following: use [metrics] insert dbo.tblsplitdata(splitstring) select c.* dbo.

add on - How to make an add-on for mIRC or any other IRC client that alarms you when a certain string is mentioned in a chat room? -

it'd quite useful me have add-on alerts me when specific said in chat room, same way you're warned if nick mentioned, string you'd like. how 1 go doing this? there interface irc programming, netbeans java example. i'm not sure how approach irc programming, forgive me if assumptions dead wrong. as guy @ comment said, first choose irc client support "scripting" or has built in function alert. solution. code in case of mirc on *:text:*someword*:#channel: { echo -ag alert beep 3 } the code should go "remote" window (alt+r)

java - How to pass the String into combo box? -

i update list in combo box in gui each time when happen. receiving new list server string . list in combo box type static string unitslist[] . have tried array conversion , splitting using comma delimiter. how pass string combo box? simple... jcombobox /*varname*/ = new jcombobox(/*string array here?*/);

bash - Linux shell script - find all files and run a command on each one of them -

i'm trying port windows batch file linux shell script (bash). here part giving me headache: for /r %%g in (*metadata*.xml) ( java -jar %saxon%\saxon9he.jar -o:%%~ng.csv "%%g" %workdir%\transformbqt.xsl) what find .xml file containing text metadata , running xslt transformation on each of these files. takes 3 arguments -o output file (this .csv same name .xml) next target file final argument .xsl file i thinking of using following: find /results/ -type f -name "*metadata*.xml" -exec java -jar $saxon/saxon9he.jar -o:??? {} $workdir/transformxmi.xsl but doesn't quite work don't know how make output file have same name .xml (with .csv extension) any tips? you process results find line line , transform <file>.xml <file>.csv : find /results/ -type f -name "*metadata*.xml" | while read file; java -jar $saxon/saxon9h3.jar -o:${file%.xml}.csv $file $workdir/transform.xmi.xsl; done this simple approach

ASP.NET MVC 4 + Google OAuth for example.com and www.example.com is treated as two different -

i have setup oauth using microsoft/google/facebook account on asp.net mvc 4 site. site can accessed both using www.example.com , example.com. when using microsoft or facebook login user have created account on www.example.com can login on example.com. when using google account user have created login on www.example.com cannot use login on example.com. my question: possible setup google oauth has same behavior microsoft , facebook login (www.example.com , example.com treated 1 site)?

delphi - Comparison of negative and positive numbers -

i have comparison function getting way complex i'm trying do. receive double can positive or negative. storing global variable needs smallest value. in terms of comparison, means smallest positive number, or if incoming values negative, smallest global value negative. my code turning bunch of if statements handling if incoming positive or negative. need compare differently if current global value positive or negative. is there better way compare 2 numbers , lowest of two? partial example code: if nestobject.rectangularscrap <> 0 begin if nestobject.rectangularscrap > 0 begin //positive rect scrap if(nestobject.rectangularscrap < gbestrect) begin gbestrect := nestobject.rectangularscrap; end; if(nestobject.rectangularscrap > gworstrect) begin gworstrect := nestobject.rectangularscrap; end; end else begin //negative rect scrap if gbestrect > 0 begin //global value positive

browser - Detecting an opened internet address in vbscript -

is there way, using vbscript, detect if address opened on internet browser? i'm beginner in vbs don't understand of it. the answer no. you'd need hook system level calls , need done in c/c++ if possible @ all.

javascript - CSS transition & animation to active at same time -

http://jsfiddle.net/bryank/ypxb5/ #spacer{ position:fixed; top:11px; left:200px; height:79px; width:155px; background-color:#fff; } #spacer:active{ -webkit-animation: click .1s 1; -webkit-animation-fill-mode: forwards; } @-webkit-keyframes click{ 0%{-webkit-transform:scale(1,1);} 100%{-webkit-transform:scale(0.9,0.9);} } /*------begin nav------*/ #toggler { display: none; } #nav{ padding:0; position:fixed; top:11px; left:26px; font-family:helvetica; font-size:14px; background-image:url(logo_back.png); /*-- background-color:red; --*/ width:11.1em; height:5.7em; overflow:hidden; transition: height .4s; -webkit-transition: height .4s; } input:checked + #nav{ height:33em; } /*-- #nav a.bg:hover{ background-color: rgba(0,0,0,0.0); } --*/ #nav a{ text-decoration:none; color:#000; } #nav a:hover{ background-color:#858585; } #nav div{ text-indent:0.5em; line-height: 1.2em; } <!--img button--&

bash - How to generate PS1 in a function (escaping issues) -

i'd move bash prompt's construction function can build modularly. problem cannot figure out how function's result interpreted. example: function build_prompt { echo "\@" } export ps1="\$(build_prompt)" my prompt shows \@ , should current time. sure there ways around particular example, i'd general solution can use other escaped components, such colours. this 1 use case prompt_command variable: running function before displaying prompt updates value of ps1 . function build_prompt { ps1='\@' } prompt_command='build_prompt'

How do I know if Amazon Elastic Transcoder has completed transcoding -

is there way have amazon elastic transcoder inform call script has finished transcoding specific video conversion? i'm working on project let people upload videos, has different steps , each step should start @ successful completion of previous step. i have been able trigger next step in every step last step calling aet , instructing go , take videos s3 bucket, transcode them , store them in different s3 bucket. so need know if aet has finished task or not, don't regularly checking status kind of cron job, rather have aet inform system has finished task. elastic transcoder uses amazon sns (simple notification service) notify of status changes. can set sns topic when create pipeline: http://aws.amazon.com/elastictranscoder/faqs/#how_do_i_use_notifications

facebook - How do I get app ID and secret key when there are no options for this on admin page? -

i have third party facebook plugin trying use on wordpress site. asking app id , secret key. cannot find how or on facebook. have searched developers section on fb , found nothing. tutorials have found seem dated looks fb has moved things around. see supposed register app bu there no options on page. please help. https://developers.facebook.com/apps top right of page "create app" button. after create app, select on left hand side , there should "settings" section contains app_id , secret visible in main part of page

java - Populating a HashMap with entries from a properties file -

i want populate hashmap using properties class. want load entries in .propeties file , copy hashmap . earlier, used initialize hashmap properties file, have defined hashmap , want initialize in constructor only. earlier approach: properties properties = new properties(); try { properties.load(classname.class.getresourceasstream("resume.properties")); } catch (exception e) { } hashmap<string, string> mymap= new hashmap<string, string>((map) properties); but now, have this public class classname { hashmap<string,integer> mymap = new hashmap<string, integer>(); public classname(){ properties properties = new properties(); try { properties.load(classname.class.getresourceasstream("resume.properties")); } catch (exception e) { } mymap = properties; //the above line gives error } } how assign properties object hashmap here ? if understand correctly, each value in properties string

Write formatted text on image with iOS sdk -

Image
i need write formatted text on image in current ios app. got example how write text on image. need formatted text. let me share example of text, guys can give me suggestion. here sample text (font should changed) programming contest !!! xyz company when: 1/1/2013 where: south africa time: 3.10 pm please give me suggestion how can formatted text (color , font changed) thanks, arefin if understand question, you're looking nsattributedstring. there several existing examples on so , apple docs . if have specific issue you're struggling with, update question , can address it. the following example applies question stands. borrows heavily existing posts, , assumes way you're writing text on image combining existing image uilabel: nsmutableattributedstring * testastring = [[nsmutableattributedstring alloc] initwithstring:@"programming contest !!! xyz company"]; [testastring addattribute:nsforegroundcolorattributename value:[

Retrieve id from cell with javascript -

i need retrive id of <td> having text content of <td> . for example: ..... <tr> <td id='hey'>hello world!</td> </tr> .... if know text "hello world", possible retrive id of <td> ? / * **** / guys! try solutions offered possible!! explain working obiee 11g , trying write script add format condition grand total not supported. till came solution: <script type="text/javascript"> var threshold = 10; // set threshold /*** definizione colonne da formattare ***/ /*** partire da 0 ***/ var colonneformattate = new array(2); colonneformattate[0] = 0; colonneformattate[1] = 2; /************************************************/ var tds = document.getelementsbyclassname('ptdt'); for(var td =0; td < colonneformattate.length;td++){ var amount = (tds[colonneformattate[td]].innerhtml.replace("€","")).replace(/&nbsp;/g,''); //alert(colonneformattate[td]);

Watir Webdriver : Can we use watir to test web services with json data format -

i new in testing web services json data format. use watir automation. wanted know if can done watir. i looking other options suggestions , links tutorial more welcome. you potentially it, it's not approach i'd take. i'd @ combination of rest-client gem generate requests , handle responses, , json-spec validation 'the cucumber book' has chapter on api testing comes close this. use different similar library (httparty), , don't think knew json-spec or have used it, validation steps rudimentary

excel - VBA complex vlookup -

okay saw number of questions similar mine none quite exact answers didn't help. although may not vlookup process similar 1 closest thing think of title. i have column (a) of values in document , want excel go through each value , in document b find same value in column (a). each value finds want 3 things: i want grab value 2 cells right of each matched value found in document b , paste 1 cell right of value in column of document a i want @ value 3 right of each matched value found in document b , if value "time" put letter "t" 2 cells right of value in column of document a. if value 4 cells right of each matched value found in document b > 5 want excel fill cell 3 cells right of value in column of document formula = value of (column g / column h) in document b same row. in case wording confusing want more complex vlookup. document has column , want @ column fill in columns b, c, , d using table in document b please let me know if have question

java - Control Statements: Why is my 'New Balance' change when I 'charge to credit' then 'pay credit' twice? -

i tried reading start of java book , of exercises summer vacation. came problem: " (credit limit calculator) develop java application determines whether of several department-store customers has exceeded credit limit on charge account.....for customers credit limit exceeded, program should display message "credit limit exceeded". " my code works if use charge credit once. if use charge credit again, new balance value change. example: * acc # = 123 * beginning balance = 20000 * credit limit = 25000 * select transaction = 1 (charge credit) * amount charge = 4000 * select transaction = 2 (pay credit) * amount pay = 2000 [my balance should 22000) * select transaction = 1 (charge credit) * amount charge = 10000 [this shud exceed credit limit] * select transaction = 3 (balance inquiry) * new balance 18000 this problem now. new balance should still 22000 since credit limit has exceeded. 18000. don't know went wrong need help, please. so here's cod

css - Problems with floating two divs side by side (both not following wrapper width) -

first off, excuse lack of knowledge regarding css , html. i'm quite new this. i've read of questions here regarding aligning 2 divs side side here, i've read tutorials. reason, i'm having trouble divs length in code. this test site's url, give guys idea of how looks. and here's html: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>okamainakute ne~</title> <link href="acver3style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main_wrapper"> <div id="banner_area"> <div id="logo"> &l

c - Comparison between intN_t and uintN_t -

this question has answer here: signed/unsigned comparisons 4 answers why negative int greater unsigned int? 6 answers i'm puzzled. example: int x=-1; unsigned y=0; (x<y) ----> false int8_t x=-1; unint8_t y=0; (x<y) ----> true additionally, compiler raises warnings on first comparison, not second. seems (int vs unsigned) - int promoted unsigned (intn_t vs uintn_t) - uintn_t promoted intn_t why have behaviour? like... really? whenever apply binary arithmetic operator (including comparisons) pair of numeric types both shorter int , c converts both operands int before performing operation. whenever apply binary arithmetic operator pair of numeric types same size, mismatched in signedness, , not shorter int , c converts signed operand unsign

javascript - Google Apps Script How to align in a grid -

how align button in center of cell within grid? var buttongrid = app.creategrid(3,2).setid('buttongrid'); buttongrid.setstyleattribute(row, column, attribute, value); buttongrid.setwidget(0,0,multibutton); buttongrid.setwidget(1,0,submitb); this worked: var buttongrid = app.creategrid(3,2).setid('buttongrid'); buttongrid.setstyleattribute("text-align", "center"); buttongrid.setwidget(0,0,multibutton); buttongrid.setwidget(1,0,submitb);

python - generating multiple 1-d arrays from randomizing an array -

i have array of values d = [1,2,3,4,.....100] i wondering how create several 1-d arrays (3,20 or 100) using random.shuffle(d) in single loop? import copy, random result = [] d = range(1, 101) in xrange(100): result.append(copy.copy(d)) random.shuffle(result[-1])

objective c - What are the differences between these two statements? -

#import "viewcontroller.h" @interface viewcontroller () { nsstring *string; } @end @implementation viewcontroller{ nsstring *string; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. } what differences between these 2 statements? better? assuming statements referring 2 different declarations of private instance variable string , there no difference. 2 different ways of declaring private ivar. it's matter of preference. pick one. i use 1 in @implementation block. use class extension private properties , declaring conformance protocols.

linux - Remove quotes sed -

i have file thousands of records pipe delimited each field enclosed quotes. need read line , write line quotes removed new file. correct sed command run correctly? installed sed on windows machine keep [input] "first name"|"last name"|"address"|"city"|"state"|"zip" [output] first name|last name|address|city|state|zip commands have tried separately neither of them work c:\program files\gnuwin32\bin>sed 's/\"//g' "c:\users\abc\documents\testfile.txt" > quoteoutput.txt c:\program files\gnuwin32\bin>sed s/\"//g "c:\users\abc\documents\testfile.txt" > quoteoutput.txt" % echo '"first name"|"last name"|"address"|"city"|"state"|"zip"' | sed -e 's/"//g' first name|last name|address|city|state|zip you n

javascript - Navigation Drop-Down Toggle Issues with Bootstrap -

i had wordpress site's homepage redesigned @ www.seosherpas.com. that designed on theme uses bootstrap. implemented on thesis taking code of customized site, installed in sub-folder, , copied , pasted custom page template. now i'm trying mimic navigation menu site-wide on customized thesis design: www.seosherpas.com/blog/ i've managed mimic design, cannot drop down menus work. have feeling it's issue how i'm calling bootstrap's javascript... maybe, maybe not. have no idea. i have line of code temporarily hide dropdown: .nav-collapse .dropdown-menu { border-bottom: 1px solid #dddddd; /* temporary fix??? display: block; */ } if show 'display: block;' drop down appears appearing, instead of when hovering. add css: .nav-collapse:hover .dropdown-menu { display: block; } and you'll see dropdown when hover on .nav-collapse element dropdown's parent. works every time, every browser. enjoy!

java - date displayed as oracle.sql in IReport -

when displaying date in ireport being displayed oracle.sql instead of actual date[ ex: 12/4/2012 displayed oracle.sql ]. tried changing date formats, difficult determine going wrong. the code date display oracle.sql <![cdata[""+$f{time_registered}]]> the code below displays jasperreport: <textfield> <reportelement uuid="e20e9b37-a687-400f-9b29-e4a210e2d71f" x="661" y="26" width="55" height="20"/> <textelement/> <textfieldexpression><![cdata[""+$f{time_registered}]]></textfieldexpression> </textfield> convert date string using simpledateformat , set object variable then declare variable in jrxml <field name="time_registered" class="java.lang.string"/> then use <textfieldexpression><![cdata[$f{time_registered}]]></textfieldexpression>

asp.net - Can I make a WebRequest without setting ContentLength -

this goofy question i'm testing tool , need create unusual situation. want make post request sends several megabytes of data web server don't want content-length set. (it ok if set 0 or -1.) httpwebrequest automatically sets request.contentlength length of requeststream buffer. there way prevent or circumvent this? you can send post request without setting content-length header using chunked encoding. chunked encoding, send data in segments (or "chunks") instead of in single piece. useful when need send data server don't know size. chunked encoding part of http 1.1 defined rfc 2616 .net provides sendchunked feature support scenario

c# - WebAPI not working in Fiddler -

i have created post webapi can call follows: <script type="text/javascript"> var thedata = { number: "7181112222", username: "myusername", password: "mypassword", enable: "true", }; $.ajax({ type: "post", cache: "false", url: "http://www.######.com/someapi/api/settingsconfig", data: thedata }).done(function (msg) { alert(msg); }).error(function (msg) { alert('fail'); }); </script> i alert of 'success' when run code. when run code in fiddler...yipes!! post http://www.######.com/someapi/api/settingsconfig number=6464482035&username=metheuser&password=9999&enable=true 404 error why inconsistancy! in javascript snippet you're posting json object, while in fiddler example it's x-www-form-urlencoded string. have tried including content-type header request: application/x-www-form-urlencoded ,

c++ - Alternative to map<someKey , map<anotherKey,Identifier > > -

i assign data for each pair of (pointer object, name of method in object), later efficiently retrieve data knowing pointer object , name of method. class object; class data; which container work better: std::map<object*,std::map<std::string, data> > container; or std::map<std::pair<object*,std::string>,data > container; or, should use else? please note of objects have 1 method, few objects having more 1 method. p.s. "work better" mean optimizing speed of access. you mentioned using qt , object qobject . qt has dynamic properties can used attach data specific instance of qobject setproperty member function.

javascript - Is it possible to force the browser to reload the same page with a hash? -

this question has answer here: javascript reload page hash value 8 answers i know can add hash end of url so: window.location.hash = '#myfancyhash'; but various reasons need reload page. on browsers works fine: window.location = window.location.href + '#myfancyhash'; but others refuse reload page since sees new url hash version. is there way force browsers redirect (reload) page anew? window.location.hash = '#myfancyhash'; window.location.reload() this cause reload new hash