Posts

Showing posts from July, 2011

php - How to get value from multidimensional array value -

array ( [updatecategories] => array ( [products] => array ( [0] => array ( [cat_id] => 3 [position] => 2 [product_id] => 8 ) [1] => array ( [cat_id] => 4 [position] => 11 [product_id] => 8 ) [2] => array ( [cat_id] => 3 [position] => 4 [product_id] => 39 ) [3] => array ( [cat_id] => 4 [position] => 9 [product_id]...

Record Sound in Android using ActionScript 3 -

Image
i build application record sound in desktop using actionscript 3 , convert application andriod application there problem sampledataevent.sample_data event doesn't receive data record here code : private var _microphone:microphone; private var _buffer:bytearray = new bytearray(); private var _difference:uint; public function record():void { if ( _microphone == null ) _microphone = microphone.getmicrophone(); _difference = gettimer(); _microphone.setsilencelevel(_silencelevel, _timeout); _microphone.gain = _gain; _microphone.rate = _rate; _buffer.length = 0; _microphone.addeventlistener(sampledataevent.sample_data, onsampledata); _microphone.addeventlistener(statusevent.status, onstatus); } private function onsampledata(event:sampledataevent):void { _recordingevent.time = gettimer() - _difference; dispatchevent( _recordingevent ); var butedata:number; while(event.data.bytesavailable > 0) { butedata = ev...

sql - SELECT DISTINC LOWER : SUBSTR -

i'm having difficulties resolve request: select distinct lower (customername), substr(customer.postalcode, 1, 3) +" "+ substr(customer.postalcode,4,6)as'postal' customer order customer.cuname i'm having message : expected lexical element not found this 1 works perfectly. select distinct customer.name, customer.postalcode as'postal' customer order customer.cuname is can help? select distinct lower (customername), substr(customer.postalcode, 1, 3) + ' ' + substr(customer.postalcode, 4, 6) 'postal' customer order customer.cuname

imap - OAuth 2 SASL string error -

i have generated following sasl string oauth 2: user=designadmin@npmdesign.mygbiz.com^aauth=bearer ya29.ahes6zttyou0nr0vaybrvkznchjpuzepr4hk3w3dxcxfq88^a^a then encoded , sent encoded string this: msb authenticate xoauth2 encoded string but error response as: {"status":"400","schemes":"bearer","scope":" https://mail.google.com/ "} what error mean , how can correct it? i figured out. in case, gmail scope(" https://mail.google.com/ ") missing, token generation process. works fine now.

Bash - replace string inside all files in directory -

i have 31 .ctl files in directory, looks this: load data characterset al32utf8 infile '../dane/kontakty_biura_wyborcze.csv' "str '\n'" append table odi_puw_osoby2 fields terminated ';' optionally enclosed '"' , '"' trailing nullcols ( lp char(4000), wojewodztwo char(4000), powiat char(4000), gmina char(4000), nazwa_instytucji char(4000), kod char(4000), miejscowosc char(4000), adres char(4000), nazwisko_i_imie char(4000), funkcja char(4000), tel_sluzb_stacjon_1 char(4000), tel_sluzb_stacjon_2 char(4000), tel_sluzb_stacjon_3 char(4000), tel_sluzb_kom_1 char(4000), tel_sluzb_kom_2 char(4000), fax_sluzb_1 char(4000), fax_sluzb_2 char(4000), email_sluzb_1 char(4000), email_sluzb_2 c...

mysql - MP3 conversion using Cron? -

i have created php script moves wav files user has uploaded via ftp temporary directory. having problems running lame.exe when accessed via exec have decided run locally on vps , store source file names , destination names in table (for example called cronmp3). i stuck go next. have queue files ready in mysql table, not sure how call them , process them, or put in cron file moving files not problem after conversion, able that. to honest, mysql isn't great queues. recommend adding redis stack. in php using predis: // when file uploaded // add whatever mysql // $mysqli->... // connect redis $redis = new predis\client(); // add $file encodequeue $redis->call('lpush', 'encodequeue', $file); then in cronjob: #!/bin/bash file=`redis-cli lpop encodequeue` lame $file -options > output... whatever

java - Setting session in JSP and getting session in servlet -

i setting session attribute in jsp code below , submitting http form servlet: session.setattribute("qnainfo", qnainfo); system.out.println("session.getattribute" + session.getattribute("qnainfo")); i trying session attribute in servlet code below: httpsession session = request.getsession(true); authqnainfo storedqnainfo = (authqnainfo) session.getattribute("qnainfo"); in servlet null on ie. in chrome value. please resolve this. in browsers ,the session.getattribute("aaaa") working , try ones

SQL Server : error on converting varchar to decimal / float -

i getting error while trying convert varchar decimal . i found place of error unable rectify it. the code use is: select convert(datetime, dbo.payments.recdate, 3) rdate, convert(decimal, dbo.payments.amount), dbo.payments.balance dbo.payments i got error message: error converting data type varchar numeric. the error occurs due value -5.862 in amount column. i try changing value -5.862 5 works properly. anyone please me convert varchar decimal value -5.862 thanks. the problem here twofold: you're storing numeric values text you're not validating input text column your comment says value stored this: - 5.862 , , not this: -5.862 . so here's sql try out: select convert(decimal, '-5.862') select convert(decimal, '- 5.862') notice first "works" (but lets come that), second throws exception. the real answer here not store numeric values text, instead store them in proper numeri...

r - empty page when plotting a network graph using d3Network package -

Image
i'm trying plot network graph using d3network package. tried organizing data match instructions appear on package website (and page), still blank web page. can spot i'm doing wrong? library(d3network) g.top3000 <- structure(list(from = structure(c(1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 3l, 3l, 3l, 4l, 4l, 5l), .label = c("afghanistan", "attack", "people", "pres_bush", "taliban"), class = "factor"), = structure(c(4l, 1l, 5l, 2l, 3l, 1l, 5l, 2l, 3l, 5l, 2l, 3l, 2l, 3l, 3l), .label = c("people", "taliban", "united_states", "attack", "pres_bush"), class = "factor"), weight = c(4, 3, 2, 6, 5, 5, 2, 3, 6, 1, 1, 5, 2, 4, 4)), .names = c("from", "to", "weight"), row.names = c(na, -15l), class = "data.frame") top3000.nodes <- structure(list(name = structure(1:5, .label = c("afghanistan", "at...

JavaScript passing argument via reference -

let i've got kind of code: var obj1 = {test: false}; function testcondition(condition){ if (!condition){ testcondition(condition); } } testcondition(obj1.test); above code pass false argument testcondition . how can pass reference obj1.test instead of passing it's value? edit wow, quick responses!! :) add, cannot pass whole object, because build 1 generic function/method check parameter , oncomplete callback or onerror callback. above code example of situation right now. you have 2 choices, can see: pass object itself, instead of member. can access , modify member: function testcondition(object) { if (!object.test) { testcondition(object); } } testcondition(obj1) alternatively, since you're changing single value, can have value returned function: function testcondition(condition) { if (!condition){ return testcondition(condition); } } obj1.test = testcondition(obj1.test); fyi, code you've display...

java - JSF 2.0 HTMLCommandButton doesn't call ActionListener in Custom Component -

i'm developing popup plain jsf on jboss 7.1 , i'm trying add command button in renderer of popup-class. class popup extends uipanel. popup inside h:form. the code adds button popup: private static final string id_field_tag = "id"; private static final string html_div_tag = "div"; [...] writer.startelement(html_div_tag, component); writer.writeattribute(id_field_tag, konstanten.getpopupfooterid(), id_field_tag); writer.write("\n"); if(popup.isshowdialogbuttons()){ htmlcommandbutton cancelbutton = new htmlcommandbutton(); component.getchildren().add(cancelbutton); cancelbutton.setid(konstanten.getpopupfootercancelbuttonid()); cancelbutton.setvalue(popup.getcanceltext()); if (!popup.getcancelaction().equals("")) { string expression = "#{"+popup.getcancelaction()+"}"; methodexpression methodexpression = expressionhelper.expression_helper. generatemethodexpression(...

c# - How to get data from SQL Server and create a treeview in ASP.NET? -

i have sql server procedure returns categories. category table has foreign key because categories have parent_id column same table. i send these data sql server in way: select id, title, desciption, parent_id category xml auto, root('categories'), elements and these data in c# program by: using (xmlreader xml = cmd.executexmlreader()) { xml.read(); categories = xml.readouterxml(); } and pass asp.net class need create treeview these data. i need make treeview considering parent_id make category , sub-category nodes correctly. and think recursive algorithm should used. how should it? since you've got xml data, recommend trying xmldatasource . since xmldatasource hierarchicaldatasourcecontrol, treeview can use populate itself.

multithreading - Notification in Java thread synchronization -

when there multiple threads in waiting state; , if call notify() rather calling notifyall() 1 going notified among several threads in waiting state? that's undefined behavior. picked up. javadoc : if threads waiting on object, 1 of them chosen awakened. the choice arbitrary , occurs @ discretion of implementation. and yes, can lead thread starvation .

php - PUT method inside Laravel Controller -

i can't seem assign function inside controller put action. tried put request on /settings got 403 forbidden. i've declared route::controller('settings', 'settingscontroller') in routes.php : <?php class settingscontroller extends basecontroller { public function getindex() { $setting = auth::user()->setting; return response::json($setting); } public function putindex() { $setting = auth::user()->setting; $setting->update(input::all()); } } probably web server blocking put requests? why web server software disallow put , delete requests? this means when try , put server returns 403.

Runtime error -2147467259 during PDF generation -

i'm newbie in using vbscript , don't understand why errorcode -2147467259 ("-2147467259: file in use application or user")(this own translation because error message in german). trying generate pdf files serial letter in ms word 2007 via vbscript. there on 28.000 pdf files generate .docx-file. maybe great number reason script fails don't hope ;). here vb code using: sub pdferstellung() dim sbrief string dim svertreterverzeichnis string dim sausgabepfad string dim ianzahl integer dim skundenname string dim serror string dim imodulo integer application.visible = false sausgabepfad = "c:\temp\" on error goto fehler activedocument.mailmerge .datasource.activerecord = wdlastrecord ianzahl = .datasource.activerecord .datasource.activerecord = wdfirstrecord .destination = wdsendtonewdocument .suppressblanklines = true .datasource ...

C# - Access XML attributes -

i want access attribute type value of abc female xelement xelement = xelement.load("..\\..\\employees.xml"); var name = nm in xelement.elements("employee") (string)nm.(element("abc") == "female").attribute("type") == "att" select nm; this didn't work. way make happen? something work. useful see xml though. var doc = xdocument.load("c:\\temp\\test.xml"); var result = doc.descendants("employee") .where(x=>(string)x.value== "female") .select(x=>x.attribute("type").value); this assuming xml this, query return "foo1". <?xml version="1.0"?> <root>- <employee type="foo"> <abc>male</abc> </employee> <employee type="foo1"> <abc>female</abc> </employee> <employee type="foo2...

ruby - Single quote string interpolation to access a file in linux -

how make parameter file of method sound become file name of .fifo >extension using single quotes? i've searched , down, , tried many different >approaches, think need new set of eyes on one. def sound(file) @cli.stream_audio('audio\file.fifo') end alright got working, might not correct way seemed trick. first thing, there may have been white space interfering file parameter. used file.join option saw posted here few different people. i used bit of each of answers really, , how came out: def sound(file) file = file.strip file = file.join('audio/',"#{file}.fifo") @cli.stream_audio(file) if file.exist? file end works charm! :d ruby interpolation requires use double quotes. is there reason need use single quotes? def sound(file) @cli.stream_audio("audio/#{file}.fifo") end as charles caldwell stated in comment, best way cross-platform file paths work correctly use file.join...

Android Eclipse NDK make error 5 - any suggestions to remedy this error? -

a user trying build project using r8e of ndk, , getting make: error 5. http://code.google.com/p/frozenbubbleandroid/issues/detail?id=17 i not see issue when build, , have posted multiple suggestions, nothing working, including using previous version of ndk, making sure path doesn't have spaces, etc. any suggestions appreciated. the user reported going prior version of ndk did not work - have not tried r8e , use r8d no issues. think r8e issue, because other similar problems being reported r8e: error on ndk-build clean this full problem: reported trungkientn, jul 14 (3 days ago) description resource path location type make: *** [obj/local/armeabi/objs/modplug-1.0] error 5 frozenbubble c/c++ problem

angularjs - IE 8 selecting n+1 index -

with ie 8, if have select list so... <select required ng-options="n n in monthnumbers" ng-model="month"> </select> ...then angular adds blank first option in. when select option, ie 8 select option comes after it. if select month 1, select month 2. if add initial element this... <select required ng-options="n n in monthnumbers" ng-model="month"> <option></option> </select> ... problem fixed. angular won't remove empty first element when other item selected behavior want. is there decent way around this? i added ng-disabled="true" manually added initial options , stops people selecting them in ie 8. https://stackoverflow.com/a/2031748/221683

powershell - How to have both write -host and html -

i have written code snippet , have incorporated write host in want both write host , convert html run snippet can 1 me that. $arrcomputers = get-content -path "c:\computers.txt" foreach ($strcomputer in $arrcomputers) { $colitems = get-wmiobject -class "win32_bios" -namespace "root\cimv2" ` -computername $strcomputer foreach ($objitem in $colitems) { write-host "computer name: " $strcomputer write-host "bios version: " $objitem.biosversion } $colitems1 = get-wmiobject -class win32_logicaldisk -filter "deviceid = 'c:'" -computername $strcomputer foreach ($objitem1 in $colitems1) { $e=$objitem1.freespace/1gb write-host "total space: " $e } $colitems4 = get-wmiobject -class win32_physicalmemory -computername $strcomputer $colitems5=$colitems4 | measure-object -property capacity -...

ios - Adding a relationship in core data -

Image
i have been @ single task several days trying relationships between core data entities working. have achieved need change new attribute value has relationship added existing object. 1 - - many database. i not sure how add relationship object exists. in new object getting added routinedetail, how create relationship object exists in routine entity? i have looked @ several examples showing how add relationships newly added objects need new object in routinesdetails has relationship value exists in routines . the value of routines held in string called routinetext rout nsmangedobject entity routines routdet nsmanagedobject entity routinesdetails i have left commented out code allows me add relationship when both new objects created. this last thing have in project driving me insane. eternally grateful fix here. advice appreciated best knowledge portal there is. thank you. nsmanagedobjectcontext *context = [self managedobjectcontext]; // create new device exc...

Can we use Oauth for our application? -

i have question project creating. here basic use cases: a user can register , edit company details (and other details) online a user member of 1 or more user groups (a user group company) data groups can contain multiple companies (eg. group called 'amsterdam' contains companies amsterdam) the data stored in database can used touchscreens show visitors these details (eg. company details 'amsterdam' , 'the hague'). use cases can defined as: a touchscreen can download data 1 or more datagroups api keys defined @ user group not @ user, if user fired shouldn't able data anymore but biggest question. can use oauth (which version don't care) download data touchscreens , can use oauth users can login online controlpanel? can write controlpanel oauth application datastore backend? or control panel need oauth independent application users can create applications or (as administrators) can create new applications each touchscreen? i have re...

CKEditor inline - cannot add form tag -

Image
we not able add form tag inline ckeditor chrome , ie, works fine in firefox. if add form inline ckeditor, removing form tag. for ex.: if add form tag in firefox, adds (which working fine) <form>test</form> in ie , chrome, shows only: (this have issue) test workaround this? i have found solution this. because of form tag in page. when form added inside form, ie , chrome seems remove added form tag. firefox ignores it. after removed main form tag of page, works fine in browsers.

regex - Find and replace to remove the icon in all my forms -

Image
i'm using visual studio, , remove icon in forms on code. icon embedded in resx files, used following regular expression find icon, used find , replace: \<data name=\"\$this\.icon\".+\n(.*\n)*^.+ree=\n(.*\n)(.*\n) the icon present in resx files following code: <data name="$this.icon" type="system.drawing.icon, system.drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> aaabaagaicaqaaeabadoagaahgaaabaqeaabaaqakaeaag4daaawmaaaaqaiakgoaacwbaaaicaaaaea ... regaaaxbgagsqyabrehaaaxbwaosqeahrehgh6xb+d+sqf//ree= </value> </data> it works, performance bad. please, find faster regular expression? thanks in advance. description this expression will: find data tags have attribute of name=$this.icon avoid of sticky problems using regex reading non regular markup languages <data\b(?=\s)(?=(?:[^>=]|='[^...

oracle sql query hangs -

alright i'm trying last 2 columns here: each ticket has journal associated can have multiple entries. trying latest entry given ticket number , based on time stamp associated entry, create query shows how time has elapsed since last entry. last column shows elapsed time well, specific type of journal entry. entries query need restricted tickets have owner id correspond 1 of 2 people. in example, people 'aaaa cccc' , 'bbbb dddd'. so, when run query, hangs. also, when remove last 2 columns, still hangs, assume has statement. i'm @ loss here, since i'm quite new sql, there simple i'm missing. select t.ticket_id, cct.issue, t.status, t.priority, a.account_name, o.identifier, to_char(t.created, 'mm/dd/yyyy hh:mm:ss') "created", to_char(sysdate - (select max(ti.timestamp) ticket_journal ti ti.ticket_id = t.ticket_id), 'hh:mm:ss') "last_entr...

Compare queries on PostgreSQL and MySQL -

have nice day! on windows azure on small vm debian 7.1 installed mysql 5.5.31 , postgresql 9.2.4. insert , select queries make php via pdo. creating table: mysql: create table `test` ( `id` bigint(20) unsigned not null auto_increment, `fdate` datetime not null, `ftext` varchar(1000) collate utf8_unicode_ci default '', primary key (`id`), key `ix_date` (`fdate`), key `ix_text` (`ftext`(255)) ) engine=innodb auto_increment=1 default charset=utf8 collate=utf8_unicode_ci pgsql: create table test ( fdate timestamp without time zone, ftext character varying(1000), id bigserial not null, constraint test_pkey primary key (id) ) ( oids=false ); alter table test owner postgres; create index ix_date on test using btree (fdate); create index ix_text on test using btree (ftext collate pg_catalog."default"); make inserts tables. data this: 152 2013-07-25 00:01:47 51e811712cfd6 100151 2013-07-25 00:28:25 51e825bfea275 1011...

ruby on rails 3 - Generate dynamic hstore key calls in Prawn -

i have hstore column i'm using build table in prawn (pdf builder). data consist of records given month. since hstore, keys used change day day needs dynamic. i need determine: 1 unique keys used month i created helper find unique keys used in month. these used column headers. keys(@users_logs) # returns array - ["xc", "pic", "mountain"] the table display users dutylog data month. testing...if explicitly call known hstore keys...the data displays correctly. but, since hstore...i wont know table column in production. for testing, call known hstore keys...this creates prawn table row data per duty log. @users_logs.map |dutylog| [ dutylog.properties["xc"], dutylog.properties["pic"], dutylog.properties["mountain"] ] end but, since hstore...i wont know keys call in production. so, need make above iteration dynamic. i tried, without success, iterate on each du...

mysql - How to join compound tables -

i have 2 tables (simplified below) **classes** **locations** [classname][locationid][time] [id][locationname][address] classa 1 1pm 1 locationa 123 classb 2 2pm 2 locationb 456 classc 2 3pm classd 1 2pm i not sure how word this...i want create select statement, can have of classes grouped location, without duplicating location data. if use: select * classes inner join locations on classes.locationid = locations.id i end result 4 rows. how can result 2 rows? (ex locationa containing classa , classd, without getting duplicate location data) is cannot done in straight mysql? if so, can manage in php. use group_concat select l.locationname, group_concat(distinct c.classname) locations l inner join classes c on c.locationid = l.id group l.locations

javascript - getElementsByTagName("table") - getting td on curious way -

i have simple example <table border="1px"> <tr> <td> </td> <td> <input type="button" value="click" onclick="inserttext()"/> </td> </tr> </table> i wanted first td element of (first) tr element, tried: var td = document.getelementsbytagname("table")[0].children[0].children[0]; because it's: var td = document.getelementsbytagname("table")[0] table element itself children[0] tr element and children[0] again first td element that's thought, apparently returns me tr element , adding .children[0] got me td element. var td = document.getelementsbytagname("table")[0].children[0].children[0].children[0]; why that, or have missed here? that's because you're forgetting <tbody> element, automatically inserted dom. what table looks like: <table border="1px"> <tbody> ...

Setting the vector length in systemc with a received parameter -

im making xor gate in systemc, binding of 4 nand gates. want module receive vector of n bits, n passed parameter. should able perform & , not bitwise operations (for nand gate). the best solution may using sc_bv_base type, don't know how initialize in constructor. i appreciate solve issue. a way parameterise module create new c++ template module. in example, width of input vector can set @ level of instantiation of module #ifndef my_xor_h_ #define my_xor_h_ #include <systemc.h> template<int depth> struct my_xor: sc_module { sc_in<bool > clk; sc_in<sc_uint<depth> > din; sc_out<bool > dout; void p1() { dout.write(xor_reduce(din.read())); } sc_ctor(my_xor) { sc_method(p1); sensitive << clk.pos(); } }; #endif /* my_xor_h_ */ note 'struct my_xor: sc_module' used i.s.o. 'sc_module' ...

asp.net - Delete_Click event with Multiple Gridviews within Update Panel -

i have page updatepanel , 5 gridviews. have delete button outside of gridview allow multiple files deleted quickly. possible use 1 delete button click event of gridviews? protected sub deletepacketbtn_click(sender object, e eventargs) handles deletepacketbtn.click 'loop through rows in gridview each gvrow c1gridviewrow in packetgrid.rows 'finiding checkbox control in gridview particular row dim chkdelete checkbox = ctype(gvrow.findcontrol("chkdelete"), checkbox) 'condition check checkbox selected or not if chkdelete.checked 'getting id of particular row using datakey value dim fileid integer = convert.toint32(packetgrid.datakeys(gvrow.rowindex).value) packetdatasource.deleteparameters("original_pkt_key").defaultvalue = fileid.tostring packetdatasource.delete() end if next packetgrid.databind() end sub yes, sender gridview cause...

How would I select a div ID with a specific class and then move that class to the next ID with jQuery/javascript? -

i have code: <div class="m-item m-active"> </div> <div class="m-item"> </div> <div class="m-item"> </div> what want when click button, jquery finds div class of "m-item" has class of "m-active", removes "m-active" class div , moves next "m-item" div. so after clicking button, code should (where m-active on second div): <div class="m-item"> </div> <div class="m-item m-active"> </div> <div class="m-item"> </div> does know how can done? thank you. $('.m-active').removeclass('m-active').next('.m-item').addclass('m-active'); further reading: next() , addclass() , removeclass()

c# - Insert again elements from one list to the prior list -

here situation. have 2 list of same type. imagine names these. fulllist , elementsremoved. in order avoid database roundtrip, anytime delete element fulllist added list of elementsremoved in case of regret's user can revert deletion. i thinking loop inside elementsremoved insert them again fulllist removed. there way simple list methods. something fulllist.insert, add, ..... (x => in order reduce line code , optimized? in front end make class holds bool , object: public class delpair<t>{ public bool isdeleted{get;set;} public t item{get;set;} } now instead of using list of objects use list of delpair<yourclass> , set isdeleted=true when deleting. this pattern allow track other things, such ismodified if comes that. based on op comment he's using entity class , needs function such: one option make delpair class inherit entity. may put implicit casting operator: ... // not sure signature, trial/error should :) pub...

CRM 2011 Get attributes from an entity using JavaScript -

i trying fill read-only field automatically using java script web resource. field dependant on lookup containing custom entity , free text field of 4 characters (first part of postcode example: nw10) i have written javascript values , create new value set in read-only field. when run string displayed shows "[object-object]-nw10". i guess i'm asking how access attributes of type object passed function? javascript below: function typeaffectedorregionaffected_onchanged(executioncontext, type, region, weighting) { var type = xrm.page.data.entity.attributes.get(type).getvalue(); var region = xrm.page.data.entity.attributes.get(region).getvalue(); // if have values both fields if (type != null && region != null) { // create weighting variable var weighting = type.substring(4) + "-" + region; // recreate weighting value xrm.page.data.entity.attributes.get(weighting).setvalue(weighting); } } type lookup, need access name ...

jsf - Primefaces treetable selected rows background color -

Image
in treetable when nodes selected, rows become grey. how can customize primefaces keep them white when selected? thank you! (i got screenshot primefaces showcase http://www.primefaces.org/showcase/ui/treetablecheckbox.jsf;jsessionid=ajhrchz2hjv71n0eb48w238gx ) you need over-ride style class uses. add below code in xhtml file <style type="text/css"> /* set proper font size */ .ui-widget,.ui-widget .ui-widget { font-size: 90% !important; } /* change background color when selectedis-->*/ .ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight { background-color: green; } </style> try , should work. how find out : using firefox browser right click on tree , click "inspect element(q)" . display style using for. showed me above tags override it. you need learn little css .

c# - Input string was not in correct format? -

when run c# code, error: input string not in correct format. , highlights code: thetwavalue=convert.toint32(thetwalabel.text); why happening? additional info: the entire c# function: <script runat="server"> protected void yourlistview_load(object sender, eventargs e) { label thetwalabel; int thetwavalue; foreach (listviewitem item in yourlistview.items) { thetwalabel = (label)item.findcontrol("twalabel"); thetwavalue = convert.toint32(thetwalabel.text); if (thetwavalue >= 0) { if (thetwavalue < 90) thetwalabel.forecolor = system.drawing.color.yellow; else thetwalabel.forecolor = system.drawing.color.red; } } } </script> here rest of code: <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:2007 soundassist ver 1.0.5 05-12-2011 ( 2013-06-24)...

javascript - how to capture private variable -

on running code ( in nodejs), 'count' runs negative large value of 'count'. culprit, 'count' or 'chain' ? right way write 'flood' function, schedules next invocation after settimeout(). flood = function( count) { chain = function() { --count; console.log("count " + count) if( count > 0 ) { settimeout(chain, 1); } }; chain(); } runit = function (count,par) { console.log("runit: " + count + " , " + par ) for( var = 0 ; < par ; ++ ) { flood(count) } } runit(3,4) thanx update: if call chain() instead of settimeout(chain,1), count never goes negative. chain global, since have not used var keyword. makes code behave so, runit(3, 4) . 4 times: flood(2); // prints "count 2" , calls settimeout then first round of asynchonous callback occurs. in round chain passed while referred correct function have...

qt - QTreeView set column size to content, no multiline (fixed row height) -

i have qtreeview on window , want set following behaviour: columns width must set resize contents, have done this: tabla->header()->setresizemode(qheaderview::resizetocontents); now, need set rows 1 line, so, if column contains '\n', should not displayed (i have detailed description dialog see that). to sum up, need set "no multiline" on treeview. any appreciated. i'd rather not extend qtreeview, since have lot of thems , wouldn't change them all, if that's takes... qtreeview seems ignore newlines in contents when uniformrowheights true (seen qt-4.8) this not documented, shouldn't relied upon. best remove newlines or replace them spaces when populating treeview. also, i've noticed exception: if there 1 row in treeview , contains newline, gets displayed in 2 lines, regardless of uniformrowheights .

python - Multiple IF Statements - Code Stops After IF Condition Not Met -

i working on python on coding bat. problem having issues with: http://codingbat.com/prob/p107863 . not sure if problem them. here code. used add of inputs not equal 13. there better way it. however, want know how evaluate next if statement if previous if statement's condition not met. def lucky_sum(a, b, c): results=0 if != 13: results= results + if b != 13: results= results + b if c != 13: results= results + c return results #edit: indented 2 spaces correct op formatting error -sequoia if run lucky_sum(1, 13, 3) returns 1 instead of 4. sure easy fix. a better way write function use non-keyword arguments . , use sum() function on generator expression return sum. >>> def lucky_sum(*nkwargs): ... return sum(x x in nkwargs if x != 13) >>> lucky_sum(1, 13, 3) 4 in original code, there issue of indentation error . return statement not indented. as per modification, above code, , 1 in question won't work codi...

Python under Excel is slower. Why? -

we embedding python inside our application. our application has number of client interfaces, including excel , command line tool. @ startup our aplication might read (depending on parameters) large number of python files. , here problem: observe application startup under excel slower in command line tool. numbers not consistent , different differnet users/boxes, in cases observe 10 times slower , 40%. regardless problem , wanted ask if has ideas why be. application goes through exacty same path in both cases (there few irrelevant differences specific excel, python path identical). it appears (that can tell cprofile report) python's open command runs slower, why - need figure out. any appreciated. thx. p.s. datanitro shed light on this? observe same behavior?

How do I place an image in a text frame using javascript in Indesign? -

i making scripted community directory, , using script labels find text boxes , fill them appropriate information json file. problem having cannot figure out how place image frame have reference to. filepath in json file, , know exists. know how load file , replace contents of box image have. also, if image fitted size of box, how work? so have text frame (filled data) , want replace image? use -- first line assumes selected text frame, of course can replace reference: a_frame = app.selection[0]; a_frame.place (file(folder.mydocuments+'/yourimagename.png'), false); a_frame.fit (fitoptions.content_to_frame); a_frame.fit (fitoptions.proportionally); a_frame.fit (fitoptions.center_content); see textframe.place "place", , textframe.fit "fitting". doesn't matter using textframe commands here place , fit image -- id uses frame. the 3 fitoptions in row ensure 1. entire image fits inside frame, out of proportion; 2. scales down proportion...

Delphi scrolling Memo -

right have code. procedure tform1.memo1change(sender : tobject); begin sendmessage(informacje.handle, em_linescroll, 0, memo1.lines.count); end; the problem can't scroll memolines when new lines added. want stop moving cursor end on scroll up, start moving cursor end when scrollbar @ bottom. thank you help. in others words. imagine there irc chat memo. new message, caret @ end of last message. want read previous messages usin scroll bar (up) cant cause there newer messages move carret bottom. want stop on mouse wheel up, read messages , after previous state (caret once again @ end on new message) when scroll bottom. you need condition decide whether scroll bottom or not. below seems work simple test, sums top visible line number of possible lines memo can show find out if last line visible or not. procedure tform1.memo1change(sender: tobject); var linecount, topline: integer; begin linecount := memo1.perform(em_getlinecount, 0, 0) - 1; topline := memo1....

ruby - HTTP request error: name or service not known -

i trying make http requests via ruby. when running following code: require "net/http" require "uri" uri = uri.parse("http://google.com/") # print response.body net::http.get_print(uri) i following error: socketerror: initialize: name or service not known org/jruby/ext/socket/rubytcpsocket.java:129:in `initialize' org/jruby/rubyio.java:1179:in `open' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:762:in `connect' org/jruby/ext/timeout/timeout.java:105:in `timeout' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:762:in `connect' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:755:in `do_start' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:744:in `start' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:454:in `get_response' c:/jruby-1.7.3/lib/ruby/1.9/net/http.rb:412:in `get_print' (irb):29:in `evaluate' org/jruby/rubykernel.java:1066:in `eval' or...

mongodb - MongoClient multiple connections using Node.js -

i want create module nodejs connecto mongodb. i've seen new, better approach use mongoclient, can't know how can make concurrent operations on database. goal want achieve have functions abstract database, following: exports.insertitem(item){ //whatever } according docs, supposed connect database way: mongoclient.connect("mongodb://localhost:27017/integration_test", function(err, db) { //do stuff on db object }); the problem how supposed reuse db object if it's not in scope can use export functions in node? supposed make mongoclient.connect() on every function deals db? you make single db connection , reuse everywhere a typical pattern modules is export.myinsert = function(db) { return function(whatever) { } } and do require('mymodule')(db) have @ example https://github.com/christkv/tic-tac-toe-steps

Jersey REST Web Service, Tomcat, Eclipse and 404's -

i've read through number of posts, can't seem solve problem. you'll see tons of posts similar one, same tutorial. following them, can't seem answer. essentially, i'm trying follow simple tutorial at: http://www.vogella.com/articles/rest/ i've made few changes make compatible jersey 2.x i'm using: eclipse tomcat 6 (deployed/run within eclipse) jaxrs-ri-2.0 i've enabled jax-rs facet in eclipse everything builds fine tomcat starts fine within eclipse can static page content via: http://localhost:8080/resttest2/index.html however, when try access service via: http://localhost:8080/resttest2/jaxrs/hello i receive 404 "message not found" , "the requested resource (not found) not available." here web.xml located @ /webcontent/web-inf/web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://jav...

c# - Trouble running SSIS package programmatically and from command line (DTEXEC) -

this question has answer here: executing ssis 2012 package has script components external application 1 answer i attempting execute ssis package programmatically using c#. application app = new application(); package package = app.loadpackage(pkgfullpath, null); package.execute(); i getting error saying: error in microsoft.sqlserver.dts.runtime.taskhost/ssis.pipeline : run ssis package outside of sql server data tools must install conditional split of integration services or higher. error in microsoft.sqlserver.dts.runtime.taskhost/ssis.pipeline : run ssis package outside of sql server data tools must install lookup of integration services or higher. i using ssis in visual studio 2010, executing c# code nunit test in vs 2012 (running .net 4.0) the package runs fine inside ssis project in vs 2010 if launch debugging (press f5), fails same error if try run u...

jsf 2 - Dynamic datatable for columns and rows jsf (JSF2) -

i followed below link added columns , row data dynamic, little confused on how show on xhtml. help http://balusc.blogspot.com/2006/06/using-datatables.html#populatedynamicdatatable list<string> strlist = new arraylist<string>(); list<list<string>> dynamiclistynamiclist = new arraylist<list<string>>(); strlist.add("name"); strlist.add("ssn"); for(string columnname : columnnameslist){ strlist.add(columnname); } list<string> rowdata = new arraylist<string>(); for(string otherlist : listdata){ try { rowdata.add(otherlist.getname()); rowdata.add(otherlist.getid()); if(otherlist.getamount() != null){ for(bigdecimal amount : otherlist.getamount()){ if(amount != null){ rowdata.add(amount.tostring());...

ruby - Method behaving differently for 2 classes using same module method -

i had previous question asked here: i (think) i'm getting objects returned when expect array have 2 properties available may give background. having received solution that, moved showing each player hand. below module included in both dealer , player classes. module hand def show_hand if self.class == dealer #need cover 1 of 2 cards here. dealer doesn't show both! print "the dealer showing: " print self.hand[0].show_card puts '' elsif self.class == player print "you have: " self.hand.each |item| item.show_card end puts '' else puts "a random person showing hand." end end end i know customization defeats purpose of module, using reinforce concept of modules. above solution worked fine dealer portion. when player portion called printed blank block. on .inspect of each "item" in player block con...

Zurb Foundation - Top Bar - Don't Collapse to Menu -

is possible not have top bar in foundation collapse menu , 3 lines. don't need feature not sure how disable collapse. will require modifying foundation.topbar.js? if you're using foundation via sass, there's better way go it. open _settings.scss file , find line: // $topbar-breakpoint: emcalc(940px); // change 9999px mobile layout uncomment , change value 0, or whatever breaking point use.

c# - How to set up routing so that Index does show? -

so know google can penalize site if have same content on multiple urls... unfortunately, in mvc common can have example.com/ , example.com/home/ , example.com/home/index , 3 urls take me same page... how make sure whenever index in url, redirects same without index , of course same thing home perhaps this little library may useful you. library not convinient in case, should work. var route = routes.maproute(name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional }); routes.redirect(r => r.maproute("home_index", "/home/index")).to(route); routes.redirect(r => r.maproute("home", "/home")).to(route);

html - Is there any way to hide a div's contents but not the div itself? -

so here's im looking in simplified form. want have box appear on page , when hover on it, it's contents visible, otherwise hidden. example let's have this: <style type="text/css"> #box { background-color:red; width:100px; height:100px; } </style> <div id="box"> <img src="smileyface.png" /> </div> most of time, image hidden , looks red box, when div hovered on image appears. there way css , not javascript. know javascript remove element , add in go, want show , hide it. thoughts? * must ie 8 compliant because i'm glutton punishment. * this quite easy. change display property of image when #box hovered #box > img { display: none; } #box:hover > img { display: block; }

Why doesn't using the search method to find a . work the way I expect in JavaScript? -

in js code, i'm trying validate email address. var validateemail = function () { var email = $("email").value; var symbol = email.search("@"); var domain = email.substring(email.indexof('@')).substr(1); var validdomain = domain.search("."); if (symbol == -1) { alert(email + " not valid email address."); } else if (validdomain == -1) { alert(email + "is not valid domain name."); } else { alert(email + " valid email address."); } }; i'm sure there better way validate email address, way i'm doing practice js properties , methods. learning simple basic stuff. not sure if example consider best practice. the problem: var validdomain = domain.search("."); is not pulling period string. can point out problem i'm having here. here's jsfiddle: http://jsfiddle.net/udv7q/ the main problem search expects regular expressi...

lua - Collision not working on the ceiling -

all collisions working except "ceiling" missing here? local screengroup = self.view jetspritesheet = sprite.newspritesheet("helicopters.png", 97, 55) jetsprites = sprite.newspriteset(jetspritesheet, 1, 4) sprite.add(jetsprites, "jets", 1, 8, 600, 0) jet = sprite.newsprite(jetsprites) jet.x = -80 jet.y = 350 jet:prepare("jets") jet:play() jet.collided = false jet.name = "jetplayer" physics.addbody(jet, "dynamic", {density=.1, bounce=0.1, friction=.2, radius=10, filter=playercollisionfilter } ) jet.gravityscale = 0 jetintro = transition.to(jet,{time=2000, x=150, oncomplete=jetready}) screengroup:insert(jet) ceiling = display.newimage("invisibletile.png") ceiling.name = "ceiling" ceiling:setreferencepoint(display.bottomleftreferencepoint) ceiling.x = 0 ceiling.y = 0 physics.addbody(ceiling, "static", {density=.1, bounce=0.1, friction=.2,} ) screengroup:insert(ceiling) local functio...

php - Show the correct error validation messages -

i have page 2 forms on it: registration form , login form. each form has submit button. i'm validating both forms, example if press submit button of registration form i'd show error messages of registration form , not of login form. @ moment both error message being shown. there way around this? <div class="grid-container"> <div class="grid-50 login"> <h3>inloggen</h3> <?php $loginemail = array('placeholder' => "email", 'name' => "loginemail"); $loginpassword = array('placeholder' => "wachtwoord", 'name' => "loginpassword"); $loginsubmit = array('name' => "loginsubmit", 'class' => "btn", 'value' => "inloggen"); $loginforgot = array('name' => "loginforgot", 'class' => "link...