Posts

Showing posts from July, 2012

shell - Lightweight console/IDE for Python? -

i use ipython (or regular python shell) test python code snippets while coding, , it's been useful. 1 shortcoming of this, though, if want test multi-line segment of code, or want write multiple lines of code before running, isn't convenient have "line line". , going change of lines cumbersome because have re-type code comes after it. i'm playing groovy right , find has excellent solution problem: groovy console . write code want, it's regular editor; , hit run ctrl+r (cmd+r since i'm on mac) , runs @ once. if want change (e.g. if there errors), that's easy -- change , ctrl+r again. is there equivalent of available python? or have recommendations on way achieve similar behavior? create new file, save it, , python <filename>.py shell. that's many steps , cumbersome. eclipse may option, it's heavyweight. i'm looking lightweight can spin when want test , rid of quickly. i'd interested hear ideas/suggestions! thanks

iphone - Format a float to display in a string with two digits? -

nsstring *timerend = [[nsstring alloc] initwithformat:@"%.0f:%.0f:%02d", hours, minutes, seconds]; so have string , bunch of floats. example, seconds = 6.54. display that. want display 06.54. there anyway that? appreciated. assuming want format 'xx:xx:xx.xx' can use following code: nsstring *timerend = [[nsstring alloc] initwithformat:@"%02.0f:%02.0f:%05.2f", hours, minutes, seconds]; when formatting float number before point (05) determines minimum total characters in entire string, not bit before point.

Unable to set cookie if it does not already exist in PHP -

i trying set cookie site if not exist. not working. if(isset($_cookie['about'])){ $_cookie['about'] += 1; } if(!isset($_cookie['about'])){ setcookie("about", 1, time()+3600); } i have tried if(empty($_cookie['about'])){ setcookie("about", 1, time()+3600); } you can read stuff $_cookie superglobal, try setting normally: setcookie("about",$_cookie['about']+1,time()+3600); so together: if(isset($_cookie['about'])){ $_cookie['about'] += 1; }else{ setcookie("about", 1, time()+3600); } note else , you've checked before if cookie isset, there no need check again either or isn't.

ssh - Cloning Git repository locally -

i have create git repository on imac under user git account , want clone main user account on same computer. have created ssh key , added .ssh/authorized_keys file. when log in main account following error message: permission denied (publickey) fatal: remote end hung unexpectedly now me, , while searching on web seems public key incorrect. have created twice , still same issue. you shouldn't need ssh key @ all. make of files world readable , clone full path. in other words, do $ git clone /path/to/repo

jquery - How to customize list/menu? -

well. hoping find solution customize list/menu css cross browser compatible. neat css menu creator: http://www.cssmenumaker.com/ , or google 'css menu'

html - HTML5 & AccessKey -

i've read: http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#the-accesskey-attribute , doesn't anywhere if or how 'home' key on keyboard can used accesskey in html 5. does know this, or if it's @ possible? it can't — keys enter characters can, , bad enough can hijack normal keyboard shortcuts them adding home list of things can broken.

Erlang OTP I/O - A few questions -

i have read 1 of erlang's biggest adopters telecom industry. i'm assuming use send binary data between nodes , provide easy redundancy, efficiency, , parallelism. does erlang send binary central node? is directly responsible parsing binary data actual voice? or fed language/program via ports? is responsible speed in telephone call, speed in delay between me saying , hearing it. is possible erlang solely used ease in parallel behavior , c++ or similar processing speed in sequential functions? i can guess @ how things implemented in actual telecom switches, can recommend approach take: first, implement in erlang, including of low-level stuff. won't scale since signal processing costly. prototype however, works , can make calls , whatnot. second, decide on performance bottlenecks. can push them c(++) , factor of 10 or can push them fpga , factor of 100. can cmos work , factor of 1000. price of latter approach steeper, decide need , go buy that. er

javascript - Move an element left on each click -

i think main question "how write this?" simple thing. every click css left property gets 500px taken off. (moved 500px left) i having hard time variables , ... don't know. $(document).ready(function() { var belt-move = 500; var belt-ammount = $(".belt").css('left'); belt-move -= belt-ammount; $(".next").click(function() { $(".belt").animate(belt-move, 500, "swing"); }); }); first of javascript (ecmascript) doesn't allow minus character '-' in variables names, can't use name belt-move , instead should use underscore '_' ( belt_move ) or camel case convention ( beltmove ). second: defining jquery animation need define property want change, in case 'left'.the 'swing' easing function default don't need pass it. third: $(function() {...}); shorter version of $(document).ready(function() {...}); so final code should this: $(f

Python: string.uppercase vs. string.ascii_uppercase -

this might stupid question don't understand what's difference between string.uppercase , string.ascii_uppercase in string module. printing docstring of both function prints same thing. output of print string.uppercase , print string.ascii_uppercase same. thanks. see: http://docs.python.org/library/string.html string.ascii_uppercase: the uppercase letters 'abcdefghijklmnopqrstuvwxyz'. value not locale-dependent , not change. string.uppercase: a string containing characters considered uppercase letters. on systems string 'abcdefghijklmnopqrstuvwxyz'. specific value locale-dependent, , updated when locale.setlocale() called.

iphone - iOS: Programmatically add custom font during runtime -

i allow application users use own fonts in app, copying them inside documents directory (through itunes). however, can't find way use custom fonts in way, since right way depends on using uiappfonts key in app's info.plist . is there way override during runtime? thanks. i know old question, trying same today , found way using coretext , cgfont. first sure add coretext framework , #import <coretext/coretext.h> then should (in example using font downloaded , saved fonts directory inside documents directory): nsarray * paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring * documentsdirectory = [paths objectatindex:0]; nsstring * fontpath = [documentsdirectory stringbyappendingpathcomponent:@"fonts/chalkduster.ttf"]; nsurl * url = [nsurl fileurlwithpath:fontpath]; cgdataproviderref fontdataprovider = cgdataprovidercreatewithurl((__bridge cfurlref)url); cgfontref newfont = cgfo

.net - Do threads by default run on more than one core? -

in multi-core processors, , windows application runs many threads. threads by default run on more 1 core ? mean every thread might run on individual core. edit: if application runs many threads, these threads run on 1 process. without parallel programming.. is process able devide , run on many core ? does application benifit of multi-core processing ? (your question unclear. hope i've answered asking, if can clarify question help.) it's os thread scheduled. there advantages keeping thread on same core if possible, in terms of cache coherency etc — forcing stay on same core overly restrictive. in short: yes, thread can run on different cores. not @ same time, of course - it's 1 thread of execution — execute on core c 0 @ time t 0 , , on core c 1 @ time t 1 . edit: talk application running many threads, "without parallel programming" — that's contradiction in terms. if you're using many threads, are using parallel programm

Java EE 6 Study Material -

i'm looking @ doing 1 of java ee 6 certifications i'm struggling find out study material available meet exam objectives. other certifications i've done have bought book prepare exam. company work has certification program pay basic study material , exam, think can safely assume 1 of oracle's 5 day courses costing in region of $3000 out of question. i know it's in game of exams still in beta testing 1 know if there worthy study material prepare exams or perhaps when available. i'm leaning towards jpa or javaserver pages , servlet developer certifications. i've never done such certification, wouldn't official java ee 6 tutorial oracle sound basis preparation?

php - Display logged in authors' posts in recent posts widget -

i have several authors on wordpress site. on recent posts widget, want display latest posts each author. how do this? you create own widget selects posts author. you'll use get_posts in widget so. have full source code of recent posts widget copy , learn from.

Why opaque views are more effective on iPhone? -

i tried find other reasons why opaque views better transparent. however, sensible reason came view behind opaque 1 doesn't need draw content @ place. is wrong assumption , there other reasons? thanks. this right assumption. directly apple documentation: opaque a boolean value determines whether receiver opaque. @property(nonatomic, getter=isopaque) bool opaque discussion this property provides hint drawing system how should treat view. if set yes , drawing system treats view opaque, allows drawing system optimize drawing operations , improve performance. if set no , drawing system composites view other content. default value of property yes . an opaque view expected fill bounds entirely opaque content—that is, content should have alpha value of 1.0 . if view opaque , either not fill bounds or contains wholly or partially transparent content, results unpredictable. should set value of property

java - Autowiring Map not working as expected -

i'm using spring 3.0.4. have beans use @autowired annotation on maps. these maps defined within application-context.xml file (as these maps constructed using several factory methods). when use debugger, can see map gets constructed using (expected) bean id. however, once autowiring process starts, claims cannot find bean id has been created. piece of code: @autowired @qualifier("dienstverbandmap") private map<string, string> dienstverbandmap; piece of context xml: <bean class="java.util.hashmap" id="dienstverbandmap" factory-bean="somefactorymethod" factory-method="getmappedmap"/> important detail, when change type java.lang.object in both class , context xml does wired in fact, can cast hashmap in code , work. not want obviously. anyone got explantion i'm doing wrong? i think type parameters dienstverbandmap . injection can performed safely if spring can figure out bean instance (a has

How do I move Delphi XE packages and settings to another user? -

we have set new (template) development machine among other things delphi xe including large number of third-party , internal packages, , intend make number of clones of computer developers in our team. note not trying bypass licensing, (re-) activate/register windows, office, delphi xe etc. after cloning. problem when logged on (as myself) clone own machine, delphi shows none of packages installed (i.e. on the template machine, using local administrator account). there anyway can find , copy/move delphi settings local administrator own user account, packages , other settings same set them on template machine before cloning? i'd try export relevant registry keys - hkey_current_user\software\borland\bds\5.0\known packages d2007 (probably ..\embarcadero\.. xe). can (carefully!) edit *.reg file , re-import it.

Simple, formally defined language for compiler learning -

i'm looking simple, formally defined language can used while learning compiler construction. should simple implement first pass , amenable further optimization efforts. feel free point me in direction of lisps, i'm looking other options well. may suggest jack programming language http://www.nand2tetris.org/ ? it's suited learning compiler construction, it's part of academic course. i in midst of blog post series on writing compiler language, in c#, code-generation c. posts have here: http://blogs.microsoft.co.il/blogs/sasha/archive/tags/compiler/default.aspx

debugging - Java: how to get arguments passed to method that called this method? -

in java, possible class , method called current method (the method in stacktrace). my question is, can arguments passed method called method? i need debugging purposes. eg: baseclass { initialfunc(input) { var modifiedinput = input + " modified you"; otherclass.dosomething(modifiedinput); } } otherclass { dosomething(input) { //get arguments passed method of class called method } } can 1 information stacktrace, or there other means? (note need able in runtime , cannot change source of baseclass, going feature of debugging class not know source beforehand) thanks. i don't believe possible using standard java api. what use aspectj, place point-cut @ calling method, save arguments, place point-cut @ called method , pass on arguments. another option (slightly more advanced) use custom, bytecode-rewriting, class loader saves original arguments, , passes them on arguments next method. take day or 2 implement.

Install and uninstall windows service via command prompt "C#" -

i want install , uninstall win service via command prompt "c#" following code not working please me string strinstallutilpath ="c:\\windows\\microsoft.net\\framework\\v2.0.50727\\"; string strinstallservice = " installutil.exe \"d:\\testuser\\serviceforpatch\\testservice\\bin\\debug\\testservice.exe\""; processstartinfo psi = new processstartinfo("cmd.exe"); psi.redirectstandardinput = true; psi.redirectstandardoutput = true; psi.redirectstandarderror = true; psi.useshellexecute = false; process p = process.start(psi); system.io.streamwriter sw = p.standardinput; system.io.streamreader sr = p.standardoutput; sw.writeline(@"cd\"); sw.writeline(@"cd " + strinstallutilpath); sw.writeline(strinstallservice); p.waitforexit(); sw.close(); you don't need start command prompt. have start installutil , pass appropriate paramters. modified code snippet, invokes insta

makefile - PARALLEL submakes -

i have been working makefiles reduce compilation time. have 2 questions 1) found if run make in sub directory of main directory, runs perfectly. mean subdirectory independent of other sub-directories , can run in parallel? 2) how run sub-makes being called recursively in parallel? tell me other -j recently simplified makefile, prerequisite other changes add features , speed things up. the simplification included removing use or recursive make. surprised discover build twice fast (from 40 minutes 20 minutes). use -j option, improving speed more. i made other changes had smaller effect.

debugging - How to find out if a Java process was started in debugger? -

i use timer call system.exit in order kill throw-away code snippet after few seconds, quite useful in case eats 100% cpu , windows gets irresponsible because of this. it's quite handy, except in case start in debugger. in debugger i'd disable automatically, otherwise forget , debugged process gets killed. can find out if process started in debugger? note: know should not use serious. i'm not going to. check here . checks jdwp . basically: boolean isdebug = java.lang.management.managementfactory.getruntimemxbean(). getinputarguments().tostring().indexof("-agentlib:jdwp") > 0;

How can a python object's classmethods be referred to inside the class attributes? -

i along lines of... class myclassa(object): an_attr = anotherclassb(do_something=myclassa.hello) @classmethod def hello(cls): return "hello" however tell me myclassa not defined when try run it. an_attr must class attribute i can't alter anotherclassb i prefer if hello() remained classmethod any ideas? you have order right, it's defined before use it: class myclassa(object): @classmethod def hello(cls): return "hello" an_attr = anotherclassb(do_something=hello) note that, because it's in namespace when we're creating class, refer hello , not myclassa.hello . edit : sorry, doesn't thought did. creates class without error, anotherclassb gets reference unbound classmethod, can't called.

php - Does array_a contain all elements of array_b -

if $array_b $array_b = array('red', 'green', 'blue'); what's efficient way compare $array_a , boolean whether $array_a contains elements of above $array_b . this output i'm trying to //false, because it's missing red `$array_b` $array_a = array('green', 'blue'); //true, because contains 3 `$array_b` $array_a = array('red', 'green', 'blue'); //true, because contains 3 `$array_b` //even though there's orange , cyan $array_a = array('red', 'green', 'blue', 'orange', 'cyan'); what's way without nasty nested loops hard keep track of? if (count(array_intersect($array_a, $array_b)) == count($array_b)) { ... } or function function function_name($array_a, $array_b) { return count(array_intersect($array_a, $array_b)) == count($array_b); }

gwt - Treepanel masking -

how can mask tree panel until loader loads data server??(at initial loading) the simplest thing call setvisible(false) on treepanel when first create , make visible in rpc callback. a more visually elegant approach use setenabled(false) combined css style changes widget more neutral appearance indicate "there data here, can't use yet". setting background light grey color, or perhaps turning down opacity of panel.

codeigniter - Datamapper: Save more than one value in a relationship -

i’m totally new @ ci , datamapper , wanna simple thing, think. i have database 3 tables courses students students_courses i’m using models student <?php class student extends datamapper { var $has_many = array('course'); } courses <?php class course extends datamapper { var $has_many = array('student'); } and controller add students , select courses students controller function add(){ $estudiante = new student(); $estudiante->name = $this->input->post('nombre'); $estudiante->save(); $user = new student(); $curso = new course(); $user->get_by_name($estudiante->name); $curso->get_by_name($this->input->post('curso')); $user->save($curso); $this->load->view('student/confirm');

java - How to test percentage in an if statement? -

how can test percentage in if statement? for example: package walker; public class walker { int tuning = 10; int speed = 0; int gas = 100; int energy = 100; int time = 1; int strecke = 0; boolean test = true; boolean beschleunigung = false; walker() { tuning = 10; gas = 0; energy = 100; } public void setgas(int x) { gas = x; } public void setspeed(int x) { tuning = x; } public void walk() { boolean walking = true; while (walking) { if (speed<10) { beschleunigung = true; }else { beschleunigung = false; } if (beschleunigung==true) { speed +=1+(tuning);

javascript - How to visually format remote server XML query response? -

i'll preface stating rank amateur when comes web dev. i have web appliance provides xml data when issued query string such as: https://example.com/api/reporting.ns?username=name&password=password&generate_report=supportsession&start_date=2009-04-01&duration=0&limit=all i created simple form allows users modify values of query , have appropriate xml returned. here form: <form id= "report" action="https://example.com/api/reporting.ns?" name="report"> username: <input name="username"><br /> password: <input type="password" name="password"><br /> <input type="hidden" name="generate_report" value="supportsession"> start date: <input name="start_date"> <input type="hidden" name="duration" value="0"> <input type="hidden" name="limit" value="all">

c# - Showing Difference between two datetime values in hours -

i retrieving 2 date time values database. once value retrieved, need difference between 2 values. that, create timespan variable store difference of 2 date values. timespan? variable = datevalue1 - datevalue2; now need show difference stored in timespan variable in terms of number of hours. referred timespan.totalhours couldn't apply same reason. how do that? using c# on mvc project. simple need show difference value in hours? edit: since timespan nullable, couldn't use total hours property. can use doing timespanval.value.totalhours ; i think you're confused because haven't declared timespan you've declared timespan? nullable timespan . either remove question mark if don't need nullable or use variable.value.totalhours .

version control - Diff file viewer? -

i'm looking tool displays diff files (generated mercurial, in case) in convinient manner. example, way bugzilla displays diff patches. clear, i'm not looking compares/merges files, got diff, want convinient way inspect it. i couldn't find (diff syntax highlighters closest thing got), knows of anything? have tried meld? (it works in unix though..)

osx - Getting input to an executable via stdin? -

i have executable need take input .wav file on desktop. executable expects input on stdin. let use example: /users/tomcruise/desktop/executable /users/tomcruise/desktop/music.wav i using mac os x. open terminal , following: $ cd /users/tomcruise/desktop $ ./executable < music.wav

c# - How do I change project references from SQL Server 2005 to SQL Server 2008 during a build? -

i'm building project references sql server 2005 assemblies, have option of building using 2005 or 2008 assemblies. currently can open each project , change references, i'm looking better way this. is there easy way i'm missing? if not possible modify these script set using script pre-build? i don't know if it's best available solution, can implement custom msbuild task reads csproj or vbproject (or other) file , modify depending on msbuild property set target caller. visual studio projects valid xml files, can use xmldocument or xdocument. your custom task like: <changemssqlversion version="2008" files="@(projectfile)" />

iphone - What is a runloop? -

after reading documentation nsrunloop did not understand much. spawning secondary thread has nstimer in launch every 1sec. update label on screen performselectoronmainthread.. however work needed runloop not understand concept of it? anyone try explain it? thanks. a run loop effectively: while(... event ...) ... handle event ...; it runs on thread; main thread has main event loop user events processed , ui drawing, etc, occurs. documentation explains in detail . however, in case, you don't need thread . it sounds doing periodically updating label in ui; isn't terribly compute intensive. just schedule timer in main thread , done it. no need spinning thread, using performselectoronmainthread: , or incurring complexities of guaranteeing data coherency across threads. sorry -- didn't understand question. internally, run loop works putting flag in run loop says "after amount of time elapses, fire timer". no additional threa

New oData javascript library (from MSFT) compared to jQuery -

what benefit of new javascript odata library on using jquery? http://blogs.msdn.com/b/astoriateam/archive/2011/02/08/new-javascript-library-for-odata-and-beyond.aspx jquery @ , datajs doesn't try duplicate of features, it's hard answer question in terms. datajs implements extensive odata support, including multiple formats, support parsing conceptual models, ability enhance results when metadata known, batch handling, etc. jquery supports json usage, that's matter of encoding - there no support odata-specific behavior. if you're talking odata server, you'll better off using datajs, , can use jquery else: animations, document building, controls, templating, etc.

boolean - PHP - Get bool to echo false when false -

for reason, following code doesn't print out anything: $bool_val = (bool)false; echo $bool_val; but following code prints out 1: $bool_val = (bool)true; echo $bool_val; is there better way print out 0 or false when $bool_val false adding if statement? edit: changed second statement false true echo $bool_val ? 'true' : 'false'; or if want output when it's false: echo !$bool_val ? 'false' : '';

android - Reference control using string instead ID -

typical way reference android control this: textview tv = (textview)findviewbyid(r.id.tv); where r.id.tv integer referencing xml control. the thing make reference using string "r.id.tv". possible? let's have multiple controls: tv1, tv2, tv3, tv4, tv5, how put sort of loop , interate through controls. thinking use loop counter reference different controls. how's done? thanks. have @ question: using findviewbyid string in loop

xml - JAXB Performance -

in current project have requirement need build xml document. planning go jaxb creating java domain classes , marshall xml. efficient approach? if not can suggest better approaches xml building? see ivan-ivanovich-ivanoff 's answer similar question posted . short answer jaxb going best approach.

cpu usage - Java CPU resource hog, 100% -

i have written program when starts runs 96% cpu , tips cpu 100% before crashing. need trace being done cpu whether program running though or particular method or call being worked on. any suggestions or links? thanks. java visualvm should help. tool included in standard jdk. allows profile , inspect running java program. should in same directory javac executable. here quick synopsis of command line use invoke tool.

c++ - Quick question about glColorMask and its work -

i want render depth buffer nice shadow mapping. drawing code though, consists of many shader switches. if set glcolormask(0,0,0,0) , leave shader programs, textures , others are, , render depth buffer, 'ok' ? mean, if glcolormask disables "write of color components" , mean per-fragment shading is not going performed ? for rendering shadow map, want bind depth texture (preferrably square , power of two, because stereo drivers take hint!) fbo , use 1 shader (as simple possible) everything. not want attach color buffer, because not interested in color @ all, , puts more unnecessary pressure on rop (plus, hardware can render double speed or more depth-only). not want switch between many shaders. depending on whether "classic" shadow mapping, or more sophisticated such exponential shadow maps, shader use either simple can (constant color, , no depth write), or performs (moderately complex) calculations on depth, not want perform colour calculatio

NGINX compile and gzip config (with rails 3 + php-fpm): "can't unzip" by torrent client from php tracker -

hi there: have got weird question new server installed nginx+php-fpm+passenger. latest version. have got configured well, web pages running, when users tried access php tracker of private tracker, returns them error: "can't unzip". utorrent. on vuze java gzip exception saying it's not valid gzip file or so, shows server has been returning gzip data clients don't understand. so here's nginx.conf: user www-data; worker_processes 4; events { worker_connections 1024; } http { passenger_root /home/meng/.rvm/gems/ruby-1.9.2-p136/gems/passenger-3.0.2; passenger_ruby /home/meng/.rvm/wrappers/ruby-1.9.2-p136/ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_static on; gzip_disable "msie [1-6]\.(?!.*sv1)"; gzip_comp_level 2; gzip_vary on; gzip_proxied any; gzip_types text/plain text/css application/x-javascript

Autocomplete breaks when I add jQuery UI.js -

i have site form autocomplete using jquery. works fine, when add jquery ui page, stops working. have idea why or how fix it, can't seem find why. the code autocomplete follows: head: <script type="text/javascript" src="js/jquery-1.5.js"></script> <script type='text/javascript' src='jquery.autocomplete.js'></script> <script type="text/javascript"> $().ready(function() { $("#food").autocomplete("search.php", { width: 260, cachelength: 10, matchcontains: false, //mustmatch: true, //minchars: 0, //multiple: true, //highlight: false, //multipleseparator: ",", selectfirst: true }); }); </script> body: <input type="text" name="food" id="food" / > so when add following line head in code s

c# - SQLDatasource parameters problem -

why if use following instruction in code behind: sqldatasource1.selectparameters["page"].defaultvalue = "0"; i 'system.nullreferenceexception: object reference not set instance of object. '? the 2 objects involves in single statement (bold) sqldatasource1 .selectparameters["page"].defaultvalue sqldatasource1.selectparameters["page"] .defaultvalue so 1 of them must null. when looking @ previous question, because have not yet added "page" parameter sqldatasource1 .

asp.net - RadListView insertitemtemplate still showing after insert -

i have pretty simple scenario using manual data operations rad list view. insert item collection in iteminserting event, listview shows new item insertitemtemplate still showing. setup wrong? have manually hide thing? markup <%@ page language="vb" autoeventwireup="false" codefile="test2.aspx.vb" inherits="test2" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <telerik:radscriptmanager runat="server" id="rsm"></telerik:radscriptmanager> <div> <telerik:radlistview id="rlv" runat="server" datakeynames="userid" itemplaceholderid=&

user interface - How do I load random levels? -

i'm using unity 3 build game. have basic gui button when clicked, user taken random level. there 10 levels in game. below copy of code i'm trying implement. function ongui () { // make background box gui.box (rect (10,10,100,90), "oracle"); if (gui.button (rect (20,40,80,20),9)); { application.loadlevel(random.range(0,9)); } } it's not happening. i've tried: function ongui () { // make background box gui.box (rect (10,10,100,90), "oracle"); if (gui.button (rect (20,40,80,20))); { application.loadlevel(random.range(0, application.levelcount 9)); } } i've never used random.range function before , confused @ proper format. also have ez gui available , wondering if enter correct random range script 'script' dropdown or 'script method' drop down work it, i'd rather use custom button. assistance appreciated. here code worked. rebuilding , adding few m

sql - USE MULTIPLE LEFT JOIN -

is possible use multiple left join in sql query? if not whats solution? left join ab on ab.sht = cd.sht i want add atach 1 more query it? work? left join ab , aa on ab.sht = cd.sht , aa.sht = cc.sht wil work? yes possible. need 1 on each join table. left join ab on ab.sht = cd.sht left join aa on aa.sht = cd.sht incidentally personal formatting preference complex sql described in http://bentilly.blogspot.com/2011/02/sql-formatting-style.html . if you're going writing lot of this, help.

java - Hudson plug-in not publishing all artifacts to Artifactory -

i've got small java project setup build continuously through hudson server. i'd publish build artifacts artifactory server post-build step so, naturally, i'm using hudson-artifactory plug-in facilitate this. local publish appears work fine - publishes 2 artifacts (both .jar files) , resolved ivy.xml file expected. when request build on hudson server, however, 1 of 2 artifacts gets published. the build creates following artifacts: ftpsvc.jar ftpsvc-lib.jar my ivy.xml file looks this: <?xml version="1.0" encoding="iso-8859-1"?> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> <info organisation="esf" status="integration" module="ftpsvc" revision="snapshot" /> <publications> <artifact name=&qu

dependency injection - EJB3 vs Data Access Objects -

i working on project need decide how going expose our persistence layer. there 2 options on table: 1) use plain daos. these implement interface , injected (probably using weld) in business components ejbs. internally use jpa/hibernate persistence. 2) rather injecting daos using weld, implemented ejbs, , injected @ejb in business components. does make sense use ejbs persistence layer when not using capabilities (e.g. transaction management - business layer deals this)? is there performance penalty in using ejb on weld (or other way round)? what option think best? using ejbs jpa based dao natural fit. if transaction starts in business layer (which ejbs mention) transaction naturally propagate them. should ever want use dao separately, transaction started you. may not use feature now, comes totally free should ever need it. also, should ever need single operation in own transaction, trivial when daos ejb based. injecting business ejbs dao ejbs may have poten

android - Why does Eclipse keep defaulting my Run config as Javabean? -

i using helios service release 1, android sdk 2.3.1 api 9 r2. everytime create new android project, , got run gives me error trying run javabean! in order run have either add project android app in run config. or right click on project , select run android app.. have problem or can suggest can try change default? thanks i not use android sdk, solved problem in eclipse instance uninstalling visual editor component. (e.g. this, depending on eclipse version: menu->help/install new software/what installed/installed software)

java - Spring and XSLT, character encoding -

i have problem proper charset encoding part of html view. xsl file in jsp files generates .html. values database encoded correct, static headers of table contain wrong characters. for example, there headers named: imiÄ™, nazwisko, hasÅ‚o, pÅ‚eć, generates: imiÄ™, nazwisko, hasÃ…‚o, pÃ…‚eć my forhomehtml.xml template: <?xml version="1.0" encoding="utf-8"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" version="1.0"> <xsl:output method="xhtml" encoding="utf-8" indent="yes" doctype-public="-//w3c//dtd xhtml 1.0 strict//en" doctype-system="http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" /> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="/employees"> <ta

swing - How can I draw lines, rectangles, and circles in my Java paint program? -

i'm working on paint program 1 of classes , i'm stuck. part of code (separated 3 java classes). when click on button "ligne", want able draw line in white rectangle. sorry french comments. //cree une fenetre public class question { public static void main(string[] args) { paint_gui test2 = new paint_gui(); } } import java.awt.*; import javax.swing.*; //class contenant le code pour dessiner public class paint_dessin extends jpanel { public void paintcomponent(graphics g) { super.paintcomponent(g); setbackground(color.white); g.setcolor(color.black); } public void tracerligne() { system.out.println("ligne"); } } import javax.swing.*; import java.awt.event.*; import java.awt.*; public class paint_gui extends jframe { //panels contenant tout les bouton de mon interface private jpanel panelbtn; //bar d'outil btn

boost - STL transform is not working with BGL -

i'm new bgl. i'm trying transform range of edges equivalent objects usable in system. std::vector<my_obj*> return_value(distance(all_edges.first, all_edges.second)); std::transform(all_edges.first, all_edges.second, return_value.begin(), bind(&graph::transform, this, _1)); but i'm getting error couldn't understand: /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_algo.h: in function `_outputiterator std::transform(_inputiterator, _inputiterator, _outputiterator, _unaryoperation) [with _inputiterator =boost::detail::adj_list_edge_iterator<std::_list_iterator<void*>, boo st::detail::out_edge_iter<std::_list_iterator<boost::detail::sep_<void*, boost::property<boost:: edge_bundle_t, my_obj*, boost::no_property> > >, void*, boost::detail::edge_desc_impl<boost::dir ected_tag, void*>, ptrdiff_t>, boost::adjacency_list<boost::lists, boost::lists, boos

How can I call `update_attribute` for a list item in rails then actually update the html using jquery? -

i want users able mark 1 or more items index view "active" or "inactive" using link. text link should state aware - might default "mark active" if corresponding attribute false or null, , "mark inactive" if true. once user clicks link , attribute updated in controller, link-text should update based on new state. i way off here, small sample of code have been trying... controller ... respond_to :html, :js ... def update @item = item.find(params[:id]) if @item.update_attributes(params[:item]) #not sure of how respond .js here end end ... update.js.erb #how identify element update? $('#item[13456]').html("state aware text link_to") view - item in @items = item.name = link_to "mark active", item_path(item), :method => :put, :remote => true. :id => "item[#{item.id}]" i happy read apis, blogs, tutorials, etc. can't seem hands/mind around task. or guidance appreciate

expressionengine - expression engine: best way to handle user data, defined member fields or tie to a channel? -

in expression engine: i have site businesses can sign , sell 1 type of widget. each business needs name, widget , price. there page shows business, widget , price. what best way handle parameters 'widget' , 'price'? from can work out there 2 options 1/ sign business user in group no admin privilages. add 2 custom member fields 'widget' , 'price' users. (it may not called 'member' field, i'm going off memory). show these business grab users. or 2/ sign business user in group no admin privilages. add 1 custom member field called 'id'. create 'business' channel , channel add custom fields 'name', 'widget', 'price', 'user_id'. link instance of business channel user 'id' property. when want show these business grab details channel. sorry if answered somewhere. i'm not getting luck google, because i'm having trouble phrasing question succinctly enough. thanks da

c# - How to block all connections from Europe on a TCPListener -

is there simple way using tcplistener in c# block incoming connections european continent? need following in order decide whether or not block connection: determine client's location (if in europe, proceed step 2, otherwise, bypass security check) read authentication token client (session id). if session id indicates customer citizen of non-european country, authorize connection. otherwise, close networkstream immediately. you try polling using c# geoip locator , doing dnsbl list application (though assume you're doing such asking question).

wordpress - mod_rewrite replace query string key -

in short, i'm trying change given url: http://mydomain.com/category/title/attachment/randomstring_?resolution=320x480 with http://mydomain.com/category/title/attachment/randomstring_320x480 in essence, removing ?resolution= query string , adding value path. the category, title, , randomstring values dynamic, placement should same. i don't know if matters, being used in wordpress. i tried following, 404: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{query_string} ^resolution=([0-9]{3,4}x[0-9]{3,4})$ rewriterule ^$ ${request_uri}%1/? [r] rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> any appreciated ;) well, after lot of trial , error (and reading rewritelog output), got working following: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{query_string} ^res

mysql - Wordpress SQL Command to Set all posts by author John Doe to draft -

i'm importing posts site. i've set posts specific author (john doe in case) , want run sql query (in phpmyadmin) gets john's posts , sets them draft. ideas? assuming database schema same 1 found here , accomplish following query: update wp_posts inner join wp_users on wp_posts.post_author = wp_users.id set wp_posts.post_status = 'draft' wp_users.user_login ='john doe' , wp_posts.post_type ='post' if know userid of "john doe" can use update wp_posts set post_status = 'draft' post_author =12345 , post_type ='post' you may want see support topic @ wordpress