Posts

Showing posts from January, 2012

How pentaho's copy block handles dublicate data? -

i trying copy mysql db hana db through pentaho's copy table wizard. automatically created workflow confused if destination db partially filled, handle dublicate rows or copy them anyways? the copy table wizard doesn't analyze duplicates. attempts run bunch of insert statements destination db. it's job etl developer ensure duplicate data filtered out or alternatively, updated on target db. check insert/update step. performance of course lower, each row first database lookup , depending on lookup results either insert or update issued.

google apps script - Email notification if specific cell is changed and add another cells value to message without change tracking -

what did: if cell in column m has been changed, email notification has been sended specify adres column n @ same row. need specify body text other columns @ same row. did working causes if other declared columns (such project, customer, task, executor) has been changed emil has been send to. what need: just track change in 1 "m" column , put @ body of email additional data other columns same row. , (thats point) did not track change @ other columns, email should send if changing column m. probably easy, i'm twisted... i bulid script based on: email notification if cell changed how attach onchange cell value event/script google sheet restrict notifications sent changes referenced in columns my script: function sendnotification() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.getactivesheet(); var cell = ss.getactivecell().geta1notation(); var row = sheet.getactiverange().getrow(); var cellvalue = ss.getactivecell().getval...

c# 4.0 - How to run the timer tasks asynchronously? -

hi developing windows phone 8 app using c# , xaml. previous team has developed code, have used many methods in timer control. when updating methods calling , blocking ui. there way use timers asynchronously ui can not blocked. in advance you should use "xaml binding" updating ui

java - Primefaces selectManyCheckbox -

i have selectmanycheckbox, cant checked values after change event (list of selected values stay empty). change event triggered in debug mode there no values in listselectedsignalcauses. tried set converter didnt either (maybe wrong converter). <p:selectmanycheckbox value="#{signalanalysisbean.listselectedsignalcauses}" layout="pagedirection" styleclass="lstsignal"> <f:selectitems value="#{signalanalysisbean.listsignalcauses}" var="causes" itemvalue="#{causes}" itemlabel="#{causes.name}" /> <p:ajax process="@this" update="test" event="change" listener="#{signalanalysisbean.checkcauseslist}" /> </p:selectmanycheckbox> <h:outputtext value="#{signalanalysisbean.arrsize}" id="test" /> public class signalanalysisbean extends abstractbean { private list<generalcolldto> listsignalcauses; ...

java - How to convert audio inpustream from google translate to wav file? -

i'm taking project make text speech google api : https://code.google.com/p/java-google-translate-text-to-speech/ . used code in part "playing translated text". project works well. want create wav file inputstream received google translate. tried codes: try { sound = audio.getaudio(text_, language.french); audioinputstream ais; ais = new audioinputstream(sound,format,sound.available()); //ais = audiosystem.getaudioinputstream(sound); //audioinputstream lowresais = audiosystem.getaudioinputstream(format, ais); audioformat aisformat = ais.getformat(); system.out.println(aisformat.tostring()); audiosystem.write(ais, type.wave, newfilepath);} } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } but wav file doesn't work, when double-click play it, have no voice. have tried convert audio received google translate wav file in java? please helps me resolv...

javascript - PhoneGap/Cordova not listening for 401, modifying http response code to 200 not working -

cpg = cordova/phonegap this question pretty result of earlier question on phonegap/401 bug here: angular not getting response when it's non-200 the resolution (at time) implement timeout on of calls. fine until hit production. realized app being used in spotty areas, , "timeout" there wasn't enough connection @ time. so, not acceptable solution our environment/app. since cpg not "listen" 401 response code, thought maybe change response code that's coming know cpg listens for, , modify message body , process accordingly. so, applied @ our gateway (firewall -> loadbalancer -> gateway (where ad authentication occurs) -> service) level, process of modifying 401 responses return 200 status code, message "authentication failed", or that. first test check , make sure response correctly via fiddler. well. next, when checking in ou cpg application (running angularjs), still never receive response. i'm able see in fiddler every...

visual studio 2013 - cannot find "use IIS Express" in the Solution Explorer dropdown in VS2013 -

i installed vs 2013, , cannot find option use iis express when right click on website project name. did option moved? without option when open existing website, , run, 403.14 forbidden error saying http error 403.14 - forbidden web server configured not list contents of directory. i'm new visual studio 2013, appreciate can provide... open project properties , , go web tab. in servers section should see dropdown 3 options: local iis, iis express , , external host. see web servers in visual studio asp.net web projects more information.

angularjs - ng-model is not working inside a ui bootstrap modal window and angular -

i'm using modal window using angular , bootstrap ui <script type="text/ng-template" id="mymodalcontent.html"> <div class="modal-header"> <h3 class="modal-title">cambia palmare {{descpalmare}} ( {{descprogetto}} )</h3> </div> <div class="modal-body"> <ul> <li > <select id="soluzionedlg" name="soluzionedlg" class="required" ng-options="soluzione.id soluzione.denominazione soluzione in soluzioni" ng-model="soluzionecorrente" ng-change="filtrosoluzione()"></select> </li> <select id="progettodlg" name="proget...

Excel formulas not calculating when copied from recordset -

i building formulas in sql query using excel vba function copyfromrecordset insert formulas in spreadsheet. text of formula enters correctly displays text , not calculate. calculation mode set automatic, , cell formatted "general" , not "text". in order formulas calculate, have enter each cell if going edit formula , leave cell without having edit anything. action of entering , exiting causes formula calculate must done manually on each cell. sub test1() application.referencestyle = xlr1c1 dim qry string qry = "select myear, '=rc[-1]*12' xformula tblyears" dim datacmd adodb.command set datacmd = new adodb.command datacmd.commandtext = qry dim datars adodb.recordset set datars = db.runselect(gv.constr_config, datacmd) activesheet.range("a1").copyfromrecordset datars application.referencestyle = xla1 end sub this results in this... 1 2 1 2012 =rc[-1]*12 2 2013 =rc[-1]*12 3 2014 =rc[-1...

python - Check if a OneToOne relation exists in Django -

now i'm using django 1.6 i have 2 models relates onetoonefield . class a(models.model): pass class b(models.model): ref_a = models.onetoonefield(related_name='ref_b', null=true) first see code points out problem: a1 = a.objects.create() a2 = a.objects.create() b1 = b.objects.create() b2 = b.objects.create(ref_a=a2) # call: print(a1.ref_b) # doesnotexist exception raised print(a2.ref_b) # returns b2 print(b1.ref_a) # returns none print(b2.ref_a) # returns a2 now problem is, if want check a object, judge whether exists b objects referencing it. how can do? the valid way tried try , catch exception, there other prettier way? my effort: 1 - below code works, ugly! b = none try: b = a.ref_b except: pass 2 - tried check attributes in a, not working: b = a.ref_b if hasattr(a, 'ref_b') else none do meet same problem, friends? please point me way, thank you! so have least 2 ways of checking that. first create...

javascript - Iterating through an arrays properties methods in js -

i have array of objects , i'm trying iterate through each object in array. need call method on each object. how should go doing this? function basicbox(x,y,width,height,color) { this.color = color; this.x = x; this.y = y; this.width = width; this.height = height; this.draw = function() { g.drawstyle = this.color; g.drawrect(this.x,this.y,this.width,this.height); } } var boxes = [b1,b2,b3]; function run() { (var = 0; < boxes.length; ++i) { boxes[i].update(); } } it think array.map() , array.reduce() , of course array.foreach() can can stuff asking for. using for or while loops absolutely adequate iterate arrays, worth try more functional approach, because prevents rewriting loops , lets focus on task, should done each element. if iterate on properties of object, for in loop possible, there object.keys() returns properties of given object.

linux - extract list of subdirectories from input file -

i new in scripting , need on one: have .txt file; in each line have digits, example: 123456 234567 345678 567890 .... on other hand, in master directory have subdirectories. in each subdirectory, have file in .xml format. in each of .xml files have 1 tag 6 digits; example: in file 1.xml under sub directory 1 , tag value 123456 , in file 2.xml under sub directory 2 , tag value 111111 , in file 3.xml under sub directory 3 , tag value 345678 , ... how can extract list of subdirectories , save file there match in digits between .txt file , .xml files? thanks i able save in output file lines in xml file under sub directories having string searching using command line: grep -r hdcontent priorite_2_hd/*/adi_new.xml where priorit_2_hd sub directory , adi_new.xml .xml file the output looks like priorite_2_hd/ados_contre_attaquent_les_hd_vf_ingest/adi_new.xml: priorite_2_hd/ainsi_soient_ils_saison_1_vf_w/adi_new.xml: ...

php - Split paragraphs into multidimensional array -

i'm trying put html-informations in array. <p>title 1</p> <p><span>content 1</span></p> <p><span>content 2</span></p> <p>title 2</p> <p><span>content 1</span></p> <p><span>content 2</span></p> <p><span>content 3</span></p> i want put these in array fields "title" , "content". problem put p-tags has span , belongs same title. the result should be: (strip_tags title , remove span content) [0]['title'] => 'title 1', [0]['content'] => ' <p>content 1</p><p>content 2</p>', [1]['title'] => 'title 2', [1]['content'] => ' <p>content 1</p><p>content 2</p><p>content 3</p>', my attempt: $paragraphs = explode('<p>', $html); ($i = 0 ; $i < count($paragraphs) ; $i++) {...

Kohana/PHP records getting replaced if it is run inside the loop -

i have following snippet in code, problem when try add multiple items. getting added repalcing added row , eg:- in following code snippet 1 record there id 150, , record 13. can please tell me problem is. public function storeskills($skills,$id) { $skills = "16,13"; $id = "150"; if(!empty($skills)){ $userskillsobj = orm::factory('userskill'); $userskills = explode(',',$skills); foreach($userskills $skill) { // $userskillsobj = orm::factory('userskill'); if statement here, //records getting added fine. $userskillsobj->user_id = $id; $userskillsobj->skills_id = $skill; $ids = $userskillsobj->save(); } } } move line creates object within foreach loop. having outside means you're referencing same object, therefore final (second) loop saves on first one, making 13. example: foreach($...

ruby on rails - Dynamically get all combinations of all elements of arrays -

important: can choose 1 element each array. i'm writing code let me test quiz permutations. below current hardcoded way return array of possible permutations. need adapt dynamic, there more arrays added later. i thinking of method accept array of options, , return array of permutations, brain breaks after first loop. appreciated. options = [ [["geek", "chef", "supporter", "fashionista"]], [["0-1000", "1001-10000", "no limit"]], [["many", "for one"]] ] def test_gifts(options) options.each_with_index |a,index| .... end end hardcoded way: character_types = ["geek","chef", "supporter", "fashionista"] price_ranges = ["0-1,000","1,001-10000","no limit"] party_size = ["many", "for one"] permutations = [] character_types.each |type| price_ranges.each |price| party_s...

java - TextField auto resize issue -

i have following code in codenameone project: final textarea tf = new textarea(); tf.setgrowbycontent(true); tf.setsinglelinetextarea(false); the problem when run app , start typing in such text area, (no matter how many characters) text area not grow until focus goes other widget. tests have been in android. is "normal" behavior? if not, how can fix it? that normal behavior. text area native , native platforms don't have convention of growing text area while typing. instead can scroll within text area. the grow content flag indicates rows/columns value text areas preferred size hint , not limitation, on default don't need invoke or disable single line mode (which on textfield ).

Algorithm for Contest Schedule -

can explain algorithm solve problem? http://community.topcoder.com/stat?c=problem_statement&pm=6708&rd=10000 . explanation given here hard understand http://community.topcoder.com/tc?module=static&d1=match_editorials&d2=srm320 i believe not pity did not understand "solution", because explained without giving essential details and... incorrect well. first of all, there should no real importance whether start search optimal solution start , going forward or start search end , go backwards towards start. off course, there slight difference, because if john manages finish tasks on contest earlier end time, might able still catch next contest. therefore, if direction matters @ all, should start planning start time , should go forward, end time might earn possibility participate on other contests well. let not dwelve ourselves deep details, small difference not important little task, important in serious project. i have been harsh solution called in...

MySQL does not start when upgrading OSX to Yosemite or El Capitan -

i know similar questions exist, such mysql mamp not work osx yosemite 10.10 . however, have mamp, nor xampp installed on computer. when try start mysql prefpane, nothing happens. when try start mqsql command line via sudo /usr/local/mysql/support-files/mysql.server start get: starting mysql . error! server quit without updating pid file (/usr/local/mysql/data/adamg.local.pid). any , appreciated. can supply file output necessary. open terminal: check mysql system pref panel, if says along line "warning, /usr/local/mysql/data not owned 'mysql' or '_mysql' if yes, go mysql folder cd /usr/local/mysql do sudo chown -r _mysql data/ this change ownership of /usr/local/mysql/data , of content own user '_mysql' check mysql system pref panel, should saying it's running now, auto-magically. if not start again. another way confirm netstat -na | grep 3306 it should say: tcp46 0 0 *.3306 *.* ...

javascript - Issue with form Submit - information to database and redirect to thank you page -

issue form submit - information need sent database , need redirect thank page here code , fiddle link well. thanks. i trying redirect - thank page instead redirected - "action"- url with existing code, there no issue of sending information database. works fine, not redirecting me thank page. html: <form name="mailinglist" method="post" id="formid" action="url" onsubmit="return validate_form(this);"> <input type="email" name="emailaddress" placeholder="email address" maxlength="100" size="28"> <br> <input type="submit" name="submit" value="submit" width="260px"> </form> var frmvalidator = new validator("mailinglist"); frmvalidator.addvalidation("email", "maxlen=50"); frmvalidator.addvalidation("email", "req"); frmvalidator.addvalidation(...

java - Does setting a Random objects' seed to a random value make the generator more random? -

i have code simulates 10 coin tosses: public void flipcointentimes() { random randomnumbergenerator = new random(); // generate 10 random numbers (int = 0; < 10; i++) { randomnumbergenerator.setseed(randomnumbergenerator.nextlong()); system.out.println(randomnumbergenerator.nextint(2) == 0 ? "heads" : "tails"); } } does setting of seed random long make method more random? i.e., more 50/50 if remove setseed() line? no , settings seed not make 'more random'. default constructor use random seed. the random class uses linear congruential generator generate pseudo random series of bits. state of random class contained in called seed. when class asked random number the seed updated . it should not affect distribution manually reset distribution of random numbers. if need better distribution harder predict can use securerandom .

dns - Trying to understand FQDN's -

i struggling understand fqdn servers. at moment mine localhost if type hostname in server terminal says localhost. i understand need different 1 if want set cpanel, or postfix or really. as know comprised of 2 parts: hostname.domainname can domain name made up, or have 1 of domains set use on server? and host name can anything, or has servername? , have set sub domain of domain? i hope understand issues. thanks try typing hostname --fqdn fqdn means qualified domain name, composed of 2 parts: your hostname the domain name hostname located. it can easy mycomputername.myfamilydomainname.tld, or complex cor-th3-1.par.fr.eu.mynetwork.net. all of can technically made up, though, if use example, google.com local domain, local resolver may use info , believe you're in google.com dns zone, may have problems resolving entries in google.com dns zone. more info at: http://en.wikipedia.org/wiki/hostname

Scrape values from HTML select/option tags in R -

i'm trying (fairly unsuccessfully) scrape data website (www.majidata.co.ke) using r. i've managed scrape html , parse little unsure how extract bits need! using xml library scrape data using code: majidata_get <- get("http://www.majidata.go.ke/town.php?mid=mte=&smid=mtm=") majidata_html <- htmltreeparse(content(majidata_get, as="text")) this leaves me (large) xmldocumentcontent. there drop-down list on webpage , want scrape values (which relate names , id no. of different towns). bits want extract numbers between <option value ="xxx"> , name following in capital letters. <div class="regiondata"> <div id="town_data"> <select id="town" name="town" onchange="town_data(this.value);"> <option value="0" selected="selected">[select town]</option> <option value="611">ahero</opt...

java - Is there any performance difference between Autowire by type and Autowire by name -

i have changed project use annotations instead of xml file , increases application deploy time. looking ways reduce it. is there performance difference between autowire type , autowire name ? any other suggestions reduce deploy time warmly welcome similar question asked sometime can refer below link answer: spring-wiring-by-type-is-slower-by-magnitude-than-wiring-by-name it appears autowire type has additional compatibility check perform , therefore inherently slower name equivalent. there fix in spring 3.1.2 , 3.2 remains slower. applications doing initialisation @ startup, isn't big issue , brings more safety application.

Xamarin.forms swipeable background, carousel style navigation -

i create carousel background in xamarin. know this , seems used replace entire page page. keep ui overlay, buttons , text in top , bottom of page, change entire background when user swipes (including horizontal slide animation). far understand, 1 page can visible @ time, meaning cannot display transparent page on top of page , animate last page. therefore seems goal not reachable using carousel linked to. else done? i using xamarin.forms , developing ios , android. thanks.

Setting error message in html with knockout validation -

i use knockout-validation adding validation rules in html5, works great: http://jsfiddle.net/gt228dgm/1/ i change default error messages generated browser (like "this field required." or "invalid"). pretty done in javascript code, believe kind of texts should go html. possible , how? guess i'm looking like: <input data-bind='value: firstname, validate: { message: "please enter first name" }' required pattern="^[a-za-z]{1,255}$"/></label> i have implemented custom knockout binding solves issue: ko.bindinghandlers.validate = { init: function(element, valueaccessor, allbindings, viewmodel, bindingcontext) { var valuebinding = allbindings().value; var value = valueaccessor(); if (value) { valuebinding.extend(value); } } }; the binding looks this <input data-bind='value: firstname, validate: { required: { message: 'full name missing' }...

ipad - How to open custom dialog box / popup using Xamarin.Forms? -

i newbie xamarin.forms , stuck situation want open popup box control details [e.g. view employee details] on click of parent page. how can open custom dialog box / popup using xamarin.forms? any example code appreciated? thanks in advance! the general purpose of trying achieve can accomplished using pushmodalasync , popmodalasync methods of xamarin.forms navigation object. the chances enough needing - however - isn't truely modal. explain after small code snippet:- stacklayout objstacklayout = new stacklayout() { }; // button cmdbutton_launchmodalpage = new button(); cmdbutton_launchmodalpage.text = "launch modal window"; objstacklayout.children.add(cmdbutton_launchmodalpage); // cmdbutton_launchmodalpage.clicked += (async (o2, e2) => { contentpage objmodalpage = new contentpage(); objmodalpage.content = await createpagecontent_page2(); ...

javascript - Responsive scrolltop -

im using following code detect when object should become 'sticky' , stay fixed in content. var $window = $(window), $stickyel = $('#single-post-details'), eltop = $stickyel.offset().top; $window.scroll(function() { $stickyel.toggleclass('sticky', $window.scrolltop() + 52 > eltop); }); however make responsive. means somehow needs detect height of banner above first doesn't trigger @ wrong point.. here fiddle example. the problem on resize, top position of sticky element change. solve that, should not check height of image, recalculate top position. the use of .resize event usefull here. on callback, update global variable : var $window = $(window), $stickyel = $('#single-post-details'), eltop = $stickyel.offset().top; $window.on({ resize : function(){ eltop = $stickyel.offset().top; $window.trigger('scroll'); }, scroll : function() { $stickyel.toggleclass('s...

javascript - onkeyup event not working in textarea -

i have basic input/output structure in html: <textarea id="input" onkeyup="sendcode()"> hello world! </textarea> <div id="output"></div> and have js function should pass input output: var input = document.getelementbyid("input"); var output = document.getelementbyid("output"); function sendcode(){ output.innerhtml = input.innerhtml; } the sendcode() function works when call manually, seems onkeyup event not firing in textarea. here jsfiddle: http://jsfiddle.net/mudroljub/y5a2n8ab/ any help? update : jsfiddle updated , working now. use value since it's not content text value property var input = document.getelementbyid("input"); var output = document.getelementbyid("output"); function sendcode(){ output.innerhtml = input.value; } and working demo here

Javascript JSON Array -

this question has answer here: access / process (nested) objects, arrays or json 16 answers i using request server api , making request , doing this: var resp = json.parse(response); i call server providing 0001 & 0002 arguments , after json.parse returns array such as: {"0001":{"id":1},"0002":{"id":2}} i know traditionally if given static responses such as {"placeid":{"id":1},"placeid":{"id":2}} i this: resp.placeid.id but given return names aren't same how can access first value resp.0001.id given 0001 may not value returned? use for...in loop. for(var property in resp) { console.log(property + ": " + resp[property]); }

c# - common web.config connectionstrings for different web applications? -

we have multiple web applications , deploy web applications in same folder called iapps. each app has own web.config file , must of have commmon connection strings. now want make common configuration file application read connection strings , use it. how can that? articles or examples current \iapps\app1 |- web.config \iapps\app2 |- web.config \iapps\app3 |- web.config expecting \iapps\app1 --web.cofig |-root config <-| \iapps\app2 --web.cofig |-root config <-| \iapps\app3 --web.cofig |-root config <-| this answer describes several alternatives. in addition, can leverage idea of inheritance placing common connection strings in web.config under root (i.e. iapps in case). app1...appn inherit settings iapps\web.config just careful anythinn define in iapps\web.config doesn't redefined in child apps' web.config, else you'll duplicate section defined error in child apps.

ruby on rails - Sass::SyntaxError: wrong number of arguments (5 for 4) for `rgba' -

i change css of app , when have wanted heroku pushed message returned following error: here css:` .subheading{ display:block; font:2.357em/1.151em 'pt sans', arial, helvetica, sans-serif; /*33px/38px*/ margin:0 0 1em; text-align:center; color:#7a7a7a; text-shadow:0px 1px 1px rgba(255,255,255,0.5); } .grey{ background:#7e8794; color:#fff; border-bottom:1px solid #f6f6f6; border-top:1px solid #f6f6f6; -moz-box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.75), inset 0 -6px 6px -6px rgba(0,0,0,0.75); -webkit-box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.75), inset 0 -6px 6px -6px rgba(0,0,0,0.75); box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.75), inset 0 -6px 6px -6px rgba(0,0,0,0.75); } .grey h1{ color:#fff; text-shadow:0 1px 2px rgba(0,0,0,0.5); } .grey h2{ text-shadow:0 1px 2px rgba(0,0,0,0.5); } .grey .subheading{ color:#d9e7fb; text-shadow:0 1px 1px rgba(0,0,0,0.5); } * +html .btn{margin:0;} .btn span{ color:#fff; padding:0 1.2...

linux - which pattern is better to filesystem with millions files? -

i work in company , have problem. there server received 1000 text files per day, files have 10mb , purge roles 10 days. files can have 20mb. have problem list , consult files, onerous linux consults. my questions is: pattern better filesystem millions files ? better strategy store , list many , large files: thanks , sorry bad english! hehe

python - Extracting BIND parameters to build a JSON query -

i have file exported bind containing tsig values 500 domain names. need repurpose data json rest api query. bind data formatted so: // secondary-example.com. key "2000000000000.key." { algorithm hmac-md5; secret "ahashedvalue="; }; zone "secondary-example.com." { type slave; file "sec/secondary-example.com."; allow-transfer { 1.1.1.1; 1.1.2.2; }; also-notify { 1.1.1.1; 2.2.2.2; }; masters { 1.2.3.4 key 2000000000000.key.; }; }; from need extract key, zone , secret. here's example api request. { "properties":{ "name":"se...

jquery - Adding fancy box to a WP theme -

i'm new making own wp themes. right i'm trying figure out how add lightbox type functionality it. googled topic extensively , decent tutorial able find is: http://code.tutsplus.com/tutorials/add-a-responsive-lightbox-to-your-wordpress-theme--wp-28100 it uses fancybox. tried following instructions on , on again - no use. don't fancybox functionality on images though - if click on image, opens full image's path, rather lightbox. can't figure out i'm doing wrong. i'm far expert when comes ensuing correctly. if there better way it, or if lightbox considered better fancybox - i'm open sorts of suggestions , directions. here test page - http://www.aspenwebsites.com/lothlorien/gallery/ basically, created 'lightbox' folder in theme's 'inc' folder , dumped there source files downloaded fancybox github. per tutorial created lightbox.js file following content: (function($) { // initialize lightbox links 'fancybox' cla...

magento - ajax into another phtml file -

i have 2 .phtml files in magento, 1 used in home cms page , referenced this: {{block type="catalog/product_list" category_id="11" template="catalog/product/special-products.phtml"}} then wish ajax; <script> function loadxmldoc(pageno) { var xmlhttp; if (pageno.length==0) { document.getelementbyid("productsdiv").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("productsdiv").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","special-products-ajax.phtml?page_number="+pageno,true); xmlhttp.send(); } </script> <script> //call after page loaded window.onloa...

bash - How can I create directories containing file name prefixes? -

i have simple (not simple me though) question. let's say, have a.txt, b.txt, c.txt. after repetitive processe, want save results in separate directories a_result/a_result.txt, b_result/b_result.txt, c_result/c_result.txt. how can shell script? thank you! you can use ${param%word} form of parameter expansion strip .txt input file name , create corresponding directory , output file name. for input in a.txt b.txt c.txt; stem=${input%.txt} mkdir -p "${stem}_result" some_command "$input" > "${stem}_result/${stem}_result.txt" done

python - Grab what is after f1= but ignore \r\n and \n if they are present -

currently use this: a = re.search(r'(?<=f1=)(.*)',a) to string after f1= . string looks this f1=test string \r\n or f1=test string \n in other words if there such thing \n or \r\n i avoid parsing them mistake aren't present. try a = re.search(r'(?<=f1=)(.*)', a.strip()) strip() remove trailing spaces , line feeds.

javascript - How to call table from another HTML page -

i working in zoho. there 2 pages have created namely test , test2 . need access table present in test2 page test page . guess, need call table name. there mechanism can access test2 table test page. you use localstorage ( http://www.w3schools.com/html/html5_webstorage.asp ) in javascript. serialize test2 form's data (e.g. using json), , store localstorage other window, test, able access. for example, in test2 have this: var tablehtml = document.getelementbyid("yourtableid").innerhtml; window.localstorage["sharedtable"] = tablehtml; and in test have: var tablehtml = window.localstorage["sharedtable"]; var table = document.createelement('table'); table.innerhtml = tablehtml; //now table in test2 window if did document.getelementbyid('yourtableid'); here kind of unique situation demo... have 2 jsfiddles represent 2 windows / pages. open first link first because represents test2 must run first in order access...

c# - Remove an item from ienumerable<string> -

i have method expect ienumerable<string> can see here : public static string fromdecimalascii(ienumerable<string> input) { return new string(input.select(s => (char)int.parse(s)).toarray()); } but every time last record of ienumerable empty got error in line because of : return new string(input.select(s => (char)int.parse(s)).toarray()); so have remove item ienumerable . the error: input string not in correct format ideas appreciated. best regards you need filter collection where : return new string(input.where(s => !string.isnullorempty(s)) .select(s => (char)int.parse(s)).toarray()); you can use extension method use tryparse : static class extensions { public delegate bool tryparsedelegate<tsource>(string s, out tsource source); public static ienumerable<tresult> whereparsed<tsource, tresult>( i...