Posts

Showing posts from September, 2010

actionscript 3 - How to search a given string in XML? -

i have xml like: <bodytext> <1 beginindex="0" endindex="723"> teddy bear soft toy in form of bear. teddy bears among popular gifts children , given adults signify love, congratulations or sympathy.</1> <2 beginindex="724" endindex="347"> morris michtom saw drawing of roosevelt , inspired create new toy. created little stuffed bear cub , put in shop window sign read "teddy's bear," after sending bear roosevelt , receiving permission use name. </2> </bodytext> how search particular string in xml ? ex: if user enters "drawing of roosevelt". 2nd xml element contains string , should return 2(it should return paragraph no). how find out ? convert xml internal class, lets call myentry has id ( 1 , 2 values in example, put them attribute, name of node irrelevant, put "a" ), beginindex, endindex , value (your string) , put method inside myentry in like: pu...

Remove the button border including the 'tab event' in wpf? -

Image
i manage remove button border using style <style x:key="transparentstyle" targettype="{x:type button}"> <setter property="template"> <setter.value> <controltemplate targettype="button"> <border background="transparent"> <contentpresenter/> </border> </controltemplate> </setter.value> </setter> </style> however, how remove dotted black border appears tab key? that focusvisualstyle showing dotted line, try set x:null

php - get the number from a string then do the calculation -

i have string this $coordinate = "coords='429, 457, 421, 460, 424, 464, 433, 465, 433, 460'"; i want multiply numbers 2, how can write simple php code calculation this? this new $coordinate should be coords="858, 914, 842, 920, 848, 928, 866, 930, 866, 920" my orriginal string "alt='japan' shape='poly' coords='429, 457, 421, 460, 424, 464, 433, 465, 433, 460'"; something like: $coords="429, 457, 421, 460, 424, 464, 433, 465, 433, 460"; $coords_arr = explode(",", $coords); array_walk($coords_arr, 'alter'); function alter(&$val) { $val *= 2; //multiply 2 } print_r($coords_arr); updated code:: $coordinate = "coords='429, 457, 421, 460, 424, 464, 433, 465, 433, 460'"; $arr = explode("=", $coordinate); $data = trim($arr[1], "'"); //remove quotes start , end $coords=explode(",", $data); array_walk($coords, 'al...

c# - LINQ First() or Single() parameter -

trying sorted data csv file. code works fine except "side" column string , same 1 group. can't figure out parameter should single() of first() methods. var stuff = line in file.readlines(@"d:\tmp\4.csv").skip(1) let columns = line.split(';') select new { time = columns[0], side = columns[2], qty = columns[3], symbol = columns[4], price = columns[5], }; var sorted = line in stuff group line new { line.time, line.symbol } category select new { category.key.time, category.key.symbol, qty = category.sum(p => int32.parse(p.qty)), price = category.average(p ...

html - google +1 button adds scroll bar to my site -

i have had google +1 button on site more year , worked fine. in last couple of days button started create horizontal scroll bar on site. i know beacase when remove button scroll bar disappears. here site: www.kitchen-guide.co.il any suggestions should do? thanks! borrowing superware's answer, having same problem... however, worked me: iframe[id^="oauth2relay"] { position: fixed !important; }

javascript - Getting the src attribute of an image within a parent tag -

i have list of images, 1 of gets class="selected" after change occurs on page: <div id="selectable"> <li> <img src="\images\1.jpg" /> </li> <li class="selected"> <img src="\images\2.jpg" /> </li> <li> <img src="\images\3.jpg" /> </li> </div> i want able capture value of image's src attribute, can use later... i'm thinking this: $("#selectable").change(function() { var src = $('li[class="selected"]').attr('src'); alert("source of image alternate text = example - " + src); } but need value of src attribute of child element (img). $("li.selected").find("img").attr("src");

Change highlight point color in flot -

i using latest flot plugin 0.8 plot realtime data.i stuck @ following issue i highlighted point using plot.highlight(series, datapoint); its working fine.but want change highlight color of plotted graph. is there way change highlight point color after plotting flot chart? any highly appreciated. simply change series 'highlightcolor' option, i.e. plot.getdata()[0].highlightcolor = "#f00";

Inno Setup: Delete empty lines from test file -

we using below code delete empty lines text file, it's not working. function updatepatchlogfileentries : boolean; var a_strtextfile : tarrayofstring; ilinecounter : integer; conffile : string; begin conffile := expandconstant('{sd}\patch.log'); loadstringsfromfile(conffile, a_strtextfile); ilinecounter := 0 getarraylength(a_strtextfile)-1 begin if (pos('', a_strtextfile[ilinecounter]) > 0) delete(a_strtextfile[ilinecounter],1,1); end; savestringstofile(conffile, a_strtextfile, false); end; please me. in advance. because re-indexing of array inefficient , having 2 arrays copying non empty lines of file unecessarily complicated, suggest use tstringlist class. has need wrapped inside. in code write function this: [code] procedure deleteemptylines(const filename: string); var i: integer; lines: tstringlist; begin // create instance of string list lines := tstringlist.create; ...

php - Hide thumbnail of Backend file uploader in Magento? -

Image
i using magento's default file uploader in custom modules. how can hide image thumbnail shown in image below? in form.php of custom extention change second argument image file before $fieldset->addfield('before_image', 'image', array( 'label' => mage::helper('testimonials')->__('before image'), 'required' => false, 'name' => 'before_image', )); after $fieldset->addfield('before_image', 'file', array( 'label' => mage::helper('testimonials')->__('before image'), 'required' => false, 'name' => 'before_image', ));

ios - How to release memory for declared object in iPhone -

this question has answer here: app crash in dealloc 2 answers i'm facing small problem, i declare array in .h file , allocate in viewdodload method. in dealloc method check if array not equal nil array=nil . it's crashing in ios 5.1.1. can't understand reason crash. my code, @interface sampleapp : uiviewcontroller { nsmutablearray *objarray; } @end @implementation sampleapp - (void)viewdidload { [super viewdidload]; objarray=[[nsmutablearray alloc]init]; } -(void)dealloc { [super dealloc]; if (objarray!=nil) { [objarray removeallobjects]; [objarray release];objarray=nil; } } add [super dealloc]; @ end of dealloc method , not @ beginning. recommended apple in documentation dealloc method . when not using arc, implementation of deallo...

c# 4.0 - C# Multiple Inheritance -

currently im studying c# asp.net mvc 4 code first approach . im visual basic developer, , want start c#. and, came accross situation i've manage multiple inheritance. but, not possible class thought. so, how should manage these classes have : //i have following person class hold common properties //and type of person e.g : student, faculty, administrative public class person { public int id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string type { get; set; } } //this student class, derived person public class student:person { public datetime dateofbirth { get; set; } public datetime enrollmentdate { get; set; } public string remarks { get; set; } public bool approved { get; set; } public datetime approveddate { get; set; } public int approveduserid { get; set; } } //this faculty class, derived person public class faculty : person { public datetime hireddate { get; set; } ...

javascript - ExtJs 4.1.1 Checkbox is rendering as button, need normal check box -

i using extjs 4.1.1 , want render normal checkbox rendered in div, following code rendered button. checked extjs source ext.form.field.checkbox , in found comment fieldsubtpl property says // creates not actual checkbox, button given aria role="checkbox" (if aria required) , // styled custom checkbox image. allows greater control , consistency in // styling, , using button allows gain focus , handle keyboard nav properly. if case way normal checkbox? ext.create('ext.container.container',{ id: 'mycontainer', width: 100, renderto: 'chekboxid', items: [{ xtype:'checkboxgroup', id:'chekcboxgrpid', items:[ { boxlabel: 'text check box', name : 'mycheckbox', inputvalue: 'true', chec...

php - Get Date from Datetime String -

this question has answer here: convert strtotime date time format in php 4 answers this string tue, 20 aug 2013 10:45:05 , want string in date format : 2013-08-20 . guys please help. thanks try this, $d=date('y-m-d',strtotime('tue, 20 aug 2013 10:45:05')); echo $d;

Changing background of a button in widget: Android -

i need change background of button programmatically. button placed in widget. i got example of changing background color here , changing color, , want use image instead of color. is there way apply background image button programmatically? thank you instead of using setbackgroundcolor in example linked should able use setbackgroundresource think.

ruby - Get erb view from inside layout -

i trying name of current view being loaded layout.erb . trying inject js file , css file layout head. building name files based on name of erb view: <link rel="stylesheet" href="/devcss/<%= viewname%>.css"> <script src="/devjs/<%= viewname %>.js" type="text/javascript"></script> how can layout template? update :i not interested in knowing how inject script in specific place in layout, think content_for used for. need knok in example above how determine viewname variable insert following application.html.erb after inside head tag <%= "#{yield(:scripts)}".html_safe if content_for?(:scripts) %> and in individual erb, insert similar following <% content_for :scripts %> <link rel="stylesheet" href="/devcss/<%= viewname%>.css"> <script src="/devjs/<%= viewname %>.js" type="text/javascript"></script...

php - Laravel Eloquent Get certain columns from nested tables using with() -

i'm trying table nested inheritance , filtered columns. , can't find ho easy it. i have table shop witch has many locations (and location has 1 city) , many actions i want of in once eloquent , filter specific columns. this how filtering shop table don't know how filter tables locations , actions. $this->shop->with('locations')->with('actions')->get(array('id','name','recommended','category_id')); i need this: $this->shop ->with('locations',location::with('city', city::get(array('id','name')))->get(array('id','name'))) ->with('actions', action::get(array('id','name')))->get(array('id','name'));); see laravel eloquent: how columns joined tables the easiest way filter columns in model (as stated in top answer linked above). however, can inconvenient when want build dynamic queries. theo...

c# - How to create file when path is 256 char long in Windows 8 application -

how create file when path 256 char long in windows 8 application . when try create file 256 char path ..no error coming , no file created. //------------------ string filename = "aaaaaaaaaaaaaaaaaaaaa_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt"; applicationdata.current.localfolder.createfileasync(filename); //------------------

javascript - how to add customize arrow in select sub menu in twitter bootstrap -

Image
please can 1 me, want add , customize select arrow in select dropdown arrow image. if you're using silviomoreto's fork of bootstrap dropdown then, the bootstrap menu arrow can added show-menu-arrow class. html: <select class="selectpicker show-menu-arrow"> <option>mustard</option> <option>ketchup</option> <option>relish</option> </select> js: $('.selectpicker').selectpicker(); check jsfiddle example.

winapi - program exits when shellexcute was called -

win7 os, vs2008. program disappears when shellexcute called, it's wtl project , code these: *.h command_handler(idc_btn_login, bn_clicked, dologin) *.cpp lresult xloginview::dologin(word, word, hwnd, bool&) { ::shellexecute(null, _t("open"), _t("http://mysite.com/login.php"), null,null, sw_show); return 0; } when login button clicked, program disappeard , visual studio exit too. even code such simple these: int _tmain(int argc, tchar* argv[], tchar* envp[]) { int nretcode = 0; // initialize mfc , print , error on failure if (!afxwininit(::getmodulehandle(null), null, ::getcommandline(), 0)) { // todo: change error code suit needs _tprintf(_t("fatal error: mfc initialization failed\n")); nretcode = 1; } else { // todo: code application's behavior here. shellexecute(null, l"open", l"http://stackoverflow.com", null, null, sw_show); ...

android - BroadcastReceiver passing value error -

i want pass integer value activity class( playlistactivity.java ) service ( audioservice.java ) class. when click on listitem , application gets stopped. couldn`t figure error. hope me error in logcat: java.lang.runtimeexception: error recieveing broadcast intent {act-com.exaple.serviceaudio.audioservice.play_song flg=0x10 (has extras)} in com.example.serviceaudio.audioservice$audioplayerbroadcastreciever@41b4e818......... here codes. playllistactivity.java lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { playsongsong(position); }}); @override protected void ondestroy() { // todo auto-generated method stub unbindservice(serviceconnection); super.ondestroy(); } public void playsongsong(int songindex){ intent intent = new intent(audioservice.play_song); intent.putextra("songindex...

android - How to Call javascript function by webview? -

i have 2 message when call invokescriptmethod("showpoll(" + device.pollid + ");"); , not work! message in logcat 1-firewall not null 2-euler: isurlblocked = false protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_poll); device.webviewshowpoll = (webview) findviewbyid(r.id.webviewshowpoll); device.webviewshowpoll.getsettings().setjavascriptenabled(true); device.webviewshowpoll.getsettings().setpluginsenabled(true); device.webviewshowpoll.getsettings().setjavascriptcanopenwindowsautomatically(true); device.webviewshowpoll.getsettings().setallowfileaccess(true); device.webviewshowpoll.addjavascriptinterface(appconnector, "appconnector"); try { device.webviewshowpoll.loaddatawithbaseurl("file:///android_asset/", utility.convertstreamtostring(getassets().open("application.ht...

ios - Objective-C - EXC_BAD_ACCESS error with ALAsset and XmlWriter -

Image
i'm using alassetlibrary retrieve information images on device (ios simulator) moment. have needed information, want write them xml file . i'm using xmlstreamwriter ( https://github.com/skjolber/xswi ) simple , easy use. problem i'm having exc_bad_access (code=1) error when run application. know related streamwriter because if comment lines of code program work perfectly. here there code (i'm using arc ): xmlwriter* xmlwriter = [[xmlwriter alloc]init]; [xmlwriter writestartdocumentwithencodingandversion:@"utf-8" version:@"1.0"]; [xmlwriter writestartelement:@"photos"]; nsmutablearray *list = [[nsmutablearray alloc] init]; alassetslibrary* library = [[alassetslibrary alloc] init]; [library enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) { if (group) { [group setassetsfilter:[alassetsfilter allphotos]]; [group enumerateassetsusingblock:^(alasset *asset, nsuinteger index, bool *stop){ ...

c++ - Security: Static Library (.lib) vs Dynamic Link Library (.dll) -

at present in situation had include smtp library , database details sending email , inserting data database client side in normal c++ console based app . major concern is, don't want data in .exe read tools such pe explorer etc , i've decided include db details such hostname, password, dbname, tablename , smtp details such username, password etc in library, link , not in exe directly. secured way or there other way around perform task? if yes, 1 use - .lib or .dll ? please clarify, in advance...

ios - How to put Count so that it won't have warning -

this question has answer here: uicollectionview not showing pictures [duplicate] 1 answer i want put count instead of long not work code nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsarray *locations = @[ @"bottoms", @"dress", @"coats", @"others", @"hats", @"tops" ]; nsstring *fpath = [documentsdirectory stringbyappendingpathcomponent:locations]; nsarray *directorycontent = [[nsfilemanager defaultmanager] directorycontentsatpath: fpath]; collectiontrash.delegate =self; collectiontrash.datasource=self; for(nsstring *str in directorycontent){ nslog(@"i"); nsstring *finalfilepath = [fpath stringbyappendingpathcomponent:str]; nsdata *data = [nsdata datawithcontentsoffile:finalfile...

i want to change css vars of extjs -

i want set back-ground color of panel using $panel-body-background-color. how can set in panel config ? getting error in following peace of code. here code var mainpanel = ext.create('ext.form.panel', { renderto: ext.get('main'), xtype: 'form', title: 'user registration', $panel-body-background-color : black /style:{'$panel-body-background-color:#64fe2e'} }); $panel-body-background-color not component configurations, sass variables. defined , configured outside of app code. see link below quick tutorial on extjs theming. powerful can overwhelming @ first. http://docs.sencha.com/extjs/4.2.1/#!/guide/theming you should using sencha command make work properly, if you can explore packages folder see themes , how set up. can use sencha command create new theme: sencha generate theme my-custom-theme

sql server - Query to make rows into column values without using PIVOT -

Image
i have following query , gives result shown below. select sum(atm) atm,sum(cc) cc,sum(csh) csh ,sum(chk) chk sales repid= 9000 , dateadd(dd,0,datediff(dd,0,idate)) ='2013-08-25 00:00:00' how modify query without using pivot rerun result shown below. this should work select 'atm' type, sum(atm) amount sales repid= 9000 , dateadd(dd,0,datediff(dd,0,idate)) ='2013-08-25 00:00:00' union select 'cc' type, sum(cc) amount sales repid= 9000 , dateadd(dd,0,datediff(dd,0,idate)) ='2013-08-25 00:00:00' union select 'csh' type, sum(csh) amount sales repid= 9000 , dateadd(dd,0,datediff(dd,0,idate)) ='2013-08-25 00:00:00' union select 'chk' type, sum(chk) amount sales repid= 9000 , dateadd(dd,0,datediff(dd,0,idate)) ='2013-08-25 00:00:00' or, using cte: ;with cte(at...

How to extract information from self-closing xml elements in vb.net in asp.net? -

for example, <image><url scope="public" type="string" value"image url"/></image> i want extract image url(value of url) element , display image. how can that? you may use xdocument ( linq-to-xml ): dim url string = xdocument.load(new stringreader("<image><url scope=\"public\" type=\"string\" value=\"image url\"/></image>")).descendants("url").attribute("value").value check xdocument.load(textreader) method overload documentation.

Where are api documentation and demo for JAVA OCR? -

i want use java ocr : http://sourceforge.net/p/javaocr/ can't find api documentation , demo. in download file, have jars. can me? thanks you can find demo code @ ocrscannerdemo old api, new api new api demo about api javadoc can generate maven. to source code : git clone http://git.code.sf.net/p/javaocr/source javaocr-source

postgresql - excluding rows from resultset in postgres -

Image
this result set i returning result set on base of refid using where refid in . on here, need apply logic without kind of programming (means sql query only). if in result set, getting period particular refid other rows same refid must not returned. for example, 2667105 having period myid = 612084598 must not returned in result set. according me can achieved using case have no idea how use it, mean don't know should use case statement in select statement or where clause... edit: this how suppose work, myid = 612084598 default row refid = 2667105 if wants refid period = 6 must return rows except myid = 612084598 but if looking period = 12, period no specific refid present in database.. must return rows except first one.. means rows refid default one.. not clear definition of problem, try this: with cte ( select *, first_value(period) over(partition refid order myid) fv test ) select myid, refid, period ct...

facebook apprequest redirecting to domain - PHP SDK -

this first app in fb. i'm developing game in facebook. i'm using php-sdk invite friends app. i able send requests , ids well, when when click on send request. i'm getting redirected domain. <a href="invite.php">invite</a> this invite.php code <?php include("config.php"); $reqid = $_get['request']; $to = $_get['to']; if($reqid==''){ $message = "check great app?"; $url = canvas_url."invite.php"; $requests_url = "http://www.facebook.com/dialog/apprequests?app_id=".app_id."&redirect_uri=".urlencode($url)."&message=".$message; echo("<script> top.location.href='" . $requests_url . "'</script>"); }else{ echo "invite done!"; echo "invited ".count($to); exit; } ?> i invite done! invited why redirecting domain ?? when go through http://apps.facebook.com/app-na...

wordpress - How to add a class within php -

i have code working pull in posts 1 category onto page in wordpress: <?php query_posts('cat=28'); while (have_posts()) : the_post(); the_title(); the_content(); endwhile; ?> what want able add css class both title , content. know little php maybe explain trying do. <?php query_posts('cat=28'); while (have_posts()) : the_post(); <div class="title-class">the_title();</div> <div class="content-class">the_content();</div> endwhile; ?> i know way off hope can lowly front end designer :) use : <?php query_posts('cat=28'); while (have_posts()) : the_post(); ?> <div class="title-class"><?php the_title(); ?></div> <div class="content-class"><?php the_content(); ?></div> <?php endwhile; ?> or <?php query_posts('cat=28'); while (have_posts()) : the_post(); ec...

java - Exporting two display tags from same page -

i have tried export 2 display tags same page independently.but first display tag exported export option in second displaytag check link displaytag1.2 here. has examples. click on view source respective code.

vbscript - VB Script (VBS) array reference -

i have 2 arrays array1 = array("elem1", "elem2", "elem3") array2 = array("item1", "item2", "item3") i select 1 of arrays randomize dim refarray if rnd < 0.5 refarray = array1 else refarray = array2 end if and make changes elements refarray(0) = "foo" refarray(1) = "bar" say rnd less 0.5 , refarray = array1 executes. both array1 , refarray point same piece of memory, when make changes refarray should visible in array1. after code executes expect contents of array1 be: "foo", "bar", "elem3". instead remains unchanged. the problem having vbs not pass reference array1 or array2, instead duplicates new array refarray, gets changes , leaves array 1 , 2 unchanged. how can reference array , have changes made refarray apply referenced object (normal java/c usage)? thanks. the way reference native vbscript array sub/function call: >> su...

javascript - 'undefined' is not an object (evaluating 'field.getAttribute') -

Image
i have used code link below login.. works fine facebook .. how login website casperjs? but give error login page of site. name of username field loginform[username] , name of password field loginform[password]. my code. casper.start(url, function() { // search 'casperjs' google form console.log("page loaded"); this.test.assertexists('form#login-form', 'form found'); this.fill('form#login-form', { loginform[username]: 'ascd@csc.com', loginform[password]: '******' }, true); }); output [info] [remote] attempting fetch form element selector: 'form#login-form' remote message caught: attempting fetch form element selector: 'form#login-form' [error] [remote] typeerror: 'undefined' not object (evaluating 'field.getattribute') remote message caught: typeerror: 'undefined' not object (evaluating 'field.getattribute') page error: typeerror...

ios - Which one is faster? for-loop or isEqualToArray -

i know isequaltoarray does... i have array size 160, each containing dictionary 11 entries, can comparison based on first column (contains date when row changed). now can simple for-cycle: bool different = false; (int index = 0 ; index < [newinfo count] ; ++index) if (![[[oldinfo objectatindex:index] objectforkey:@"update"] isequal:[[newinfo objectatindex:index] objectforkey:@"update"]]) { different = true; break; } if (different) { } else nslog(@"contact information hasn't been updated yet"); or can use built-in isequaltoarray method: if ([oldinfo isequaltoarray:newinfo]) nslog(@"contact information hasn't been updated yet"); else { nslog(@"contact information has been updated, saving new contact information"); [newinfo writetofile:path atomically:yes]...

c - different behaviour of scanf function with different format-specifiers -

when use scanf %d or %f, skips white-space characters. on other hand when used %c reads white-space characters.can elaborate on why happens? with %d or %f code below skips white-space characters automatically #include<stdio.h> void main(void) { int i; scanf("%d ",&i); } if read input this #include<stdio.h> void main(void) { char ch; scanf(" %c ",&ch); scanf(" %c",&ch); /*or this*/ } it skips white-space characters. why scanf showing different behaviours format-specifiers???? basically, it's because white space character not valid %d or %f , skip them. but white space character valid character, %c try process it. c99 §7.19.6.2 the fscanf function section 8 input white-space characters (as specified isspace function) skipped, unless specification includes [ , c ,or n specifier.

android - Multiple activities called on single button click causing screen flashing/blinking -

i new android. please me working multiple activities. i working on sms problem have click on button start activity. activity handling checks , doing work in background. in case, fetching user's address , checking attachments (for mms). after starts activity displays ui in case dialogue user entering recipients the problem when click on button in first screen, blinks , starts intermediate activity in background , starts activity displays dialog. i dont want ui blinking appearing user, , cannot skip intermediate activity how can call third activity appear on button click on first screen without screen blinking/flashing any apprectaied

ruby on rails - How to use reverse proxy on apache for a specific url? -

i have load balancer balances 2 servers & b on cloud both of have apache running on them. & b can serve requests except search powered a. search request through http://example.com/search . if b receive such request, how can forward request , serve response received server client? ps: running ruby on rails. apache's proxypass directive seems you're asking for. you in server b configuration: proxypass /search http://server-a.example.com

php - MySQL: Every derived table must have its own alias -

this question has answer here: every derived table must have own alias 3 answers update `flightschedule` set delay=( select * ( select minute(eta - sta) `flightschedule` `flightnum_arr` = '3517' ) ) `flightnum_arr` = '3517'; says "every derived table must have own alias". how fix issue? fixing - shown in error message: update `flightschedule` set delay= (select update_field ( select minute (eta - sta) update_field `flightschedule` `flightnum_arr`='3517' ) internal_0 ) `flightnum_arr`='3517'; but above there more correct suggestion - rid of nested subquery @ (see gordon's answer). edit (based on comments) : if want find difference, use timediff function: update `flightschedule` set delay = timediff(eta - sta) `flightnum_arr`='3517';

machine learning - Late fusion step of classification using libLinear -

i doing classification work use liblinear kernel these days. , have trained 2 type of feature sets 2 models prediction query input. wish utilize late fusion combine 2 result models, change code of liblinear can decision score different classes. got 2 sets of score determine class query should in. is there standard way "late fusion" or intuitively add 2 scores of each classes , choose class highest score candidate? the standard way combine multiple classifiers weighted sum of scores of individual classifiers. of course, have problem of specifying weight coefficients. there different possibilities: set weights uniformly set weights proportional performance of classifier train new classifier takes scores input

validation - How to validate age using Angularjs? -

we using angular js our project. , validation handling through angular js. we able validate text field except drop down box. we have 3 dropdown box datefields(dd mm yyyy). have 2 questions... how can fetch values these 3 dropdown , how form date. then, want validate date (if age greater 50 set error flag). how can using angular js? want set form invalid if user select age beyond 50. please suggest me this? i'm new angular js. i don't have code base answer off of, here function identify correct age: $scope.datediff = function(birthmonth, birthday, birthyear) { var todaydate = new date(), todayyear = todaydate.getfullyear(), todaymonth = todaydate.getmonth(), todayday = todaydate.getdate(), age = todayyear - birthyear; if (todaymonth < birthmonth - 1) { age--; } if (birthmonth - 1 === todaymonth && todayday < birthday) { age--; } return age; }; $scope....

math - Addition using printf in C -

this question has answer here: adding 2 numbers without using operators 2 answers on net: using printf add 2 numbers(without using operator) following: main() { printf("summ = %d",add(10,20)) return 0; } int add(int x,int y) { return printf("%*d%*d",x,' ',y,' '); } could please explain, how works: return printf("%*d%*d",x,' ',y,' '); note: fails when call "sum" following: sum(1,1) or sum(3,-1) there 2 central concepts here: printf() returns number of characters printed. the %*d format specifier causes printf() read 2 integers arguments, , use first set field width used format second (as decimal number). so in effect values being added used field widths, , printf() returns sum. i'm not sure actual d formatting of space character, @ moment. loo...

ios - Objective-C/ALAssetLibrary - How read and save informations about images -

i have found informations images inside emulator using alassetlibrary. can show correctly these informations using nslog, don't know how can save these informations inside list example. code i'm using this: nsmutablearray *list = [[nsmutablearray alloc] init]; alassetslibrary* library = [[alassetslibrary alloc] init]; [library enumerategroupswithtypes:alassetsgroupall usingblock:^(alassetsgroup *group, bool *stop) { if (group) { [group setassetsfilter:[alassetsfilter allphotos]]; [group enumerateassetsusingblock:^(alasset *asset, nsuinteger index, bool *stop){ if (asset){ nsstring *description = [asset description]; nsrange first = [description rangeofstring:@"urls:"]; nsrange second = [description rangeofstring:@"?id="]; nsstring *path = [description substringwithrange: nsmakerange(first.location + first.length, second.location - (first.location + first.len...

java - How can I change the color of buttons? -

i'm developing first application in vaadin , can't change color of button (want them blacks). i'm using custom theme inherited reindeer. i try in way: buttonsetting = new button(); buttonsetting.seticon(new themeresource("images/icons/16px/setting.png")); buttonsetting.addstylename(reindeer.button_small); buttonsetting.addstylename(reindeer.layout_black); but doesn't work, how can do? as far can see reindeer.layout_black should style name of component containing button. public class adminbar extends customcomponent { private final horizontallayout layout = new horizontallayout(); public adminbar(lang lang) { setcompositionroot(layout); setwidth(100, unit.percentage); layout.setwidth(100, unit.percentage); setstylename(reindeer.layout_black); button button = new button("i'm button"); button.setstylename(reindeer.button_small); layout.addcomponent(button); } } if set style name o...

android - Can't update data for my list view -

Image
i'm trying add feature app can allow users edit data used populate item list view included in payments class. whenever enter changes wish make , press accept, list view doesn't update new edited data. below data add payments class. public void acceptclicked(view view) { failflag = false; checkedittexts(); // if fine if (failflag == false) { mosdatabase db = new mosdatabase(this); sqlitedatabase datab = db.getwritabledatabase(); converttostring(); convertinttostring(); spaymentdate = spaymentyear + spaymentmonth + spaymentday; contentvalues vals = new contentvalues(); vals.put("ptitle", stitle); vals.put("pday", spaymentday); vals.put("pmonth", spaymentmonth); vals.put("pyear", spaymentyear); vals.put("pa", samount); vals.put(...

java - Display multiple result array -

so far, got app working already, i'm faced issue. fyi, app getting user input (the user types in sentence , app ambiguous word/s , display meanings). this code have: final string[] words = {"cowboy", "animal" , "monster", "duck"}; final string[] meanings = { "meaning1", "meaning2", "meaning3", "meaning4" }; private void initcontrols() { // todo auto-generated method stub text = (edittext) findviewbyid (r.id.edittext1); view = (textview) findviewbyid (r.id.textview1); clear = (button) findviewbyid (r.id.button2); clear.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub text.settext(""); view.settext(""); } }); ok = (button) findviewbyid (r.id.button1); ok.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // tod...

php - Convert TIMEDIFF to hours plus minutes -

time1: 2013-08-26 16:33:00 time2: 2013-08-26 15:10:00 $query="update `flightschedule` set delay = minute(timediff(time1, time2)) `flightnum_arr`='".$flightnum_arr."';"; it saves value 23 delay. instead correct answer should 83 minutes. how it? i think looking for: $query="update `flightschedule` set delay = ceil((unix_timestamp(time1) - unix_timestamp(time2))/60) `flightnum_arr`='".$flightnum_arr."';"; alternatively, there time_to_sec function - and, since provides result in seconds, you'll need divide 60 too.

linq - Dynamic Expression Building Error -

i have searched lot regarding issue wrong here shorter version of code /// companyid integer type value here 220 var cond1 = buildexpression(companyid); var acntlst=entities.accounts.where(cond).tolist(); account class querying against account collection buildexpression function private static expression<func<account, bool>> buildexpression(string companyid) { var paramexp = expression.parameter(typeof (account), "p"); var proprty = typeof(account).getproperty("companyid"); var prpexp = expression.property(paramexp, proprty); var varexp = expression.variable(typeof(int32), companyid); var cond1 = expression.equal(prpexp, varexp); return expression.lambda<func<account, bool>>(cond1,paramexp); } error message is the parameter '220' not bound in specified linq entities query expression expression.variable(typeof(int32), companyid); this creates variable named ...

.net - WPF DataGrid Display Issue In Windows XP -

can 1 me... 1) problem --> | name __ | address _ _ | __ _ __ _ __ _ __ _ ____ <---datagrid header |------------------------------------------------------------------- <--rows |------------------------------------------------------------------- |------------------------------------------------------------------- rows getting cutted. 2) want this-> | name __ | __ address __ _ _ | __ _ __ _ __ _ __ _ ___ <---datagrid header | _abc_ _ | xyz __ _ __ _ __ | _ __ _ __ _ __ _ __ _ __ | _ ahj __ | xzs_ _ __ _ __ _ | __ _ __ _ __ _ __ _ ____ | _ alk __ | xyf_ _ __ _ __ _ | __ _ __ _ __ _ __ _ ____ can see row detail. i having trouble of rows not displaying in windows xp, program build in win 8, wpf .net framework 4.0,3.5,4.5. of them having same issue. am missing something? how solve this. wpf datagrid,has auto generatedcolumn = true. here code. xaml <datagrid x:name="dgconfirminquiry" horizontalalignment="left" margin=...

mysql - Why do I get "Access denied for user 'root'@'localhost'"? -

i'm using code connect mysql database: username="root" password="admin" host="localhost" db="one" mysql.new(host,username,password,db) i got error while executing code: access denied user 'root'@'localhost' (using password: yes) if use mysql.new('localhost','root','admin','one') works fine. when print variables correct values printed. please me figure out what's wrong. basic trouble-shooting 101: if literal strings work, , variable assignments don't, suspect variable assignments; wrong 1 of them, such invisible character. try: vars = ('localhost','root','admin','one') mysql.new(*vars) then try: vars = %w(localhost root admin one) mysql.new(*vars) or: host, username, password, db = %w(localhost root admin one) mysql.new(host, username, password, db) or: host, username, password, db = 'localhost','root...

How to specify Access Control parameters for a video in YouTube V3 API -

in youtube v2 api while uploading video 1 can specify access control parameters rate, comment, videorespond, embed etc. https://developers.google.com/youtube/2.0/developers_guide_protocol_uploading_videos however in v3 api, video resource doesn't seem have part access control. https://developers.google.com/youtube/v3/docs/videos#resource is there way in v3 api same. for v3 has embed one. other ones should ported well.

php - Loop through an array onsubmit -

i want loop through array each time form submitted character in array incremented each person in world receives character incremented person has used form. how do? <!doctype html> <html> <body> <script type="text/javascript"> var = 0; </script> <form action="index.php" method="post"> country: <select name="country"> <option value="a">america</option> <option value="b">germany</option> <option value="c">greece</option> <option value="d">russia</option> <option value="e">uk</option> </select><br> postcode: <input type="text" name="postcode"> <input type="submit"> </form><br> number is: <?php $place = array("t", "u", "v", "w", "x", "y", "z"); $person = ...

cryptoapi - Adding Response from TSA to CRYPT_SIGN_MESSAGE_PARA for CryptSignMessage (c++, Crypto Api) -

i'm struggling how must add response tsa server cryptsignmessage? using pkcs#7. have message digest , sign cryptsignmessage crypto api. so: // initialize signature structure. crypt_sign_message_para sigparams; sigparams.cbsize = sizeof(crypt_sign_message_para); sigparams.dwmsgencodingtype = my_encoding_type; sigparams.psigningcert = hcontext; sigparams.hashalgorithm.pszobjid = szoid_rsa_sha1rsa; sigparams.hashalgorithm.parameters.cbdata = null; sigparams.cmsgcert = 1; sigparams.rgpmsgcert = &hcontext; sigparams.dwinnercontenttype = 0; sigparams.cmsgcrl = 0; sigparams.cunauthattr = 0; sigparams.dwflags = 0; sigparams.pvhashauxinfo = null; sigparams.cauthattr = 0; sigparams.rgauthattr = null; // first, size of signed blob. if(cryptsignmessage( &sigparams, false, 1, messagearray, messagesizearray, null, &cbsignedmessageblob)) { printf("%d bytes needed encoded blob.", cbsignedmessageblob); } else { myhandleerror(); ...

php - get parent array name after array_walk_recursive function -

i use following function verify if search word in name of files of folder. $files2=list_files("documents/minelli"); class commentaire_filter{ static function test_print($item, $key, $value) { if (preg_match("#".$value."#", $item)) { $array = array($key=>$item); print_r($array); ?> <a href="documents/minelli/<?php echo $item; ?>"><?php echo $key.' '. $item; ?></a><br /> <?php } } } array_walk_recursive($files2, 'commentaire_filter::test_print',$motrecherche ); i obtain list of files. i add link permit users download file. when i'm using array_walk_recursive function, can name of file , key. how can name of parent arrays made link ? here extract of $files: array (size=5) 'administratifs' => array (size=5) 0 => string 'campagne-sanmarina.jpg'...

Google App Script trigger is not firing -

i google app script user since last 2 years. see here in india during peak time i.e during evening 1 minute trigger not firing @ proper time. there server side issue or there other issue. saying worse case scenarios, today script trigger has not been fired since past 2 hours. have correctly done logging. no log printed means not go method. can tell me might exact reason behind it. it might beneficial show code behind script, given there method potentially being skipped over. have there been no errors thrown via google apps script notifications? it seems, perhaps, issue may fall place reported error: https://code.google.com/p/google-apps-script-issues/issues/detail?id=2708 we're not going able give precise answer problem if can't examine you're working with. wish luck in endeavor, though.

qt creator - C++ console ncurses project - QtCreator doesn't show any output in xterm neither in console -

#include <ncurses.h> int main() { initscr(); addstr("hello world"); refresh(); getch(); endwin(); return 0; } this basic application doesn't show output when building , running in qtcreator 2.8.0. when run compiled in qtcreator program in separate terminal window, works fine. when run under qtcreator (ctrl-r or press "run" button), see empty xterm window , no output. guess somehow related qtcreator_process_stub , entitles empty xterm window. try replacing addstr("hello world"); with printw("hello world !!!"); see

c# - Can't restore database from backup file -

based on this article made small wpf application backup/restore database. code: using system.windows; using microsoft.sqlserver.management.smo; namespace dbmanager { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow { private server srv; private database db; private backupdeviceitem bdi; private int recoverymod; public mainwindow() { initializecomponent(); srv = new server(); db = srv.databases["mydb"]; recoverymod = (int) db.databaseoptions.recoverymodel; bdi = new backupdeviceitem("test_full_backup1", devicetype.file); } private void button1_click(object sender, routedeventargs e) { backupdb(); } private void button2_click(object sender, routedeventargs e) { restoredb(); } publi...

ios - UIViewController pushed onto UIController embedded in UITabBarController not calling delegates -

i have uitabbarcontroller has 4 uiviewcontrollers . these set in app delegate , behaves expected. i have set first uiviewcontroller uitabbarcontrollerdelegate , works fine too; tabs pressed shouldshowviewcontroller fires expected. inside first uiviewcontroller , first tab, buttons. 1 pushes uiviewcontroller using standard: [self.navigationcontroller pushviewcontroller:vc animated:yes]; this works fine: new uiviewcontroller , it's view appear expected. however, when press tab button shouldshowviewcontroller function called (as expected) , passes reference first tab (as expected) child uiviewcontroller found. is, viewcontroller.navigationcontroller.viewcontrollers empty array ( count == 0 ). to debug implemented uinavigationcontrollerdelegate , assigned navigationcontroller same class uiviewcontroller , tab controller. fires when called tab controller not view controller. i've tried can think of find reference topmost visible view controller i'm...

Mysql windows Error -13 and absolute path -

i've problem mysql on windows , load data infile "c:/mydir/filetoimport.csv" (not using local) specifying absolute path "c:/mydir/filetoimport.csv" or "c:\mydir\filetoimport.csv" the file import not in mysql temp directory. i've have error -13 "can't stat of '/var/lib/mysql/c:/mydir/filetoimport.csv" problem that, stated in mysql documentation ( mysql doc ), if file path not start '/' mysql use relative path , try find file in /var/lib/mysql. if try, test, put '/' in front of file name '/c:/mydir/filetoimport.csv' mysql find trailing slash , not try search file temp directory , unfortunately path '/c:/mydir/filetoimport.csv' wrong interpreted , doesn't work. seems in windows not possible specify full path statement load data infile. has workaroud/suggestions?(no local option please). in advance

javascript - How to split an array into a multidimensional array? -

so have json feed returns list of job titles. split parsed data split nodes of 3. example, right appending ones html looks like: <div class="slide"> <div class="jobs-list"> <a href="#" class="job">title 1</a> <a href="#" class="job">title 2</a> <a href="#" class="job">title 3</a> <a href="#" class="job">title 4</a> <a href="#" class="job">title 5</a> </div> </div> i output like: <div class="slide slide1"> <div class="jobs-list"> <a href="#" class="job">title 1</a> <a href="#" class="job">title 2</a> <a href="#" class="job">title 3</a> </div> </div> <div class="slide slide2"> <...

ruby - Finding the first non-Nil element in an array -

Image
i have code: default_group_id = @group_list[0].list[0].name but list member of @group_list[0] empty code crashes :) need find first @group_list[i] list member not nil , use that. how can this? here structure: you can use enumerable#find : @group_list.find { |x| !x["list"].blank? } #=> first non-nil , non-empty list in group_list