Posts

Showing posts from February, 2012

Eclipse debugger does not recognize new java code -

i have added new method javacode , put breakpoint @ begin of method , different places. eclipse debugger go throw breakpoints in old code not in new added method. have cleared project project-> clear exclude cache possibility. me, appears eclipse dont recognize new added java code. any idea problem? use eclipse juno service release 2. you need stop debugging , start program again since signature has changed. if want more hot-swap possibilities need consider using jrebel or similar tool.

How to make 2 jQuery functions work? -

i have 2 jquery functions on website: fotoslider , scrollit function. can use 1 function because other won't work. depends on 1 put @ bottom. i have barely knowledge jquery need functions on site. the function working here fotoslider because it's @ bottom. html: <link href="ppgallery/css/ppgallery.css" rel="stylesheet" type="text/css" /> <link href="ppgallery/css/dark-hive/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script> <script type="text/javascript" src="ppgallery/js/ppgallery.js"></script> <script type="text/javascript"> $(docum...

Spring Repository Pattern -- One or zero results are found though tables are populated -

i having these weird problems 'repository' in spring. well, think it's weird, don't know spring @ all. the problem: though know there's hundreds of rows of data in respective database tables, 1 of repositories returns 1 item (result type list<...>), , other 1 returns nothing @ all, when calling findall(). i suspected there might problems not using standard auto-generated long id, hence second repo, implemented second @entity type auto-generated long id, , populated data in same way. also tried @query "select f typename f" see if there difference. there not. so, might problem here? tried step implementation of interface, it's ridiculous try step through spring invocation handler chain; , maybe code behind generated bytecode or whatever. tips on how debug welcome indeed. @transactional(propagation = propagation.required) public interface newforumpersistence extends jparepository<syncnewforum, long> { @query("select f...

excel - Marshaling COM objects between Python processes using pythoncom -

i'm hoping can me being able make marshaled cross-process call excel python. i have excel session initiated via python know , running when needs accessed separate python process. have got working desired using marshaling comarshalinterfaceinstream() , cogetinterfaceandreleasestream() calls pythoncom module, need repeat access stream (which can set once in case), , cogetinterfaceandreleasestream() allows once-only access interface. i believe achieve can done createstreamonhglobal() , comarshalinterface() , counmarshalinterface() unable working, because not passing in correct parameters. rather describe in detail main scenario, have set simple example program follows - takes place in same process 1 step @ time! following snippet works fine: import win32com.client import pythoncom excelapp = win32com.client.dispatchex("excel.application") marshalledexcelapp = pythoncom.comarshalinterthreadinterfaceinstream(pythoncom.iid_idispatch, excelapp) xlapp = win32c...

c++ - initialization of 'unused' is skipped by 'goto label' - why do I get it for std::string but not for int? -

i bumped against error in code, , after experimenting stumbled upon weirdness - std::string , not int . for std::string error c2362: initialization of 'unused' skipped 'goto label' : { goto label; std::string unused; label:; } for int i don't error , however: { goto label; int unused = 10; label:; } why difference? because std::string has non-trivial destructor? this covered in draft c++ standard section 6.7 declaration statement says ( emphasis mine ): it possible transfer block, not in way bypasses declarations initialization. a program jumps 87 point variable automatic storage duration not in scope point in scope ill-formed unless variable has scalar type, class type trivial default constructor , trivial destructor , cv-qualified version of 1 of these types, or array of 1 of preceding types , declared without initializer (8.5). and provides following example: void f() { // ... goto lx; // ill-formed: jump sc...

mysql - Why is this query duplicating results? -

Image
i'm not experienced when comes joining tables may result of way i'm joining them. don't quite understand why query duplicating results. instance should return 3 results because have 3 rows specific job , revision, returning 6, duplicates same first 3. select checklist_component_stock.id, checklist_component_stock.job_num, checklist_revision.user_id, checklist_component_stock.revision, checklist_category.name category, checklist_revision.revision_num revision_num, checklist_revision.category rev_category, checklist_revision.per_workorder_number per_wo_num, checklist_component_stock.wo_num_and_date, checklist_component_stock.posted_date, checklist_component_stock.comp_name_and_number, checklist_component_stock.finish_sizes, checklist_component_stock.material, ...

ruby on rails 4 - Load testing results on blitz.io and new relic for the same config show different queuing times -

i testing rails 4.0 app on blitz.io , new relic.. blitz: 200 users, 4000 timeout, in 60sec. heroku: 20 dynos (2x standard dynos). database: postgresql 200 connections plan using unicorn @ 7 processes(new relic shows app uses 140mb, 2x standard dyno, 1gb, , 1024/140 7. link ref in below line) ref: http://blog.bignerdranch.com/2188-how-to-improve-rails-application-performance-on-heroku/ for same config , multiple tests see response queuing in new relic ranging 240ms 443ms. know why varying much. else should monitoring. how can reduce atleast 50ms? ideal response queuing time? thanks

c# - Is a serialized object portable? -

in c# application saved class objects serialization. have binary file on disk. file portable in sense installations of same application on other systems recognzie it? there disadvantages consider? if have exact same version of app, pretty serializer happy. when start iterating versions, assuming using binaryformatter , can start hitting version compatibility issues, particularly if have refactored (moved / renamed types, moved / renamed fields, etc). why recommend not using binaryformatter persistence. if want data stored, there wide range of other serializers work great; xmlserializer , json.net, protobuf-net, datacontractserializer , etc - handle versioning more gracefully binaryformatter . if want binary performance reasons (large files, etc), protobuf-net may worth (but i'm biased). otherwise, use compression - xml , json compress pretty well. additionally, note binaryformatter not work at all between other platforms, or generally on other .net frameworks (i...

Doctest and Decorators in Python -

i trying use python decorator catch exceptions , log exceptions. import os.path import shutil class log(object): def __init__(self, f): print "inside __init__()" self.f = f def __call__(self, *args): print "inside __call__()" try: self.f(*args) except exception: print "sorry" @log def testit(a, b, c): print a,b,c raise runtimeerror() if __name__ == "__main__": testit(1,2,3) it works fine desktop> python deco.py inside __init__() inside __call__() 1 2 3 sorry the issue when tried use testing doctest @log def testit(a, b, c): """ >>> testit(1,2,3) """ print a,b,c raise runtimeerror() if __name__ == "__main__": import doctest doctest.testmod() nothing seems happening. desktop> python deco2.py inside __init__() what's wrong this? the decorated fun...

c# - Linq - get objects with a list property that does not contain values in another list -

i feel complete idiot not being able work out myself. i have list of "booking" objects called existingbookings. have observablecollection of "count" objects each of has "bookings" property list of "booking" objects. using linq, how select count objects "bookings" property not contain of "booking" objects in existingbookings? i.e. list<booking> existingbookings = new list<booking>(); existingbookings.add(booking1); existingbookings.add(booking2); count1 = new count(); count1.bookings.add(booking2); count1.bookings.add(booking3); count2 = new count(); count1.bookings.add(booking3); count1.bookings.add(booking4); list<count> counts = new list<count>(); counts.add(count1); counts.add(count2); i expecting output list of count objects containing count2, since neither of booking objects exist in existingbookings. please put me out of misery :( assuming booking class implements equa...

c preprocessor - How to generate a warning when a deprecated variable / structure is used -

sorry seems noddy question how compiler generate warning when variable / structure used? for example if have following code: int getabstractedfoo() { return 1; } struct new_name { int foo; } typedef new_name old_name; how do #warning "warning "old_name" depreciated please use new_name" and expanding on further how "warning accessing foo directly has been depreciated please use "abstractedfoo"? i have had trouble googling beyond basic #warning when header used. -thanks, chris ah bit more digging , came across post , fab answer michael platings: c++ mark deprecated i think purposes shall extend macro to: #define deprecate( var , explanation ) var __attribute__((availability(myframework,introduced=1,deprecated=2.1,obsoleted=3.0, message= explanation))); deprecate ( typedef old_name new_name, “please use new_name”);

python - How to print a word in a list which has been assigned a random number? -

i wondering if me problem. in piece of code working on, creating game upon user guesses word list imported text file in python 3.3. choose random word list e.g words = random.randint(0,len(wordlist)) i have successfully, got program working, when user gets word wrong, prints random number assigned not word list. example else: print("no, answer was",words) i wondering how print word list not random number? don't use random number @ all. use random.choice() function instead: words = random.choice(wordlist) random.choice() picks random item list. your use of random.randint() has 2 problems: you need use wordlist[words] each time want word; never interested in random integer, there no point in storing that. but words = wordlist[random.randint(0, len(wordlist))] is rather more verbose random.choice() alternative. random.randint() picks number between start , stop values, inclusive . means can end picking len(wordlist) , there no ...

html - php empty post array with file upload -

<form method="post" enctype="multipart/form-data"> <h3>add video</h3> <div class="field_wrap"> <p>name</p> <input type="text" name="title"/> </div> <div class="field_wrap"> <p>video</p> <input name="video" type="file" /> </div> <p><button>add</button></p> </form> this form use upload video file , title, when don't upload file $_post variable filled form data, if upload file $_post variable empty, why that? you looking in wrong spot, try looking in $_files not $_post

c++ - What are constrained templates? -

herb sutters mentioned constrained templates (a.k.a. concepts lite) in talk: modern c++: need know . i know boost has concepts package in ages, allows 1 pretty print error messages, when template deduction mechanism fails find operators, functions or has access violation patterns. i've encountered mentions on isocpp blog there experimental branch of gcc implementing document proposing concepts lite . looking through current c++14 draft couldn't find hints whether part of c++14 . so questions simple: will concepts lite part of c++14? (reference in standard preferred. not find one, , i'm not familiar standard.) what correct syntax of it? (the proposal , slides of herb diverge here , don't know 1 more date) could give minimal example of constraint (predicate) , constrained template? note: if wait long enough i'll try gcc branch running , can @ least experimental implementation, not imply correctness of syntax. concepts lite "constrai...

php - Why does mkdir mode parameter start with 0? -

mkdir function has default value parameter mode 0777 . bool mkdir ( string $pathname [, int $mode = 0777 [, bool $recursive = false [, resource $context ]]] ) every example of mkdir have seen, has mode parameter starting 0. doesn't leading octal digit signify type of file? from this page , 0 means regular file while 3 means directory. so, shouldn't default value mode parameter in mkdir 3777 opposed 0777 . what difference between 2 modes respect mkdir. if creating regular folder, mode value should use? you can pretty confusing information depending on whom ask. modes specify chmod , mkdir , touch , other tools create , modify file permissions tend deal lower-order permission bits, , sticky , set[ug]id bits. higher-order parts of mode, ls -l , stat output, less seen, include file type. the rightmost 9 bits entirely occupied permissions, , next several bits related sticky, setuid , segid bits. note: bin(0777) => '0b111111111' # 9 bits,...

c# - Conditional Assignment of Fields -

i have issue loading in data xml file , saving domain model objects. issue xml file not consistent in not records contain same attributes. for example in code below variable roundingrule may not exist. can somehow put conditional statement around field skipped if there nothing assign. var workrule = new workrule { name = (string) element.attribute("name"), customerid = 11, punchroundruleid = roundingrule, effectivedate = effectivedate, exceptionruleid = exceptionrule, paycodedistributionname = paycodedistributionname, daydivideoverride = daydivideoverride, unapprovedovertimepaycodename = unapprovedovertimepaycodename, exceptionrulename = exceptionrulename, }; you'll need this: var workrule = new { name = element.attribute("name") == null ? "n/a" : (string)element.attribute("name"), };

java - Text extraction and segmentation open CV -

Image
i've never used opencv before, i'm trying write neural network system recognize text , need tool text extraction/ segmentation. how can use java opencv preprocess , segmentate image containing text. i don't need recognize text, need each letter in separate image. something : try code .no need of opencv import java.awt.image.bufferedimage; import java.util.arraylist; import java.util.list; import org.neuroph.imgrec.imageutilities; public class charextractor { private int croptopy = 0;//up locked coordinate private int cropbottomy = 0;//down locked coordinate private int cropleftx = 0;//left locked coordinate private int croprightx = 0;//right locked coordinate private bufferedimage imagewithchars = null; private boolean endofimage;//end of picture private boolean endofrow;//end of current reading row /** * creates new char extractor soecified text image * @param imagewithchars - image text */ public charextractor(bufferedimage imagewithchars) { ...

Stored Procedure for multiple value with single parameter in SQL Server -

Image
i have form in c# listbox selected 4 items. want make single stored procedure using can find data single table selected item single parameter. as beginner when comes sql server, don't know type of procedure thanks, not question's answer want single stored procedure items selected in listbox create procedure procedurename ( @itemname varchar(50), ) begin ( select * item_master item_name = @itemname ) end by query can find data 1 itemname, want selected items in listbox, don't know c# code also, plz me.... this simple example want. not want use hard-coded connection strings, in-line, , want error-handling, going clarity possible. want make column length greater 50 characters, made match column definition. also, recommend generic approach, passing keys (column names) , values, able use sort of criteria, asked keep require, trimmed down essential. this example returns employees firstname matching in list passed stored procedure (as user-defined table ...

vba - Paste text into a Word Document with a specific format -

i'm working on macro i'm stuck @ point. i'm copying text 1 word document another, need text pasted in specific format, neither source formatting, or it's destination's. is possible determine text i'll pasting, gets pasted specific font, specific size, , specific color? the easiest way follows: start recording new macro. paste text. select pasted text. set formatting (font, size, color) require. stop recording macro. borrow heavily auto-generated selection , formatting code of new macro use in original macro.

jquery - Loading lightbox with double click -

is possible set lightbox shows expanded picture when double clicked/tapped rather single click/tap? update: i using code below disable click command on links , make them react double click instead: $('a', this).each(function () { $(this).click(function () { return false; }).dblclick(function () { window.location = this.href; return false; }); }); however, getting page load picture instead of lightbox functionality loads picture overlay. how can call lightbox functionality javascript/jquery function? jquery offers dblclick event handler http://api.jquery.com/dblclick/ javascript offers ondblclick listener http://reference.sitepoint.com/html/event-attributes/ondblclick update: i see, lokesh's lighbox (i'm assuming 1 using, since there several) intrinsically connected single click event, can see on lines 49-55. github.com/lokesh/lightbox2/blob/...

awk: changing OFS without looping though variables -

i'm working on awk one-liner substitute commas tabs in file ( , swap \\n missing values in preparation mysql select into ). the following link http://www.unix.com/unix-for-dummies-questions-and-answers/211941-awk-output-field-separator.html (at bottom) suggest following approach avoid looping through variables: echo b c d | awk '{gsub(ofs,";")}1' head -n1 flatfile.tab | awk -f $'\t' '{for(j=1;j<=nf;j++){gsub(" +","\\n",$j)}gsub(ofs,",")}1' clearly, trailing 1 (can number, char) triggers printing of entire record. please explain why working? so has print fields awk separated ofs , in post seems unclear why working. thanks. awk evaluates 1 or number other 0 true-statement. since, true statements without action statements part equal { print $0 } . prints line. for example: $ echo "hello" | awk '1' hello $ echo "hello" | awk '0' $

Linux - understanding the mount namespace & clone CLONE_NEWNS flag -

Image
i reading mount & clone man page. want clarify how clone_newns effects view of file system child process. (file hierarchy) lets consider tree directory hierarchy. lets says 5 & 6 mount points in parent process. clarified mount points in question . so understanding : 5 & 6 mount points means mount command used 'mount' file systems (directory hierarchies) @ 5 & 6 (which means there must directory trees under 5 & 6 well). from mount man page : mount namespace set of filesystem mounts visible process. from clone man page : every process lives in mount namespace. namespace of process data (the set of mounts) describing file hierarchy seen process. after fork(2) or clone() clone_newns flag not set, child lives in same mount namespace parent. also : after clone() clone_newns flag set, cloned child started in new mount namespace, initialized copy of namespace of parent. now if use clone() clone_newns create child process, ...

javascript - How to capture text value from input field, and pass it to new input field -

i want couple of things happen simultaneously on keypress() event, got 2 pages, default.html there input text box , page.html input text box, need moment key pressed type letter in input text box on default.html, keypress() fires (i need on keypress, not on keyup or keydown) , 'letter' captured var c = string.fromcharcode(e.which); and @ same time page redirected document.location= "page.html"; return false; to 'page.html' showing 'letter' in input text field typed on previous page. have got incomplete code.. $(document).keypress(function(){ var c = string.fromcharcode(e.which); document.location= "page.html"; return false; } }); don't know how use var c here show value text field on next page(page.html). javascript code on page.html...please correct , code.. picked post..i can see value typed on default.html page shows in address bar of page.html not show in input text box,...

Matlab Nested Classes, Reference to object of the same class from within -

i trying create tree class in matlab creation of decision tree. when try run script, first time runs through code, can see arrived @ favorable value of f, , v. however, after part of initialization of new nodes left , right, current object empty. how correctly nest reference same class within class such not interfere each other classdef dtree properties (access = public) maxdepth; currentdepth; features; left; right; f; v; end methods function this=dtree(md, cd, nf, xtrain, ytrain) % real initialization begins this.maxdepth = md this.currentdepth = cd; this.features = nf; this.train(xtrain, ytrain); end function s = gini(dt, labels) s = 1; s = s - (sum(labels > 0.0) ./ numel(labels)) ^ 2; s = s - (sum(labels < 0.0) ./ numel(labels)) ^ 2; end function train(dt, xtrain, ytrain) if (size(unique(ytrain)) == 1 | dt.currentdepth > dt.maxdepth) ...

encoding - Perl Handling Malformed Characters -

i'd advice perl. i have text files want process perl. text files encoded in cp932, reasons may contain malformed characters. my program like: #! /usr/bin/perl -w use strict; use encoding 'utf-8'; # 'workfile.txt' supposed encoded in cp932 open $in, "<:encoding(cp932)", "./workfile.txt"; while ( $line = <$in> ) { # process comes here print $line; } if workfile.txt includes malformed characters, perl complains: cp932 "\x81" not map unicode @ ./my_program.pl line 8, <$in> line 1234. perl knows if input contains malformed characters. want rewrite see if input or bad , act accordingly, print lines (lines not contain malformed characters) output filehandle a, , print lines contain malformed characters output filehandle b. #! /usr/bin/perl -w use strict; use encoding 'utf-8'; use english; # 'workfile.txt' supposed encoded in cp932 open $in, "<:encoding(cp932)", "./w...

matlab - fwrite write the numbers in reverse Byte order -

i'm writing binary values file using fwrite function. problem when write numbers larger 1 byte, writes each byte in reverse order, examples: fwrite(fid,3,'int32'); writes file 03 00 00 00 instead of 00 00 00 03 . fwrite (fid,5076,'int32'); writes file d4 13 00 00 instead of 00 00 13 d4 . how make function write bytes in correct order? you should use machine format parameter , switch litle endian (x86 proccessor (intel amd default value suppose) big endian. look @ http://en.wikipedia.org/wiki/endianness understand endianess mean edit : in link give have put fwrite(fileid, a, precision, skip, machineformat) // replace machine format 'b' in case : fwrite(fid,3,'int32',0,'b');

ruby - Converting nested array to flat hash -

i have this: [["hello", 1], ["world", 1]] i want this: { "hello" => 1, "world" => 1 } i've coded works, feels stupid. here is: hash = {} array.each |element| hash[element[0]] = element[1] end hash is there better way? yes.. below using hash[ [ [key, value], ... ] ] → new_hash hash[[["hello", 1], ["world", 1]]] # => => {"hello"=>1, "world"=>1} if in ruby2.1 use array#to_h [["hello", 1], ["world", 1]].to_h

java - Capturing the color in between? -

i need assignment java. assignment is: create game where: there 2 playing pieces, black , white ones. when piece or line of pieces surrounded opponents on both left , right sides or both front , back, said captured , color changes color of pieces surrounded it. on turn, must capture @ least 1 of opponent’s piece. game ends when user has no more valid moves. , winner assigned player captured more pieces. the board 6x6 , need display results in words, not actual game. know how create board using arrays. don't know how code actual game. appreciated!! know have use lot of "if" statements , loops don't know how it. have far: boarda[0] = "a1"; boarda[1] = "a2"; boarda[2] = "a3"; boarda[3] = "a4"; boarda[4] = "a5"; boarda[5] = "a6"; boardb[0] = "b1"; boardb[1] = "b2"; boardb[2] = "b3"; boardb[3] = "b4"; boardb[4] = "b5"; boardb[5] = "b6"; boardc...

android - What is the meaning of this method? -

this code: public class photo extends activity implements view.onclicklistener { imageview iv; button bt; imagebutton ib; intent ; bitmap bmp; final static int cameradata =0; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); intsallttion(); } private void intsallttion() { // todo auto-generated method stub iv = (imageview) findviewbyid(r.id.iv); bt = (button) findviewbyid(r.id.bt); ib = (imagebutton) findviewbyid(r.id.ib); bt.setonclicklistener(this); ib.setonclicklistener(this); } @override public void onclick(view v) { switch(v.getid()){ case r.id.bt: break; case r.id.ib: = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(i,cameradata); break; } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method s...

c++ - Creating an employee class -

i attempting write following: 1) write class definition class named employee name , salary employee objects. class contains 2 member functions: constructor , function allows program assign values data members. 2) add 2 member functions employee class. 1 member function should allow program using employee object view contents of salary data member. other member function should allow program view contents of employee name data member. 3) add member function employeeclass. member function should calculate employee objects new salary, based on raise percentage provided program using object. before calculating raise, member function should verify raise percentage greater or equal zero. if raise percentage less zero, member function should display error message. 4) write main function create array of employee objects, assign values objects, display names , current salaries objects, ask user raise percentage , calculate , display new salaries objects. i ...

html - make a list item inline when list has list-style-type -

i have simple list: <div>why did duck cross road?</div> <!-- div added context --> <ul> <li>to other side</li> <li class="correct">to prove he's no chicken</li> <li>because chicken's day off</li> </ul> what want highlight correct answer, have class: .correct { background: rgba(3, 113, 200, 0.2); } fiddle the problem want highlight text of list item, ie want correct item inline. but if add display:inline / display:inline-block .correct class - list-style-type gets mangled. fiddle now, know can add span element markup correct item achieve so: <ul> <li>to other side</li> <li><span class="correct">to prove he's no chicken</span></li> <li>because chicken's day off</li> </ul> fiddle ..but wondering whether without span. demo html <ul> <li>to othe...

How to debug Android GPS tracking project? -

i posted question: how track gps if reaches particular location or around 20 meters? that, learned how start, created code track. activity: import java.text.decimalformat; import java.text.numberformat; import android.app.activity; import android.app.pendingintent; import android.content.context; import android.content.intent; import android.content.intentfilter; import android.content.sharedpreferences; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; public class proxalertactivity extends activity { private static final long minimum_distancechange_for_update = 1; // in meters private static final long minimum_time_between_update = 1000; // in milliseconds private static final long point_radius = 500; // in mete...

java - What does "inherently thread-safe" mean? -

i came across line "some functions inherently thread-safe, example memcpy() " wikipedia defines "thread-safe" as: a piece of code thread-safe if manipulates shared data structures in manner guarantees safe execution multiple threads @ same time. ok. inherently mean? related inheritance? it not related inheritance . informal expression , means more like "some functions thread-safe nature". example function not touch shared values/state thread safe anyway i.e. "is inherently thread-safe" .

Reading inputs from Keyboard in Objective C -

i new objective c . know c/c++ . want accept inputs keyboard, let assume program adding 2 numbers. so can use scanf("%d %d",&a,&b); ? objective c superset of regular c , can use c functions scanf() or getchar() , similar!

mysql - LEFT JOIN - losing a line from LEFT table selection -

i have trouble following query: select ifnull(t4.itemid, ifnull(t3.itemid, ifnull(t2.itemid, t1.itemid))) id, ifnull(t4.parentitemid, ifnull(t3.parentitemid, ifnull(t2.parentitemid, t1.parentitemid))) parent, ifnull(tp4.itemno, ifnull(tp3.itemno, ifnull(tp2.itemno, tp1.itemno))) itemno itemsparents t1 left join itemsdb tp1 on t1.itemid = tp1.id left join itemsparents t2 on t1.itemid = t2.parentitemid left join itemsdb tp2 on t2.itemid = tp2.id left join itemsparents t3 on t2.itemid = t3.parentitemid left join itemsdb tp3 on t3.itemid = tp3.id left join itemsparents t4 on t3.itemid = t4.parentitemid left join itemsdb tp4 on t4.itemid = tp4.id t1.parentitemid = ( select id itemsdb itemnoint = 359 ) this table should return 2 rows (822 , 875) first part of selection , append more rows following itemsparents left joins . appends new rows, 1 row original 2 gets lost.   822   859   834   846   810 ...so ...

How can I write multiline strings in Haskell? -

let's have string literal line breaks: file :: string file = "the first line\nthe second line\nthe third line" is there way write this? file :: string file = "the first line second line third line" the attempt above leads error: factor.hs:58:33: lexical error in string/character literal @ character '\n' failed, modules loaded: none. you can write multiline strings so x = "this text escape \ \ , unescape keep writing" which prints as "this text escape , unescape keep writing" if want print 2 lines x = "this text escape \n\ \ , unescape keep writing" which prints as this text escape , unescape keep writing

Rails: How does the console decide which Ruby version to use? -

i'm bit confused ruby version that's being used on machine - can explain why rails console (or appears be) using different version of ruby (2.1.0) rest of below commands return (2.1.1) ? $ bundle exec rails c loading development environment (rails 4.1.0.rc2) 2.1.0 :001 > => 2.1.0 $ ruby -v ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux] => 2.1.1 $ ruby /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby => 2.1.1 $ rvm list rvm rubies =* ruby-2.1.1 [ x86_64 ] # => - current # =* - current && default # * - default => 2.1.1 edit: $ rvm info ruby-2.1.1@rails410rc2: system: uname: "linux [...] 3.11.0-18-generic #32-ubuntu smp tue feb 18 21:11:14 utc 2014 x86_64 x86_64 x86_64 gnu/linux" system: "ubuntu/13.10/x86_64" bash: "/bin/bash => gnu bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)" zsh: " => not installed" rvm: version: ...

android - Grab return value of asynctask? -

is possible grab return value of doinbackground()-method? jsonarray response = new supportfunctions.executeurlwithresponse().execute(url); it tells me: description resource path location type type mismatch: cannot convert asynctask<string,void,jsonarray> jsonarray contactfunctions.java /buddycheck/src/com/pthuermer/buddycheck line 138 java problem something this? is possible grab return value of doinbackground()-method? not in manner trying. there get() method can call block current thread , wait asynchronous work complete. not want -- want work done asynchronously (otherwise, why have asynctask ?). move code needs jsonarray response either onpostexecute() or other method executed onpostexecute() .

amazon web services - Hello World PipeLine with ShelCommandlActivity -

Image
i'm trying create simple dataflow pipeline single activity of shellcommandactivity type. i've attached configuration of activity , ec2 resource. when execute ec2resource sits in waiting_on_dependencies state after sometime changes timedout. shellcommandactivity in canceled state. see instance launch , quicky changes terminated stated. i've specified s3 log file url, never gets updated. can give me pointers? there guidance out there on debugging this? thanks!! you forcing instance shut down after 1 minute gives timeout status if can't execute in time. try increasing 50 minutes. also make sure using ami runs amazon linux , using full absolute paths in scripts. s3 log files written as: s3://bucket/folder/

javascript - socket.io emitting every second -

really quick question. i'm creating synced streaming app emit current timecode of what's being played every second through socket.io , broadcast down other clients. is wise? there drawbacks making same call every second, can make other calls @ same time? p.s. i'm not making database calls or doing processing server-side. with not many clients viewing videos should fine, experience small lags if number of users viewing starts big. another approach keep track on server example can this video loads autoplay or emit event start timer server-side // client-side socket.emit('videoplaying',/* video data */); on server side start small timers based on socket ids function timer(videoinformation){ this.currenttime=0; this.startedat=+new date(); this.endedat=null; this.title=videoinformation.title||'untitled'; this.interval=null; this.play=function(){ var self=this; this.interval=setinterval(function(){ self.currenttime=+n...