Posts

Showing posts from April, 2010

Scala: Issue w/ sorting -

sort of new scala.. have array: 1,2,3,4,5,6,7,8,9,10 and numbers 6 how achieve in scala? you can example this: val l = list(1,2,3,4,5,6,7,8,9,10) l.sortby(num => math.abs(num - 6)) take @ documentation of sortby method of list: http://www.scala-lang.org/api/2.10.3/index.html#scala.collection.immutable.list sortby takes argument function defines order. in our case ordering function takes single argument num , maps distance number 6. distance computed absolute value of 6 substracted given number.

How to execute a Postgresql procedure through Windows Task Scheduler -

how can execute procedure select my_proc() inside postgresql database using windows task scheduler? possible make script call procedure every 5 minutes? if it's possible need one. i can't use pgagent in environment, sorry guys! any tips? use task scheduler run psql on desired schedule, command like: psql -u username -d databasename -w -c 'select my_procedure()' and put password in .pgpass file, or set pgpass environment variable in task. you don't need kind of script unless want command specific error handling.

osx - Flash Builder 4.6 Project issues when transferring from PC to Mac -

i have project works fine on pc. use nativeprocesses means have build pc , mac on respective environments make native build. here details. background: use flash builder 4.6 on both environments. i'm using air sdk 3.5 had manually upgrade in both environments installing air sdk separately overlaying aidsdk contents in flash builder install environment. i've tested on mac , can generate test air applications using air 3.5. here's problem: when transferred project on gave me errors things <mx:button> i did research out found out need mx.swc. in mac appears not in build path automatically on pc. added it. errors go away have these other strange errors respect spark libraries. example have issues using <s:state> <s:spacer> in project. says "could not resolve". on pc working ok on mac giving me these problems. not sure how resolve this. appears including mx.swc solved 1 problem caused another. any ideas?

java - NIST time exception -

i trying following code log4j in applet. creation , cant trap error. opened fw rule not getting far. try { ac00_lfj.debug("nisttime: query==true: create ntpudpclient"); timeclient = new ntpudpclient(); }catch (exception ex) { ac00_lfj.debug("ntudpclient: creation exception = "+ex.tostring()); }

c# - Combobox displaymember issue, driving me crazy -

sorry bother, have problem c# winforms, since i've been searching same problem, found solutions they're not working me. ok, have bindinglist objects bindinglist<objects.usuario> usuarios = new bindinglist<objects.usuario>(); the objects have public strings , int variables, 1 string , 1 int variables need. public string datanombrecompleto; public int dataidusuario; so, once list "usuarios" has objects, this cbadministrativos.displaymember = "datanombre"; cbadministrativos.valuemember = "dataidusuario"; cbadministrativos.datasource = usuarios; and thing is, it's not working, combobox (cbadministrativos) still displays object. when go through debugger, after breakpoint, combobox sets display member, valuemember , datasource, code goes, but, in next instruction (the end of method), realized displaymember, magically, turns "" instead string "datanombre". any idea

actionscript 3 - How to display Movie Clip if shared Object is equal to a number AS3 -

hey i've been trying ti accomplish no success how display movie clip object named achiev_10 when nscore number equal 10. here have far in shared object data. in constructor have this: //initialize our shared object give path save local data sharedobject = sharedobject.getlocal("geometryblast"); if (sharedobject.data.highscore == null) { // checks if there save data trace("no saved data yet."); // if there isn't data on computer... sharedobject.data.highscore = nscore; // ...set savedscore 0 } else { trace("save data found."); // if did find data... loaddata(); // ...load data } then in savedata(); function have this: public function savedata():void { if (nscore > sharedobject.data.highscore ) { sharedobject.data.highscore = nscore; } menuend.bestsc

multithreading - TImer is not working properly in java -

here timer scheduler timer.schedule(new superone(),new date(),10); in superone class in run method calling synchronized method using above code task working once. my requirement has call synchronized method every minute(60 seconds). here timer scheduler not working expect ... because running synchronized method ? please me in this * edit: working first time (calling 1 time ) , not calling after 10 milliseconds * this code has run private boolean proxyenabled=false; public synchronized void statuschecker() { stopwatch swatch = new stopwatch(); resourcebundle resource = resourcebundle.getbundle("resources.application"); system.out.println(resource.getstring("url")); try { url url = new url("https://www.google.com/"); httpurlconnection urlconnection; if(proxyenabled) { proxy proxy = new proxy(proxy.type.http, new inetsocketaddress("proxyhost", portnumber)); swatch.start(

ios - Are my Core Data relationships correct? -

Image
i'm working on displays title of list on uitableview , , once user selects specific list pushes uitableview , displaying items in list including properties, such item name, price, ect. using core data save of data. i'm kinda new core data; have played around it, never used in way. have far, i'm not sure if it's right or if i'm going in right direction. have 2 entities 1 list , name of list. thats have far, relationships what's confusing me. if on , point me in right direction appreciated. i believe didn't understand how use entities , attributes: two entities 1 list , name of list you should have 1 entity hold lists, , 1 entity hold items list. don't understand attributes either. trying keep you've done possible, i'd rename wishlist item , listname list . relationship inside list should named items . makes sense, @ least me. don't need write itemname , itemprice , on, attributes inside entity called item - name

css - Font-Awesome with Sliding JQuery Code Error -

i creating jquery sliding navigation using font awesome (see: http://fortawesome.github.io/font-awesome/ ) now upon adding css since third party web fonts icons wonder how can apply own code using + , - icon. + -> <i class="fa fa-plus"></i> fa-plus - -> <i class="fa fa-minus"></i> fa-minus my jquery code is. $("#toggle > li > div").click(function(){ if(false == $(this).next().is(':visible')) { $('#toggle ul').slideup(); $("span.minus-btn").removeclass('minus-btn'); } $(this).next().slidetoggle(); }); $("#toggle > li > div").click(function() { $("#toggle > li > div").removeclass("active"); $(this).addclass('active'); if($(this).hasclass("active")){ $("span.plus-btn", this).toggleclass('minus-btn'); } }); now stock don't know h

Determine if file write out is true c -

is there way find out if file write occurred in c. i'm supposed return 0 if wrote file , -1 if nothing written. if you're using fwrite() , example, return code number of items written. similarly, fprintf() returns number of characters written. so can examine return code figure out if written, like: if (fprintf (fh, "val=%d\n", value) == 0) return -1; return 0; or: if (fwrite (buffer, sizeof(something), 7, fh) == 0) return -1; return 0; keep in mind you're asking nothing/something indication , means partial or complete success. if want know how much of requested written, hat's tiny bit more complex.

What do you need to have a Cocos2d-x full backup? -

i have developers creating app in cocos2d-x, , have asked them send me backup of code in case copy gets destroyed or no longer want work them. don't know should have in possession represents full backup. they sent me .ipa file, need give if start on new programming team?

javascript - Change the alert box height and width? -

change alert box height , width? its possible change alert box height , width? its possible change alert box height , width? no not possible in javascript can change alert box style although have add custom jqueries in 1 called popup not alert box checkout link how specify height , width of flex alert box in css?

c++ - How do I set up an if statement to animate a sprite? -

how can set if statement after every frame sprite shows next frame , next , once goes through frames over? i tried using if statements , has never worked me, give example? edit: after demand code have decided add sample. int frame4 = 1; if(frame4 = 1) { walkdownframe1(); //renders frame 4 } else if(frame4 = 2) { walkdownframe2(); //renders frame 2 } else if(frame4 = 3) { walkdownframe3(); //renders frame 3 } else if(frame4 = 4) { walkdownframe4(); //renders frame 4 } else if(frame4 = 5) { frame4 = 1; } frame4++; no matter modifications apply stays stuck on 1 frame. i'm assuming mean if conditions true animation occurs , if conditions false stops, in case like /*rest of model transformation code*/ if(shouldbeanimating){ /*animation code*/ }else{ /*default state or nothing if want model freeze @ point in animation*/ } then whenever program should stop animation set shouldbeanimating false

I can't get image from Google Map with help of Drawing Cache in Android Studio -

i have code in layout: <framelayout> <fragment ... android:name="com.google.android.gms.maps.supportmapfragment"> </fragment> </framelayout> but when try use drawing cache, screenshot have zoom bar (with + , - buttons) , text "google" in left corner. use next code getting image: view view = findviewbyid(r.id.frame); view.setwillnotcachedrawing(false); view.destroydrawingcache(); view.builddrawingcache(); view.setdrawingcacheenabled(true); routescreen = bitmap.createbitmap(view.getdrawingcache()); view.setdrawingcacheenabled(false); the reason because map drawn using opengl , pixel data stored in gpu. have @ google map's googlemap.snapshot() method in order capture screenshot of map.

ef code first - EF CodeFirst ,how to add custom model to create table? -

i work on asp.net mvc 5.1 , follow this post create own userprofile table table per type (tpt) method. but how want add model code first? for example, want add independent table country table , currency table, create following classes: country.cs namespace miapos.models { public class country { // primary key public int countryid { get; set; } [required] public string name { get; set; } } } currency.css namespace miapos.models { public class currency { // primary key public int currencyid { get; set; } [required] public string name { get; set; } } } datacontext.cs using system; using system.collections.generic; using system.data.entity; namespace miapos.models { public class datacontext : dbcontext { public dbset<country> countries { get; set; } public dbset<currency> currencies { get; set; } } }

Using RSA key with chilkat API in C -

i tried use rsa key .ssh directory using chilkat api in c failed. have such experience? here did far: #include <stdio.h> #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_ckssh.h" #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_ckftp2.h" #include "/home/germaneau/opt/chilkat/chilkat-9.5.0-x86-linux-gcc/include/c_cksshkey.h" void testftp2create(void) { hckftp2 ftp; bool success; ftp = ckftp2_create(); // string unlocks component 1st 30-days. success = ckftp2_unlockcomponent(ftp,"anything 30-day trial"); if (success != true) { printf("%s\n",ckftp2_lasterrortext(ftp)); } ckftp2_dispose(ftp); } void sshsample(void) { hckssh ssh; bool success; const char * hostname; long port; long channelnum; const char * cmdoutput; hckstring privkey; hcksshkey key; // important: helpful send

sql - How to choose proper table name dynamically from multiple tables for creating join query -

Image
i want create join query dynamically contains following tables: table 1) usertable : contains userid, userfirstname, userlastname table 2) grouptable : contains groupid, groupname, groupdescription table 3) usergroup : contains relation between usertable , grouptable table 4) grouproles : contains relations between groupid , roleid (any random column) case1: if want know in tables groupid present/common, gives result query: i have 1 form accepts userid. using userid have find: userid, userfirstname, userlastname , groupname. problem: the problem while creating dynamic query join clause. as in case 1 there 2 options of tables: either grouproles or usergroup. so how come know which table select these 2 options dynamically takes me grouptable via relational table usergroup table in case? in case have find userid, userfirstname, userlastname , groupname. i can userid, userfirstname , userlastname usertable. groupname column present in grouptable have take

r - Install lpSolve package -

i new r. can tell me how can add lpsolve package r on mac example folder add to, etc? i couldn't find in documentation. if new r i'd suggest rstudio, visual ide r. use teaching students basic statistics , programming in r, rstudio download inside rstudio menu tools -> install packages type package name click install now, after installs, goto package tab in slower right pane. check box next package , loaded. i'd suggest using "lpsolveapi" interface lpsolve.

java - Restrict tag insertion in XML -

my question related java. have xml valid per xsd, have used dom parser , got document object out of (i using jaxp). now, want disallow insertion of invalid xml element. so, when try doing appendchild() should exception if element invalid per schema. i have set schema @ factory level before getting dom. however, seems fine insertion of invalid elements. know document incorrect when using validation api check validity of document happening @ end. here xml <?xml version="1.0" encoding="utf-8"?> <company xmlns="uri:trial"> <business> <apac>tns:apac</apac> </business> <nonbusiness> <facilities>tns:facilities</facilities> </nonbusiness> </company> the xsd <?xml version="1.0" encoding="utf-8"?> <schema xmlns="http://www.w3.org/2001/xmlschema" targetnamespace="uri:trial" xmlns:tns="uri:trial" elementfor

string - Errors using pointers with Function in C -

first of apologize, simple question i'm not versed in coding. code, need use pointer syntax , define own function reverse string. i'm not allowed use strlen() in situation. i've tried playing around pointers, following errors: incompatible type when assigning type char[15] type char (i have write in pico, i'm not sure line number refers to. appears somewhere around point call strcmp() function assignment makes integer pointer without cast (this 1 appears when define s pointer in function or around there) any , help/troubleshooting ideas appreciated. i'm using gcc compiler, if matters #include<stdio.h> #include<string.h> char revcheck(char string[15]); int main(void) { char string[15]; printf("enter string: \n"); scanf(" %s", string); if (strcmp(string, "engr-awesome")) { printf("that's right!"); } else { string = revcheck(string); }

android - Combined Control :ImageButton and TextView,i want the ImageButton can response click event,not the TextView,however,i can not do it -

package com.example.test20140308; import android.content.context; public class mainbutton extends linearlayout { private drawable drawable; private drawable drawablebg; public imagebutton mimage; textview mtext; private int size; string text = ""; public mainbutton(context context) { super(context); } public mainbutton(context context, attributeset attrs) { super(context, attrs); typedarray localtypedarray = context.obtainstyledattributes(attrs, r.styleable.mybutton); if (localtypedarray.hasvalue(r.styleable.mybutton_mybuttonicon)) { this.drawable = localtypedarray .getdrawable(r.styleable.mybutton_mybuttonicon); } if (localtypedarray.hasvalue(r.styleable.mybutton_mybackground)) { this.drawablebg = localtypedarray .getdrawable(r.styleable.mybutton_mybackground); } if (localtypedarray.has

javascript - navigating to new page in jquery touch -

i trying navigate new div/page based off of javascript condition. add tag href "#thispage" using jquery touch , it's based off of dropdown menu, want window.location.href = "#thispage" doesn't work same "#home" still has class "current" . can remove class "#home" , add "#thispage" , messes further navigation jq touch . jq touch has goto function passes in topage , animation, , reverse there way access javascript? i'm stuck. function getpage() { var id = document.getelementsbyname('id')[0].value; if (id == 1) { //window.location.href="#thispage"; //$(goto('#thispage','slideleft')); } else { //window.location.href="#thatpage"; //$(goto('#thatpage','slideleft')); } }

c# - HTTP 503 Service is unavailable when trying to browse signalr/hubs -

i have windows hosted signalr hub created in vs2012: public class startup { public void configuration(iappbuilder app) { app.usecors(corsoptions.allowall); app.mapsignalr(); } } public static class signalr { public static void start() { const string url = "http://*:8080"; webapp.start<startup>(url); } } public class broadcaster : hub { public void senddownloadresult(bool result, string device, string description, string connectionid, string task) { var context = globalhost.connectionmanager.gethubcontext<broadcaster>(); context.clients.client(connectionid).senddownloadresult(result, device, description, task); } } i have deployed windows service on 3 different pcs, works fine on 2 pcs, on other, http 503 service unavailable when try browse http://localhost:8080/signalr/hubs no exception thrown when code executed on 3 pcs. i have checked i

Jquery json response value to a variable -

url http://www.freecurrencyconverterapi.com/api/convert/?q=usd-inr&compact=y json response { "usd-inr": { "val": 61.235 } } jquery function convert_currency(){ var currency = $('#convertor select').val(); jquery.ajax({ type : 'get', datatype: 'jsonp', data : { q : 'usd-' + currency, compact : 'y' }, url : 'http://www.freecurrencyconverterapi.com/api/convert/', success : function(data){ var value = data[0].val; $('#converted_amount').text(value); } }); } $(document).ready(function(){ convert_currency(); $('#convertor select').change(function(){ convert_currency(); }) }); but method not correct. var value = data[0].val; . please correct me... try use: var value = data["usd-inr"].val; since you've assigned currency v

tfs - How to pass build parameters and other information to powershell script in TFS2013 build? -

i using default build template tfs 2013, how can access build parameters (for example, changeset number under build, build directory, source paths, tfs address, agent information...) powershell script? example situation: want rewrite assembly info version informations on pre-build script last part of version number changeset number, can changeset tf.exe commands inside of script isn't thing want know build agent during build. i have tried run get-variable in script , write build haven't find special variables inside of script. is there have missed or default build template not pass variables powershell runtime during execution? figured out. variables automatically written environment variables, dir env: showed me tfs automatically create following variables: tf_build true tf_build_binariesdirectory c:\wp0\101\bin tf_build_builddefinitionname tfsbuildtest2 tf_build_builddirectory c:\wp0\101 tf_build_buildnumber

android - Navigation Drawer not occupying the entire screen height -

i have drawer layout drawer on left. drawer has button on click of want replace view of drawer new view. the problem , when new view gets replaced doesn’t occupy entire screen height. to illustrate have given background colour navigation drawer views. i want green view occupy entire screen height. copy-paste code below going: mainactivity.java public class mainactivity extends activity { layoutinflater inflater; drawerlayout drawer; relativelayout parentrl; relativelayout viewtoberemovedrl; view viewtobeadded; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.layout.main_activity); inflater = (layoutinflater) .getsystemservice(context.layout_inflater_service); drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); parentrl = (relativelayout) findviewbyid(r.id.parentrl); viewtoberemovedrl = (relativelayout) findviewbyid(

javascript - Listen for keyup on all input fields -

im trying capture keyup on input fields on page. my current code is: var els = document.queryselectorall('input'); (var = 0; < els.length; += 1) { addevent('keyup', els[i], makehandler(els[i])); } function makehandler(field) { console.log(field.value); } function addevent(evnt, elem, func) { if (elem.addeventlistener) { elem.addeventlistener(evnt,func,false); } else if (elem.attachevent) { elem.attachevent("on"+evnt, function(e) { e = e || window.event; if (!e.preventdefault) { e.preventdefault = preventdefaultonie; } func.call(this, e); }); } else { // no elem[evnt] = func; } } but reason capturing value on page load, not once begin type in of fields. any ideas i'm doing wrong? the problem makehandler function. makehandler(els[i]) being evaluated , return value ( undefined , in case) being

mysql - Maintaining the history of values in table/ track the changes of table by date -

following table structure: project_id module_id pass fail retest not_executed total test_1 test_1_mod_1 10 5 2 2 19 test_1 test_1_mod_2 20 5 5 0 30 test_1 test_1_mod_3 30 5 2 0 37 test_1 test_1_mod_4 40 5 7 2 54 test_1 test_1_mod_5 50 5 2 0 57 and every day update numbers in pass, fail, retest, net executed , total column of table. doing using webpage (as front end both viewing , updating table). now problem arises when want see status of 2 days before. more clear, data of mar-09 like: project_id module_id pass fail retest not_executed total test_1 test_1_mod_1 10 5 2 2 19 test_1 test_1_mod_2 20 5 5 0 30 test_1 test_1_mod_3 30 5 2 0 37 test_1 test_1_mod_4 40 5 7 2 54 test_1

Rails 4, cocoon gem destroying created objects -

i have big problem in applications. it's little complicated try explain deeply. in application have model "car": class car < activerecord::base has_many :prices, dependent: :destroy accepts_nested_attributes_for :prices, allow_destroy: true end and "price": class price < activerecord::base belongs_to :car end im using wicked gem have wizard form. im use cocoon gem create nested objects. "payment step html": = simple_form_for [:partners, @car], url: wizard_path |f| = f.simple_fields_for :prices |price| = render 'price_fields', f: price #links = link_to_add_association 'add price', f, :prices = link_to t('cars.back'), edit_partners_car_path(@car) = f.submit t('cars.next'), class: 'btn btn-primary' and price_fields: .nested-fields %table.table.table-striped.table-bordered %thead %th = f.input :from_days %th = f.input :to_days

javascript - Angularjs directive with isolated scope needs clarification -

edit: there functional example in plunker: http://plnkr.co/edit/gfqgp0q3o9rjlalranps?p=preview outer scope has $scope.name = 'donald' all directives declared as: <directive-name binding="name"> this multi-part question. im trying gain better understanding of isolated scopes has watch or binding outer scope variable. with non-isolated scope directive works should: // [works] .directive('noscopewithwatch', function(){ return { restrict: 'e', link: function(scope, lelement, attrs) { scope.$watch(attrs.binding, function(name){ lelement.text('hello ' + name); }); } }; }) // returns hello donald the confusing part when try isolate scope , keep binding. im asking clarification on why of following examples work, while , others not. if add scope isolation 'normal' binding fails: // 1. [fails] .directive('scopewithwatch', function(){ retu

android - Autocomplete-Adapter: java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification -

i'm out of ideas on here. have autocompletetextview adapter power suggestions. search words geographic regions. i have 2 kinds of autocomplete-suggestions: searched regions (search history, locally saved) , automplete api called on the network. sometimes when type in word fast receive following error: java.lang.illegalstateexception: content of adapter has changed listview did not receive notification. make sure content of adapter not modified background thread, ui thread. i understand exception in general (the underlying data of adapter should not changed without calling notifydatasetchanged() on adapter) don't see i'm doing wrong here. as far understand getfilter() method running on ui thread , automplete() method running asynchronously. here's adapter , can see the autocompregions changed in getfilter() method (ui thread) , notifydatasetchanged() called after. also, had same problem when using regions retrieved via api , didn't have addi

I want to fill city dropdown automatically from database according to state dropdown in ASP.NET MVC and Ajax -

i want city list database , store selected city's id database. have used ajax call function of member class. not working, please me sort out. here model: [required] [display(name = "state")] public int stateid { get; set; } public string statename { get; set; } public list<selectlistitem> statelist = new list<selectlistitem>(); [required] [display(name = "city")] public int cityid { get; set; } public string cityname { get; set; } public list<selectlistitem> citylist = new list<selectlistitem>(); clubdatacontext cd = new clubdatacontext(); public void insertmember(m_reg m) { m_registarion m1 = new m_registarion(); m1.m_statteid = m.stateid; m1.m_cityid = 1; //temporary storing 1 cd.m_registarions.insertonsubmit(m1); cd.submitchanges(); } here controller: [httpget] public actionresult registration() { var model

c - Writing data to stderr makes the program to exit after the program becomes a daemon -

please @ code. runs in centos6 64bit. #include<stdio.h> int main(int argc, char **argv) { fprintf(stderr, "output 1\n"); printf("output 2\n"); fflush(stdout); system("echo abc"); fprintf(stderr, "output 3\n "); printf("output 4\n"); fflush(stdout); daemon(0, 1); fprintf(stderr, "output 5\n"); printf("output 6\n"); fflush(stdout); system("echo abc"); fprintf(stderr, "output 7\n"); printf("output 8\n"); fflush(stdout); } if run it, see these messages: output 1 output 2 abc output 3 output 4 output 5 output 6 abc output 7 output 8 if use ssh login , run it, see same results. however, if use binary name parameter of ssh , run it, program exit when writing data stderr after calling daemon(0, 1). suppose binary name myapp. run ssh loc

javascript - JSHint not handling defineProperty syntax? -

i have piece of code in constructor function: object.defineproperty(this, "color", { : function() { return color; }, set : function(newval) { color = newval; this.path.attr("stroke", color); } }); jshint warning 'color' not defined. supposed define 'color' somehow before configuring defineproperty? (i have tried using 'this.color' inside defineproperty, causes infinite loops) thanks color indeed undefined. need store information elsewhere. you via closure: var color; object.defineproperty(this, "color", { : function() { return color; }, set : function(newval) { color = newval; this.path.attr("stroke", color); } }); or another, non-enumerable (so doesn't show on for in ) , non-configurable (to avoid overrides) property: object.defineproperty(this, "_color", { con

rest - AngularJS POST 404 -

i using angularjs connect service, deployed on same server. have followed every suggestion listed in posts related similar error, cors, has not solved problem. though, service called asynchronously, response received before server gets chance handle it. missing? here service services.factory('testservice', function($http) { var myservice = { createtag: function(tag) { return $http.post('/temptag', tag); } }; return myservice; }); any controller looks this: app.controller('tagctrl', function ($scope, testservice,$location) { $scope.tag={}; $scope.createtag = function () { testservice.createtag($scope.tag).then (function(data){ console.log('data success: = ' + data); }, function(data){ console.log('data = failure ' + data); }); }; }); the control goes "data success:" data undefined

javascript - ajax 302 Moved Temporarily when call odesk rss feed -

when fetching data odesk feed 302 moved temporarily error, when open same url in browser, content there: doing wrong? var url = "https://www.odesk.com/jobs/rss?nbs=1&g=&q="; var x = new xmlhttprequest(); x.onreadystatechange = function() { alert(x.status); if (x.readystate == 4 && x.status == 200) { doc = x.responsexml; } }; x.open("get", url, true); x.send(); it fault trying in localhost.. worked fine in phone.

regex - Why these commands fail if I concatenate them (with "|")? -

to turn this: · 阿富汗 country1 · 阿爾及利亞 country2 · 孟加拉 country3 * · 不丹 country4 (請參閱下列*說明處) into this: country1,country2,country3,country4 i following: %s/[^\x00-\x7f]//g remove chinese characters. %s/\s\+$//g remove trailing white spaces %s/\s\+//g remove remaining whites paces g/^$/d remove empty lines %s/\n/,/g connected each line single 1 (each word separated comma). now want in 1 command. concatenated commands: %s/[^\x00-\x7f]//g|%s/\s\+$//g|%s/\s\+//g|g/^$/d|%s/\n/,/g which produces this: country1,country2,,country3,,country4, i find strange since commands work if use them separately. what happening here? not ex command can concatenated. commands, :global command, can take sequence of commands, , therefore eat remaining arguments, including | command separator. see :help :bar list of such commands. provides solution if want include such command in sequence: need enclose command :execute . applied problem, bec

javascript - Disable application layout for custom Facebook share button in Rails -

i've implemented custom buttons twitter , facebook sharing in rails app, , have had use javascript below open popups when clicked: $('.popup, #fbshare').click(function (event) { event.preventdefault(); window.open($(this).attr("href"), "popupwindow", "width=600,height=400,scrollbars=yes"); return false; }); the twitter button works fine facebook share button keeps attempting yield default application layout , giving error message of: activerecord::recordnotfound in userscontroller#show couldn't find user id=undefined" the javascript file named search.js.erb, , i'm trying share link home page, assume need add applicationcontroller, error message makes seem error userscontroller (which route root, i'm not on user page when attempting share). i've had around , found 2 solutions proffered: 1 add layout proc{|c| c.request.xhr? ? false : "application" } to applicationcontroller: doesn't seem wo

java - In selenium how to continue running a script even if it is failed -

i have form filling script during execution in line (step) if test case failed directly closing browser . ex: while filling form if couldn't find element (textbox or checkbox) throws exception nosuchelements , directly closes browser using assert (testng) in script want if test case failed anywhere middle want test case continue execution in report should show test case failed in code string jobvalue = driver.findelement(by.xpath("//label[@for='ctl00_contentplaceholder1_radpanelbar1_i0_chkcolumns_5']")).gettext(); assert.assertequals(jobvalue, "job value ($)"); reporter.log(jobvalue+" text verification ---- passed",true); assert fail test case if actual value not equals expected value want alternate assert or code continues executing test case till end , @ reports should show failed if actual value not equal expected value santhosh, need more info/code on trying.by assumption, here answer question. use validate() method

android - SignPost error using OAuth and get Error parsing data org.json.JSONException: End of input at character 0 of -

i accessing magento backend android app using consumer. , getting following response magento after authentication done manually. object(zend_http_response)#16 (5) { ["version":protected] => string(3) "1.1" ["code":protected] => int(200) ["message":protected] => string(2) "ok" ["headers":protected] => array(6) { ["date"] => string(29) "mon, 10 mar 2014 05:55:59 gmt" ["server"] => string(45) "apache/2.4.7 (win32) openssl/1.0.1e php/5.5.6" ["x-powered-by"] => string(9) "php/5.5.6" ["connection"] => string(5) "close" ["transfer-encoding"] => string(7) "chunked" ["content-type"] => string(31) "application/json; charset=utf-8" } ["body":protected] => string(27184) "6a23 {"16": {"entity_id":"16","attribute_set_id"

java - Change the icon of Jtree Root Node -

below code have created jtree root node "data generation.. rootnode = new defaultmutabletreenode("data generation"); treemodel =new defaulttreemodel(rootnode); tree = new jtree(treemodel); tree.seteditable(true); i have changed icon images leaf node childnode=new defaultmutabletreenode(existingtagnames.get(len).tostring()); defaulttreecellrenderer renderer = (defaulttreecellrenderer) tree.getcellrenderer(); imageicon imageicon = new imageicon(generate_explorer.class.getresource("/org/qmon/generate/images/leaf node.png")); renderer.setleaficon(imageicon); tree.setcellrenderer(renderer); i dont know how root node.. searched in internet unable find it. thanks in advance. if use these 2 methods on renderer, should set icon on non-leaf nodes. setclosedicon(icon newicon) setopenicon(icon icon)

image - Is it possible to take a screenshot of your screen from within LiveCode? -

i looking have ability of importing capture of screen livecode application. i use following key combination on mac: cmd + shift + 4 then imported image control or referenced image within image control. set filename of image 1 "/path/to/image.png" is there way directly script, bypassing need these additional steps? on mouseup import snapshot end mouseup note can more specific import command, example specifying whole screen, or 1 part or object of stack. make sure check out possibilities of import snapshot command in dictionary. on mouseup import snapshot line 1 of screenrects import snapshot me end mouseup

c# - what happen to sliding expiration after it accessed -

according msdn , cache set sliding expiration gets expired if hasn't been accessed within specified time interval. my question cache entry removed after time interval has elapsed or removed when next code statement tries access , .net realizes has expired ? found below caching the link azure there 3 types of expiration type: none, absolute, , sliding window. these configure how time live (min) used determine expiration. default expiration type absolute, means countdown timer item's expiration begins when item placed cache. once specified amount of time has elapsed item, item expires. if sliding window specified, expiration countdown item reset each time item accessed in cache, , item not expire until specified amount of time has elapsed since last access. if none specified, time live (min) must set 0, , items not expire, , remain valid long in cache. so, expiration countdown reset if item accessed within sliding window.

sonarqube - sonar-runner fails every time -

while running sonar-runner (with debug flags, , stack trace) i'm getting error. my sonar server bound mysql runs on same machine. running ok time, lately have started ending following error. 10:25:23.030 debug - 178223 measures dump 10:25:23.629 debug - updating semaphore batch-test:test1 10:25:33.739 debug - updating semaphore batch-test:test1 10:25:43.968 debug - updating semaphore batch-test:test1 10:25:49.551 info - store results in database 10:25:49.551 debug - execute org.sonar.batch.index.componentdatapersister 10:25:54.151 debug - updating semaphore batch-test:test1 10:26:02.159 debug - execute org.sonar.batch.issue.issuepersister 10:26:02.196 debug - ooo using connection [jdbc:mysql://localhost:3306/sonar?useunicode=true&amp;characterencoding=utf8, username=sonar@localhost, mysql connector java] 10:26:02.196 debug - ==> preparing: select * projects p p.kee=? 10:26:02.196 debug - ==> parameters: test:test1:com.test.framework.gba.gbainfoprovide

katzer cordova-plugin-email-composer collapse bottom navbar jQuery Mobile 1.4 cordova 3.x.x -

using: cordova 3.x.x katzer cordova-plugin-email-composer jquerymobile 1.4 iphone 5 ios 7 real device plugin works fine after sending email, when app, bottom navbar disappears, leaving 15px gray horizontal bar. bar grows 15px circa every time send email. any ideas how show bottom navbar again after sending email?

java - what does the method Mojo.getLog() do? -

i wonder why said how getlog() in maven works? nice if can describe main task of method in few sentences. it has been mentioned in apache common logging api doc refer link http://commons.apache.org/proper/commons-logging/apidocs/org/apache/commons/logging/logfactory.html#getlog(java.lang.class)

Change environment variable name in Android Eclipse -

Image
we have master computer based on windows os (windows 7) team members can access in shared manner. have android sdk bundle on machine long time. bundle using environment variable android_sdk_home set specific path in system properties. for specific reason, today downloaded latest sdk bundle. need set android_sdk_home different path. can't without disturbing other team members. so, there way change variable name android_sdk_home to, new_android_sdk_home in eclipse configurations , set new_android_sdk_home in system properties desired value new adk bundle? update : in source code , variable android_sdk_home accessed path value. source code, whereas sdk bundle apparently bunch of compiled and/or binary stuffs. so, provide clue. also, consider sdk home , sdk location 1 same thing, here links clear air it: 1) link 1 2) link 2 3) of course, the answer below provided @sanjeev. try 1 bro. open local.properties , setup android sdk path # file automatically

variables - Parse error: syntax error, unexpected T_VARIABLE in /home/a8479867/public_html/index.php on line 538 -

so i'll use php 3-4 week , i'll run intro error 1 if need more information ask's :d thanks! parse error: syntax error, unexpected t_variable here php code error on line '538' <?php $p=strtolower$_get['p']; if (isset($p) && preg_match("/^[a-z0-9]+$/i",$p){ if(file_exists)("pages/$p.html")){ include "pages/$p.html"; } else{ include "page/404.html" } } else { include "page/404.html"; } ?> <?php $p=strtolower($_get['p']); if(file_exists("page/".$p.".html")){ include "page/".$p.".html"; }else{ include "page/404.html"; } ?>

selenium - Unable to click on Sub menu link after mouse hover in Internet Explorer -

i have click on sub menu link, displayed after hovering mouse on main menu. below code work on firefox: actions builder = new actions(driver); webelement = driver.findelement(by.id("menumaincontracts")); builder.movetoelement(we).perform(); thread.sleep(2000); webelement sublink = driver.findelement(by.id("mnusubcontracts")); builder.movetoelement(sublink).click().build().perform(); but in internet explorer not click on sub menu link, instead tries click on main menu itself. it not show error message also. please rid of issue. there can 2 chances. 1.your application frontend design may restrict ie support. can odd or classy framework might used. 2.in case, if able perform same in manual, need have proper approach. try following, actions builder = new actions(driver); webelement = driver.findelement(by.id("menumaincontracts")); builder.movetoelement(we).build().perform(); // have missed build here ! thread.sleep(2000); webelement

javascript - Should I save in db - user input as html encode? -

Image
we're having conflict coworkers on whether should htmlencode user input , save db ( vs saving straight forward is) i find various answers says db should save plain(!) input. why ? because db should know user length 1 in < , not 4 in &lt; the html encoding should only made when outputting. but: having said , see stackoverflow not following rule. when save question here @ , contains plain < show (obviously) &lt; in preview pane. when submit question : submit content json with html encode ! json.stringify not doing html encode so if type in input : and submits : i see (via fiddler) sends html encode value : question : as see - i'm bit confused. common logic says db should save whatever user type 1:1. the syntizations should made @ output you must encode input sent server, because otherwise anti cross site scripting protection on server block entire request. however, decode input before saving db. in other, s

css - Alternative of box-shadow -

i want give box-shadow in email property not supported gmail , yahoo there in alternative trick give box-shadow in mail? if yes please inform me possible the possibilities are: a single image box-shadow box-shadow-like images on edges of element simulate box-shadow that's guess.

r - Remove time from XTS -

i trying compare different timeseries, day. currently typical xts object looks like: > vwap.crs quantity quantity.1 2014-03-03 13:00:00 3423.500 200000 2014-03-04 17:00:00 3459.941 4010106 2014-03-05 16:00:00 3510.794 1971234 2014-03-06 17:00:00 3510.582 185822 now, can strip time out of index follows: > round(index(vwap.crs),"day") [1] "2014-03-04" "2014-03-05" "2014-03-06" "2014-03-07" my question is, how replace existing index in variable vwap.crs , rounded output above? edit: to.daily fixed it this should it indexclass(vwap.crs) <- "date" also, take @ code in xts:::.drop.time you way you're trying if use index<- index(vwap.crs) <- round(index(vwap.crs),"day")