Posts

scala - How to alias a sequence of tasks? -

i have custom tasks in sbt (0.12.2) project. let's call them a , b , c . when i'm in interactive mode of sbt can type a , task associated a executed. can type ;a;b;c , 3 tasks executed in sequence; same way ;clean;compile do. can interactive shell create alias run them all: alias all=;a;b;c . when type all tasks executed in obvious manner. i'm trying achieve creating alias inside of sbt configuration project. this section of sbt documentation deals tasks, achieve this: lazy val = taskkey[unit]("a", "does a") lazy val b = taskkey[unit]("b", "does b") lazy val c = taskkey[unit]("c", "does c") lazy val = taskkey[unit]("all", ";a;b;c") lazy val tasksettings = seq( <<= seq(a,b,c).dependon ) the problem have approach tasks combined , execution happens in parallel in contrast sequential, i'm trying achieve. how can create alias alias all=;a;b;c inside of sbt configurat...

.net - DevExpress TextEdit - Mask for Negative Values -

actually, have devexpress textedit , displaying amount in textedit. have set mask properties of textedit : - masktype -> numeric - editmask -> n2 - usemaskasdisplayformat -> true now, getting output : - postive values -> 800.00 - negative values -> 800.00- but,i want output negative values -800.00 can me? you set: righttoleft = true - right? please set righttoleft = false & properties.appearence.textoption = far => when in put negative value => -800.00

c# - Deploy REST service without access to IIS -

i have developed .net rest web service in c#. while have plenty of c# experience, unfortunately not have understanding in deploying such service in web hosting environment. due environment, not have access iis. the advice have been provided support services of hosting provider follows: create subdomain of main domain achieve dedicated application pool (this requirement of host provider) create bin folder hold compiled libraries of source code add following web.config file: <system.web> <httphandlers> <add type="reportrestwebservice.service, reportrestwebservice" verb="*" path="report" /> </httphandlers> </system.web> <system.webserver> <handlers> <add name="report" path="report" verb="*" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="file"...

Powershell: Combining variables -

i'm new powershell , have question: i made function: function a_function($a,$b){ $d = $a + $b $d } a_function "0","1" the problem is, function gives output: 0 1 and on 1 line: 01 i tried things like: $d = ($a + $b) #result: same sabove $d = (""+$a + $b+"") #result: 1 0, dont want space inbetween $d = "$a$b" #result: 1 0, dont want space inbetween thank helping you sending array , bind $a only. in powershell delimit arguments space. try way instead: a_function "0" "1" also note you're adding 2 strings, result "01" ant not 1, in case wanted add numbers.

JavaScript - Get system short date format -

is there way system short date format in javascript? for example whether system's short date in american format eg. m/d/y or in european eg. d/m/y please note: not question formatting date or calculating based on geolocation, getting format os/system after pinch of research concluded technically it's not possible regional settings -and this, date format- can several other things. pick 1 of these options: a) mentioned -and outdated- "tolocalestring()" function: var mydate = new date(1950, 01, 21, 22, 23, 24, 225); var mydateformat = mydate.tolocalestring(); alert (mydateformat); issues: 1) can't "mydateformat.replace" date mask month not stored "01", "02", etc in string text instead, based on locale (like "february" in english it's "Φεβρουάριος" in greek , knows in e.g. klingon). 2) different behavior on different browsers 3) different behavior on different os , browser versions... b) use t...

trimming - Removing only the last whitespace in string - Javascript -

this question has answer here: trim string in javascript? 24 answers how can remove last whitespace (if there any) user input? example: var str = "this "; how can remove last 1-4 whitespaces still keep first 2 whitespace (between this, , it) question solved - lot! using function this: string.prototype.rtrim = function () { return this.replace(/((\s*\s+)*)\s*/, "$1"); } call: str.rtrim() addition if remove leading space: string.prototype.ltrim = function () { return this.replace(/\s*((\s+\s*)*)/, "$1"); }

android - Issue on changing the resource in imageView when that imageView is pressed -

i trying write application change image resource, when imageview pressed. i referred this link . i used both setontouchlistener , setonclicklistener in code. in both, logs. but, image didn't change. have given code below: imageview more; more = (imageview) row.findviewbyid(r.id.imageview1); more.setimageresource(r.drawable.ic_more_1); setontouchlistener is: more.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { // todo auto-generated method stub log.d(tag,"event type "+event+" "+ event.getaction()); switch (event.getaction()) { case motionevent.action_down: more.setimageresource(r.drawable.ic_more_2); break; case motionevent.action_up: more.setimageresource(r.drawable.ic_more_1); break; ...

c - How to reconnect the clients to server? -

my server program (socket stream) running , accepts clients. due abnormal condition, server getting terminated. other side clients waiting server reply. how reconnect running clients new server? functions in sockets? a socket had been connect() ed once can not reused call connect() . the steps connect tcp server , read/write data follows (pseudo code): fd = socket(...) // create socket describtor (allocate socket resource) connect(fd, server-address, ...) // connect server read/write(fd, data) // read server close(fd) // close /socket descriptor (free socket resource) in case server goes down after connect client , shall is close(fd) // close /socket descriptor (free socket resource) and start on beginning with: fd = socket(...) // create socket describtor (allocate socket resource) ... starting on , beginning with: connect(fd, server-address, ...) // connect server ... would propably lead undefined behaviour, @ least error.

cakephp 2.x router with i18n internationalization -

i'm using cakephp 2 i'm having hard time customize routes in routes.php. so in case, have post model , postscontroller. index action lists post , each listed post clickable link goes show action. "standard" route posts>index is: "localhost/cakesite/posts/index" , translated version it's like: "localhost/cakesite/eng/posts/index". corresponding modified routes are: "localhost/cakesite/news" , "localhost/cakesite/eng/news". now show action it's different because need pass parameters such slug , id, looks without modification of route: "localhost/cake/posts/show/75/language:eng". like: "localhost/cakesite/news/slug-id" , translated version: "localhost/cakesite/eng/news/slug-id". these both routes can't done. one: "localhost/cakesite/news/slug-id" working when have pointer on link get: "localhost/cake/posts/show/75" once click on it, redirects me on right url...

c# - Execute postback url from another button -

i have 2 buttons , buttona (normal 1 ) , buttonb (has postbackurl) , need execute (buttonb) click of buttona <asp:button id="buttona" runat="server" text="button" /> <asp:button id="buttonb" postbackurl="url" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ $("#<%= buttonb.clientid%>").trigger("click"); }); }); </script> can tell me , how , either jquery or codebehind , because don't know if it's possible ? thanks, unless posting data form buttonb's postbackurl , have window redirect postbackurl so: <asp:button id="buttona" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ wind...

java - PreferenceCategory theme not applied to PreferenceScreen -

i saw lots of answers , threads regarding problem alone tutorials how create custom preferencecategory. nothing works me. theme not applied. preferenceactivity class: public class preferencesactivity extends preferenceactivity{ private mypreferencefragment preferences; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); preferences = new mypreferencefragment(); getfragmentmanager().begintransaction().replace(android.r.id.content, preferences).commit(); } public static class mypreferencefragment extends preferencefragment { @override public void oncreate(final bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.layout.mypreferences); } } } androidmanifest: <activity android:name="com.gpsy.preferences.preferencesactivity" android:screenorientation="portrait" android:configchanges=...

html - How to create a div with 2 columns for text and image icon? -

Image
there following code: <?php foreach ($data $vacancy) { ?> <div class="vacancy"> <img src="<?php echo yii::app()->request->baseurl; ?>/images/vacancy_icon.jpg" /> <div class="name"> <?php echo chtml::link($vacancy['name'], array('vacancy/show', 'id'=>$vacancy->vacancy_id)); ?> </div> <div class="info"> <div class="public_date">public date: <?php echo $vacancy['date']; ?></div> </div> <hr /> </div> <?php } ?> as can see, each "vacancy" contains 2 columns text , 1 image. there styles: .vacancy img { float:left; width: 50px } .vacancy .name { margin: 0; width: 50px; } .vacancy .info { float: right; width: 50px; } i need each vacancy visible in following order: icon, "name",...

python - Automatically create (and keep) an object when accessed -

i this: class a: def hello(): print "hello" # not want explicitly setup a: = a() # = a() -> want happen automatically when access # first try this: def a(): return a() # also, not want call function a(): must object # , must stay alive , initialized a.hello() # created, object of class a.hello() # not want second instantiation how can implement this? properties ? cached-properties ? classes: module-level object. def lazyinit(cls): class p(object): def __init__(self, *args, **kws): self._init = lambda: cls(*args, **kws) self._obj = none def __getattr__(self, k): if not self._obj: self._obj = self._init() return getattr(self._obj, k) return p example: @lazyinit class a(object): def __init__(self, a, b): print("initializing...") self.x = + b + 2 def foo(self): return self.x x = a(39, 1) print x prin...