Posts

Showing posts from March, 2011

sockets - Maya crash in Python script -

i'm new python, exploring can't execute program because maya crashes. don't know more. everytime execute python script in script editor have quit maya , restart it, because de program won't respond. code i'm using is: import socket import maya.cmds cmds udp_ip="localhost" udp_port=6001 sock = socket.socket( socket.af_inet, socket.sock_dgram ) sock.bind((udp_ip, udp_port)) while 1: data= sock.recv(1024) print (data) datasplit=data.split(';') print (datasplit) mylist=[] in range (0, len(datasplit)): mylist.append(int(datasplit[i])) print(mylist) cmds.setattr('ik_root.movex',mylist[0]) cmds.setattr('ik_root.movey',mylist[1]) cmds.setattr('ik_root.movez',mylist[2]) cmds.refresh() any help? the while loop has no exit, you'll stuck in listen-and-process mode forever. call socket.recv blocking, won't able interact maya @ while script running - s

loops - looping over character values in SAS -

in stata can loop on list of character values foreach command . i've been trying same in sas no avail far. i'm trying run series of data , proc statements on values of character column. tried following: %let mylist = b c; * these values of column called "code"; data mydata_@mylist; * each element creates new table; set mydata; code=&mylist; run; what doing wrong or missing? thanks in advance, matías try this: %macro loopit(mylist); %let n = %sysfunc(countw(&mylist)); %do i=1 %to &n; %let val = %scan(&mylist,&i); data mydata_&val; set mydata; code = "&val"; run; %end; %mend; %let list=a b c; %loopit(&list);

plot - gnuplot: plotting from a binary file containing single column -

i have binary file - 1 column, 20 values . the first 10 - x coordinate the following 10 - corresponding y coordinates. is possible plot x-y plot using gnuplot without preprocessing ? if not, how can preprocess binary file (not converting normal text file) plotting in gnuplot ? as far can see, not possible gnuplot, although offers massive options binary files. 1 possibility plot file following python script (provided, numbers stored integer ), otherwise must adapt it: import sys import numpy np np.savetxt(sys.stdout, np.fromfile(sys.argv[1], dtype='i4').reshape(2,10).transpose()) and plot plot '< python script.py data.bin' if plan work more binary data files, suggest use hdf5 file format.

java - get null data if post to struts2 with: Content-Type is text/html or text/plain -

does know reason, controller action can not data if set content-type text/html or text/plain when post data action? (i using struts 2) my action below: public class apinewsaction extends actionsupport { private string rowid; public string getrowid() { return rowid; } public void setrowid(string rowid) { this.rowid = rowid; } public string onnews(){ system.out.println("rowid="+ rowid); } } and configed struts.xml below: <package name="api_news" extends="struts-default" namespace="/news-api"> <action name="news" class="news.action.apinewsaction" method="onnews"> <result name="input" type="json"></result> </action> </package> anyone know? thanks,

android - Unable to start service when service in separate package -

if problem appreciate it. i have activity starting service using alarmmanager , works fine. created new service (a modified copy) , giving error: java.lang.runtimeexception: unable start service...with intent {...(has extras) }: java.lang.classcastexception i've done lot of searching , have checked manifest many times seems usual problem. both services declared, inside application tags , scoped. examples i've seen refer 1 service so, in case, i've tried several different ways code 2 services in manifest have found no valid version other 1 below. i've tried several ways create intent assume problem lies in fact new service in different package (within same app). i tried intent filter , custom action (see bottom) gave same error. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="couk.jit.currencycheck1" android:versioncode="1" android:versionname="1.0.1" > <uses-sdk android:m

java - I have to compile hello.scala which has a import command "org.scala._" -

i know folder located, how run hello.scala terminal i doing scala hello.scala , generates error /users/username/desktop/hello/hello.scala:1: error: illegal start of definition package org.scala ^ 1 error found how can run program? include package name when using scala command , run against class file instead of source code scala org.scala.hello like java, scala naming conventions indicate classes start initial uppercase letter classes, e.g. hello

swing - Java SecurityManager @Override public void checkPermission(Permission perm) -

i'm building swing application , need write custom securitymanager. if write empty class extends securitymanager this public class sandbox extends securitymanager {} it works fine, meaning gui rendered correctly , privileges i/o revoked. need customize checkpermission method , whenever override nothing works anymore... why shouldn't work?? public class sandbox extends securitymanager { @overide public void checkpermission(permission perm) { super.checkpermission(perm); } } update: basic example shows problem this public static void main(string[] args) { system.setsecuritymanager(new securitymanager() { @override public void checkpermission(permission p) { if (some_condition_here) { // here } else { // resort default implementation super.checkpermission(p); } } }); new jframe().setvisible(true); } removing "checkpermission" meth

haskell - Polymorphic types in records -

i'm trying write function reads raw bytes file, "casts" "plain" type, sorts it. in order this, need tell sort how should interpret binary data - i.e., type of binary data is. in order "binary" data, in sense of "i can treat data raw bits, read , write disk", type of data must binary , bits. and, sort it, must member of ord. any type constrained these ways should sortable. as little hack, in order pass type sort function, passing inhabitant of type instead. (if there's way pass type , achieve results, i'd love know.) {-# language rankntypes #-} import data.binary.get import data.binary.put type sortable = forall a. (bits a, binary a, ord a) => data sortopts = sortopts { maxfiles :: int , maxmemory :: integer , maxthreads :: int , bintype :: sortable } defaultopts = sortopts { maxfiles = 128 , maxmemory = 1000 * 1000 * 1000 * 1000 , maxthreads = 4 , bintype = 0 :: word32 }; putbinaryvalue

joomla2.5 - joomla prepends to 'path' -

my wife have joomla 2.5 site she claims has done nothing except, installing , and subsequently uninstalling koowa plugi, ninja plugin , ninjaboard component. anyway after joomla 'path' have changed such between domain name , path rendered html, joomla server seems insert "/index.php" or "/index.php/menu-item-name" for example clicking link following: <a href="images/some_folder/xxx.jpg"> points like: http://www.domain.contry/index.php/fun/images/some_folder/xxx.jpg how change 'global path settings' such that <a href="images/some_folder/xxx.jpg"> points http://www.domain.contry/images/some_folder/xxx.jpg nb: joomla , php skills basic :) update: i think problem this: all image paths used 'absolute' , relative, if in 'index.php/some-menu' , click 'images/xxx.jpg' resolves 'index.php/some-menu/images/xxx.jpg', has images in image folder, there way make image paths

html - CSS/HTML5 using :target or :active to display different text when link is clicked -

sorry may open ended question... wondering if @ possible display different text when link clicked. example on personal website if have "about" or "contact" link switch text of body without reloading page. in body of index.html file have: <div class="nav-bar"> <ul class="nav"> <li id="other"><a>about</a></li> <li id="other"><a>contact</a></li> <li id="other"><a>other</a></li> </ul> </div> and in wondering if using a:active or a:target in separate css style sheet perform task described above or if need use js. the idea of switching text of body without reloading page commonly known “single page application”, rather trendy thing many benefits , disadvantages or challenges. implemented using javascript, using library or framework, since that’s how handle programming on web pages. however, poss

.net - Bing translation Service returning first response to every request -

i implementing bing translation services using http api. have run 2 issues in implementation after hours of research still have not been able resolve. hope out there can provide me little guidance. the issues: 1) initial page sent webservice translated perfectly. however, after first page rendered following calls server receive response first call. meaning html string sent service correctly, service returns original response original request instead of expected new response new request.(could service caching request?) 2) javascript translated inner html:-/ see below example: javascript(translated :-/) $(función () {} elformulario var document.forms['ctl01 =']; si (typeof(sys) == 'undefined') tira error nuevo ('asp net ajax client-side fram... my translation class(web service call) using system; using system.collections.generic; using system.linq; using system.text; using system.xml; using system.configuration; using system.web; using system.web

java - How to resolve [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified -

i tried make connection access encountered following problem after compiling java file [microsoft][odbc driver manager] data source name not found , no default driver specified my code : import java.sql.*; public class abc { public static void main(string args[]) { try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string fn="c:/ctb/new"; string database = "jdbc:odbc:driver={microsoft access driver (*.mdb,*.accdb)};dbq="+fn+".accdb;"; connection conn = drivermanager.getconnection(database); system.out.println(conn); } catch(exception e) { e.printstacktrace(); system.out.println("error!"); } } } when copy , paste code eclipse error message

Executing all JavaScript code before repainting a browser window -

i'd resize & move browser window using javascript. resizeto() , moveto() seem friends here: window.resizeto(x,y); window.moveto(x,y); this works, visually, it's bit clunky. first, window moved desired location , window gets repainted on display. finally, window resized desired dimensions , gets repainted on display once more. happens within couple hundred milliseconds 2 discrete step noticeable , looks awkward. what want these 2 methods atomic, such both return before browser window (ui , all,) gets repainted on display. can more cohesive presentation of window repositioning , resizing achieved using javascript? use settimeout trick allow ui "catch-up". window.settimeout(function() {window.resizeto(x,y)},0); window.settimeout(function() {window.moveto(x,y)},0);

objective c - How to traverse peg through all the squares in a Monopoly type Game in iOS -

Image
how traverse peg through squares in monopoly type board game ? i have written function movepegbutton on click moves peg destination position gets random generated number. this have written far move peg button. (ibaction)movepegbutton:(id)sender { self.pegdestinationpositionindex = self.pegcurrentpositionindex + self.randomnumber; if (self.pegdestinationpositionindex > [self.boardcordinatesarray count] - 1) { self.pegdestinationpositionindex = self.pegdestinationpositionindex - [self.boardcordinatesarray count]; } [self animatepeg]; self.pegcurrentpositionindex = self.pegdestinationpositionindex; } this have written animate peg. (void)animatepeg { int destinationxcord = [[[self.boardcordinatesarray objectatindex:self.pegdestinationpositionindex] objectforkey:@"x"]intvalue]; int destinationycord = [[[self.boardcordinatesarray objectatindex:self.pegdestinationpositionindex] objectforkey:@"y"]intvalue]; [uivi

.net 4.5 - Is there a Model Checking software (like Java Path Finder) but for C#? -

< edit > question being off-topic , opinion-based, i'll try more clear. goal undestand if such tool existed, not interested in opinions best one. @ time wrote question spent quite amount of time searching internet , found old dead projects such tool java existed , couldn't belive there nothing c#. think question related programming (code verification), , not asking opinion. also, it's still not easy find information , think answer saving someone's time. said, i'm not expert of stackoverflow, if still think question/answer not fit site feel free delete it. < /edit > i've found moonwalker http://fmt.cs.utwente.nl/tools/moonwalker/ last update has been done in 2009 , don't think supports .net4.5 (and it's poorly documented). the answer question propose codecontracts model checking tool model checking tool c# i've tried using , don't think model checker, not in same way java path finder java is. im worng? can used jpf? i nee

java - Libgdx MainMenuScreen -

i trying learn use libgdx engine. tutorial ( https://code.google.com/p/libgdx/wiki/extendedsimpleapp ) on website of libgdx describes, tried set little main menu. have imported classes needed, @ line 29 there error: "mainmenuscreen can not resolved type". here source code: package com.me.mygdxgame; import java.awt.splashscreen; import com.badlogic.gdx.applicationlistener; import com.badlogic.gdx.game; import com.badlogic.gdx.gdx; import com.badlogic.gdx.graphics.gl10; import com.badlogic.gdx.graphics.orthographiccamera; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.bitmapfont; import com.badlogic.gdx.graphics.g2d.sprite; import com.badlogic.gdx.graphics.g2d.spritebatch; public class mygdxgame implements applicationlistener { private orthographiccamera camera; private spritebatch batch; private texture texture; private sprite sprite; private bitmapfont font; @override public void create() { batch = new spritebatch();

qt - QMainWindow stops receiving QEvent::UpdateRequest when user opens menu or resizes window -

mywindow inherits qmainwindow. mywindow contains qglwidget displays animation. the problem animation pauses whenever open menu or resize window. the animation implemented calling qcoreapplication::postevent(this, new qevent(qevent::updaterequest)) periodically, calling redrawing each time window receives qevent::updaterequest , this: bool mywindow::event(qevent *event) { qdebug() << event; switch (event->type()) { case qevent::updaterequest: render(); return true; default: return qmainwindow::event(event); } } as seen qdebug() , while menu open or window being resized, window stops receiving update request events. is there setting on qmainwindow/qwidget make continue receive update request events? or there better way implement animation? edit : i'm on mac os x. this may qt bug. i'll investigate. alas, you're way overcomplicating code. the postevent should replaced th

c++ - Sort Vector<MyClass> on one of MyClass's data members? -

this question has answer here: how sort vector of pairs based on second element of pair? 7 answers standard library sort , user defined types 2 answers i create class, call myclass has 3 data members- a, b , c. wish put many myclass objects in std::vector<myclass> , sort vector according data members. is there elegant way of doing using stl? didn't want re-invent wheel , sure can't first. in java guess use comparator . the following should trick: bool operator < (myclass const& lhs, myclass const& rhs) { return lhs.a < rhs.a; } std::sort requires value_type of iterators less-than comparable, or in more technical terms, must form strict weak ordering. given code above, should able sort other type: std::sort(std::begin(my_classe

.net - Parsing XML using XmlDocument -

i trying parse below xml. have multiple invoice tags: <invoices> <invoice> <invoice_id>1234</invoice_id> <billing> <name> abc </name> <address1>1 main street</address1> <city> city </city> <state>state </state <zip>00000</zip> <amount> <baseamt>35</baseamt> <tax>3</tax> <total>28<total> <amount> </billing> <item> <name> pen </name> <qty> 5 </qty> <amount> 10 </amount> </item> <item> <name> paper </name> <qty> 3 </qty> <amount> 20 </amount> </item>

sass - how to define grayscale out of pure white or black -

suppose have defined $color-white: #ffffff and/or $color-black: #000000 in variables.sass . how can define different shades of grey scale using either sass or compass helpers? use color functions: http://sass-lang.com/docs/yardoc/sass/script/functions.html#other_color_functions color: darken($color-white, 25%); or color: lighten($color-black, 25%); toy numeric value until heart content.

Where to put validator for Django model field? -

the django documentation shows example of custom validator model field. doc doesn't put validator function in code. if put in models.py file in either location (as shown below), error when try start server: nameerror: name 'validate_name' not defined where right location validate_name function? thanks. # models.py, example 1 django.db import models django.core.exceptions import validationerror class commentmodel(models.model): # error if define validator here def validate_name(value): if value == '': raise validationerror(u'%s cannot left blank' % value) name = models.charfield(max_length=25, validators=[validate_name]) # models.py, example 2 django.db import models django.core.exceptions import validationerror # error if define validator here def validate_name(value): if value == '': raise validationerror(u'%s cannot left blank' % value) class commentmodel(models.model): nam

physics - Trying to simulate a 1-dimensional wave -

Image
i'm trying make simplified simulation of 1-dimensional wave chain of harmonic oscillators. differential equation position x[i] of i-th oscillator (assuming equilibrium @ x[i]=0 ) turns out - according textbooks - one: m*x[i]''=-k(2*x[i]-x[i-1]-x[i+1]) (the derivative wrt time) tried numerically compute dynamics following algorithm. here osc[i] i-th oscillator object attributes loc (absolute location), vel (velocity), acc (acceleration) , bloc (equilibrium location), dt time increment: for every i: osc[i].vel+=dt*osc[i].acc; osc[i].loc+=dt*osc[i].vel; osc[i].vel*=0.99; osc[i].acc=-k*2*(osc[i].loc-osc[i].bloc); if(i!=0){ osc[i].acc+=+k*(osc[i-1].loc-osc[i-1].bloc); } if(i!=n-1){ osc[i].acc+=+k*(osc[i+1].loc-osc[i+1].bloc); } you can see algorithm in action here , click give impulse 6-th oscillator. can see not doesn't generate wave @ generate motion growing total energy (even if added dampening!). do

Bootstrap 2 or Bootstrap 3 for IE 7 Performance Wise -

while know not vs b topics hear me out. bootstrap 3 has been released countless improvements. 1 potential deal breaker drops ie 7 compatibility. site's cater corporate users unfortunately isn't practical since in 1 particular use case 10% market still. so supporting ie7 must 1 think means choosing stick bootstrap 2. however, https://github.com/coliff/bootstrap-ie7 1 can add ie7 support while keeping benefits of bootstrap 3. the 1 issue must use boxsizing.htc polyfill ie 7 users ( https://github.com/schepp/box-sizing-polyfill ) so question better stick bootstrap 2 or switch bootstrap 3.0 boxsizing.htc? b3 .htc slower 10% ie7 users b2, if barely noticeable (especially if server caching) worth benefits rest of 90%. if know 1 knows, next thing guess test installing default b2 , b3 .htc demo sites , comparing speeds in ie7. ps if there better polyfill adding boxsizing ie7 1 listed above performance wise let me know. i faced similar dilemma bootstrap 3/ie7,

Facebook send dialog in iOS app -

i have ios app in tell user share link friends wants. want offer him possibility open new inbox within app , if possible pre-filled content. no pre-filled recipient. , want available users (not facebook connect). basically want replicate following send dialog web in app : https://developers.facebook.com/docs/reference/dialogs/send/ which means open facebook app , not browser show new inbox dialog. from research found no clear solution , possible website surprised cannot same app. thank in advance, jules you can use uiactivityviewcontroller . first have create list of things want share: url, string, etc this nsarray *activityitems = @[[nsurl urlwithstring:@"www.link-to-share.com], @"what want written above"]; afterwards, have create uiactivityviewcontroller things want share , present modally: uiactivityviewcontroller *activitycontroller = [[uiactivityviewcontroller alloc] initwithactivityitems:activityitems applicationactivities:nil]; [self

javascript - Why is this jQuery click function not working? -

code: <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <script type="text/javascript"> $("#clicker").click(function () { alert("hello!"); $(".hide_div").hide(); }); </script> the above code doesn't work. when click on #clicker, doesn't alert , and doesn't hide. checked console , no errors. checked see if jquery loading , indeed is. not sure issue is. did document ready function alert , worked not sure doing wrong. please help. thanks! you supposed add javascript code in $(document).ready(function() {}); block. i.e. $(document).ready(function() { $("#clicker").click(function () { alert("hello!"); $(".hide_div").hide(); }); }); as jquery documentation states: "a page can't manipulated safely until document "ready." jquery detects state o

jquery - How to find a sibling cell using class names? -

i have table that's generated looping through data, this: $.each(array_rule_segments, function (key, listofwidgets) { //console.log('in outer loop'); var widget_details = listofwidgets.split(','); var counter = key + 1 htmlstring += '<tr id="listofwidgets_' + key + '">'; htmlstring += '<td><input type="button" value="remove" class="remove"/></td>'; htmlstring += '<td name="widget_type" class="widget_type" id="widget_type' + counter + '">' + widget_details[0] + '</td>'; htmlstring += '<td name="widget_details" class="widget_details" id="widget_details' + counter + '">' + widget_details[1] + '</td>'; htmlstring += '<td name="widget_order" class="widget_order" id="widget_order' +

java - get reference to project's base url in static resource file in Spring MVC -

i have bunch of static javascript files handle ajax functions query various parts of application, , deploy multiple versions of application, might have along lines of: https://www.myurl.com/projectname/ - production release https://www.myurl.com/projectname_alpha/ - current alpha release https://www.myurl.com/projectname_beta/ - current beta release https://www.myurl.com/projectname_unstable/ - current development build so if have controller "foo" want make ajax call to, can't hard-code /projectname/foo url (as point production release). currently, inject script each of views gets base url of project global variable: <script type="text/javascript"> // declare global variable hold project's base url var baseurl = '<spring:url value="/" />'; </script> and reference in javascript files: var url = baseurl + 'foo/'; it's functional, ugly solution, , rather not pollute global namespace if ca

Homebrew installation hanging on "Receiving objects" -

i'm attempting install homebrew through advised command line... ruby -e "$(curl -fssl https://raw.github.com/mxcl/homebrew/go)" when installation gets "receiving objects" installation hangs... ==> downloading , installing homebrew... remote: counting objects: 126495, done. remote: compressing objects: 100% (58957/58957), done. receiving objects: 33% (41744/126495), 8.74 mib | 598.00 kib/s the above second attempt @ installing homebrew. first attempt got 56% before hanging. after aborting installation i'm getting this... ^cfailed during: git fetch origin master:refs/remotes/origin/master -n any ideas what's going on here? i had script hang twice. waited overnight, suggested tatn, did not work in case. however, when restarted computer script ran successful completion.

orchardcms - Does Orchard CMS have asynchronous drivers? -

is there asyncdriver object in orchard allows me achieve widgets asynccontroller can regular mvc actions? what involved in making 1 if not? nope , adding 1 not provide real benefits, while introducing more complexity. can asynchronous stuff in drivers if wish. driver cannot directly compared controller there multiple of them called during single request , need synchronized @ point anyway - build final display/editor view. being said - having asyncdriver won't add more can achieve now. plus - we're gonna on .net 4.5 soon, you'd able use async / await sugars inside drivers , anywhere else.

sql - Calculate call cost from rate table using MySQL -

i trying compare call rates between 2 telephone providers. have 2 tables, follows: create table 18185_rates ( calldate date, calltime time, calledno varchar(20), duration integer(8), callcost float(5 , 3 ) ); create table int_rates ( dialcode varchar(20), description varchar(20), callcost float(5 , 3 ) ); the 18185_rates contains call data records phone system, example values follows: calldate,calltime,calledno,duration,callcost 2013-07-30,11:21:38,35342245738,10,0.050 2013-07-30,16:19:25,353872565822,37,0.130 2013-08-02,08:31:12,65975636187,1344,0.270 2013-08-05,11:03:53,919311195965,2356,1.640 the table int_rates contains tariff data calls provider in following format: dialcode,description,callcost 1,usa,0.012 1204,canada,0.008 1204131,canada,0.018 1226,canada,0.008 1226131,canada,0.018 1242,bahamas,0.137 1242357,bahamas mobile,0.251 1242359,bahamas mobile,0.251 i trying run comparison, can see how calls in 18185_rates have cost other provider. can

css - Responsive div - text wrapping div. Can this be stacked when minimized? -

i have set global element align images right: .containerright { float: right; margin: 5px 5px 5px 10px; position:relative; } it works until screen minimized mobile portrait size. text wrap leaves few words behind. for example: <div class="containerright"><img src="/images/imageexample.jpg" width="223" height="160" hspace="0" vspace="5" alt="imageexample" border="0"></div> <h2>here example of heading text!</h2> when minimised 'here example...' aligned top-left of image , rest of sentence '...of heading text!' falls under image there huge break image sitting right. how can set class when it's viewed '@media (max-width: 320px)' stacks eg. display:block; ??? thanks help! just remove float in media query css. :) @media (max-width: 320px) { .containerright { float: right; /* remove float on mobile media query */

How to remove an opaque background behind textfield and movieclip in ActionScript 2 -

i have problem need help. i'm using as2 create ui setup box. when overlap textfield on movieclip, there opaque background behind textfield. how remove it? here link image error: http://i.stack.imgur.com/rzzbu.png please me! in advance my source code: private function createmain(inidata:object):void { //create album picture /*----- ducldm add 130820 -----*/ g_background = g_mc.attachmovie( "mcbackground", "serviceview_mcbackground" + g_mc.getnexthighestdepth(), g_mc.getnexthighestdepth() -1 ); /*----- ducldm end -----*/ g_mcmain = g_mc.createemptymovieclip("g_mcmain" + g_mc.getnexthighestdepth(), g_mc.getnexthighestdepth()); g_mcmain.blendmode = "layer"; var x_pos:number = (stage.width - 802) / 2; var y_pos:number = stage.height - 200; var arr:array = new array(); g_mcborderinfo = g_mcmain.attachmovie("mcborderbutton_vip"/*"mcborde

packaging - Proper permissions for python packages -

i keep seeing python packages... python package installs files. in packaged tar, things this: -rw-r----- 1 schwehr eng 7 sep 3 18:10 version for: https://github.com/scrapy/scrapy/blob/master/scrapy/version then when python setup.py install root managed environment (e.g. fink macosx) uses root permissions, file gets owned root , permissions preserved. code run user unable access file. this project , other projects same issue (typically eggs portion of install) use python setup.py sdist upload. how these projects supposed build tar has proper permissions files world readable? e.g. wget https://pypi.python.org/packages/source/s/scrapy/scrapy-0.18.2.tar.gz#md5=14f105e2fdb047c666b944990e691389 tar tfvv scrapy-0.18.2.tar.gz | head drwx------ buildbot/buildbot 0 2013-09-03 10:30 scrapy-0.18.2/ -rw------- buildbot/buildbot 385 2013-09-03 10:27 scrapy-0.18.2/manifest.in -rw------- buildbot/buildbot 140 2013-09-03 10:30 scrapy-0.18.2/setup.cfg drwx------ buildbot/bui

linux - where is daemon command in rhel? -

i write service script following service script found there no daemon command, , can't google how install it from /usr/share/doc/initscripts-*/sysvinitfiles : # source function library. . /etc/init.d/functions ... functions in /etc/init.d/functions ======================================= daemon [ --check <name> ] [ --user <username>] [+/-nicelevel] program [arguments] [&] ...

ios - Show camera with pause(take picture) on tap -

i trying create app job mechanic. 1). need able have front cam come white bars around side(to provide light 2). on tap pauses , displays picture without saveing camera library(if kept id out of space in no time. 3). able have same thing camera minus white bars. as of im toxcode , need lot of help. haveing app make jobs 100x easier.

java - Return the k elements of an array farthest from val -

method needs return k elements a[i] such abs(a[i] - val) k largest evaluation. code works integers greater val. fail if integers less val. can without importing other java.util.arrays? enlighten me? appreciated! public static int[] farthestk(int[] a, int val, int k) {// line should not change int[] b = new int[a.length]; (int = 0; < b.length; i++) { b[i] = math.abs(a[i] - val); } arrays.sort(b); int[] c = new int[k]; int w = 0; (int = b.length-1; > b.length-k-1; i--) { c[w] = b[i] + val; w++; } return c; } test case: @test public void farthestktest() { int[] = {-2, 4, -6, 7, 8, 13, 15}; int[] expected = {15, -6, 13, -2}; int[] actual = selector.farthestk(a, 4, 4); assert.assertarrayequals(expected, actual); } there 1 failure: 1) farthestktest(selectortest) arrays first differed @ element [1]; expected:<-6> was:<14> failures!!! tests run: 1, failures: 1

Android: Multi Pane layout detail view appears by default -

in app, have requirement of multi payne layout. in layout, first fragment listview shows list of items. on click of list item, detail view open on right hand side of list item. but, in case, when run app on tablet, detail view appears along listview default. while, want should appear on click of list item. below code: activity class: public class orderactivity extends fragmentactivity implements onorderselectedlistener { private static final string tag = "orderactivity"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); log.d(tag, "oncreate called"); setcontentview(r.layout.order_details); if (findviewbyid(r.id.fragment_container) != null) { if (savedinstancestate != null) { return; } orderlistfragment orderlistfragment = new orderlistfragment(); orderlistfragment.setarguments(getintent().getextras()); getsupportfragmentmanager().begin