Posts

Showing posts from April, 2013

javascript - How to delegate `hover()` function by using `on()` -

this question has answer here: jquery .on() method multiple event handlers 1 selector 6 answers i had coffee code this. $('.foo').hover \ (-> $(this).css "cursor", "pointer"), \ (-> $(this).css "cursor", "default") and want apply function dynamically appended dom, tried delegate function using on() this. as example referred this question $(document).on 'hover', '.foo', (event) -> $(this).css "cursor", "pointer" if event.type "mouseover" $(this).css "cursor", "default" if event.type "mouseout" but code doesn't work @ all. how can apply function dynamically added elements? i think you'll need unbind , add hover handler. also, don't need line continuations if you're indenting (in ca

c# - Removes several sets of datacolumns from datatable? -

i'm bulk-uploading excel file 470 columns datatable. due mssql's row size limit of 8060 bytes, need delete many datacolumns. cannot pick-and-choose excel files can upload. these datacolumns need delete: cols [180-195], [220-245], [320-380], [430-465]. i understand can loop , delete first batch (cols 180-195) using exact column number. 2nd, 3rd, 4th batch, there way besides having subtract total i've deleted col num i'm delete , avoid out-of-index exception? in case, when 4th batch (430-465) instead of deleting cols 430-465, believe deleting columns 330-365 (15+25+60 previous deletes) thanks. in loop, start last column , move towards first one. way can refer original column numbers , don't have deal shifts take place if delete columns in middle.

javascript - How can I display an external website in my PhoneGap app including a own header/footer -

the title says all. question is, how display external website webapp header or footer. i tried iframe, there problem, can't go in history backbutton example, can i? the second idea tried inappbrowser, there problem cannot use phonegap features , include own header. so need inappbrowser shown in iframe. i hope can me question. sincerely check out: http://www.w3schools.com/jsref/met_his_back.asp if willing implement button..

database - Select an output column to be used for LIKE -

i want use like column output of convert , code below. not working since column i've selected doesn't belong view i've been using. there way me way? or shall create new view instead? select [description], convert(varchar, cast([item value]*[qty] money), 1) [total amount], vwitemlist [total amount] '%' + @targetitem + '%' you have use sub query or repeat since cannot refer alias in where -clause select [description], convert(varchar, cast([item value]*[qty] money), 1) [total amount], vwitemlist convert(varchar, cast([item value]*[qty] money), 1) '%' + @targetitem + '%' another option, cte similar sub query: with cte ( select [description], convert(varchar, cast([item value] * [qty] money), 1) [total amount], vwitemlist ) select [description], [total amount] cte [total amount] '%' + @targetitem + '%'

Menu css3 & jquery with blur effect -

i have problem menu on website: http://goo.gl/xc1e5f when hover mouse on button "about", other buttons have effect blur permanently. make blur disappear after 1 second (that without). (exaclty when use automatic focus camera, adjust focus , goes away) can me? thanks! css3 animation should solution: @keyframes myfirst{ 0% { background: transparent; color: #000; text-shadow: 1px 1px 10px rgba(255, 255, 255, 0.6); } 50% { background: rgba(255, 255, 255, 0.2); color: transparent; text-shadow: 0 0 5px #000000; } 100% { background: transparent; color: #000; text-shadow: 1px 1px 10px rgba(255, 255, 255, 0.6); } } i've created fiddle demonstrate it.

mysql - Deployment java app offline -

i've finished developing desktop app, patients data. i'm using eclipse on mac osx, , mysql server database access. need install software on desktop pc has no internet connection, have downloaded java 1.7 installer , mysql server. now, put mysql server,the java platform , program in usb drive. installed , works question is... is there way pack make full installer? i've been searching java web start, think it's deploying apps via browser, anyway jws needs internet connection (i'm not sure that, saying) thanks in advance!

css - Switching the order of columns as rows in responsive bootstrap -

i'm wondering if trying achieve possible bootstrap. using bootstrap 3's push / pull arrange columns in row. i'm happy how things otherwise render in mobile view 1 exception. i'd have happen switch order of 2 columns render rows on mobile device - author , title. see attached http://bootply.com/109874 in mobile version, i'd position of author , title change. title appear on top of author in mobile view. thought achieved through push / pull. how can make happen? you can't change stacked source order push , pull. think cleaner solution use responsive utilities: http://jsbin.com/axihofah/1/edit <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-push-4"> <p class="visible-xs">title</p> <p>author</p> <p class="hidden-xs">title</p> <p><img src="//placehold.it/460x340" class="visi

Change Shortcode wrapper in Woocommerce -

i'm using wordpress 3.8 + woocommerce 2.0 need change class of wrapper woocommerce generate when use shortcode. i use shortcode: [recent_products per_page="12"] , output is: <div class="woocommerce"> the_product_loop.... </div> i want obtain <div class="mycustomclass"> the_product_loop.... </div> but can't find have change code... in class-wc-shortcodes.php file i've found declaration of function generates wrapper: public static function shortcode_wrapper( $function, $atts = array(), $wrapper = array( 'class' => 'woocommerce', 'before' => null, 'after' => null ) ) but... don't want change core files of woocommerce plugin, it's possible define custom class via functions.php?? you can create own shortcode, clone of default one, change, paste in functions.php: function custom_recent_products_fx($a

python - Cannot get logging to work when running Pyramid app with uwsgi -

i have pyramid application, works fine, when started via pserve or via uwsgi . when started via pserve , logging setup works fine, not when started via uwsgi . uwsgi section of paster ini looks this: [uwsgi] socket = 127.0.0.1:3099 master = true processes = 1 virtualenv = /opt/data/virtualenvs/some_virtual_env paste = config:%p paste-logger = true buffer-size = 65535 i found of course this question , tried configure logger this: paste-logger = %p but not work. logging config using absolute path , target folder of log file allows reading , writing everybody. wonder little bit how specify paste-logger , because has no argument according documentation . the command line configuration upstart defined this: exec uwsgi --master --die-on-term --emperor /etc/uwsgi/apps-enabled no custom log files created , in uwsgi log don't see helpful messages or errors. how logging working or debug problem appreciated. this not asked about, following works me on ubuntu. i

how to select which id comes second the most often in sql server -

i have table so: create table t1 ( id_a int id_b int dt datetime ) sample data might be: id_a id_b dt 39838 6 2014-01-21 11:20:29.537 39838 546 2014-01-21 11:20:29.790 39839 4088 2014-01-21 11:20:31.543 39795 6 2014-01-21 11:20:33.117 39795 546 2014-01-21 11:20:34.100 39795 3189 2014-01-21 11:20:35.520 39841 6 2014-01-21 11:20:36.957 39841 7588 2014-01-21 11:20:38.030 i want sql tell me id_b follows id_b of 6 (by follows mean dt) id_a for sample data above, id_b 546 follow 6 twice same id_a , 7588 follows 6 once same id_a, output looking in case 546 i hope i've made clear, can me how i'd write sql that? something effect: select most_common(id_b) t1 previous_entry(id_b) = 6 , previous_entry(id_a) = this_entry(id_a) order id_a, dt you can accomplish using parition clause: select ib_b, count(id_a) no_of_times (select *, row_number() on (partition id_a order dt) row_no t1)temp row_no = (select top 1 row_no+1 (select *, row_num

Actionscript 3: Delete code-generated movieclips when changing frame -

this code generates airport symbol part of bigger presentation. works pretty well, @ moment objects don't disappear when change frame, them to. i've tried different methods in other frame, whatever error: "call possibly undefined method removechild through reference static type class." i'm pretty new as3, keep in mind :) thank you. below code. for (var key:object in airports) { var myairport = new airport(); myairport.x = airports[key]["x"]; myairport.y = airports[key]["y"]; myairport.width = 17; myairport.height = 17; addchild(myairport) myairport.addeventlistener(mouseevent.click, this.clickhandler) } put movieclips each scene array build each scene. can loop through array , remove them calling cleanup function: function cleanupview():void { for( var i:int = 0; < collectedmovieclipsarray; i++ ) { var parentcontainer:movieclip = collectedmovieclipsarray[ ].parent movieclip; parentcontainer.

sql - Netezza INSERT - ignore invalid dates? -

is there option or setting tell netezza ignore invalid dates ? entire insert fails in example below because 3rd row of source table has invalid date. expect offending row may skipped, insert 0 rows seems tad extreme. i tried following, failed well. alternative parsing source date , verifying each component validity ( including days/month, leap years etc.. ) insert db.test ( cmclmn, effdt, efftm ) select cmclmn, case when to_date(effdt,'yyyymmdd') null null else to_date(effdt,'yyyymmdd') end, cast(lpad(efftm,6,0) time) efftm db.test_src ; entire script: create table db.test ( cmclmn integer, effdt date, efftm time ) distribute on ( cmclmn ); drop table db.test_src; create table db.test_src ( cmclmn integer, effdt integer, efftm integer) distribute on ( cmclmn ); insert db.test_src ( cmclmn, e

windows - msvcr100d.dll missing from computer -

i have tried basic update suggested many, sp 1 redistribute 2010 vs x86. have tried sp 2012 , 2013. have vs 2013 , windows 7. there else can try? msvcr100d.dll debug version of dll , should installed when install visual studio 2010 , cannot legally redistributed (so isn't part of redistributable packages).

TF26198 error when doing git tfs rcheckin -

we use tfs 2010 @ work, , use git-tfs can use git locally. i've upgraded machine, , copied local repository folders across. i seem able pull tfs , commit locally. when git tfs rcheckin , error: tf26198: work item not exist, or not have permission access it. it work when using git tfs checkintool . i presumed getting error because original git tfs clone done on computer. reading git-tfs docs, sounds should doing git clone old machine (rather copy), git tfs bootstrap . however, when trying this, still same error. any ideas causing this? other difference can think of old machine has vs2010 , vs2012 installed, whereas new machine has vs2012 installed. git-tfs parses commit comments provide work item associations changesets. default, if enter #1234 , git-tfs checkin , rcheckin commands attempt associate work item 1234 checkin. if using #1234 in commit messages in order associate these different bug tracking system, in conflict. in particular case, git-tf

java - Wicket - Custom Page Navigation in DataTable -

Image
i've got datatable a bottomtoolbar. datatable<example> exampletable = new datatable<example>("exampletable", columns, provider, 10); exampletable.addbottomtoolbar(new navigationtoolbar(exampletable)); right have normal navigation (<< < 1 2 3 > >>). want achieve feature this: so have a) normal page navigation: << < 1 2 3 > >> , b) go field. you use method in class datatable public final void setcurrentpage(final long page) { datagrid.setcurrentpage(page); onpagechanged(); } in combination ajaxformsubmitbehaviour on textfield, this: textfield.add(new ajaxformsubmitbehaviour("onkeyup or other event") { @override protected void onsubmit(ajaxrequesttarget target) { datatable.setcurrentpage(long.parselong(textfield.getmodelobject())); target.add(datatable); } }) the 'textfield' component being textfield can enter page number.

r - in matrices with NAs, finding second highest value in a row -

how find second highest value in rows of matrix. matrix has na values. looking highest values poses no problems looking second highest returns error. new_class <- max.col(memb)### first highest value n<- length(memb[i,k]) sort(memb,partial=n-1)[n-1] error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : index 27334 outside bounds and how find column second highest value try this: # create amatrix na values <- runif(n=30) a[sample(30,10)] <- na memb <- matrix(a, ncol=3) memb [,1] [,2] [,3] [1,] 0.8534791 0.4881141 0.99065285 [2,] 0.7340371 0.7439187 0.13665397 [3,] 0.3355996 na 0.24051520 [4,] na 0.6561470 0.15877743 [5,] na 0.3649768 0.84415732 [6,] na na na [7,] na 0.1018859 0.75347257 [8,] 0.3918607 na 0.04462168 [9,] 0.4653950 0.4043837 0.75119324 [10,] na na 0.54516193 # find second highest value (while omitting na values

Updating a form through another form in C# -

i have button in form. when button clicked, button click function called. in function @ first form (let's call object form2 class form2) created objects including labels , progress bars (these objects created through form2 constructor). form2.show() called. while loop comes end of variables updated. use these variables update several objects in form2. problem form objects not shown rightly until button click function finished. example instead of labels, white rectangles shown. tried using thread.sleep(1000) after while see if objects shown rightly didn't have effect on form2 shape. used messagebox.show() after while , worked surprisingly! objects shown correctly in form2. appreciate if problem , how can solve it. you're blocking ui thread, preventing updates until release ui thread continue handling other messages sent it. if have long running cpu bound work, should offloading background thread. if have io or other non-cpu bound work should doing asynchronou

c# - MySQL .Net Connector Issue Executing Routine -

i'm having issue getting code execute mysql routine. keeps popping error: procedure or function 'shortenedurls' cannot found in database 'get'. routine delimiter $$ use `o7thurlshortner`$$ drop procedure if exists `get.shortenedurls`$$ create definer=`root`@`localhost` procedure `get.shortenedurls`(in `id` bigint) no sql select `shortid`, `shortcode`, `url`, `clickthroughs` `shortener` `accountid` = id$$ delimiter ; code - accessing , running routine internal dbdatareader getresults() { try { // check parameters if (areparams()) { prepareparams(_cmd); } // set our connection _cmd.connection = _conn; // set type of query run _cmd.commandtype = _qt; // set actual query run _cmd.commandtext = _qry; // open connection _cmd.connection.open(); // prepare c

Logback - Multiple syslog appenders -

i'm logging syslog syslog appender shown below: <appender name="syslog" class="ch.qos.logback.classic.net.syslogappender"> <sysloghost>localhost</sysloghost> <facility>local6</facility> <suffixpattern>app: %logger{20} %msg</suffixpattern> </appender> but i've got new requirement want send logs "local5" facility instead of local6. i've read logback configuration documentation http://logback.qos.ch/manual/configuration.html i'm still not sure how this. you can use 2 syslog appenders 1 local6 , other local5 <appender name="syslog" class="ch.qos.logback.classic.net.syslogappender"> <sysloghost>localhost</sysloghost> <facility>local6</facility> <suffixpattern>app: %logger{20} %msg</suffixpattern> </appender> <appender name="syslog1" class=&qu

c# - Gridview postback datasource persistance -

i have grid data bound generic list. edit , need persist changes of, db. the problem when hit submit button postback. , sets data source of gridview null. i've tried storing data source in view state viewstate["data"] works great data isn't being updated in viewstate when changes made on grid. any ideas? here code gridview: <asp:gridview id="dgmerchantconfiguration" runat="server" autogeneratecolumns="false" causesvalidation="false" custompagercssclass="" headerheight="30px" numberofpagesheight="15px" numberofpageswidth="40px" pagerheight="15px" pagerwidth="40px" showdatagridcustompaging="none" sortheight="15px" sortwidth="70px" backcolor="white" bordercolor="#999999" borderwidth="1px" cellpadding="1" font-size="smaller" gridlines="vertical" wi

node.js - How Does Middleware Actually Work? -

i'm curious nodejs , express. how middleware work? how go creating own middleware? does rely on type of dependency injection? understand add middleware in order want executed, , http request/response passed middleware, , onto next, , next, until 1 of them returns/renders request/response. are request , response objects passed through each middleware reference? sorry if sounds confusing. i'm trying learn how create own middleware better understanding of in general. edit: post written express 3. minor details have changed since then, it's conceptually same. a note before start: express built atop connect , handles middleware. when write express in these examples, i'd able write connect . at bottom level, have node's http server module. looks kind of this: var http = require("http"); http.createserver(function(request, response) { response.end("hello world!\n"); }).listen(1337, "localhost"); basically, make si

actionscript 3 - Listen if 2 events are dispatch -

is possible listen if 2 events dispatch ? example : when puzzle = true --> dispatchevent(new event("the first")); when puzzle2 = true --> dispatchevent(new event("the second")); and : do if "the first" dispatch if "the second" dispatch and thing if "the first" , "the second" dispatch. the event structure independent of each other. 1 event can dispatched another. puzzle.addeventlistener("the first", handler1); puzzle2.addeventlistener("the second", handler2); alternatively, have both events trigger same function. puzzle.addeventlistener("the first", handler); puzzle2.addeventlistener("the second", handler);

How can i send a Facebook App Request with access token and graph -

can send request notification specific user on facebook using access token i searched on facebook developers pages .. they shared .. post /{recipient_userid}/notifications?access_token= … &template= … &href= … but user resive notfication must accessed app before .. https://developers.facebook.com/docs/howtos/requests my question .. can send notfication invitation app user not invitaion dialog .. ?

IDE showing error in PHP concatenation -

Image
i trying display name , address in mail using following piece of code perfect- </tr> <tr> <td align="left"><p>'.$admin_message['message'].'</p></td> </tr> <tr> <td align="left"><p>kind regards</p></td> </tr> <tr> <td align="left"><p>'.ucwords($finance_info['fi_schoolname']). '<br />'.ucwords($finance_info['fi_address']). ' <br /> email :- '.ucwords($finance_info['fi_email']). '<br /> contact:- '.ucwords($finance_info['fi_phoneno']).'</p> </td> </tr> now want add image logo in trying - <tr> <td align="left"><p>'.$admin_message['message'].'</p></td> </tr> <tr> <td align="left"><p>kind regards</p></td> </tr> <tr> <td align=&qu

ios - drawTextInRect: in UITextView class -

i use drawtextinrect: method in uitextfield class create outlined text (text black border/store effect). but need similar create same outlined text in uitextview, drawtextinrect: method not included here. how can textview? this code use in uitextfield class: - (void)drawtextinrect:(cgrect)rect { cgcontextref c = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(c, 1); cgcontextsetlinejoin(c, kcglinejoinround); cgcontextsettextdrawingmode(c, kcgtextfill); self.textcolor = [uicolor whitecolor]; [super drawtextinrect:rect]; cgcontextsettextdrawingmode(c, kcgtextstroke); self.textcolor = [uicolor blackcolor]; [super drawtextinrect:rect]; } how can create similar solution textview in uitextview class? are targeting ios 6.0+? should work, perhaps: nsattributedstring *yourstring = [[nsattributedstring alloc] initwithstring:@"your text" attributes:@{ nsstrokecolorattribu

android - Implementing floating app...where to start -

i create floating app - app floats/hovers on other apps. along lines of folks @ floating apps have achieved. lost begin such effort. i understand conventional way of creating app @ loss thinking how started on creating floating calculator. can point me in right direction or me started? appreciate inputs. thanks. while don't know how particular example works, if you've been paying attention various ui/ux experiences on android might have heard facebook chat heads has similar float on existing app feel. you may want start here investigation: what apis in android facebook using create chat heads?

html - table-cell height is not fitting to content -

Image
i using css tables setup basic grid page. center cell of each row contain content whereas first , third "columns" background color. the problem having has table-cell height. here jsfiddle showing issue: http://jsfiddle.net/uqua9/ /*** essential css layout ***/ html, body { height: 100%; margin: 0pt; } .frame { display: table; width: 100%; } html>/**/body .frame { height: 100%; } .row { display: table-row; height: 1px; overflow: hidden; /* commenting out has no effect. */ } html>body .row.expand { height: auto; /* commenting out has no effect. */ } .row div { display: table-cell; } note in headerrow, contentcolumn has large gap beneath end of text between , menurow. don't understand why table-cell padding out that. far can see, don't have padding or margin set account empty space. went css table because autofit cell h

c - Do binary files have encoding? Confused -

suppose write following c program , save in text file called hello.c #include<stdio.h> int main() { printf("hello there"); return 0; } the hello.c file saved in utf8 encoded format. now, compile file create binary file called hello now, binary file should in way store text " hello there ". question encoding used store text? as far i'm aware, vanilla c doesn't have concept of encoding, although if correctly keep track of multi-byte characters, can use encoding. default, ascii used map characters single-byte characters. you correct string "hello there" being stored in executable itself. string literal put global memory , replaced pointer in call printf, can see string literal in data segment of binary. if have access hex editor, try compiling program , opening binary in editor. here screenshot when did this. can see each character of string literal represented single byte, followed 0 (null). ascii.

c# - MVC Url.Content with javascript local variable -

i have problem this: var id=5; var el = $("mainphotoholder"); el.attr("src", '@url.content("~/page/getimage/" + id)'); id local javascript variable, gives me error saying not in context. question how point out should javascript variable , not c# 1 ...? you cannot mix javascript , razor in way. razor not have reference cannot use generate link. try this: el.attr("src", '@url.content("~/page/getimage/")' + id); you might have use "url.action" if you're serving images controller rather static repository.

unity3d - fAWEFwefWEFSDFSDFASFASEFAWEFWEF -

this function for (i = 0; <= array.length; i++) { if (array[i].transform.position = 0) array.removeat(i); print(“removed element: “ + array[i].name); else if (array[i].transform.position > 0) array[i].transform.forward = vector3(1,0,0); } please me possible. you can't compare vector 0 needs this if(myobject.transform.position==vector3.zero) and removing things i'd suggest include system.collections.generic lib use listarray can use array.removeat(index);

c# - How do I create a "Remote Powershell" server object that can be called by clients? -

in microsoft exchange, it's common clients call remote server object using following commands $s = new-pssession -configurationname microsoft.exchange -connectionuri http://server01/powershell/ -authentication kerberos import-pssession $s my understanding no software needed on client, , calls remotely executed on server "server01" my question is: assuming have basic powershell object created, how expose in such way can called in similar manner client? is "remoting" possible arbitrary powershell commandlets, or there set of prerequsites must met? to add keith has provided, not cmdlets, proxy functions. functions depend on rbac roles belong in exchange. if aren't member of role group that's authorized perform function don't proxy functions cmdlets. if try use them tell command not found. also, don't have use import-pssession. if you're using limited number of cmdlets, once have session established can use invoke-comma

ruby - How do I define this reject method from the Gosu library tutorial? -

i'm wondering how define reject in code the gosu tutorial : def collect_stars(star) if star.reject! {|star| gosu::distance(@x, @y, star.x, star.y) < 35} @score += 1 end end looking @ tutorial, don't see reject defined. define it? the code refers stars.reject! makes sense that's built-in array reject! method : def collect_stars(stars) if stars.reject! {|star| gosu::distance(@x, @y, star.x, star.y) < 35 } @score += 1 end end what you've done here switched star.reject! different, it's acting against class star . i'm not sure intent there.

javascript - Meteor JS: How should I bind events to the window in Meteor? -

i trying detect mouseup outside of window in meteor. tried this, window doesn't seem work: template.layout.events({ 'mouseup window' : function(e) { console.log("mouseup"); } }); how should bind events window in meteor? the code snippet below bind event handler when template created , unbind when template destroyed. should give behavior you're looking for. var layoutmouseuphandler = function(e) { console.log('window.mouseup'); }; template.layout.oncreated(function() { $(window).on('mouseup', layoutmouseuphandler); }); template.layout.ondestroyed(function() { $(window).off('mouseup', layoutmouseuphandler); }); note event bound in oncreated handler, there's chance template not have been rendered yet when event fires. if handler interacts dom, need check that. not bound in onrendered handler because cause mouseup handler bound multiple times if template re-rendered. edit: serkan mention

C# exclusive enum -

this question has answer here: how prevent duplicate values in enum? 3 answers i trying use enum represent different types order. there no compiler support ensure values mutually exclusive. example, have totally leagle enum public enum mysearchtype{ searchbyname = 1, searchbyid = 2, searchbyordernumber = 2 //i meant have 3, overlooked. //so compiler give me error here. } is there anyway in c# achieve want do? the standard thing when need order in c# enum order first value , let rest auto-increment public enum mysearchtype{ searchbyname = 1, searchbyid, //implicitly 2 searchbyordernumber, //implicitly 3 } i believe (and wrong here) enum instances in c# implemented integer alias there no way ensure no duplicates (nor want to, makes perfect sense allow aliases same enum value). perhaps want

apache - Bash script use of "OR" operator -

my default logrotate script apache is: /var/log/httpd/*log { missingok notifempty sharedscripts postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript } i understand output , error redirection on line 6 can please explain purpose of || true ? , potential consequences of omitting bit? when logrotate utility runs postrotate (or prerotate ) scripts, checks error code returned script. in particular, when sharedscripts specified, error handling follows (quoted man logrotate , emphasis added): sharedscripts normally, prerotate , postrotate scripts run each log rotated , absolute path log file passed first argument script. means single script may run multiple times log file entries match multiple files (such /var/log/news/* example). if sharedscripts specified, scripts run once, no matter how many logs match wildcarded pattern, , whole pattern passed them. however, if none of logs in pattern

javascript - How can I combine child nodes with JSX? -

i want build ul list li elements, li elements come different sources, can't in 1 statement. appears jsx can't handle set of child elements, gives me syntax error: var items = <li>s</li> <li>s</li> <li>s</li>; ideally want like: var items1 = <li>s</li> <li>s</li> <li>s</li>; var items2 = <li>s</li> <li>s</li> <li>s</li>; var list = <ul>{items1}{items2}</ul>; is there way achieve this? jsx desugars straightforwardly javascript syntax can mix freely. /** @jsx react.dom */ var items1 = [ <li>s</li>, var items1 = [ react.dom.li({}, "s"), <li>s</li>, react.dom.li({}, "s"), <li>s</li> ]; react.dom.li({}, "s") ]; var items2 = [ <li>s</li>, var items2 = [ re

objective c - Adding UIGravityBehavior and UIPushBehavior after a collision takes place in iOS 7 -

i'm messing around new physics api in ios 7. i decided make simple game, have character can move around screen @ tap of finger, periodically, shapes fly bottom , if hit character it's game over. i have implemented of above , works great, however, thing doesn't character falling when shape collides him. all collisions work, problem trying make character fall when collision takes place. because don't want character able fall before (lets he's levitating while trying avoid shapes) decided add character gravity when collision happens, , does, first, character shoots upwards collision animation continues. is there way prevent collision animation happening? there better way? here code in collisionbehavior:begancontactforitem:withboundaryidentifier:atpoint: method: // main character // if ([item isequal:self.maincharacter]) { [self.collision removeitem:item]; // push // uipushbehavior *pushbehaviour = [[uipushbehavior alloc] init

javascript - getting the date from datepicker -

i'm using jquery 's datepicker in other dates user. defined form following: <form id="myform" action="/graphs/get_builds" method="post"> start: <input type="text" id="start" /> end: <input type="text" id="end" /> <input type="submit" value="go" /> </form> on js side, have: $(document).ready(function () { var data = { 'start': $('#start').datepicker({ onselect: function(datetext, instance) { return $(this).datepicker('getdate'); } }); }; console.log(data); // bind 'myform' , provide simple callback function $('#myform').ajaxform(function () { console.log("hello"); }); }); i know definition on data value it's not right, how value of start , end in other pass ajaxform . need value of both start

Xcode Codesign error: timestamps differ -

my attempts @ signing application within xcode failing error "code signing failed: check identity selected valid". since certificates check out valid tried using codesign utility in terminal. when run these parameters: codesign --force --deep -s cryptic error: timestamps differ 230 seconds - check system clock i have research error in documentation , on web , found nothing. any ideas ? thank you. update - few days later: able dispense problem getting fresh certificates , signing identity , doing "clean build folder" (hold option key down when choosing clean build). sometimes profiles may messed up. in cases download them again. , (using finder) activate them opening profiles. nothing spectacular happen, may see profiles flashing or being updated in xcode. after works.

r How to change vector values? -

how change 3 values set in vector, eg: v=c(1,1,1,1,1,6,2,3,4,4,4,4,4,2) r=v[which(v %in% c(6,2,3))] = c(6,0,8) r [1] 1 1 1 1 1 6 0 8 4 4 4 4 4 6 the result comes warning: number of items replace not multiple of replacement length. the idea result need : [1] 1 1 1 1 1 6 0 8 4 4 4 4 4 2 i want 3 values change when set/group, not individually, suggestion great appreciated! edit: i'm sorry guys, there more 1 set of 6,2,3 in data, example should like: v=c(1,1,2,1,1,6,2,3,4,4,4,4,4,2,6,2,3,4) and result be: [1] 1 1 2 1 1 6 0 8 4 4 4 4 4 2 6 0 8 4 a quite different way using regular expressions: as.numeric(strsplit(gsub("6 2 3", "6 2 8", paste(v, collapse = " ")), " ")[[1]]) # [1] 1 1 1 1 1 6 2 8 4 4 4 4 4 2 this replace instances of c(6, 2, 3) .

how to prevent needing "npm rebuild" everytime with rsync and Node.js on Linux -

my deploy approach may noob. i'm using rsync , works part on many node.js website except ones there build dependancies xml. supposed try git concerned having bloat on vms , wanted keep lean possible. is there better way using rsync options or should try alternative deployment approach. rcpy seems bad. or if must "npm rebuild" command if created in shell script automate in terms of chaining commands? update: using approach: write shell script ssh remote machine , execute commands with npm rebuild if run same node.js version on same processor architecture, don't need npm rebuild , since binaries work on target without change. otherwise there no way avoid (except removing binary dependencies entirely of course).

excel - Visual Basic runtime error 1004 -

i trying write visual basic script run windows task scheduler. script supposed open delimited text file excel , save .xlsx file. function importtext() path = "c:\users\username\documents\" infile = "2014_1_31_data_parse.txt" outfile = "2014_1_31_data_parse.xlsx" set objexcel = createobject("excel.application") objexcel.workbooks.opentext filename:=path & infile, other:=true, otherchar:="^" objexcel.activeworkbook.saveas filename:=path & outfile objexcel.quit wscript.quit wscript.echo "completed" end function currently gives run-time error of 1004 file can not found. file there. there few issues code, first thing change method call syntax. using named parameters (which guess comes recorded macro?). objexcel.workbooks.opentext filename:=path & infile, other:=true, otherchar:="^" should changed to objexcel.workbooks.opentext path & infile, , , , , , , , , , true, "^"

Android 4.1: how to enable ADB over internet on device with pared-down menu? -

i have problem fly iq449. haven't got full developer menu. also, can't connect via usb (i tried install different drivers, adb still doesn't work). , haven't got root. 7x tapping on "build number" in device info menu doesn't work too. absolutely no effect. possible it? /sorry google english/ for adb work , need explicitly enable via developer settings. if such option not available in phone , try have custom rom cynogenmod installed , options there .

c - Posting API keys on github -

i'm working on c project uses wolframalpha api, , planning on making available on github, source code contains api key. people post api keys on github or should delete it? you should delete api key , have readme.md in github repository states pre-requisite obtain api key , place in config. assuming code reads api key config file. if doesn't, update code so. i don't think unreasonable request. also, if leave api key in there, key hit api rate limit , wolframalpha disable key anyways. hth.

How to Setup Geokit with Google geocoder: client_id and cryptographic_key -

i have been trying @ couple hours geocoder work google. more or less trying figure out how configure google account , code below make geocoder work geokit::geocoders::googlegeocoder.client_id = '' geokit::geocoders::googlegeocoder.cryptographic_key = '' for various parameters have tried, following response google. unable authenticate request. provided 'signature' not valid provided client id. learn more: https://developers.google.com/maps/documentation/business/webservices/auth on google developer panel, there following options: 1. default client id , email address fields given compute engine , app engine. have following apis enabled: bigquery, geocoding, google cloud sql, google cloud storage, google storage json api, google maps api v3, google maps coordinate api, google maps geolocation api when click create new client id, given 3 options: web application, service account, , installed application. have tried web application , installed applicati

c# - Get decimals of a double? -

i have function adds double double need add digits after decimal point , number of digits varies based on size of number. public double calculate(double x, double add) { string xstr; if (x >= 10) xstr = x.tostring("00.0000", numberformatinfo.invariantinfo); if (x >= 100) xstr = x.tostring("000.000", numberformatinfo.invariantinfo); if (x < 10) xstr = x.tostring("0.00000", numberformatinfo.invariantinfo); string decimals = xstr.remove(0, xstr.indexof(".") + 1); decimals = (convert.todouble(decimals) + add).tostring(); xstr = xstr.substring(0, xstr.indexof(".") + 1) + decimals; x = convert.todouble(xstr, numberformatinfo.invariantinfo); return x; } i'm wondering if there isn't simpler way without having convert number string first , adding decimal part of it. can see number added should 6 digit number ever decimal separator is.

c# - ListPicker "SelectedItem must always be set to a valid value" -

i try clear (and add) items listpicker , when app have clear of items error - "selecteditem must set valid value". code: <toolkit:listpicker x:name="select" horizontalalignment="right" margin="0,135,30,0" verticalalignment="top" width="195" height="64" d:layoutoverrides="horizontalalignment" borderbrush="{x:null}" fontfamily="arial" fontweight="bold" fontsize="32" style="{staticresource listpickerstyle1}" borderthickness="0" datacontext="{binding}"> <toolkit:listpicker.background> <imagebrush stretch="fill" imagesource="list_picker.png"/> </toolkit:listpicker.background> and action button private void button_tap(object sender, system.windows.input.gestureeventargs e) { select.items.clear(); //here error (int = 0; < arrays.length; i++) { select.ite

javascript - setMonth(1) gives me March? -

why setmonth(1) giving me march? believe 0=jan, 1=feb, 2=mar <!doctype html> <html> <head> <script> window.onload = init; function init(){ var d = new date(); d.setfullyear(2014); d.setmonth(1); d.setdate(1); document.getelementbyid("demo").innerhtml = d; } </script> </head> <body> <div id="demo"></div> </body> </html> i get... sat mar 01 2014 15:11:03 gmt-0600 (central standard time) i'm running win7 pro 64-bit , clock , calendar seem correct. today 31st of january. when d.setmonth(1); trying set date 31st of february. since date doesn't exist, falls on 3rd of march. set whole date when initialise object, don't try change piecemeal.

WEBMethods connection string is not working? -

the following webmethods string not connecting server on our companies network drive. can take string , place in web broswer , windows exploer screen when run webmethods error access denied. question: causing access denied through webmethods? (i can access file through internet explorer) connection string: (names change safe guard information) //servername/drivename/s/ab/p/t error: com.wm.app.b2b.server.serviceexception: java.io.filenotfoundexception: \\espr1fs05 \dssxfer\systems\access backups\prod\test\tbe-file02.txt (access denied) new code added: system.out.println("outputdirectory --> " + outputdirectory); writer = new printwriter(new bufferedwriter(new filewriter("doug.txt"))); i have code in java service , write network drive test. allowedwritepaths=//espr1fs05/dssxfer/systems/access backups/prod/test; allowedreadpaths=//espr1fs05/dssxfer/systems/access backups/prod/test; alloweddeletepaths=//

java - is it worth catching an Exception just to close a stream and reset a CharsetDecoder? -

my understanding closing streams in java recommended, not close "requirement". likewise, it's idea, not near requirement, reset charsetdecoder after done using it. throwing exception makes method clean , readable. catching exception might "recommended", adds little clutter method. so, on professional programming team, "catch , close/reset"? important? here, preferred throw it: <!-- language: java --> public static string[] grabdata(url url, charsetdecoder dcdr) throws exception { list<string> dump = new arraylist<string>(); dcdr.reset(); httpurlconnection conn = (httpurlconnection) url.openconnection(); bufferedreader bufrdr = new bufferedreader(new inputstreamreader(conn.getinputstream(), dcdr)); while (dump.add(bufrdr.readline())) { } bufrdr.close(); dcdr.reset(); return dump.toarray(new string[0]); } your understanding incorrect. indee

Accessing Session in the ServiceStack Razor View -

i trying access session inside servicestack razor view (partial). in case trying render our menu exists in session. @(new htmlstring(this.sessionas<customusersession>().menuhtmlstring)) i error: response status error code nullreferenceexception message object reference not set instance of object. stack trace [bopbasicinfo1vm: 1/31/2014 9:46:45 pm]: [request: {quotenumber:1,agencyid:0,errors:[],isvalid:false}] system.nullreferenceexception: object reference not set instance of object. @ asp._ bopbasicinfo1vm.execute() @ servicestack.razor.viewpage 1.writeto(streamwriter writer) @ servicestack.razor.managers.razorpageresolver.executerazorpagewithlayout(irequest httpreq, iresponse httpres, object model, irazorview page, func 1 layout) @ servicestack.razor.managers.razorpageresolver.resolveandexecuterazorpage(irequest httpreq, iresponse httpres, object model, razorpage razorpage) @ servicestack.razor.managers

machine learning - Testing The Trained Neural Network - Matlab -

i want use neural network classify handwritten digits of mnist dataset i have created 2 layer neural network 100 hidden unit , trained using 60,000 * 784 trainimages matrix , 60,000 * 1 trainlabels net = newff(trainimages,trainlabels,100) how test , calculate error rate of trained network 10,000 * 784 testimages training: [net,tr]=train(net,trainimages',trainlabels'); testing: predictedlabels = sim(net,testimages'); error_rate = 1- mean(predictedlabels == testlabels');

ruby on rails - Uninitialized constant error while deleting multiple connected records from database -

i have following database. after user registers site new galleryphoto created him. can have 1 galleryphoto in can store multiple photos. these models: class user < activerecord::base has_one :gallery_photos, :dependent => :delete has_many :photos, :through => :gallery_photos after_create :setup_gallery def setup_gallery galleryphoto.create(userid: self.id, name: self.email) end end class galleryphoto < activerecord::base belongs_to :user has_many :photos, :dependent => :delete_all end class photo < activerecord::base belongs_to :gallery_photo end after want delete user: def destroy user.find(params[:id]).destroy end i receive following error on line: nameerror in userscontroller#destroy uninitialized constant user::galleryphotos gallery created after user registers , can add images it. thank help! modify line has_one :gallery_photos, :dependent => :delete has_many :photos, :through => :gallery_photos t

ajax - PHP Session Array -

i'm trying sketch out easiest way pass integers array when button/href clicked. need access array globally on page. do have ajax or possible in 1 file through session array? thanks pointing me in right direction. -jonathan i suggest using client side tehcnology such localstorage or cookies instead. the main reason that, if trying track clicks on buttons , links php, need send new http request every time can track on php $_post or $_get . while can obvious link, hurt user experience when comes buttons (that not form submit buttons). assuming want avoid refershing page on every button click, need implement ajax. leads folllowing question - if using javascript , ajax, why not track in javascript first place , communicate server when needed? client side tracking localstorage : by using localstorage or cookies , can bind events clicks , save array. in javascript/jquery can use following examaple: $(document).ready(function() { var urls = json.parse(lo

npm - Installing Bower on Ubuntu -

i'm trying install bower on xubuntu 13.10, following instructions on bower home page, after doing sudo apt-get install npm , sudo npm install -g bower following after issuing bower on command line: /usr/bin/env: node: no such file or directory i install node (even though assume not unnecessary since bower's dependency npm, correct?). anyhow, after install node sudo apt-get install node of bower commands, such bower help , don't anything, i.e. output nothing. how install bower on ubuntu (preferably without manually downloading various versions of things)? sudo ln -s /usr/bin/nodejs /usr/bin/node or install legacy nodejs: sudo apt-get install nodejs-legacy as seen in this github issue .

statistics - Intuition about the kernel trick in machine learning -

i have implemented kernel perceptron classifier, uses rbf kernel. understand kernel trick maps features higher dimension linear hyperplane can constructed separate points. example, if have features (x1,x2) , map 3-dimensional feature space might get: k(x1,x2) = (x1^2, sqrt(x1)*x2, x2^2) . if plug perceptron decision function w'x+b = 0 , end with: w1'x1^2 + w2'sqrt(x1)*x2 + w3'x2^2 which gives circular decision boundary. while kernel trick intuitive, not able understand linear algebra aspect of this. can me understand how able map of these additional features without explicitly specifying them, using inner product? thanks! simple. give me numeric result of (x+y)^10 values of x , y. what rather do, "cheat" , sum x+y , take value 10'th power, or expand out exact results writing out x^10+10 x^9 y+45 x^8 y^2+120 x^7 y^3+210 x^6 y^4+252 x^5 y^5+210 x^4 y^6+120 x^3 y^7+45 x^2 y^8+10 x y^9+y^10 and compute each term , add them together?

xcode5 - Compiling embedded MATLAB functions in Simulink, Mac OSX 10.9 Mavericks, Xcode 5, MATLAB 2012b -

Image
after updated latest osx mavericks, i've had issues compiling simple matlab function blocks in simulink, diagram , attached code below. function y = fcn(t) %#codegen %simple matlab .m function compiled diagram y = sin(t)+cos(t); i had same problem under osx 10.8 mountain lion, able solve problem downloading mathworks patch , following instructions on this site . with new os , having upgraded xcode 5, followed instructions in this post change compiler , sdk info in mexopts.sh file from #patch: macosx10.8 cc='llvm-gcc-4.2' cxx='llvm-g++-4.2' sdkroot='/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk/' macosx_deployment_target='10.8' archs='x86_64' to #patch: macosx10.9 cc='llvm-gcc' cxx='llvm-g++' sdkroot='/applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sd

javascript - Website reload after page orientation -

i have 1 page responsive website , don't want reload/refresh after page orientation. how can prevent this? add piece of javascript page: $(window).on('load', function() { switch(window.orientation){ case -90: contenttype = "rotated-right"; break; case 90: contenttype = "rotated-left"; break; } $('html').removeclass('rotated-left').removeclass('rotated-right').addclass('rotated-' + orientation) }); and css: html.rotated-right { transform: rotate(90deg); -webkit-transform: rotate(90deg); } html.rotated-left { transform: rotate(-90deg); -webkit-transform: rotate(-90deg); }

How to get rid of yahoo search in firefox browser? -

i have deleted yahoo search in firefox browser search button. when type wrong url in browser, getting yahoo search results. how rid of that?. default search engine, set google. screen shot http://imgur.com/bec6983 want rid of yahoo search thing. type “about:config” address bar , accept warning. search "browser.search.defaultenginename" in search area. change search engine want see this thread on mozilla support site or this step step guide

python - Wxpython: Couldn't retrieve information about list control item XXX -

when deleting select item, errormsg poped up: "can't retrieve information list control item xxx". can take , find way solve it? appreciate help! import wx data = { 0 : (u"test2", "123456", ), 1 : (u"test", "123456",), 2 : (u"doe", "156789", ), 3 : (u"john", "13455", ) } class myapp(wx.app): def oninit(self): frame = myframe(none) frame.show() self.settopwindow(frame) return true class myframe(wx.frame): def __init__(self, parent): wx.frame.__init__(self, parent, wx.newid(), size=(500, -1)) wx.frame.centeronscreen(self) self.panel = mypanel(self) class mypanel(wx.panel): def __init__(self, parent): wx.panel.__init__(self, parent) self.list = mylistctrl(self,3) self.add_button = wx.button(self, label="add") h_sizer = wx.boxsizer(wx.horizontal) h_sizer.add(self