Posts

Showing posts from June, 2014

iphone - Two options bar button item -

Image
maybe not smart question how make such close each other, 1 on - other off type of buttons? your question vague, if right you're looking segmented control can found under objects in interface builder.. can add uitoolbar uibarbuttonitem :) fiddle options , check documentation more info.. -v

linux - How can i echo the newline after everyline -

my host red hat enterprise linux server release 5.4 bash. when use command: netstat -tnpl | grep "tcp" | awk '{print $4}' ,than output following: 127.0.0.1:2208 0.0.0.0:871 0.0.0.0:9001 0.0.0.0:3306 0.0.0.0:111 127.0.0.1:631 127.0.0.1:25 127.0.0.1:6010 127.0.0.1:6011 127.0.0.1:2207 :::80 :::22 :::8601 ::1:6010 ::1:6011 :::443 but when use this: ip_port=`netstat -tnpl | grep "tcp" | awk '{print $4}'` && echo $ip_port ,it becomes following: 127.0.0.1:2208 0.0.0.0:871 0.0.0.0:9001 0.0.0.0:3306 0.0.0.0:111 127.0.0.1:631 127.0.0.1:25 127.0.0.1:6010 127.0.0.1:6011 127.0.0.1:2207 :::80 :::22 :::8601 ::1:6010 ::1:6011 :::443 it becomes online. how did happen , want original format. you need enclose variable in quotes when echoing: echo "$ip_port" also, don't need use both grep , awk because awk can grep . can simplify command to: netstat -tnpl | awk '/tcp/{print $4}'

javascript - ember.js - update template from whatever controller observes -

i getting started ember.js. want update controller's data based on server request made controller; i.e: mycontroller should update state when indexcontroller has changed property. think have right, i'm not sure how update template based on observed change. here's have 'til now: <script type="text/x-handlebars" data-template-name="application"> <div> {{outlet}} </div> </script> <script type="text/x-handlebars" data-template-name="index"> <form> <label for="go">data</label> <input type="text" id="go" /> <button type="button" {{action "finddata"}}>find data</button> </form> </script> <script type="text/x-handlebars" data-template-name="my"> <ul> {{#each entry in controller}} <li>{{entry}}</li> {{/each}} </ul> &l

c# - Pass a value between a Window and a page in WPF -

i developing software wpf , pass parameter(textbox) between window(mainwindow) page(it situated in frame) ...do have idea it? thansk friends... bb edited : have textbox in mainwindow value "db2012_2013" code of frame 1 : <frame horizontalcontentalignment="stretch" loadcompleted="frsample_loadcompleted" navigating="frsample_navigating" verticalcontentalignment="stretch" x:name="frsample" background="{x:null}" margin="0,0,0,0" source="{binding selecteditem.xamlfilepath, elementname=categorytreeview, fallbackvalue=welcome.xaml, isasync=true}"/> then when choose page open pass value of textbox in new page ... use value query .. you can use datacontext , wpf binding feature. you can set datacontext belong mainwindow. need pass data frame or ui component textbox? <textbox name="textbox" text="text"></textbox> <frame datacontext=&qu

amazon web services - efficient way to administer or manage an auto-scaling instances in aws -

as sysadmin, i'm looking efficient way or best practices on managing ec2 instances autoscaling. how manage automate following scenario: (our environment running autoscaling, elastic load balancing , cloudwatch) patching latest version of rpm packages of server security reasons? (yup update/upgrade) making configuration change of apache server change of httpd.conf , apply instances in auto-scaling group? how deploy latest codes app server less disruption in production? how use puppet or chef automate admin task? i appreciate if have share on how automate administration task aws check out amazon opsworks , new chef based devops tool amazon web services. it gives ability run custom chef recipes on instances in different layers (load balancer, app servers, db...), manage deployment of app various source repositories (git, subversion..). it supports auto-scaling based on load (like auto-scaling using), auto-scaling based on time, more complex achieve standard

performance - Running Powershell script via Runspace from C# is very slow -

when executing particular script powershell command window, execution takes 2 minutes. executing same script c# (windows service) using system.management.automation.runspaces takes 5 6 minutes! spawning new powershell.exe process service makes time drop 2 minutes again. i noticed cpu usage higher when using runspace. unsurprisingly, time spent in pipeline.invoke(), doesn't make debugging problem easier. the script use complex , whole bunch of stuff, it's not easy pin down issue. how can narrow down problem? is there obvious may missing?

environment variables - Nagios doesn't get exports from /etc/profile -

i've got nagios , oracle sqlplus client installed on server. sqlplus needs few environment variables run, added exports /etc/profile . login root sets variables right, login user nagios sets ok when run checks nagios web interface (these checks written in bash), end error error: empty result sqlplus. check plugin settings , oracle status. when run these checks terminal root or nagios user, ok, that's how found out problem in env variables. i glad suggestions. i found bug nagios, can check documentation this link . you find in file /etc/init.d/nagios code. # load environment variables nagios , plugins if test -f /etc/sysconfig/nagios; . /etc/sysconfig/nagios fi just create file nagios on /etc/sysconfig/ path fedora or rhel variables need. on case. [root@server sysconfig]# cat nagios export oracle_home=/usr/lib/oracle/11.2/client64 export tns_admin=$oracle_home/network/admin export path=$path:$oracle_home/bin export ld_library_path=$oracle_hom

Save form data on GET requests in Spring MVC -

i have huge spring form containing table user can add or delete rows of data. gridview. deleting have put anchors job through get requests . problem facing after user has added 1 or more rows of data table, still in editable (textarea) mode, if wants delete other row, text has painstakingly written on textareas dissappear, not bound form bean , not travel requests. know not of elegant solution tackle problem, except, ofcourse can submit form periodically through javascript. there better design solution out there? please share? for deleting have put anchors job through requests. a bad idea. bad idea, web crawler bot delete rows accidently. with post request have ensure name of client side added element congruent (i assume collection on backing bean) existing spring form.

if statement - In scala, check non nullity and apply method directly? -

with following definitions: class test { var activated: boolean = false } def maybetest(): test = { if(...) { val res = new test if(...) res.activated = true } else null } i having lot of if structures one: val myobject = maybetest() if(myobject != null && myobject.activated) { // not care object } i condensate little bit. there nice way define/write avoid nullpointerexception: if(maybetest() &&> (_.activated)) { ... } what best way of achieving in scala? you can wrap such code in option this: class test(num: int) { def somenum = num } val test: test = null option(test).map(t => t.somenum) in example if variable null none, otherwise work some(value) update if don't want use option, can define such function class test(num: int) { def give = num } def ifdefandtrue[t, k](obj: t)(iftrue: t => boolean)(then: => k) { if (obj != null && iftrue(obj)) } in case this: val test = new tes

iphone - Why does my UIScrollView not work? -

i have placed uiscrollview in viewcontroller in ib , gave view tag:1 . in viewdidload: , have code: uiscrollview *scrollview = (id)[self.view viewwithtag:1]; scrollview.backgroundcolor = [uicolor clearcolor]; scrollview.opaque = no; [scrollview setscrollenabled:yes]; [scrollview setcontentsize:cgsizemake(320, 800)]; i have slider , label in scrollview see if scrolls, doesn't scroll @ all. change backgroundcolor example yellowcolor , doesn't scroll. there method or action have add? please help! :) try uiscrollview *scrollview = (id)[self.view viewwithtag:1]; scrollview.frame=cgrectmake(0, 0, 320, 460); [self.view addsubview:scrollview]; scrollview.backgroundcolor = [uicolor clearcolor]; scrollview.opaque = no; [scrollview setscrollenabled:yes]; [scrollview setcontentsize:cgsizemake(320, 800)]; because when scroll view height cross current view height scrollable.

asp.net mvc 4 - Kendo ui - how to tie validation to mvc model attributes -

from reading posts in thread - , being unable post question there bizarre reason :( ask here in hope of getting solution am write in saying have validation below.. i add html5 attribute (data-required-msg/validationmessage) textbox , required attribute well.. i make span invalid msg , tie field "data-for" attribute. message "please enter name" should appear in span then. questions is way work this? is there no way me display proper error message ("error message want show"), in way tie mvc attributes on viewmodel. poster said lot more scalable/re-usable , better design. using data-for="name" brittle change in model field name not reflect there , forgotten hence delivering buggy software. losing type safety of @html.validationmessagefor(m=> m.name) code public class aviewmodel { [required(errormessage="error message want show")] public string name { get; set; } } <div class="validatio

How to do spatial search using mongodb queries? -

i trying use spatial search in android app. new mongodb , spatial search. trying implement query in command prompt displays nothing db.places.find( { loc: { $geowithin : { $center : [ [x, y], 10 ] } } } ) inplace of x , y wrote longitude , latitude. want spatial search around particular longitude , latitude. should write in loc, x, y? please help!!!! thanks in advance. look @ this: http://docs.mongodb.org/manual/reference/operator/center/ check http://docs.mongodb.org/manual manual, helps lot.

extjs4 - override initComponent() method -

i want override initcomponent( ) method of ext.grid.column.column class. how executes lines. want remove listeners element , wants assign other element. ext.override(ext.grid.column.column, { initcomponent: function(){ . . //all lines till me.callparents(); . . . . . . . // initialize headercontainer me.callparent(arguments); me.on({ <<<------------------------------do not need these. element: 'el', click: me.onelclick, dblclick: me.oneldblclick, scope: me }); me.on({ <<<------------------------------do not need these. element: 'titleel', mouseenter: me.ontitlemouseover, mouseleave: me.ontitlemouseout, scope: me }); } } i not want attach listeners "el" , "titleel&

api - SoundCloud: I need a function to extract a var for artwork_url from any permalink_url to insert in a DB -

my permalink_url example " https://soundcloud.com/rac/sets/rac-chapter-one ". need function produce artwork_url variable permalink url. similar thiscode lifted soundcloud docs, expressed function: <script src="http://connect.soundcloud.com/sdk.js"></script> sc.initialize({ client_id: 'your_client_id' }); // permalink track var track_url = 'https://soundcloud.com/rac/sets/rac-chapter-one'; sc.get('/resolve', { url: track_url }, function(track) { sc.get('/tracks/' + track.id + '/comments', function(comments) { (var = 0; < comments.length; i++) { console.log('someone said: ' + comments[i].body); } }); }); </script> i barely capable player type of coding, , appreciate practical help. cheers! you have artwork_url property sound representation: <script src="http://connect.soundcloud.com/sdk.js"></script> sc.initialize({ client_id: 'yo

hashmap - Java - looping through LinkedhashMap and get the value -

i have following linkedhashmap in put values in following way: if (preauthorizeannotation != null) { requestmappingvalues = requestmappingannotation.value(); // url value requestmethod[] methods = requestmappingannotation.method(); // request method type system.out.println(+i + ":method : " + method2.getname() + " secured "); //system.out.println("requestion method type : "+methods[0].name()); class[] parametertypes = method2.getparametertypes(); (class class1: parametertypes) { userdefinedparams = new userdefinedparams(); strclassnametofix = class1.getname(); strclassname = strclassnametofix.replaceall("\\[l", "").replaceall("\\;", ""); if (class1.isarray()) { //classobj = strclassnames.substring(strclassnames.lastindexof('.')+1, strclassnames.length()-1); userdefinedparams.setdatatype(strclassname); userdef

java - Why the 20x ratio Thread sweet spot for IO? [formerly : Which ExecutionContext to use in playframework?] -

i know how create own executioncontext or import play framework global one. must admit far being expert on how multiple context/executionservices work in back. so question is, better performance/behaviour of service executioncontext should use? i tested 2 options: import play.api.libs.concurrent.execution.defaultcontext and implicit val executioncontext = executioncontext.fromexecutorservice(executors.newfixedthreadpool(runtime.getruntime().availableprocessors())) with both resulting in comparable performances. the action use implemented in playframework 2.1.x. sedispool own object future wrapping of normal sedis/jedis client pool. def testaction(application: string, platform: string) = action { async( sedispool.withasyncclient[result] { client => client.get(stringbuilder.newbuilder.append(application).append('-').append(platform).tostring) match { case some(x) => ok(x) case none => results.nocontent }

Access VBA - TreeView Control - AfterLabelEdit Event -

i've got treeview control in form. able edit node in tree , push change access db. however, i'm having trouble finding appropriate event. msdn treeview events reference page advices afterlabeledit , not able work. aware of workaround/solution? snippet of code use (i've added onclick , ondblclick comparison, work): private sub xmytreeview_click() 'ok testit end sub private sub xmytreeview_dblclick() 'ok editlabel end sub private sub xmytreeview_afterlabeledit() 'problem afterlabel end sub sub editlabel() me.xmytreeview.startlabeledit end sub sub afterlabel() msgbox prompt, vbokonly, "afterlabel" end sub sub testit() dim nodselected mscomctllib.node ' variable selected node set nodselected = me.xmytreeview.selecteditem ' selected node nodesstrlength = len(nodselected.key) dim nodestr string dim strtochange string strtochange = nodselected.key nodestr = mid(strtochange, 2, nodesstrlength - 1) me.txtnodeid = nodestr me

python - Many different sharded counters in single transaction -

i have increment 3 different counters in single transaction. beside have manipulate 3 other entities well. get too many entity groups in single transaction i've used recipie https://developers.google.com/appengine/articles/sharding_counters implement counters. increment counters inside model (class) methods depending on business logic. as workaround implemented deferred increment method uses tasks update counter. doesn't scale if number of counters increases further there limit of tasks in single transaction (i thinks it's 5) , guess it's not effective way. i found https://github.com/docsavage/sharded_counter/blob/master/counter.py seems ensure updating counter in case of db error through memcache. don't want increment counters if transaction fails. another idea remember counters have increment during web request , increment them in single deferred task. don't know how implement in clean , thread safe way without passing objects created in reques

java - Set object in application context in spring mvc -

i have utility class want initialize when application starts in spring mvc. implementing initializingbean . have create object same , save in application scope can access same instance everywhere. not able hold of this. here try: public class dashboardinitializer implements initializingbean, applicationcontextaware { private applicationcontext mapplication; @override public void afterpropertiesset() throws exception { initializeconfigurationutil(); configurationutil util = configurationutil.getinstance(); /* save util application scope */ } @override public void setapplicationcontext(applicationcontext papplication) throws beansexception { this.mapplication = papplication; } } is approach correct or there better way that? i think need simplify little bit. you want utility class initialized after application context loaded, want util class in application context? seems util class has dependency obj

sql server - Rollback SSIS Data Flow Tasks if one fails -

Image
in ssis package have several data flow tasks. is there way in ssis says if f0101z2 task completes f03012z1 fails rollback passed in f0101z2 step? any guidance appreciated. thanks set transactionoption=required on package level, , configure tasks transactionoption=supported (by default supported) . join transaction, , if fail, transaction rolled back. note: first make sure msdtc(ms distributed transaction co-coordinator) enabled in control panel--->admin tool-->services.

AngularJS & Rails - Seperated apps/deployments or one app? -

most of resources/example rails , angular on internet put them together. angularjs goes inside of rails under app/assets. feels reeeaaaly dirty me. idea? if decide @ time won't using rails , move to, don't know, sinatra? how hard port? what pros/cons of everthing in single rails app , pros/cons 2 seperated apps? thank you! even when placing angular (or other client-side mv* framework) inside rails app, pretty keeping separation of concerns intact. is, have rails api serving json (or similar) data, , separate javascript framework using data render appropriate views. if ever wanted use different server-side api, can so, , still utilize entire javascript directory is. placing client side framework in rails matter of convenience. comes organized directory structure , ability serve html, you're using when comes views. again, these views aren't tied rails, they're html , javascript, can move them different platform when necessary.

c - Link Lists, invalid application of path to size incomplete type -

im getting invalid application of path size error when compiling code cant find problem myself, can help? /********************************************************* * node represent packet includes link reference* * link list of nodes pointer packet struct * **********************************************************/ struct node { unsigned int source; unsigned int destination; unsigned int type; int port; char *data; struct packet *next; // link next packet //unassigned int source //unassigned int destination //int type //unassigned int port //char *data //struct node *next link next node }; typedef struct packet node; // removes need refer struct /********************************************************* * stubs declared functions below * **********************************************************/ void outpacket(node **head); void push(node **head, node **apacket); node* pop(node **head); int main() { /**************************************************

syntax - What could be case of use `int x = x;` expression (C language)? -

i have lib written in c. in code found few lines int x = x; . need rewrite pieces of code compilation /zw flag. in places mean's int x = some_struct->x; , in cases don't understand it. in places first use of x variable. in cases used such int x = x; expression. void oc_enc_tokenize_dc_frag_list(oc_enc_ctx *_enc,int _pli, const ptrdiff_t *_coded_fragis,ptrdiff_t _ncoded_fragis, int _prev_ndct_tokens1,int _prev_eob_run1){ const ogg_int16_t *frag_dc; ptrdiff_t fragii; unsigned char *dct_tokens0; unsigned char *dct_tokens1; ogg_uint16_t *extra_bits0; ogg_uint16_t *extra_bits1; ptrdiff_t ti0; ptrdiff_t ti1r; ptrdiff_t ti1w; int eob_run0; int eob_run1; int neobs1; int token; int eb; int token1=token1; int eb1=eb1; /*return if there no coded fr

php - Selecting table column names then display them -

i want select column names in specific table. display them. i searched , results one. select `column_name` `information_schema`.`columns` `table_schema`='yourdatabasename' , `table_name`='yourtablename'; if query one, how fetch them , display them ? when fetch data of table display them accourding column name. like: $table = mysql_query("select * table_name"); while($fetch = mysql_fetch_assoc($table)) { echo $fetch['id'] . ":" . $fetch['fullname'] . '<br>'; } $rows = mysql_query("show columns table_name"); while($row = mysql_fetch_assoc($rows)) { echo $row['field']; }

apache - Recursively try all urls alphabetically and download files -

is there way recursively , alphabetically test possible urls inside folder , recursively download files local machine? i aware of curl , wget, i'm not sure if work this. say... http://www.domain.com/something/ from there download recursively files located in subfolders aaa, aab, aba, baa, abb, bab, bbb, ccc... possible amounts of letters / numbers , custom limits script user.

c# - System.InvalidOperationException: Internal Connection Fatal Error. when opening sql connection -

i've started playing around sql on c#, , i'm trying connect remote sql server. i've added ip list of hosts have remote access permission. my code keeps producing error: system.invalidoperationexception: internal connection fatal error. @ system.data.sqlclient.tdsparserstateobject.trypocessheader<> @ system.data.sqlclient.tdsparserstateobject.trypreparebuffer<> @ system.data.sqlclient.tdsparserstateobject.tryreadbytearray<.byte[] buff, int32 offset, int32 len, int32& totalread> the trace longer that, first few lines. this code that's causing error (my actual connection string has correct username, password, , database name): connectionstring = "data source=173.254.28.27,3306;network library=dbmssocn;initial catalog=mydatabase;user id=myusername;password=mypassword;"; using (sqlconnection myconnection = new sqlconnection(connectionstring)) { try { myconnection.open(); } catch (exception e) { console.write

java - How to json with circular references? -

i have following class construct creating circular dependency. in general, jackson library should able handle these circular dependencies. i'm looking way not having use annotations on every class has circularities, somehow configure in objectmapper . @jsonidentityinfo(generator = objectidgenerators.intsequencegenerator.class, property = "@id") abstract class shape; class line extends shape { //a line can connect 2 circles circle from, to; } class circle extends shape { // circle can have many lines connected list<line> lines; } i serialize list, contains both circles , lines : list<shape> shapes; objectmapper om = new objectmapper().setdefaulttyping(); it possible configure id generation globally on mapper? no. since not types can have ids (only pojo types, is, collection s, map s , arrays out), , since details may vary, there no "default id" setting unlike type ids.

r - How to map numbers to colours? -

Image
i trying view file(unsigned character, pixel =1440 , lines=720) map. tried piece of code given bellow. first, downloaded may problem code using continuous colour scheme, though have discrete data (which classification scheme). how can map numbers colours ? please example of wanted scale shown below: conne <- file("c:\\landcover.bin", "rb") dfr<- readbin(conne, integer(), size=1, n=720*1440, signed=f) y<-matrix((data=dfr), ncol=1440, nrow=720) image(y) the raster package provides method use categorical data. read page of ratify details. first let's create rasterlayer data: library(raster) dfr <- readbin('biome1440s.bin', integer(), size=1, n=720*1440, signed=f) r <- raster(nrow=720, ncol=1440) r[] <- dfr now define rasterlayer factor ratify . should change levels using information instead of letters : r <- ratify(r) rat <- levels(r)[[1]] rat$soil <- letters[1:15] levels(r) <- rat and final

customising scroll bars in html/CSS -

i have created page custom scroll bars. when applied code, scroll bars in body , of browser window reacted code. yet wanted customize scroll bars body not of window. how can change this? many thanks. here webkit code. ::-webkit-scrollbar .right { width: 7px; } /* track */ ::-webkit-scrollbar-track .right{ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); -webkit-border-radius: 10px; border-radius: 10px; } /* handle */ ::-webkit-scrollbar-thumb .right{ -webkit-border-radius: 10px; border-radius: 10px; /*background: rgba(255,0,0,0.8); */ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); } ::-webkit-scrollbar-thumb:hover { background-color:#028eff; } demo : http://jsfiddle.net/2cpsw/2/ (webkit only) you can use more restrictive selector: /* testing */ div.custom-scroll { overflow: auto; height: 200px; } /* modified selectors ques

iphone - My Application Crashing when using url connnections -

i working on sever based project in if push 3 view controllers 1 one .. each view requesting urls , getting data sever in scenario working fine when pop (or) coming previous view click in button continuously app crashing because data server not received , again requesting url - (void)connectiondidfinishloading:(nsurlconnection *)connection { [uiapplication sharedapplication].networkactivityindicatorvisible = no; [self hideloader]; if (_delegate != nil) { nsmutabledata *data = [[nsmutabledata alloc]initwithdata:responsedata]; [_delegate finishedreceivingdata:data withrequestmessage:requestmessage]; [data release]; } -- getting error here.. and want crash report application there frameworks? in dealloc method of controller/view (depends delegate) need nil delegate property. - (void)dealloc { _urlconnection.delegate = nil; [super dealloc]; } don't count on nil condition. can deallocated, not nil.

versioning - How to find the Change Request with my modifications? -

i've copied 2 function modules ( qm06_send_paper_step2 , qm06_fm_task_claim_send_paper ) analogous z* function modules. i've put these fuba's inside zqm06 function group (which created developer). i want use transaction scc1 move developments 1 client another. in transaction se01 transport oganizer, don't find names of 2 function modules anywhere. how can find out change request work? [edit]: coppied fm in order modify functionality (i know fms client independent). function modules, other abap workbench entities, client-independent. is, not need copy them between clients on same instance. however, can find transport request contains changes going transaction se37, entering name of function module, , choosing utilities -> versions -> version management menu. provided did not put changes local package (like $tmp ) system have asked transport request when saved or activated changes, is, unless function group in modifiable transport req

How to write HTML, CSS and Javascript all together in Joomla 2.5 article? -

i trying write html, css , javascript in joomla 2.5 article failed desired output, there way work 3 in joomla 2.5 article? please me out issue. new joomla. there extension called sourcerer allow adding code articles. once installed, enable plugin, open articles , can start adding code article. below example: {source} <span style="color:red">this text should red!</span> <script type="text/javascript"> alert("this javascript"); </script> <?php echo 'this php'; ?> {/source} hope helps

javascript - Handling Multiple Ajax Request -

how handle multiple ajax request i using more 1 like button in single php page , when clicked calls same ajax code update corresponding like unlike text.. the below code works fine button when click of them n waits till ajax update it.. when click more 1 @ same time , waits updation, in such condition last clicked text changes unlike.. please provide better solution or code it thanx page : like.php <span id="like1" onclick="ajaxfun(1)">like</span><br /> <span id="like2" onclick="ajaxfun(2)">like</span><br /> <span id="like3" onclick="ajaxfun(3)">like</span><br /> <span id="like4" onclick="ajaxfun(4)">like</span><br /> <span id="like5" onclick="ajaxfun(5)">like</span><br /> .... <span id="like10" onclick="ajaxfun(10)">like</span><br />

In ASP.Net (C#), HTML Table does not have 'COLUMN' attribute, what to do? -

basically doing html table csv export in c#, needed count of rows & columns i count of rows table1.rows.count, cannot count of columns table1.columns.count. any ideas how number of columns ? stringbuilder sb = new stringbuilder(); (int = 0; < table1.rows.count; i++) { (int k = 0; k < **table1.column.count**; k++) { //adding separator sb.append(table1.rows[i].cells[k].text + ','); } //appending new line sb.append("\r\n"); } tables.rows[i].cells.count give total number of cells in row. columns, may change cell(column) spanning different.

Selenium IDE - local (non-webhosted) file access for testing? -

my problem when selenium ide used run test, "base url" accessed via http on web server. i need know if (and how) possible selenium ide run test on locally stored file. when opening file in firefox, path looks in address bar: file:///c:/documents , settings/username/my documents/somehtml.html however, selenium gives nasty error when put path in selenium ide's base url field test (see bottom of post). what tried i run windows xp , have tried switching file path slashes backslashes while keeping protocol (file:///) slashes is. tried replacing spaces %20 too. i considered whether firefox proxy settings might causing issue, isn't because if open file in firefox without issue. the solution i'm working on avoid selenium webdriver @ phase. know better on technical there practical reasons why can't use @ point. selenium ide must used now. error error thrown when attempting open local file: [error] unexpected exception: name -> ns_error_fai

ZK Component with independent columns -

i new zk framework[newbie] version 5.0.8 m.v.c approach trying implement component columns independent each other.... wanna able represent data on 2 columns , able respond click on each column something like ----------------------------------- company----company oracle ibm microsoft xerox hp apple ----------------------------------- if click ibm want not click oracle.....[in same component mean dont want create 2 grid or 2 listbox or else] is possible? lot. it's not clear need in terms of independence here. looking separation in terms of data model or want different event listeners each rendered cell? regarding event listeners, it's easy attach listeners you'd like. in zk, htmlbasedcomponent 1 of common root components , support onclick , ondoubleclick , onrightclick , , more. as these zk components being created dynamically, can't wire event listeners @listen annotation. problem don't have id cells in advance. in

php - Convert an array of 2-element arrays to an array making 2 elements as key => value -

is possible convert following array using php built-in functions array contain value of id key , value of label associated value? if not what's efficient way? thanks. input array: array ( [0] => array ( [id] => 2 [label] => mtd-589 ) [1] => array ( [id] => 3 [label] => mtd-789 ) ) output array: array ( [2] => mtd-589, [3] => mtd-789, ) introducing array_column (still in php 5.5 beta). $new_array = array_column($your_array 'label', 'id'); output : array ( [2] => mtd-589, [3] => mtd-789, ) using array_walk . array_walk($array, function($a) use (&$return) { $return[$a['id']] = $a['label']; }); print_r($return);

dto - WCF and Data Transfer Object -

i stuck on simple question. in console application, want consume wcf service. add web reference project , call it. it. but why saw examples using restsharp, never add web reference. use called "dto" return object service , consume it. i hope can clarify concepts me. dto used inside wcf? sample: private static list<applicationdto> features; restclient client = new restclient("http://" + baseurl + "/facilitydata.svc"); var request = new restrequest(method.get); request.resource = "/getfeatures"; request.parameters.clear(); request.addparameter("id", 888); var response = client.execute(request); features = jsonconvert.deserializeobject<list<applicationdto>>(response.content); from this post: for rest service, provides generic way wcf service consuming doesn't rely on soap. that's why no longer need "add servicereference..." consuming it. rest service operations can acces

c# - Asp:Menu not working as expected in IE 6 . but working Fine in IE 7 and above -

below in menu control code in aspx page <table width="100%" cellpadding="0" cellspacing="0" style="background-color: black; height: 30px; "> <tr style="background-color: black; height: 30px;"> <td style="background-color: black; width: 100%; height: 30px;"> <div style="height:30px"> <asp:menu id="navigationmenu" runat="server" enableviewstate="false" renderingmode="default" cssclass="menu" forecolor="white" includestyleblock="false" orientation="horizontal" height="30px" onmenuitemclick="navigationmenu_menuitemclick" > <staticmenuitemstyle cssclass="menuitem" /> <dynamicmenuitemstyle cssclass="menuitem" /> <items>

ios - take cliped area into a image -

i have cgbitmapcontext image drawn in , path want copy image of size clippingpath.boundingbox (of course normalized 0,0,width,height). now, how do this? from understand clipping paths work : have path, clip image, inside path gets kept, else discarded. i don't want that, want copy inside path , have context because want clip several different paths same context. i don't expect full clear code answer (although great), pointer right direction.

php - Check through an array and identify matching numbers -

i working on scratch card game user purchases scratch card me/my store , can redeem said card scratching off numbers , matching 3 pictures win prize like physical scratch cards want prizes pre configured know when prize won, users dont, can limit prizes, not true random, random in terms of wins prize.. i know how setup prizes need check each data value in array ensure there not 3 matching numbers, unless have won.. so far have (i neaten , shorten code down soon) $numbers = array( 0 => rand(0,9), 1 => rand(0,9), 2 => rand(0,9), 3 => rand(0,9), 4 => rand(0,9), 5 => rand(0,9), 6 => rand(0,9), 7 => rand(0,9), 8 => rand(0,9) ); which randomly generates 9 numbers , echo "<table>"; $i=0; for($x=0;$x<3;$x++){ echo "<tr>"; for($y=0;$y<3;$y++){ echo "<td>" . $numbers[$i] . "</td>"; $i++; } echo

Run a process before compiling in Visual Studio C++ -

more exacly want run flex.exe "file.l" before compile able compile lex.yy.c after. if there anyway this? mean automatically in way click run , all? you may use custom build steps check project properties->build events

debugging - Find Apache memory leaks in operational web-instance -

i'm running heavily used apache server, hosts webpage, downloads, svn (using dav svn) , trac instance (using mod_python). mod_deflate used save bandwith users. server has serious memory issue. after 24 hours takes 2 gb more memory after fresh start. i installed monitor of garbage collector state in trac system, indicates, python (and trac) not have memory leak. now i'm bit lost how proceed find issue. any , suggestions , how find cause of memory increase helpful. loglevel set debug, don't find helpful in log. the system uses apache 2.2.22 worker-mpm. currently apache restarted every 24 hours workaround. if set value maxrequestsperchild (e.g. 500), seems gets unresponsive (hanging connections?).

.htaccess - Removing index.php in Codeigniter 2 -

i'm having trouble using codeigniter2. want remove annoying "index.php" url that: - http://localhost/ci_intro/index.php/site/home becomes - http://localhost/ci_intro/home i've followed couple of links on stack overflow , have found following 2 posts: remove index.php url - codeigniter 2 and removing index.php codeigniter-2 however after performing both steps still no joy. my .htaccess follows: <ifmodule mod_rewrite.c> rewriteengine on rewritebase /ci_intro/ #removes access system folder users. #additionally allow create system.php controller, #previously not have been possible. #'system' can replaced if have renamed system folder. rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ /ci_intro/index.php?/$1 [l] #when application folder isn't in system folder #this snippet prevents user access application folder #submitted by: fabdrol #rename 'application' applications f

angularjs - What is the best practice to pass parameters from Controller to a directive? -

i'm new in angularjs in angular app, have directive , controller. need controller send options of kinds of configurations, including callback methods. my directive element implements 1 button post data webservice. desire controller send url "post" method , send callback method, have called after "post" in directive. how best way this? practice send callback methods this? i specify parameters in tags of element. instance: <my-directive my-service="someservice" my-callback="somecallback" /> inside directive use $parse function read/set these values: var getservice = $parse(attrs.myservice), setservice = getservice.assign, service = getservice(scope);

mongodb - $slice implemented in the php driver? -

my question if 1 can use '$slice' update() , $push in mongodb. i tried this: (with , without casting (object) $db->collection->update( array('_id' => new mongoid($id)), (object)array( '$push' => array('thumbs' => array( '$each' => $items, '$slice' => -5 )))); but thing happens mongo adding whole second array in update() collection. get thumbs: [ { "$each" : ... thanks in advance! you running mongodb pre 2.4. mongodb 2.4 introduced $slice , , previous $push operator did not support $each operator. when mongodb encounters unrecognised operators (i.e. in mongodb 2.2) $push believe keys want use , treat other data.

android - Admob Interstitial Time Showing -

i have big problem in game admob interstitials. ad shown when timer finished or when player exit round. @ finish of activity. when there isn't connection, it's ok. change of activity fast. when there god , fast connection same. problem when there worth connection , when player finish round, there long time (sometimes ad never shown) activity don't change, player can continue play tough time over. code: public void ondismissscreen(ad arg0) { // todo auto-generated method stub } public void onfailedtoreceivead(ad arg0, errorcode arg1) { intent data = new intent(); data.putextra("team", team); mydb.close(); data.putextra("a", a); data.putextra("b", b); // data.putextra("contadb", this.contdb); setresult(1, data); finish(); } public void onleaveapplication1(ad arg0) { // todo auto-generated method stub } public void onpresentscreen1(ad arg0) { // todo auto-generated method stub }

Add a fade effect to this image replacement jQuery snippet -

i'm using image replacement jquery snippet when hovers on thumbnail, "main" image changes; $('.circle img').hover(function () { $('#main-image').attr('src', $(this).attr('src')); }); is there way make "main" images fade 1 when hovers on .circle img instead of them switching? using fadein() or fadeout() effect can done

python - Global variable usage with web.py in Apache -

i have come across strange problem when configured web.py code apache. have 3 variable need use across 2 classes. used handle using global variables unfortunately doesn't work now. example: urls = ( '/', 'index', '/result','result' ) # index form takes inputs class index: def post(self): global var1, var2, var3 = web.input() var1 = i.word1.__str__() var2 = i.word2.__str__() var3 = i.word3.__str__() raise web.seeother('/result') class result: def get(self): print var1, var2 return r_result(var1, var2) def post(self): print var2, var3 this works fine when run code independently (i.e. python webappy.py) when used in apache settings gives: nameerror: global name 'var1' not defined @ print statement in res

python - Pcap file replay based on the packet timestamp using scapy -

i have 1 pcap file (~90m), , want replay file. came across scapy , provides way read pcap file , replay it. tried following 2 ways replay packets sendp(rdpcap(<filename>) and pkts = pcapreader(<filename>); pkt in pkts: sendp(pkt) first 1 game me memory error, memory consumption of python process went 3 gig , died. second option worked fine me because did not read whole file memory. have following 3 question is 90m pcap file big scapy replay? whenever use tcpdump/wireshark, every packet has timestamp associated it. assume packet 1 came @ time t , packet 2 came @ time t+10, scapy replay packets in similar manner, first packet @ time t , second @ t+10? or keep sending them in loop, think later case pcapreader. if answer no above question ( replay in loop, without considering packet inter arrival time), have other python library can job me? python not constraint me. to answer first question, sounds answered yourself! try running first option aga

excel - VBA looking for error values in a specific column -

sub macro9() dim lreturnvalue boolean lreturnvalue = iserror(sheets("lookup addition").range("a:a").value) if lreturnvalue = false = msgbox("there no errors", vbokonly) else = msgbox("there errors", vbokonly) end if end sub i little confused iserror(customfunction()) syntax should be. how tell check every cell in the range? counting errors in range doesn't require looping (which can slow if range large) or vba. just add worksheet function cell somewhere. if don't want user see cell, can hide row/column/sheet. =sumproduct(iserror(a:a)*(1=1)) if still want pop-up box user, vba be: sub counterr() msgbox "there " & activesheet.range("b1").value & " errors" end sub make sense?

asp.net insert the same value according to check box selection -

i have 2 drop down data, 1 date field , 1 field total added check box. if insert value drop down, 1 drop down 2 in date , if check box checked when click save same value should inserted every date in year example: if select date 1.04.2013 i have: drop down 1 company , drop down 2 depart, total 2000 , date 1.04.2013 for depart of company value 2000 should inserted every month in year if check box checked.