Posts

Showing posts from February, 2010

Smarty replace the string and use another variable instead of that -

i have form in smarty this <div class="psmd_content"> <div class="psmd_text"> <form class="psmd-form psmd_"> <div class="psmd-fields"> {if {$display_fields} == 1 || {$display_fields} == 2 } <input type="text" placeholder="enter first name" name="psmd_fname" class="psmd_fname"> {/if} {if {$display_fields} == 2} <input type="text" placeholder="enter last name" name="psmd_lname" class="psmd_lname"> {/if} <input type="text" placeholder="enter email" name="psmd_email" class="psmd_email"> </div> <div class="psmd-btn-cont"> <button class="psmd-btn">{$submit_button_text}</button> </div> <div class="psmd-...

regex - Test for filtering illegal characters from a string -

i need filter out illegal unicode characters string outlined in guide preparing data amazon cloud search. both json , xml batches can contain utf-8 characters valid in xml. valid characters control characters tab (0009), carriage return (000d), , line feed (000a), , legal characters of unicode , iso/iec 10646. fffe, ffff, , surrogate blocks d800–dbff , dc00–dfff invalid , cause errors. (for more information, see extensible markup language (xml) 1.0 (fifth edition).) can use following regular expression match invalid characters can remove them: /[^\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd]/ . i trying write test success , failure cases, having trouble writing unicode characters in prohibited range. edit2: javascript language trying write tests in edit1: link amazon cloudsearch documentation: http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html in javascript can use unicode escape sequences produce invalid characters strings, so...

python - Why reflectbox doesn't work when pdflatex is called with the dvips option of graphicx package -

general overview i want generate pdf image containing latex-style flipped character matplotlib associated package graphicx. here python code: import matplotlib params = {'backend':'pdf', 'text.latex.preamble':['\usepackage{amsmath}', '\usepackage{graphicx}'], 'text.usetex':true} matplotlib.rcparams.update(params) import matplotlib.pyplot plt fig = plt.figure() axe = fig.add_subplot(111) axe.set_xlabel('\text{\reflectbox{$\boldsymbol{\gamma}$}}') axe.savefig('image.pdf',bbox_inches='tight') i non-flipped character whereas same latex command compiled pdflatex works fine , gives horizontaly flipped character. apparently matplotlib generates latex-style calling dvi latex compiler force use [dvips] option graphicx package. implementation test i tried same syntax directly in latex , observed [dvips] option of package graphicx disable flipping behaviour of...

python - OpenCV findContours() complains if used with black-white image -

Image
i want perform edge detection following code. error because of image color depth. error makes in eyes no sense, convert image gray-scale image, , in subsequent step black , white image, working correctly. when call findcontours error. import cv2 def bw_scale(file_name, tresh_min, tresh_max): image = cv2.imread(file_name) image = cv2.cvtcolor(image, cv2.color_rgb2gray) #(thresh, im_bw) = cv2.threshold(image, tresh_min, tresh_max, cv2.thresh_binary | cv2.thresh_otsu) (thresh, im_bw) = cv2.threshold(image, tresh_min, tresh_max, 0) cv2.imwrite('bw_'+file_name, im_bw) return (thresh, im_bw) def edge_detect(file_name, tresh_min, tresh_max): (thresh, im_bw) = bw_scale(file_name, tresh_min, tresh_max) contours, hierarchy = cv2.findcontours(thresh, cv2.retr_tree, cv2.chain_approx_simple) if __name__ == '__main__': edge_detect('test.jpg', 128, 255) i error: dgrat@linux-v3pk:~> python aoi.py opencv error: unsupported form...

java - How to display the value of a HashMap key when user clicks autocom -

i'm new android development , java programming. in code (shown below), when user clicks search button , value of key displayed in displayfield textview . want value displayed when user clicks (touches) item on autocompletetextview dropdown items, without needing click search button . import java.util.hashmap; import java.util.map; import android.content.context; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.view; import android.view.inputmethod.inputmethodmanager; import android.widget.arrayadapter; import android.widget.autocompletetextview; import android.widget.button; import android.widget.edittext; import android.widget.textview; public class mainactivity extends actionbaractivity { map<string, string> map = new hashmap<string, string>(); private edittext autocomplete_searchfield; private textview displayfield; string note; @override protected void oncreate(bundle sav...

mysql - PDO via SSH2 in PHP? -

i'm trying access remote mysql database reachable locally (localhost). my code looks this: $connection = ssh2_connect('ip server', 22); if (ssh2_auth_password($connection, 'user', 'password')) { echo "authentication successful!\n"; } else { die('authentication failed...'); } $tunnel = ssh2_tunnel($connection, '127.0.0.1', 3306); try { $this->_connection = new pdo($dsn, $config['login'], $config['password'], $flags); $this->connected = true; if (! empty($config['settings'])) { foreach ($config['settings'] $key => $value) { $this->_execute("set $key=$value"); } } } catch (pdoexception $e) { throw new missingconnectionexception(array( 'class' => get_class($this), 'message' => $e->getmessage() ...

c# - Swipe between webviews in Xamarin -

anyone knows way swipe between webview s using c# in xamarin ? i have list of static urls want swipe between cards (tinder like). each webview load 1 url , user able swipe between them carousel. best practice ways lot.

ios - Setting frame for UIButton ignored -

i have ios 8 application using autolayout involved views. however, main view has lot of programmatically created views take long arrange using auto layout. want manage layout of views myself. inside view buttons. when try set frame of button, ignored - frame remains unchanged after command, when stepping through in debugger. i've set translatesautoresizingmaskintoconstraints true , false, no difference (for particular problem), , i've deleted constraints on button , view above (both before execution , in code before doing layout, in desperation). creating & managing constraints programatically tough trace. anyhow , try use storyboard directly - best way manage constrants easily.

c# - Unable to Map Registration to RegistrationDTO -

i tried mapping registrationdto registration using following code worked fine. mapper.createmap<registrationdto, registration>() .formember(dest => dest.address, o => o.mapfrom(s => s.address != null ? s.address : s.address)) .formember(dest => dest.businessentityaddress, src => src.mapfrom(s => s.businessentityaddress != null ? s.businessentityaddress : s.businessentityaddress)); mapper.createmap<addressdto, address>(); and mapper code is, registration userdetails = mapper.map<registrationdto, registration>(user); now inorder convert registrationdto registration used below code mapper.createmap<registration, registrationdto>() .formember(dest => dest.address, o => o.mapfrom(s => s.address != null ? s.address : s.address)) .formember(dest => dest.businessentityaddress, src => src.mapfrom(s => s.businessentityaddress != null ? s.businessentityaddress : s.businessentity...

Disable visual studio xml comments formatting -

<rowdefinition height="1"/> resharper inserts new line before comment <!-- row 6 --> what want original <rowdefinition height="1"/><!-- row 6 --> preserved is. there way tell visual studio stop "helping" around comments? thanks upd: oops, seems visual studio idiotic thing without resharper, thusly i'm dropping resharper tags , adding visual-studio tag

Rest Custom HTTP Message Converter Spring Boot 1.2.3 -

i want create custom of httpmessageconverter using rest, json, spring boot 1.2.3 , spring 4, custom httpmessageconverter its' never called. i have preformed following steps : 1: created class extends abstracthttpmessageconverter @component public class productconverter extends abstracthttpmessageconverter<employee> { public productconverter() { super(new mediatype("application", "json", charset.forname("utf-8"))); system.out.println("created "); } @override protected boolean supports(class<?> clazz) { return false; } @override protected employee readinternal(class<? extends employee> clazz, httpinputmessage inputmessage) throws ioexception, httpmessagenotreadableexception { inputstream inputstream = inputmessage.getbody(); system.out.println("test******"); return null; } @override protected void writeinternal(employee t, httpoutputmessage outpu...

regex - Slight adaptation of a User Defined Function -

Image
i extract combination of text , numbers larger string located within column within excel. the constants have work each text string will •either start a, c or s, , •will 7 characters long •the position of string extract varies the code have been using has been working efficiently is; public function xtractor(r range) string dim a, ary ary = split(r.text, " ") each in ary if len(a) = 7 , "[sac]*" xtractor = exit function end if next xtractor = "" end function however today have learnt data may include scenarios this; what adapt code if 8th character "underscore" , 1st character of 7 characters either s, or c please extract until "underscore" secondly exclude commons words "support" & "collect" being extracted. finally 7th letter should number any ideas around appreciated. thanks try ary = split(replace(r.text, "_", ...

mysql - Entity inheritance an error while refreshing with EntityManager -

Image
when using entity inheritance hierarchy witch @discriminatorcolumn storing discriminatortype.string values in mysql enum. below code example: @entity @discriminatorcolumn(name ="account_type", discriminatortype = discriminatortype.string, columndefinition = "enum('natural_person', 'firm', 'provider', 'employee', 'administrator', 'moderator', 'user')") @discriminatorvalue("user") public class user implements serializable { ... } and inherited entity: @entity @discriminatorvalue("firm") public class firm extends user { ... } when create firm object or removes works ok, when find entitymanager, if make enitymanager.refresh(firm) there error complaining about: caused by: com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: unknown column 'firm0_.account_type' in 'field list' update: when changed columndefinition of @descriminatorcolumn ...

Any way to override the and operator in Python? -

i tried overriding __and__ , & operator, not and - 1 want. can override and ? you cannot override and , or , , not boolean operators.

Pluggable Annotations Java 6 new feature -

annotations have been introduced java 5.0 ( jsr-175 ).java 6 has introduced new jsr called jsr-269 , pluggable annotation processing api . i trying learn pluggable annotation unable properly,so asking in so. what pluggable annotation ? how different annotations , extra features pluggable annotation (jsr-269) provides on annotations (jsr-175) i looking way take advantages of pluggable annotation , how can achieve that? (practical scenario). it's not annotations "pluggable", rather entire processing api. nothing changed annotations; way processed. if read jsr-269 outline , makes clear: "this jsr define apis allow annotation processors created using standard pluggable api."

google apps script - Trying to work in sheets with large dataset -

i have automated dashboard in sheet "my dashboard" in google drive. the data dashboard comes google analytics (ga) via api. data have been able pull in using google sheets ga add on. my source data 1 of tables in dashboard pretty large - large fit within sheet itself. so, limited scripting skills , of forum , online tutorials created script in google-apps-script queries ga api , returns of data need , puts csv file in same directory main dashboard. so now, in "dashboard" folder in drive have 2 files: "my dashboard" - sheet , "my data" csv file. could, if wanted, instead output results of api call sheet assumed csv file more efficient. i opened "my data" csv file in gsheet , called "combined". here sample of data like: ga:year ga:month ga:medium ga:source ga:campaign ga:goal1completions 2013 5 (none) (direct) (not set) 116 2013 5 (not set) adperio silvercontact?dp 0 2013 5 (not s...

c - undeclared error with thread in OS X? -

error: use of undeclared identifier 'clone_fs' error: use of undeclared identifier 'clone_files' error: use of undeclared identifier 'clone_sighand' error: use of undeclared identifier 'clone_vm' i use ubuntu code processes , thread can run in ubuntu in mac give me error.how can fix it? if change macro decimal error disapper too. main(int argc,char *argv[]) { pthread_mutex_init(&mutex,null); sem_init(&product,0,0); sem_init(&warehouse,0,8); int clone_flag,arg,retval; clone_flag = clone_vm|clone_sighand|clone_fs|clone_files; int i; char *stack; for(i=0;i<2;i++) { arg = i; stack = (char *)malloc(4096); retval = clone((void *)producer,&(stack[4095]),clone_flag,(void *)&arg); stack = (char *)malloc(4096); retval = clone((void *)consumer,&(stack[4095]),clone_flag,(void *)&arg); } exit(1); }

Why can't I create a scheduled task with PHP exec()? -

i'm having headaches while trying create scheduled tasks php script because same error xml code malformed ! here's code use : $tn = 'mailing_19'; $sc = 'once'; $tr = '"\'c:\program files\php\v5.4\php.exe\' \"d:\inetpub\wwwroot\pdbmanager_fmf\communication\ajax\campagne.publish.php 19 1001\" "'; $st = date('h:i:s', time() + (60*60)); $cmd = 'schtasks /create /tn ' .$tn .' /sc ' .$sc .' /tr ' .$tr .' /st ' .$st .' 2>&1'; exec($cmd, $data); print_r($data); it ends : (it's in french, means xml malformed): array ( [0] => erreur: le code xml de la tâche contient une valeur incorrectement formatée ou hors limites. [1] => (40,4):task: ) i don't know find xml code involved. this works while trying in command line though. please !

javascript - how does angular deal with elements with multiple directives -

if element has multiple directives, 1 scope:false , 1 scope:true , 1 scope:{} , how angular deal element? if include 3 directives asking 3 scope options on same element, error. true , false compatible , use same scope, adding {} causes: error: [$compile:multidir] multiple directives [isolatedscope, truescope] asking new/isolated scope on: <div false-scope="" true-scope="" isolated-scope=""> in case, true , {} conflict when true tries create new, inheriting scope , {} tries create new, isolated scope, reasonable , perhaps expected. $compile docs say: if multiple directives on same element request new scope, 1 new scope created. if have multiple directives scope: true , they're fine , one, scope: {} asks different kind, , angular can't produce both. directives can declared priority , have quietly picked winner, lead sorts of surprises, wisely decided shout it. here's a plunker demonstrating it. put 3 s...

.net - Non-managed referenced code strangely, "magically" changes its state for no reason when wrapped in managed -

i have strange problem: my unmanaged third-party library has class, let's call foo has method bar() returns object of type bar , like: foo* foo = new foo(); bar bar = foo -> bar(); now, bar has method supposed return true when obtained via above means. in unmanaged code, works desired: foo* foo = new foo(); bar bar = foo -> bar(); // yes, bar() returns object, not pointer bool b = bar.shouldbetrue(); // b true now, wrote managed wrapper foo , bar simple: managed.h: namespace managed { public ref class managedbar { private: thirdparty::bar* _delegate; public: managedbar(thirdparty::bar* delegate); ~managedbar(); bool shouldbetrue(); }; public ref class managedfoo { private: thirdparty::foo* _delegate; public: managedfoo(); ~managedfoo(); managedbar^ bar(); }; } managedbar.cpp (includes stripped): namespace managed { managedbar::managedbar(thi...

javascript - Request Entity Too Large Making Ajax call -

here problem, on button click call jquery function should execute code below. executes ok in instances when count value 30996 or around range. added count know maximum data length should be. when length increases 72000 error reads request entity large. trying achieve loop through textboxes in repeater capture value , save information. i looked through links advice increase maxjasonlength, if default length 102400 data length still less default, why still getting error? $(".inputfield").each(function () { // if ($(this).val() != "") { csvdata = csvdata + $(this).attr('id') + " = " + $(this).val() + ","; // } }); //check csvdata length var count = csvdata.length; $.ajax({ type: "post", datatype: "json", url: "http://localhost/webmethod", contenttype: "ap...

php - How can I format my timestamp right? -

i have timestamp mysql database , format it. $date = $row['date']; $date = date("f j, y, g:i a"); my problem prints not date of database. instead prints out current date. not need. so if print this, right date: printf($row['date']); but if print right format not right date: printf($date); you need pass date, unix timestamp, date() second parameter. otherwise date() has no idea want format specific date: $date = date("f j, y, g:i a", strtotime($row['date'])); this assumes $row['date'] in valid date format .

javascript - JS Asynchronous calls - my callback method is not working to check an image dimensions -

i have boolean function here called checkurl checks if picture has 100 x 100 pixels. if returns true. there asynchronous call within function check size of image. function checkurl(url, callback) { var valid; var img = new image(); img.src = url; img.onload = function (callback) { valid = callback(img.width, img.height); }; console.log(valid); return valid; } function nextstep(w, h) { if (w == 100 && h == 100) { return true; } else { return false; } } var pic_valid = checkurl(a_url, nextstep); i getting error: callback not defined within checkurl function. worrying variable valid within checkurl end being invalid. additional edit: if add console.log(valid); before returning valid undefined. expected? you define callback here: function checkurl(url, callback) { then redefine here: img.onload = function(callback){ … masks variable give value to. don't mask it: img.on...

javascript - Not able to give a specific ul a different css style? -

i have give part of hmtl specific css style: <div id = "comp_display1" style = "display: none;"> <div class = "ui-widget-overlay ui-front"></div> <div class="ui-helper-hidden-accessible" role="log" aria-live="assertive" aria-relevant="additions"></div> <div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front col-xs-3 " style= "height: auto !important; width: auto !important; overflow : scroll; display: inline; position: absolute; left: 20%; z-index: 500; flex-wrap : wrap; border: medium none; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; border-top-right-radius: 4px; border-top-left-radius: 4px;" tabindex="-1" role="dialog" aria-describedby="signinpopup" aria-labelledby="ui-id-1"> <div> <d...

Text to Date function in Excel -

in excel have row many dates in it: oct-13 nov-13 dec-13 jan-14 feb-14 mar-14 apr-14 may-14 however coded as: =text(ad42,"mmm-yy") =text(ad41,"mmm-yy") =text(ad40,"mmm-yy") =text(ad33,"mmm-yy") =text(ad31,"mmm-yy") =text(ad28,"mmm-yy") =text(ad26,"mmm-yy") =text(ad23,"mmm-yy") , respectively. i need increase of numbers one. oct-13 oct-14. formatted general. have tried change numbers multiple times majority of times gets coded jan-00. file given me did not create, trying manipulate. don't think excel has greatest continuity date function. in end took long way , did: 'mmm-yy thank all you add 365 cell containing date (for example): =text(ad42+365,"mmm-yy") or if instead accommodate leapyears, pull out year number , add 1 it: =left(ad42,4)&(right(ad42,2)+1)

php - SOLVED: Every 5 min cron job between specific time (Windows server 2008 and batch file) -

Image
previous colleague set cron job every 5 min 24 hrs. now need modify running between 7am 7pm. i had never learned cron job googled , tried didn't work. task scheduler set below and modified batch file c:\php\php.exe -f c:\path\cron.php five-mins to 7-19/5 * * * * c:\php\php.exe -f c:\path\cron.php five-mins even added 7-19/5 * * * * batch file, doesn't work. appreciative if can me. in advance , taking time. update found question on https://superuser.com/questions/133456/run-a-cron-job-every-5-minutes-between-two-times , changed batch file */5 7-19 * * * instead of 7-19/5 * * * * still not working. update & solved got solution redgrittybrick on superuser.com https://superuser.com/questions/926549/every-5-min-cron-job-between-specific-time-windows-server-2008-and-batch-file

c# - TypeConverter for a List of Objects -

Image
i'm trying create windows form uses property grid display list of objects. right have few classes. first one, displaycontainer, holds list of objects , instance of acts selected object property grid [typeconverter(typeof(expandableobjectconverter))] public class displaycontainer { [categoryattribute("xrecord data")] public string name { get; set; } //name of collection uniquely id [typeconverter(typeof(expandableobjectconverter)), categoryattribute("xrecord data")] public list<object> objects { get; set; } //list of objects manipulated public displaycontainer() { objects = new list<object>(); } } the object i'm wanting store instance of serialine class [typeconverter(typeof(serialineconverter))] public class serialine { [categoryattribute("points")] public seriapoint firstpoint { get; set; } [catego...

jquery - Mousemove parallax effect moves position of div -

i'm trying create slight parallax effect (i'm not sure if constitutes parallax it's similar idea). there 4 layers move around @ different rate when mouse moves. i have found great example offers similar want: http://jsfiddle.net/x7uwg/2/ it achieves shifting background position on #landing-content div when mouse moves. $(document).ready(function(){ $('#landing-content').mousemove(function(e){ var x = -(e.pagex + this.offsetleft) / 20; var y = -(e.pagey + this.offsettop) / 20; $(this).css('background-position', x + 'px ' + y + 'px'); }); }); however, cannot work out way work not on background-position shift, on div position shift. e.g position:relative; , top:x div moves around little. my reasoning div contains css animation elements needs div content inside it, not background image. any solutions using code above? how using jquery.offset() instead? might want adjust math/values, think should ...

php - $(form id).serialize() returns empty string -

i have simple search form content want send php query post request. i'm using ajax send it, , far works fine, reason instead of sending actual value of input field, sends empty string. can please explain i'm doing wrong here? my html: <form id="searchbox"> <input type="text" placeholder="author, title, keyword..."> <input type="submit" value="search"> </form> my js (the console.log line there in order see what's getting posted, ie checking what's wrong code): $("#searchbox").submit(function(e) { e.preventdefault(); console.log($("#searchbox").serialize()); $.post( "db_queries/all_articles.php", $( "#searchword" ).serialize(), function(data) { console.log(json.parse(data)); } //end response function ); //end search article post request }) my php: try { $hostname = ...

ios - Xib based view is always full-screen and displayed on top of all other views -

this generic question , must missing simple. i've create xib file, put few views in it, created view class inherited ui view, defined initwithcoder , initwithframe, set file's owner of xib class. view class loads xib via loadnibnamed . add custom view storyboard view takes half of screen. view appears correct on storyboard, can set constraints it, when app runs, view taking full screen. not appearing inside view i've added to. what doing wrong?

ruby on rails - Apache 2.4.7 error client denied by server configuration: /home/appname -

so using digital ocean host ruby on rails application i used tutorial on how deploy it: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04 after completing have tried access server through ip address , gives me 403 access denied error , checking apache error log find following message: ah01630: client denied server configuration: /home/appname, referer: http://ipaddress/ my /etc/apache2/sites-available/appname.conf files follows: <virtualhost *:80> # servername directive sets request scheme, hostname , port t$ # server uses identify itself. used when creating # redirection urls. in context of virtual hosts, servername # specifies hostname must appear in request's host: header # match virtual host. default virtual host (this file) # value not decisive used last resort host regardless. # however, must set further virtual host explicitly. servername www.peerparking.com...

ios - Swift 2.0 - Binary Operator "|" cannot be applied to two UIUserNotificationType operands -

i trying register application local notifications way: uiapplication.sharedapplication().registerusernotificationsettings(uiusernotificationsettings(fortypes: uiusernotificationtype.alert | uiusernotificationtype.badge, categories: nil)) in xcode 7 , swift 2.0 - error binary operator "|" cannot applied 2 uiusernotificationtype operands . please me. in swift 2, many types typically have been updated conform optionsettype protocol. allows array syntax usage, , in case, can use following. let settings = uiusernotificationsettings(fortypes: [.alert, .badge], categories: nil) uiapplication.sharedapplication().registerusernotificationsettings(settings) and on related note, if want check if option set contains specific option, no longer need use bitwise , and nil check. can ask option set if contains specific value in same way check if array contained value. let settings = uiusernotificationsettings(fortypes: [.alert, .badge], categories: nil) if settings.typ...

How to export a .bullet file from blender -

i trying export rigid body blender .bullet file using python script using following video guide: https://www.youtube.com/watch?v=fv-oq5oe8nw the weird thing .bullet files created not. in other projects .bullet file, never appears. knows why?:/ i've written add-on blender automates task, , far seems work flawlessly. it's available on github: https://github.com/v0idexp/blender-bullet-export after having installed via file -> user preferences -> add-ons window, select object , invoke exporter via file -> export -> bullet physics data (.bullet)

How can I make a PHP 'foreach' loop repeat entire line? -

my objective allow users select check boxes , when click submit combines pdfs 1 pdf. (each check box has pdf value). <?php include 'pdfmerger.php'; $pdf = new pdfmerger; $pdf1 = "/path/pdf1.pdf"; $pdf2 = "/path/pdf2.pdf"; ?> <form action="#" method="post"> <input type="checkbox" name="check_list[]" value="<?php echo $pdf1 ?>"><label>pdf one</label><br/> <input type="checkbox" name="check_list[]" value="<?php echo $pdf2 ?>"><label>pdf two</label><br/> <input type="submit" name="submit" value="submit"/> </form> <?php if(!empty($_post['check_list'])){ foreach($_post['check_list'] $selected){ $pdf->addpdf($selected); } } ?> <?php ob_start(); if(isset($_post['submit'])){ $pdf->merge('download', 'test223...

xml - PHP SimpleXMLElement: How to add dynamic child with ampersand escaping -

i'm using following code add dynamic child xml node <?php $recordxml = new simplexmlelement("<record></record>"); $rowxml = $recordxml->addchild('row'); foreach ($array $column => $column_value) { $rowxml->addchild($column,$column_value ); } this code gives "unterminated entity reference" warning! when there ampresand & in of $column_value , know & can escaped if assign child content below $rowxml->column_name = "text & content"; // gives <row><column_name>text &amp; content </column_name></row> // without warning now how use method add dynamic child node ampresand escaping ? basically make work would have this: $rowxml->{$column} = $column_value;

c# - Delete duplicate rows from excel with HSSF POI -

so have file comes third party edit , save our application. use hssf library that. file comes of duplicate rows , when edit it, edits on duplicate lines. when try upload our payrol giving false result because there duplicate values. there better way delete duplicate rows? dont want loop through rows , delete duplicates.

embedded - u-boot select boot partition based on GPIO state -

i'm developing recovery mechanism on embedded system. want boot recovery mode if user pressed gpio button. recovery mode means selecting different kernel , root partition usual. got stuck on using gpio value in conditional command. if write if gpio input 20; cmd; fi cmd run because gpio returns error status not value of gpio. how can value? is feasible use u-boot commands implement boot selection (i need blink leds 15s , if user presses button @ least 5s switch recovery). easier implement logic in c code? if , there examples? in general providing recovery system seems common task embedded engineer. best practices in scenario? common way of implementing this? not find or guidelines on web. recovery may depend on system has available you, , how robust need be. remember keep can read-only , seperated stuff writeable. keep writeable stuff in different partition in nand or wherever. method described above , running if kernel/fs bad. may need. if ever plan on allo...

Facebook PHP API getReachEstimate -

i quite beginner , trying learn apply things in facebook php sdk, there things poorly explained in documentation. my goal number of users interested in both "socker" , "football". i think function getreachestimate($array, $array) that, approach be. use facebookads\object\reachestimate; use facebookads\object\fields\reachestimatefields; use facebookads\object\adaccount; $account = new adaccount($account_id); $reachestimate = $account->getreachestimate($some_array, $some_array2)); i looked in source of sdk , function takes 2 arrays, explained these arrays must like. if has suggestions, please let me know. thank you. the first parameter seems irreverent me. i'm not sure. update answer when find. meanwhile here's how it: suppose following parameters: $params = [ 'targeting_spec' => ['geo_locations' => ['countries' => ['us']]] ]; $fields = []; then call in following way: $adaccount = new...

angularjs - sorting in ui grid with grouped columns (cellTemplate) -

i have grouped 2 columns in ui-grid using celltemplate, , rendered fine: celltemplate: '<div class="ngcelltext">{{row.entity.firstname}} {{row.entity.lastname}}</div>' unfortunately, sorting worked when columns separated (firstname alone, lastname alone) not work anymore. i sort grouped columns in celltemplate sorting firstname only. could give me hints work (i not ask complete solution) personally modify data prior populating grid, example create full name property on initial objects array , use in grid instead of first name + last name. that way, have 1 column full name , sortable without additional code.

ios - How to implement delegate for open source browser SVWebViewController? -

i understand ios uiwebview can implement uiwebviewdelegate , access method required. however custom browser svwebviewcontroller , confused how implement delegate method tried implementing uiwebviewdelegate above , did not work (the "load" message not showing @ all). class tableinfo: uitableviewcontroller, mwfeedparserdelegate, ensidemenudelegate,uiwebviewdelegate{ var allowload = true func webview(webview: uiwebview, shouldstartloadwithrequest request: nsurlrequest, navigationtype: uiwebviewnavigationtype) -> bool { println("load") return allowload } func webviewdidfinishload(webview: uiwebview) { allowload = false } } override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { if hasinternet { let item = self.items[indexpath.row] mwfeeditem let url = nsurl(string: item.link) let con = svwebviewcontroller(url: url) self.navigationcontroller?.pushviewcontroller(...

c# - asp:label change visibility after hiding it -

i've got asp:label , asp:dropdownlist want able switch , forth between visible , invisible when clicking on buttons. right now, code looks like aspx file <asp:label associatedcontrolid="statusfilter" id="statusfilterlabel" runat="server" cssclass="filterlabel">status <asp:dropdownlist id="statusfilter" runat="server" cssclass="filterinput" autopostback="true" onselectedindexchanged="anyfilter_selectedindexchanged" appenddatabounditems="true"> <asp:listitem selected="true" value=" 0">&lt;all&gt;</asp:listitem> </asp:dropdownlist> </asp:label> <asp:button text="all" id="alltabbutton" cssclass="tabbutton" runat="server" onclick="alltab_click" /> <asp:button text="arrived" id="arrivedtabbutton" cssclass="tabbutton...

actionscript 3 - Can't interact with tiles in an interactive jigsaw puzzle (Flash CC AS3) -

i am doing interactive assignment media arts class , have no idea how code in action script 3. took orignal code tutorial , didn't work came here , attempted learn how modify it. as3 code //********************* // initialize: flash.events.mouseevent var numpieces = 16; (var = 0; < numpieces; i++) { var piecename = "p" + (i + 1); var piece = this[piecename]; if( piece ){ piece.name = piecename; piece.addeventlistener(mouseevent.mouse_down, function)(evt) { this.scalex = 1; this.scaley = 1; this.shadow = null; this.parent.addchild(this);// bump top this.offset = {x:this.x - evt.stagex, y:this.y - evt.stagey}; }); piece.addeventlistener(mouseevent.mouse_move, function) { this.x = evt.stagex + this.offset.x; this.y = evt.stagey + this.offset.y; }); piece.addeventlistener(mouseevent.mouse_up, function)(e...

ruby on rails - IOS Core Data or Caching for Offline User Experience -

i new ios , looking way improve user experience when network bad or there's no network @ all. app uses rails server back-end. for example, users can send messages each other, , able display 10 recent conversations of user if offline, can still check last messages. what best way accomplish kind of features? core data or caching techniques? thx help core data approach caching, built enormous amounts of data. it's extremely quick rather hard use , meant more complex situation saving cache. don't know app cant tell should use, there other options might want @ nsuserdefaults , nscache extremely easy use considered slower. , of course can find plenty of third-party options on github. luck!

get array from text android java -

i'm french sorry english, need help, i'm trying have array ( or arraylist ) text file : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 2,2,2,2,2,2,2,2,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...

excel - Change Value in Adjacent Cell Via Click (VBA right?) -

Image
this first time have ever worked vba stuff (the code found vba right? :p ) please forgive inability just...understand looking @ it. :) have experience macros , know /some/ of code compatible, don't know how write it...only know how record use bits know work. the puzzle: have column adjust weighted values of row in (either makes values more or less, or leaves them alone), weights entirely subjective need changed manually usually. the issue when needing change lot of them @ once because tons of clicking each cell , changing value 1 @ time "guessing" weights need entering numbers until "looks good" (like said subjective), found this: http://www.mrexcel.com/forum/excel-questions/51933-changing-cell-value-clicking-cell.html made tiny changes version @ bottom of page , have right now: private sub worksheet_selectionchange(byval target excel.range) application.enableevents = false if target.cells.count = 1 if not intersect(target, range("q3:q...

php - twilio dynamic voice url number? -

i'm using twlio rest api in php application make phone calls. everything works fine should. however, need allow users use own phone number if want. for don't know how should proceed because current twilio voice url static url (php file xml output) has caller id within it! i can verify numbers via rest api , add them twilio account how use numbers in application dynamically opposed adding them manually voice url page? this voice url page: <?php header('content-type: text/xml'); // put phone number you've verified twilio use caller id number $callerid = "+44xxxxxxxx0"; // put default twilio client name here, when phone number isn't given $number = "michelle"; // phone number page request parameters, if given if (isset($_request['phonenumber'])) { $number = htmlspecialchars($_request['phonenumber']); } // wrap phone number or client name in appropriate twiml verb // checking if number given has digits...

http status code 404 - Laravel 5.0 custom 404 does not use middleware -

Image
i'm using middleware parse output of templates. working fine pages. however when want show 404 (got custom page that) doesn't treat http request (that's think) since doesn't go through middleware. my question is, how have requests go through middleware. the error pages don't go through routes.php. in kernel.php move middleware $routemiddleware array $middleware array. middleware in array run on every request (tested in 5.1).

html - Javascript syntax highlighter infinite loop -

i'm making syntax highlighter in javascript , html. works fine @ moment think it's inefficient because have interval time of 0 runs function loops through of characters in text area , inserts them div behind text area provide syntax highlighting. i think lexer bad too, @ moment i'm more concerned function running million times second loops through every character in text area each time. can please think of more efficient way this? there doesn't seem performance problems i'm not sure if work on lower-powered machine because don't want crash browser tab because want have several on page need efficient possible. i understand annoying given loads of code , asked help, thought problem easiest debug you'd need entire code. here code: <html> <head> <title>my syntax highlighter</title> <style type="text/css"> #container { width: 100%; height: 100%; position: relative; ...

linux - Simple tee example -

can please explain why tee works here: echo "testtext" | tee file1 > file2 my understanding tee duplicates input , prints 1 screen. the above example allows output echo sent 2 files, first redirecting second. i expect 'testtext' printed screen , passed through file1 , landing in file2. similar how text in following example end in file2. echo "testtext" > file1 > file2 can explain missing in understanding? edit is because writing file , stdout gets redirected? your description right: tee receives data stdin , writes both file , stdout. when redirect tee's stdout file, there nothing written terminal because data ended inside second file. is because writing file , stdout gets redirected? exactly. what trying done (demonstrating how tee works): $ echo "testtext" | tee file1 | tee file2 testtext but since tee gnu coreutils accepts several output files specified, 1 can just: $ echo "testtext...