Posts

Showing posts from May, 2011

php - How can I redirect to the log in page when I press the log out button -

when i'm using following code blank page <form action="login.php "> <input type="submit" name="log out" value="log out"> use header("location:login.php"); automatically redirect on page

xslt - read last 5 entries from xml in reverse order using xsl -

i want know how modify xsl display last 5 nodes in reverse order xml below. <?xml version="1.0" standalone="no"?> <?xml-stylesheet type='text/xsl' href='resultxsl.xsl'?> <automation> <run> <client1> <date>25/02/2014</date> <totaltests>23</totaltests> <success>13</success> <failures>10</failures> </client1> <client2> <date>25/02/2014</date> <totaltests>4</totaltests> <success>0</success> <failures>4</failures> </client2> <client3> <date>25/02/2014</date> <totaltests>9</totaltests> <success>3</success> <failures>6</failures> </client3> </run> <run> <client1> <date>26/02/2014</date> <totaltests>23</totaltests> <success>13&l

.net - How to call Parent Form method from Child Form in C#? -

i have parent form 1 method refresh panel content called resetpanel() . have button in parent form. if click button, new form opens up. changes , click on save. content gets saved in database , child form closes. parent form displayed. i want call resetpanel() method now, panel shows updated values. how can achieve this? if child form dialog one, can check form's dialog result : // not forget release resources acquired: // wrap idisposable using(..) {...} using (form mychildform = new mychildform()) { //todo: if want pass main form child one: // on result save "cancel" update panel if (mychildform.showdialog() != dialogresult.cancel) resetpanel(); } in case child not dialog can pass this child form reference main one: form mychildform = new mychildform(this); mychildform.show(); // <- show, not showdialog() ... private mymainform m_mainform; public mychildform(mymainform form) { m_mainform = form; } private

php - Two different kinds of arrays -

i have 2 different arrays below: array ( [1] => 2 [2] => 3 [6] => 1 ) ; // array1 has 3 keys , 3 value 1=>2, 2=>3, 6=>1 array ( [1] => 2 [6] =>2 ) ; // array2 has 2 keys , 2 value 1=>2, 6=>1 i want array1 , array2 same key can sum both value: ex: array1 "[1]=>2" , array2 "[1]=>2" want out put [1]=>4; [6]=>3 $result = array(); foreach ($array1 $key => $value) { if (isset($array2[$key])) { $result[$key] = $value + $array2[$key]; } }

javascript - How to fix the bug thrown by highcharts when trying to download PDF version of the chart? -

Image
there bug thrown when try use functionnality of highcharts pdf download. makes web-page no longer clickable, i've tried refresh after download using javascript still same. think there javascript still forwarding request export.highcharts server . so, i've added instruction abort javascript code execution, after full execution of web-page's code , after reload of page. but, bug still triggering. how fix please? i've tried using chrome , ie, , problem persists. try integrate api web-app, , can see bug thrown 'cause can't see jsfiddle. ps : bug not thrown after pdf download, also, after load of chart! here chrome's warning thrown (sorry in frensh, it's same appearence in other languages , it's known): and web-page becomes this: chrome's console's error thrown : here full code : jsfiddle , but, jsfiddle doesn't show reload , threw exception. can test code any brilliant idea, please?

eclipse - Code for android spinner -

i'm having problem change xml file android spinner.i'm still new in android development , hope me. <channel id="1"> <title>m</title> <description>my new tv. viewer: 15+ </description> <icon>image</icon> <link>link</link> you need this in strings.xml define: <string-array name="array_name"> <item>array item one</item> <item>array item two</item> <item>array item three</item> </string-array> in layout: <spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:drawselectorontop="true" android:entries="@array/array_name" />

eclipse - JSDoc - how to check types for JavaScript -

Image
i applying jsdoc annotations: /** * @param {number} millis * @param {function} callback * */ function sleep(millis, callback) { settimeout(function() { callback(); }, millis); } then tool tell there error line below? sleep('aaa', 'sdsdsd'); is jshint aware of jsdoc type annotations? how enable such support in eclipse? disclaimer, i'm author of tern.java . i suggest you install tern.java 1.0.0-snapshot . provides capability validate javascript files using jsdoc annotations. here screenshot sample of issue : if need improvement jsdoc validation, please create issues here

html - I need to use a PHP variable between functions -

need options page wp plugin, user can remove link choosing dropdown. the options page created , variable set in function called printselection(). function returns value in dropdown box wp dashboard. function printselection() { if(isset($_post['selectbox'])){ return $_post['selectbox']; } } $link = printselection(); print($link); the $link variable being printed wp options page. use variable in frontend well, after form. full code here: <?php /* plugin name: gladstone brookes mortgage calculator widget plugin uri: http://gladstonebrookesmortgages.co.uk description: simple mortgage calculator widget version: 1.0 author: ian butler author uri: http://gladstonebrookesmortgages.co.uk */ /*-----------------------------------------------------------------------------------*/ /* include css */ /*-----------------------------------------------------------------------------------*/ function gb_mortgage_calculator_css() { wp_enqueue_style( 'gb_mortga

android - Which fragment library should I import? -

i implementing fragments drawerlayout. have 2 options when import fragments android.support.v4.app android.app which 1 should use ? dont see difference except seems android.support.v4.app has no support objectanimator . what suggest ? edit: plan on supporting api level 14 , higher... it depends on whether using support library. if using fragments below api level 11 use android.support.v4.app . in case extend fragmentactivity base class of support based fragments. if using fragments in api level 11 , above use android.app . in case extend standard activity . take @ below link , decide on versions app should run. depending on decide whether need support library or not. https://developer.android.com/about/dashboards/index.html i plan on supporting api level 14 , higher... then there no need use support library. use import android.app.fragment and extend standard activity .

CakePHP email sending with photo -

i have cakephp project , wants send email photo using cakephp email. sending email fine , photo not printed inside body.i giving full url of image. code sample below: i not find out proper way send image email. <td style="text-align: right;"> <img alt="" width="120" height="120" src="http://localhost/lictors/app/webroot/img/lict/passport_copy.jpg"> </td> first have attach image this: $email->attachments([ 'photo.png' => [ 'file' => '/full/some_hash.png', 'mimetype' => 'image/png', 'contentid' => 'my-unique-id' ] ]); after refer contentid int img src, this: <img src="cid:my-unique-id">

asp.net - UpdateProgress not showing when doPostBack is manually called from javascript -

i using update panel , update progress control. in update panel have textbox textchange event. event automatically called javascript when user enters 10 digits textbox. call : __dopostback("labeltextboxcode", "textchanged"); this html code : <asp:scriptmanager id="scriptmanager1" runat="server"> </asp:scriptmanager> <asp:updateprogress runat="server" id="updateprogress1" associatedupdatepanelid="updatepanel"> <progresstemplate> ...processing </progresstemplate> </asp:updateprogress> <asp:updatepanel id="updatepanel" runat="server" updatemode="conditional"> <contenttemplate> <asp:textbox id="labeltextboxcode" runat="server" ontextchanged="textchanged_textboxcode"> </asp:textbox>

asp.net - Bill me later in the shopping cart itself -

Image
i have requirement have integrate bill me later feature our cart. problem required scenario customer add products cart , have 3 options 1. regular checkout 2. paypal checkout 3 bill me later option is possible have mean enable before going paypal ? you cannot have bill me later alone in shopping cart. in express checkout can force option: check here not before going paypal

javascript - Drag and Drop child node to parent node using angular.treeview and angular ui-sortable -

hi im new angularjs , im using treeview directive angular.treeview matched angular-ui ui-sortable directive so modified angular.treeview.js , added ui-sortable tag <ul> tag make work: //tree template var template = '<ul ui-sortable>' + '<li data-ng-repeat="node in ' + treemodel + '">' + '<i class="collapsed" data-ng-show="node.' + nodechildren + '.length && node.collapsed" data-ng-click="' + treeid + '.selectnodehead(node)"></i>' + '<i class="expanded" data-ng-show="node.' + nodechildren + '.length && !node.collapsed" data-ng-click="' + treeid + '.selectnodehead(node)"></i>' + '<i class="normal" data-ng-hide="node.' + nodechildren + &#

node.js - Adding library files in WebStorm IDE -

i running mean (mongodb, express, angularjs, nodejs) project in webstorm ide, have included required library files @ time of starting project. after including mongodb connection, need include mongoose library in project. i have searched options given in webstorm ide can't find way. please tell me way including library files in project using webstorm ide. webstorm opens folder of file system. click on open , select folder. in order mongoose library, navigate project folder in command prompt and, use npm install mongoose this install mongoose in node_modules folder. wherever want use mongoose, require("mongoose") .

php - how to send automatically email -

i programming 1 application check records depending on creation date, need application check post date automatically, if more or equal 2 days send notification email without action users or admin. i know crontab solution know working on specified time. how can needs? mysql posts table id | post | date 1 | post 1 | 1394094854 2 | post 2 | 1394094754 3 | post 3 | 1394094654 4 | post 4 | 1394094554 my script.php <?php define('dbhost', 'localhost'); define('dbname', '-'); define('dbuser', '-'); define('dbpass', '-'); /* / $db ====> mysql connection */ $getposts = $db->query("select * posts"); foreach($gp $getposts){ if(time() - $gp['date'] >= 172800){ // morethan or equal 2 days // send notification email mail('to_email', 'subject', 'message', 'headers'); } } please me in issue. best reg

PHP/Codeigniter- How can I search tweets with hashtag using by REST api and twitterapiexchange library? -

i trying use rest apı search tweets hashtags. also, using library twitterapiexchange. there problem when wanted write keyword searchbox. here controller customer.php ... public function search(){ if($this->session->userdata('logged_in')){ error_reporting(0); $session_data = $this->session->userdata('logged_in'); $data1['email'] = $session_data['email']; $this->load->view('navbarview', $data1); $settings= array( 'consumer_key' => 'd76iqflcqrxijvjgqvjr1q', 'consumer_secret'=> 'pspjkrxrsr74gzmljsx5fevqijhlgerk8nmt3gw8by', 'oauth_access_token'=> '616244226-g0fqhmvkn5utpmzvslcncjnbcg4hpsezxjdmxeax', // optional 'oauth_access_token_secret'=> 'rsihbvzihfjrsi5drtypddhgkhpoao0zbpojca6tzcvm5'); $this->load->library('twitterapiexchange' ); if(isset($_post[('searchbox')])){ $url =

Durandal view composition order -

durandal 2.0 - view composition order i have view, has number of child views using break html separate files. index.html(index.js) - menu.html - header.html - footer.html the menu view populated index view after it's loaded. inside index.html compose menu view (there no module menu.js, html composition here): <!--ko compose: { view: 'menu'}--><!--/ko--> the problem order of view composition. i have attached event wired in index.js calls function populate menu div that's sat in menu.html. but, attached view event called before menu.html view has been composed. the events looks console: binding views/footer binding views/index binding complete: <section data-view=​"views/​index" style=​"display:​ none;​">​…​</section>​ [index] main view attached binding views/header binding views/menu binding views/menudropdown so, main view attached before children. is there way change composit

symfony - schema update with doctrine2 postgresql always DROPs and then ADDs CONSTRAINTs -

when updating schema, doctrine drops , add constraints. think, wrong... php app/console doctrine:schema:update --force updating database schema... database schema updated successfully! "112" queries executed php app/console doctrine:schema:update --dump-sql alter table table.managers drop constraint fk_677e81b7a76ed395; alter table table.managers add constraint fk_677e81b7a76ed395 foreign key (user_id) references table."user" (id) not deferrable immediate; ... php app/console doctrine:schema:validate [mapping] ok - mapping files correct. [database] fail - database schema not in sync current mapping file. how can may fixed? after digging doctrine update schema methods, i've found issue. problem table names - "table.order" , "table.user". when doctrine makes diff, names become non equal, because of internal escaping (?). so, "user" != user, , foreign keys tables (order, user) recreating. solution #1 - rename tab

java - SharedPreferences in a edittext of a AlertDialog -

i'm using texttospeech first time , have problem.. created dialog edittext can write something: alertdialog.builder alert = new alertdialog.builder(this); alert.settitle("title"); alert.setmessage("message"); // set edittext view user input final edittext input = new edittext(this); alert.setview(input); alert.setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { value = input.gettext().tostring(); // value! } }); alert.setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { // canceled. } }); alert.show(); i need save in preferences value. i created one: private void prefvalue(string tag) { string name = savename.getstring(tag, null); sharedpreferences.editor preferenceseditor = savename.edit(); preferenceseditor.putstring("tag", tag); preference

WPF - C# - open parent window only once -

i´m programming simple thing in c# , wpf. have mainwindow button. if trigger button opens secon window: private void btnf4_click(object sender, routedeventargs e) { secondwindow second = new secondwindow(); second.show(); } naturally if trigger button 3 or 4 times, have 3 or 4 windows open. don´t want use showdialog(), want open second window once. mean if trigger button , window open, should nothing happen. thank you! make second instance variable parent window class , create new window if hasn't been created. of course need make sure null instance variable when second window closed. public class parentwindow ... { private secondwindow m_secondwindow = null; .... private void btnf4_click(object sender, routedeventargs e) { if (m_secondwindow == null) { m_secondwindow = new secondwindow(); m_secondwindow.closed += secondwindowclosed; m_secondwindow.show(); } }

HTML Emails: Center aligning tables affects cell text in Internet Explorer -

i have noticed 'bug' or whatever internet explorer when viewing html emails. i'm using version 11 , still present. if want align table in center of page, causing text in <td> cells centered, if set attribute align="left" , use inline css specify text-align="left". here example code (try sending html email yahoo or gmail account , view in ie): <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="background:#ccc;"> <tr> <td> <table width="650px" border="0" align="center" cellpadding="0" cellspacing="0" style="padding-left:11px;padding-right:11px;background:#fff;"> <tr> <td align="left" valign="top" style="text-align:left;">moreover, while in other animals can think of, eyes planted imperceptibly blend visual

Stop loop in Python when a file has been modified -

i've filename myfile.txt , want simple script tells me when file has been modified. i'm using os.stat(file).st_mtime see if has been modified. if time has changed, file has been modified. how can use os.stat(file).st_mtime in while loop this? while file hasnt been modified: print "file not modified" print "the file has been modified" thanks in advance. something like mtime = os.stat(file).st_mtime while os.stat(file).st_mtime == mtime: print "file not modified" print "the file has been modified"

collections - Functional style in Scala to collect results from a method -

i have 2 lists zip , go through zipped result , call function. function returns list of strings response. want collect responses , not want have sort of buffer collect responses each iteration. seq1.zip(seq2).foreach((x: (obj1, obj1)) => { callmethod(x._1, x._2) // method returns seq of string when called } what want avoid create listbuffer , keep collecting it. clues functionally? why not use map() transform each input corresponding output ? here's map() operating in simple scenario: scala> val l = list(1,2,3,4,5) scala> l.map( x => x*2 ) res60: list[int] = list(2, 4, 6, 8, 10) so in case like: seq1.zip(seq2).map((x: (obj1, obj1)) => callmethod(x._1, x._2)) given function returns seq of strings, could use flatmap() flatten results 1 sequence.

makefile - Variable for '%' in multiple files matching -

i make complete text document several sources (since 1 of file source change, want doc change). i have pass through translator develop. pass language argument, make cleaner. yesterday, late @ night, dreamed of makefile this... #makefile # ... my_complete_doc.%.html: my_trans_exe header.%.html $(wildcard source/*.%.html) $< --language $(variable_for_%) > $@ (?) replace % languages have own header.language.html files. , file my_completed_doc.language.html changed 1 of source/*.language.html changed? (?) how % replaced in several prerequisites, possibly wildcard , in recipe? first, easy problem: wish use '%' variable in recipe. answer use '$*' automatic variable: my_complete_doc.%.html: my_trans_exe ... $< --language $* > $@ then easy question: yes, header.%.html prerequisite correct. when try build my_complete_doc.dutch.html make evaluate header.dutch.html , when try build my_complete_doc.french.html , make eval

Add numeric keyboard in android -

it's possible set or add numeric keyboard without +, -, . sign in android app? i want 0-9, backspace , enter keys? i tried inputtype="number" setrawinputtype(inputtype.type_class_number) but doesn't work. try add line on code: input.setrawinputtype(configuration.keyboard_12key); this show only numeric keyboard.

java - Using if else with jsp from data-bind -

so don't know how describe question best way since never worked in jsp before, , jumped in project , needs finish it. sorry if unclear, ask me , i'll try reply fast. so got language check html tags, looks this: <p data-bind="if: 'en_us' == currentlang()">english text</p> which works fine, want put in if/else statement. in php, write like: <?php if((currentlang() == 'en_us)) { echo 'english text'; else { echo 'italian text'; } ?> so how do this, checking currentlang() in .jsp file? i try use f:subview tag ( http://docs.oracle.com/cd/e17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/f/subview.html ) , put condition in rendered attribute <f:subview rendered="if: 'en_us' == currentlang()">english text </f:subview> i think should work.

ios - show record timer while making video -

i had implemented concept of avcapturesession recording video. -(void)startrecordingwithorientation:(avcapturevideoorientation)videoorientation { avcaptureconnection *videoconnection = [avcamutilities connectionwithmediatype:avmediatypevideo fromconnections:[[self moviefileoutput] connections]]; if ([videoconnection isvideoorientationsupported]) [videoconnection setvideoorientation:videoorientation]; [[self moviefileoutput] startrecordingtooutputfileurl:[self outputfileurl] recordingdelegate:self]; } it recording video recording timer in not there on screen. has idea how show timer while making video. thanks in advance. i use add uilabel view presented video while recording , use code show record time @property (weak, nonatomic) iboutlet uilabel *labeltime; @property(nonatomic, strong) nstimer *timer; @property(nonatomic) int timesec; @property

knitr - xtable R - can't get rid of decimal places -

i have looked @ other answers on subject can't seem work - trying not show decimal places in output table keep appearing. using knitr: {r cyclist_proportions, echo=false, results='asis', warning=false} print(xtable(cyclist_proportions), digits=c(0,0), type='html', include.rownames=false) the values numeric: 'data.frame': 5 obs. of 2 variables: $ percentage of casualties cyclists: num 7 8 8 9 10 $ year : num 2008 2009 2010 2011 2012 i did try digits=c(0,0,0) in case needed allow rownames made no difference - values have 2 decimal places. thanks update thank answers, both helped me solve it. mixing arguments of xtable , print.xtable. so in script file have cyclist_proportionstab <- xtable(cyclist_proportions) digits(cyclist_proportionstab) <- 0 and in r markdown file ```{r cyclist_proportions, echo=false, results='asis', warning=false} print.xtable(cyclist_proportions

c# - Why I can't access to these node content using XPath? -

i pretty new in xpath , in c# , have following problem: i have parse file: http://static.nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml as can see opening in browser file have following structure: <?xml version='1.0' encoding='utf-8'?> <cpe-list xmlns:meta="http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2" xmlns:config="http://scap.nist.gov/schema/configuration/0.1" xmlns:ns6="http://scap.nist.gov/schema/scap-core/0.1" xmlns:scap-core="http://scap.nist.gov/schema/scap-core/0.3" xmlns="http://cpe.mitre.org/dictionary/2.0" xmlns:cpe-23="http://scap.nist.gov/schema/cpe-extension/2.3" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://scap.nist.gov/schema/configuration/0.1 http://nvd.nist.gov/schema/configuration_0.1.xsd http://cpe.mitre.org/dictionary/2.0 http://scap.nist.gov/schema/cpe/2.3/cpe-dictionary_2.3.xsd http:

How to save a ListView into a xml file in Android? -

i developing android app capable of detecting ble signals , list them in listview. after scan period of time stop scanning. here code (it same in developers page): scanbleactivity.class (extends scanbaseactivty): public class scanbleactivity extends scanbaseactivity { private bluetoothadapter mbluetoothadapter; private boolean mscanning; private handler mhandler = new handler(); // stops scanning after 10 seconds. private static final long scan_period = 20000; /* (non-javadoc) * @see com.zishao.bletest.scanbaseactivity#initscanbluetooth() */ protected void initscanbluetooth() { bluetoothmanager manager = (bluetoothmanager) getsystemservice(context.bluetooth_service); mbluetoothadapter = manager.getadapter(); startscanlen(true); } @override protected void ondestroy() { super.ondestroy(); if (mscanning) { startscanlen(false); } } /** * * @param enable */ private void startscanlen(final boolean enable) { if (enable) {

python - wxPython drag and drop matplotlib figure -

i have number of wx.panels, each containing matplotlib figure (a thumbnail gallery). want user able drag , drop of these figures another, bigger panel. what tried binding wx.evt_motion of each thumbnail panel. unfortunately, seems event consumed figure never fires. i tried connecting 'motion_notify_event' of each figure 1 fires when mouse on particular figure. is possible somehow disable matplotlib events, event gets panel underneath? or there solution? you need take @ documentation , demos wx.droptarget , wx.dropsource , overview . code examples see: samples/dnd subdirectory of wxwidgets installation or http://svn.wxwidgets.org/viewvc/wx/wxwidgets/trunk/samples/dnd you consider adding tick box or button each thumbnail makes 1 large view.

jquery - Frames at the center of a page -

i need put 2 separate frames @ center of page (see this ). first frame (left) file tree displayed , second frame search results appear. in pic, put 2 separate divs overflow: scroll style. purpose why switching frames not want file tree refresh , disappear whenever click submit button (see this ). can please me? appreciate it. thanks. :) you can use iframes inside divs, if wish. lets put frames wherever want. one way works stick current system, on 1 page, , use jquery $('#dir_area').load('thispage #dir_area', {dirname: 'dir_to_load'}) (something that) load part ("fragment") of new page want refresh. see: https://api.jquery.com/load/

matlab - Interpolating produces weird results -

one easy question reason cannot see answer to: i working on matlab project need interpolate specific set of data. have 2d-matrix mat , 2 vectors x , y assign value each column , row (strictly monotonically increasing of course). matrix 0s, except diagonal lines amongst has nonzero values. i wish interpolate data along thise lines on entire area, linear interpolation should enough now. approach is [y,x] = meshgrid(y,x); %create meshgrid out of grid vectors ysave=y;xsave=x; m = mat; %now, eliminate elements mat 0 since want interpolate there y(mat==0)=[]; x(mat==0)=[]; m(mat==0)=[]; interpolant = scatteredinterpolant(y',x',m'); % , create our interpolant result = interpolant(ysave,xsave); however, when execute code, interpolated picture not not resemble "intuitive" interpolation @ - not have original data points included... doing wrong? thanks help! edit comments, visibility: imgur.com/a/7baxm visual respresentation of data. top picture interpolated

asp.net - Programmatically created controls overwriting each other -

i'm creating labels in code behind of c# .net website. labels hold standard data server. the problem have add button these created controls (inside label), additional control overwrite text defined in label. what options stop this? for (var = 0; < (quotearray.length)-1; i++) { button[] btnarr = new button[quotearray.length]; //not used var button = new button { id = "quote_0" + i, commandargument = "i", text = "!!", cssclass = "countbutton" }; label addl1 = new label { id = "new_labeieeu" + i, text = string.format("tariff: {1}</br>reference: {0}</br>price: £{3}</br>excl. vat.</br>max passenger: {4}</br>max luggage: {5}</br>{2}</br>", quotearray[i][0], quotearray[i][1], quotearray[i][2], quotear

bash - Print result to every second line of output file in awk -

seems no 1 yet stumbled upon problem,so here goes. sets say,i want take third column $3 of every other line 2nd,4th,6th etc of input file(i know how that) , print result @ same position in output file. mean, $3 of 2nd line of input,to $3 of 2nd line of output , goes on. i want this,using awk bash. here how awk awk 'fnr==nr {a[nr]=$3;next} fnr%2==0 {$3=a[fnr]}1' firstfile secondfile this take data firstfile , update secondfile using column $3 , every second line. data replaced in same position. cat firstfile 1 one green 2 two red 3 three blue 4 four orange 5 five yellow 6 six brown cat secondfile 1 one jan 2 two feb 3 three mars 4 four april 5 five jun 6 six juli running awk command: 1 1 jan 2 two red 3 three mars 4 four orange 5 five jun 6 six brown too store data secondfile awk 'fnr==nr {a[nr]=$3;next} fnr%2==0 {$3=a[fnr]}1' firstfile secondfile > tmp && mv tmp secondfile

input - Talend: tMap only generates Main outputs, not Lookup outputs -

Image
when working talend, find when trying create outputs tmap components, type can create *new output* (main) . yet, need create lookup outputs. (to pipe other tmaps have main input). does know cause of issue and/or way fix it? the distinction main/lookup has sense incoming connections. outgoing connection scope, there's no difference between lookup or main: it's vectorized stream of data. pratically speaking, means can connect main connection of wanna-be-lookup tmap real-main tmap: since cannot have more 1 main connection, additional one(s) automatically marked lookup connection(s). you can change flow type incoming connections (from main lookup , vice-versa) @ time doing right-click on connection, "change connection order" it's quite easy mess-up mind while doing this. remember main connection 1 starts component has green background.

r - Using non-ASCII characters inside functions for packages -

i'm trying write function equivalent scales::dollar adds pound (£) symbol beginning of figure. since scales code robust, i've used framework , replaced $ £. a stripped-down function example: pounds<-function(x) paste0("£",x) when run check following: found following file non-ascii characters: pounds.r portable packages must use ascii characters in r code, except perhaps in comments. use \uxxxx escapes other characters. looking through writing r extensions guide doesn't give lot of (imo) on how resolve issue. mentions \uxxxx , says refers unicode characters. looking unicode characters yields me code &#163 guidance can find \uxxxx minimal , relates java on w3schools. my question thus: how implement usage of non-unicode characters in r functions using \uxxxx escapes , how usage affect display of such characters after function has been used? for \uxxxx escapes, need know hexadecimal number of character. can determine using ch

How can I edit a view in MySQL Workbench without it auto prefixing a database name to the tables/views used -

when create view, create in context of default database. none of references table have prefix explicitly specify database. however, when edit view in workbench automatically adds database prefix! i don't want database prefix because when restore database under different name causes restore fail. is possible stop prefixing in view edit or there way round restore issue? regards, bobbyy that's not possible. views stored in specific databases, not in space "above" databases. consider following... use playground_a; /*or whatever database*/ create view view_whatever select * table_whatever; use playground_b; select * view_whatever; /*here error view_whatever not exist*/ select * playground_a.view_whatever; /*this works*/ that's why there database prefixes in view definition. the possibility see, use stored procedure database name parameter. in procedure you'd use prepared statement execute concated string of query , database name param

oracle - Multiple column update -

i have execute following lines of update in procedure. can update in single line. 1 table present here. update magic_table set first_col=0,last_col=my_value first_col not null; update magic_table set second_col=0,last_col=my_value second_col not null; update magic_table set third_col=null,last_col=my_value third_col not null; if give performance improvements? update magig_table set first_col = nvl2(first_col , 0, first_col ), second_col = nvl2(second_col, 0, second_col), third_col = nvl2(third_col , 0, third_col ), last_col = my_value first_col not null or second_col not null or third_col not null;

java - Why does this negative lookbehind fixed length regex not work? -

i'm trying match single '1' in space-separated number list. here's sample code: public class regextester { public static void main(string[] args) { string test1 = "1 2"; string test2 = "2 1 2"; string test3 = "2 11 2"; string regex = "(?<!\\d)1(?!\\d)"; system.out.println("matches 1: " + test1.matches(regex)); system.out.println("matches 2: " + test2.matches(regex)); system.out.println("matches 3: " + test3.matches(regex)); } } output is: matches 1: false matches 2: false matches 3: false but should (imo): matches 1: true matches 2: true matches 3: false lookbehind of fixed length, i'm confused why regex doesn't match. appreciate if know why and/or can provide alternative working regex case. thank you. your regex correct. problem matches method checks if entire input string can matched regex, not if contains substring can matche

java - Hadoop: Measuring the duration of each phase(map, shuffle/sort, reduce) -

there's similar question want know. how can measure duration of each phase(map, shuffle/sort, reduce) in hadoop? answer says web/ui of tasktracker shows each duration of application. environment hadoop-2.2.0 , there's no tasktracker. tasktracker web/ui "localhost:50030/tasktracker.jsp" not working. answer appropriate lower version of hadoop(1.x.x), guess. how can measure duration of each phase(map, shuffle/sort, reduce) in hadoop-2.x.x version? there other web/ui check them? my environment: red hat 6.3, hadoop-2.2.0. this information can seen via jobhistory url http://localhost:19888/jobhistory .click on "job id" "retired job" list , show average map,reduce,shuffle , merge time job. if click on map or reduce tasks can see details each task's start , end time.

ORACLE cursor to select a race horses position will not work -

here table trying query using cursor: create table raceresult (raceid number(5), horseid number(5), jockeyid number(5) not null, position varchar2 (3)); i have written function query , return horse id's have come first in race. create or replace function get_horse (horsepos in varchar2) return varchar2 pos varchar2; cursor c_horse select horseid raceresult position=horsepos; begin open c_horse; fetch c_horse pos;- if pos%notfound pos := 9999; else if c_horse = ('1st') return pos; end if; close c_horse; end get_horse; it not work, , beyond puzzled on try next.

javascript - Add an if statement to change css of certain item -

i have created website , within website there list, user can insert items, info user inputs saved database, inside table have 'id', 'content'(which to-do item) , 'status' have put status in here want user able click done, partially done or not done, values 1,2 , 3. // update list view (var i=0; i< res.length; i++){ $("<li/>", {"id": res[i].id, "text": res[i].content + res[i].status}).appendto(todo.list); // extend width if msg long if(res[i].content.length >= 35){ $('#'+res[i].id).css("height","50px"); the to-do list in javascript, if statement if status 1 turn green, , similar other two, different colours, having trouble getting code correct. thanks. all need add class li item, in css target class different colour: $("<li/>", {"id": res[i].id, "text": res[i].content + res[i].status, "class": 'status-'

c++ - Which projects with open source you can see the use of advanced memory management? -

i want know open source projects used things arena, allocators, overloading new , etc. refers c + + language. see google perf tools , jemalloc . last 1 used in freebsd default malloc implementation. so, every project use of 2 use arenas, cause both use them internally. new operator in c++ implemented libc's malloc function. also, see nginx http server sources , allocates memory pool session before connection created (but it's written in pure c). apache has apr pools library .

ios - Change color of inset area in UITableView separator -

Image
i have customized uitableview, cells have different background color (set in custom backgroundview). however, background color applied within cell, not extended inset area of separator. can see in screenshot, there white area left of colored separator. how can change color of white line? make line "disappear" setting same color cell background. thanks! setting cell's background colour same contentview's background colour seems give best results. cell.backgroundcolor = cell.contentview.backgroundcolor; that handle cases accessoryview wrong colour well.

java - Access Denied even on Signed Jar -

i using applet , jar signer sign jar file ,but still getting error ,my java version 51 hiiiii java.io.filenotfoundexception: d:\dest (access denied) @ java.io.fileinputstream.open(native method) @ java.io.fileinputstream.<init>(unknown source) @ uploadapplet.actionperformed(uploadapplet.java:49) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionperformed(unknown source) @ javax.swing.defaultbuttonmodel.fireactionperformed(unknown source) @ javax.swing.defaultbuttonmodel.setpressed(unknown source) @ javax.swing.plaf.basic.basicbuttonlistener.mousereleased(unknown source) @ java.awt.component.processmouseevent(unknown source) @ javax.swing.jcomponent.processmouseevent(unknown source) @ java.awt.component.processevent(unknown source) @ java.awt.container.processevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.a

android - How to draw a smooth path on touch in Andengine -

i doing game air control in andengine. need draw path user touches character , give direction it. character should follow path constant speed. right taking every point when user touches screen , finding distance between each point , adding few more points in between make equal in distance. to show path on scene making 1 rectangle on each point , attaching scene. heavy , not feasible when have many characters on screen please me doing in , engine.

ios7 - How to properly set the Radius of CLRegion? -

Image
this code creating geofence: geofence *geofence = [[geofence alloc] init]; [geofence setradius:100.0]; [geofence setidentifier: @"fence1"]; [geofence setlocation:currentlocation]; clregion *region1 = [[clcircularregion alloc] initwithcenter:[geofence.location coordinate] radius:geofence.radius identifier:geofence.identifier]; region1.notifyonentry=yes; region1.notifyonexit=yes; [self.locationmanager startmonitoringforregion:region1]; i that, above code works, meaning geofence have been created. there's problem i've been encountering. i have .gpx files (in using simulation of current location), distances center of region/geofence follows: 55m, 90m, 150m, 200m, 300m, 500m, 1km, 5km , 10km. my problem is, seems geofence radius not 100m, because when simulate using gpx files distance center of geofence 55m, 90m, 150, 200m, 300m, 500m, 1km. delegate methods of loca

projection - Compute 3D marker coordinates from 2D positions (Motion Capture) -

i hoping out there may able me out problem having motion capture system. looking stream real-time xyz marker positions matlab online processing; however, have real-time access 2d marker positions seen each camera (8 cameras in total). markers located on human subject moving relatively within capture volume. i have been racking brains, , exhausting google, stackoverflow, , multiple view geometry text answer question: can reproject 2d marker positions 3d space if know precisely projection matrices of each camera? or, still bound triangulate corresponding 2d points between camera views obtain xyz position of marker? i really really hope can obtain 3d marker coordinates knowing 2d positions seen given camera, , projection (intrinsic+extrinsic) matrix - doubtful... i appreciate in advance! cheers! yes! can obtain 3d position of marker number of 2d positions. track-it-yourself open-source library hosted @ google code. allow compute 3d position 2 2d markers.

android - Write An NDEF Message To A Tag Inside Runnable -

i have started developing in android , have started project using nfc tags ndef messages. have managed create simple application read text/plain ndef records , write data screen. now working on writing ndef messages tags. seem have working wonder whether or not it's best write tag on thread other main ui thread? having started learning, have been taught doing (potentially) long-running tasks in main thread no-no, , figured writing tag count such. putting code write tag inside runnable(), though, seems cause write fail. so, question is. wrong in assumption writing tag should done off of main thread? or wrong use runnable? , apologies if has been answered before, tried googling couldn't find on topic. i've included example code: the button handler: public void writebutton(view view) { //some validation createmessagetowrite(); } creating message: public void createmessagetowrite() { edittext messagebox = (edittext)findviewbyid(r.id.towrit

php - Why doesn't this use of html_decode_entities work? -

this code adapted php manual entry on html_entity_decode() protected function decode($data) { $data = html_entity_decode($data, ent_quotes,'utf-8'); //echo $data; return $data; } protected function decode_data($data) { if(is_object($data) || is_array($data)){ array_walk_recursive($data,array($this,'decode')); }else{ $data = html_entity_decode($data, ent_quotes,'utf-8'); } return $data; } if data contains value children&#39;s not decoded children's the problem has nothing html_entity_decode , you're doing right if want decode quote entities, &#39; . instead problem weren't using array_walk_recursive correctly. in following used anonymous function , pass value reference: function decode_data($data) { if(is_object($data) || is_array($data)){ // &$val, not $val, otherwise array value wouldn't update. array_walk_recursive($data, function(&$val, $in

snap framework - Heist top level tags from template? -

i'm trying learn how use snap , heist , wanted put links javascript libraries in on place. created template in _js-libs.tpl : <bind tag="jquery"> <script type="text/javascript" src="/js/jquery-2.1.0.js"></script> </bind> <bind tag="d3js"> <script type="text/javascript" src="/js/d3.js"></script> </bind> and tried in base.tpl template: <html> <head> <title>snap web server</title> <link rel="stylesheet" type="text/css" href="/screen.css"/> <apply template="_js-libs"/> <jquery/> <d3js/> </head> ... snip ... but resulted in <jquery></jquery> , <d3js></d3js> in page. take bind tags not visible in template has applied template containing bind. how create top level tags in templates? can find examples of creating top

java - Setting column width of a command output on AIX -

i'm trying parse df -pg command's output in java application, print me want. here output of command: filesystem gb blocks used available capacity mounted on /dev/hd4 1.00 0.30 0.70 31% / /dev/hd2 3.62 2.65 0.98 74% /usr /dev/hd9var 2.00 0.19 1.81 10% /var /dev/hd3 2.88 1.61 1.27 56% /tmp /dev/hd1 2.00 1.30 0.70 66% /home /proc - - - - /proc /dev/hd10opt 1.00 0.27 0.73 28% /opt /dev/fslv00 2.88 1.25 1.63 44% /tsmfiles /dev/fslv01 2.00 0.84 1.16 43% /opt/ibm/itm /dev/livedump 0.25 0.00 0.25 1% /var/adm/ras/livedump /dev/doonceaix 0.75 0.00 0.75 1% /doonceaix /dev/nmonlv 1.00 0.03 0.97 4% /var/perf/poa /dev/fslv02 49.50 42.86 6.64 87% /u01 /dev/fslv03 68