Posts

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> ...

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=...

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...