Posts

Showing posts from June, 2014

java - Unable to 'read' text file after creating and adding data to it -

i've received regarding how append text file, seems i've broken else. i'm not able 'read' file. what i'm trying is: enter data gui text fields click save button(creating file , appending data .txt file) be able read file panel i'm doing dumb again, fear. below java code gui, createtextfile, , readtextfile import java.awt.color; import java.awt.flowlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.sql.sqlexception; import javax.swing.*; public class donorgui extends jframe { // components private jpanel panel; private jtextarea results; private jbutton entrybutton; private jbutton exitbutton; private jbutton clearbutton; private jbutton savebutton; private jbutton openbutton; private jtextfield donorfield; private jtextfield charityfield; private jtextfield pledgefield; //create variables string[] donorname = new string[20]; string[] cha...

Hadoop MapReduce: Two values as key in Mapper-Reducer -

how can build key 2 components? reason have undirected graph. there edge between 2 nodes , b if , b associated through communication (the direction irrelevant). communication has numerical parameter. achieve have key combines , b set, communication b , b can considered equivalent , summed stats say: a b 5 b 10 the key should semantically "a or b together", set containing , b key should have value 5+10=15. the wordcount example has key specific words. in case, want have key set 2 components. during map , reduce phases, sum long b or b satisfies. thx! in addition (correct) answer david: if problem has graphs have @ http://incubator.apache.org/giraph/ also.

iphone - Change color of Zxing frame on scan -

i working on qr code scanner using zxing , wondering if there way change color outline of frame after successful scan, scan app in appstore does. thanks. sure, it's possible, takes customization/effort. color hard coded in overlayview.m . you'd need make not hardcoded , tell overlay view redraw @ appropriate times. alternatively/fwiw, "flash" screen: add full screen white view , fade away, bit flash on camera. doesn't require interaction lower level code and, personally, effect better, @ least in context.

ruby on rails - HTML content for button_to -

i using link_to: <%= link_to edit_webcast_path(@webcast), :class => 'btn' %> <i class="icon-pencil"></i> edit webcast <% end %> but want same button_to, button_to must have first label argument passed or use path label. <%= button_to edit_webcast_path(@webcast), :class => 'btn' %> <i class="icon-pencil"></i> edit webcast <% end %> ... results in button label resolved edit_webcast_path(@webcast) path. in effect seems have no effect. i have tried passing html directly first argument: <%= button_to "<i class=\"icon-white icon-minus-sign \"></i> edit webcast".html_safe, webcast_path(@webcast), :class => 'btn'%> but results in button label displaying part of html string pass in. looking @ generated html can see contents of first argument placed in input's value attribute , not inside input itself. how can work? ...

c# - binary formatter to string -

binaryformatter formatter = new binaryformatter(); using (memorystream m = new memorystream()) { formatter.serialize(m, list); streamreader sr = new streamreader(m); hiddenfield1.value = sr.readtoend(); } i'm getting blank value hiddenfield1.value. not sure i'm doing possible? list populated (is list<t>) depending on want achieve... 1 option show content of binary stream base64 string: var memorystream = new memorystream(); using(memorystream) { formatter.serialize(memorystream, list); } hiddenfield1.value = convert.tobase64string(memorystream.toarray());

Flex Sub-Apps and MarhsallingSupport missing in 3.x SDK's -

i'm looking @ using sub-applications within flex, enable mutli-versioned compilation. specifically, i'm looking have flex 4.x host app loads flex 3.6 sub-apps. the docs state possible (and purpose of sub-apps). specify this: when compiling each of these types of applications, should include marshallingsupport class main application , sub-applications. includes compiler argument, following example shows: -includes=mx.managers.systemclasses.marshallingsupport however, can tell, marhsallingsupport wasn't included until 4.x releases. looking @ mx.managers.systemclasses package 3.5.0.12683 , 3.4.1.10084 shows no reference of marshallingsupport ( see svn here , here ) this true 3.6a (download of sdk available, can't find source). am missing something? how supposed include class in 3.x sub-apps, when it's not available? see http://help.adobe.com/en_us/enterpriseplatform/10.0/aepdeveloperguide/ws8cbf8723eeed7311-4cca458e1328d...

performance - Primitive types slower than user types in C++? -

i curious , did little benchmark determine performance delta between primitive types such int or float , user types. i created template class var , created inline arithmetic operators. test consisted of looping loop both primitive , var vectors: for (unsigned = 0; < 1000; ++i) { in1[i] = i; in2[i] = -i; out[i] = (i % 2) ? in1[i] + in2[i] : in2[i] - in1[i]; } i quite surprised results, turns out var class faster of time, int on average loop took 5700 nsec less class. out of 3000 runs, int faster 11 times vs. var faster 2989 times. similar results float , var 15100 nsec faster floatin 2991 of runs. shouldn't primitive types faster? edit: compiler rather ancient mingw 4.4.0, build options defaults of qtcreator, no optimizations: qmake call: qmake.exe c:\...\untitled15.pro -r -spec win32-g++ "config+=release" ok, posting full source, platform 64 bit win7, 4 gb ddr2-800, core2duo@3ghz #include <qtextstream> #include <qvector...

Jquery mobile: page size not refreshed after adding an element -

so, struggling "loose" parts of page after adding elements in contens section of jquery mobile page. not able scroll down see bottom of page. i have tried several solutions far. $('#<pageid>').trigger('create'); after adding elements. and placing $.support.touchoverflow = true; $.mobile.touchoverflowenabled = true; in pageinit event. does know missing here? regards edit: i have buttons show/hide divs well. clicking on these updates page size, , able scroll whole way down. the problem experienced using phonegap on android simulator/device so, reason did not work out of box android. came solution. after adding elements dom set body size div containing elements. $('body').css({'height' : $('#<div id>').height()}); hope saves time :-)

Button Inside Android ListView doesnt respond to clicks -

Image
i have default listview have added custom views list items, buttons inside of these views not clickable of time. output log.v when button receives click event, have tap button dozen times before register click. the other problem related tot having when button pressed want animation happen revealing menu sliding out beneath it. @ moment have tried several different methods making custom class views versus using layout inflater relativelayout object view, nothing working properly. have tried using listview.getadapter().notifydatasetchanged(); has pop-into-place extended view when want animation. i have searched everywhere , seems possible solutions either rewrite own custom listview or use linearlayout scrollview. latter seems easier dont think optimized listview is. any suggestions appreciated, if need see code, please let me know... thanks! update: the getview() contains this: holder hold; convertview = friends.get(position); hold = new holder(); hol...

javascript - escaping metachar in javascripot regex -

i have fragment of string looking begins , ends dot . char. i trying parse in javascript with: var regex = new regexp('\\.([^\\.]+)\\.', ''); var ar = s.match(regex); but doesn't work. doing wrong? way, there more regex, think part not working, other parts simple. you can strip 1 level of escaping using regular expression literal syntax: var regex = /\.([^.]+)\./; additionally that, inside […] . not have special meaning outside.

swift - How can I switch views programmatically in a view controller? (Xcode, iPhone) -

have been struggling while, , can never seem direct answer. any appreciated! if you're in navigation controller: viewcontroller *viewcontroller = [[viewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; or if want present new view: viewcontroller *viewcontroller = [[viewcontroller alloc] init]; [self presentviewcontroller:viewcontroller animated:yes completion:nil];

android - How we can parse OPML String -

i got following string response when post url via httppost. problem how can parse string. <?xml version="1.0" encoding="utf-8"?> <opml version="1"> <head> <status>200</status> </head> <body> <outline type="object" text="account"> <account> <guide_id>u36710162</guide_id> <username>xyz</username> <session_id>9d28d854-bd31-4bba-9a5f-4e5cd88edaac</session_id> <first_name /> <last_name /> <email>xyz@gmail.com</email> </account> </outline> </body> </opml> how can status, guide_id, username, session_id, first_name, last_name , email string. thanks in advance ...!!! it xml format response. can parse saxparser , domparser or xmlpullparser . about status can http itself httpclient httpclient = new defaulthttpclient(); httpresponse respo...

C# Early and Late Binding concept -

as known binding concept of declaring object of specific data type, , cant hold other type of object. while late binding concept of declaring object of generic type , can hold instance of other type. consider example: public abstract class animal { public virtual string name { { return "animal"; } } } public class dog : animal { public override string name { { return "dog"; } } } public class cat : animal { public override string name { { return "cat"; } } } public class test { static void main() { animal animal = new dog(); animal animaltwo = new cat(); console.writeline(animal.name); console.writeline(animaltwo.name); } } my question when compilor recognize function call of object, either @ compile time or run time? sorry if unclear. mean ask concept of virtual on riding , virtual methods involve late binding or not? .. if not how possible. runtime. a virtual function...

php - How to check hours in timestamp is in between a particular range of hours? -

possible duplicate: how convert unix timestamp hhmmss? i have timestamp in format of: 1330559989 how check hours in timestamp in between 6 hours , 23 hours? can me please? date('h', 1330559989) give hours in 24h format leading zero, in example: 23 . there specific function hour of timestamp called getdate offers array interface information ( demo ): getdate(1330559989)['hours']; # 23

iphone - Setting a preference value from stored preference -

playing code today, i run particular piece of code several times in minor variations throughout particular class, i'm trying streamline though. difference in effect minimal changes amount of code volume of hundreds or thousands of lines big personal win me. essentially have value stored integer key of 'codekey' , want insert value of key number 30061 resides. i'm @ bit of loss how, can me out one? i know need recall value somehow , place in i'm not sure how look. if ([[nsuserdefaults standarduserdefaults] integerforkey:@"buttonid"] == 1) { nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults]; [userdefaults setinteger:30061 forkey:@"scifi1"]; [userdefaults synchronize];} i take mean dynamically saving information without duplicating same code on , over. if correct, solution this: -(void)savecodekey:(int)key { if ([[nsuserdefaults standarduserdefaults] integerforkey:@"butt...

mysql - Trying to add a subquery to a join query -

i have query this select tbl_products.*, group_concat(tags.name) tbl_page_collections_products, (select page_collection_name name tbl_page_collections left join tbl_pages on tbl_page_collections.page_id = tbl_pages.page_id tbl_pages.page_name '%friends%') tags left join tbl_page_collections on tbl_page_collections.page_collection_id = tbl_page_collections_products.colid left join tbl_pages on tbl_page_collections.page_id = tbl_pages.page_id left join tbl_products on tbl_products.product_id = tbl_page_collections_products.product tbl_pages.page_name '%friends%' the error unknown column 'tbl_page_collections_products.colid in on clause don't error when subquery isn't there , column exists in table. is conflicting? tbl_page_collections_products not in subquery clause. maybe want: select tbl_products.*, group_concat(tags.name) tbl_products, (select page_colle...

jdbc - Viewing SYS schema tables of JBoss EDS/Teiid VDB -

can me understand how expose sys schema objects of jboss teiid virtual database when connected via odbc-jdbc bridge ? the client connecting odbc side of bridge , jdbc side of connecting virtual database (vdb) running on jboss soa server. with current setting tables , columns modeled thru jboss studio's teiid designer exposed not sys schema , underlying objects. client app microstrategy bi application. you able traverse metadata used data sources using native jdbc java api.

linux - How to create a downloadable public link for files on server -

i afraid question stupid, , duplicate. didn't manage find want after looking similar questions on site. my question simple, have big file, i.e. 1gb on ubuntu server, , want share file other users. how can create url address public users, in other words, when 1 user click url, download automatically start without demanding username , password, download many stuff (pdf, music) when find usable url google. someone suggests me setup anonymous ftp. think it's possible solution, didn't succeed accomplish it. can 1 give me more details how achieve goal, (with or without ftp both ok). thanks help, , grateful examples, or tutorials ! install apache2 sudo apt-get install apache2 place file /var/www/ directory (might need root privileges this) sudo cp yourfile /var/www/yourfile access file following link: http://your-ip-address/yourfile if running under router or firewall, might have open port 80 , forward pc.

python - Non-ASCII characters in Matplotlib -

Image
i have problem displaying non- ascii characters in matplotlib, these characters rendered small boxes instead of proper font, looks (i filled these boxes red paint hightlight them): how fix it? a related question accented characters in matplotlib . this problem may have couple of different causes: the default font not include these glyphs you may change default font using following (before plotting done!) matplotlib.rc('font', family='arial') in versions of matplotlib you'll have te set family: matplotlib.rc('font', **{'sans-serif' : 'arial', 'family' : 'sans-serif'}) (note because sans-serif contains hyphen inside **{} syntax, necessary.) the first command changes sans-serif font family contain 1 font (in case arial ), second sets default font family sans-serif . other options included in documentation . you have improperly created/passsed string objects m...

c# - Using static variables instead of Application state in ASP.NET -

i plane use static variables instead of application state in asp.net , wondering if correct approach: [global.asax.cs] ... public class global : system.web.httpapplication { void application_start(object sender, eventargs e) { // code runs on application startup } ... private static dictionary<string, object> cacheitems = new dictionary<string, object>(); private static object locker = new object(); public static dictionary<string, object> cacheitems { { lock (locker) { return cacheitems; } } set { lock (locker) { cacheitems = value; } } } public static void removecacheitem(string key) { cacheitems.remove(key); } ... } as can see use automatically created global.asax (and code behind) file. i've added static variables , methods. ca...

Android - How to enable full page scrolling on a layout with a ListView? -

i have layout listview. list scrolls fine, other content on page needs bigger , either list or other content take of screen need scroll. can done? here layout have far: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <include android:id="@+id/header" layout="@layout/header" android:layout_height="wrap_content" android:layout_width="fill_parent"/> <textview android:id="@+id/view_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="business:" /> <textview android:id="@+id/business_privacy" andr...

c++ - Append to a parent function via classes? -

in project have parent class cwnd base win32 window classes down chain. create instances of class template declaration can have many different types of windows. i add members so: void cchildwndclass::onsize(hwnd hwnd, uint state, int nwidth, int nheight) { // } the problem these members virtual. in events (ie: ondestroy) there code execute in every window class regardless without having copy paste each child class because overrides parents original code. how can have functions in children classes append code themselves, rather override? subclass class functionality desire, , subclass class of own obtain similar subclasses. the method don't want implement, don't, , continue virtual in subsubclasses. people use make libraries in situations.

php - How do I sanitize data from users before sending it to mySQL? -

i making forum @ moment. i sanitize input data (that is, posts users) before sending mysql database. i have been searching functions that, i'm not sure if have used enough of them , if they're secure enough. suggestions welcome. here code have: $message=$_post['answer']; $message=nl2br($message); //adds breaks text $message=stripslashes($message); //removes backslahes (needed links , images) $message=strip_tags($message, '<p><a><b><i><strong><em><code><sub><sup><img>'); //people can use tags inside 2nd param $message = mysql_real_escape_string($message); //removes mysql statements think (not sure) edit: please tell me if should add tags strip_tags function. maybe have forgotten some. try using pdo instead. has great binding function, improves security. here's examples: http://php.net/manual/pl/pdostatement.bindvalue.php pdo default in php5, pretty everywhere these days. ...

c# - Simplifying class structure -

i have set configuration system grab configuration mysql database. , have got working, realize value cache, have use long messy code. cachelayer.instance.caches["app_config"].current.emailalertinterval i remove current , haven't managed figure out if it's possible have class directly. @ moment implementation looks this. public t current { { if (_current == null) { reloadconfiguration(); } return _current; } } but this: cachelayer.instance.caches["app_config"].emailalertinterval i looking @ this, works indexers. public t this[t key] edit: add more context add more code. this cachelayer. allows me store multiple configurations. may have 1 example general app config, can grab array of emails used. public dictionary<string,igenericcache<dynamic>> caches { { return _caches; } } public void addcache(string config) { _caches.add(config,new genericca...

java - Deploying an EJB easily -

i may being naive here, assumption ejb 3, marking class @stateful required make stateful session bean. my question: can deploy is, , if how? or still need package in ear. think annotation sufficient, may being over-optimistic. thanks in advance help. annotation detailing out beans in xml file. should still packed in jar file go in ear. annotation substitution of xml configuration files.

linux - Error while running parallel make -

consider following make: all: b a: echo exit 1 b: echo b start sleep 1 echo b end while running make -j2 receive following output: echo echo b start exit 1 b start sleep 1 make: *** [a] error 1 make: *** waiting unfinished jobs.... echo b end b end we have quite big make file , it's easy miss error, since there's no error message @ end of execution. is there way error message appear in end of make execution? update: see possible solution how check make exit status within make. if program called make returns error, return code of make not zero. after calling make check return code see if error occurred. on bash (and many other shells zsh ) following: # make .... # echo $? the echo print 0 if ok , print else if wasn't. you run check inside shell script: make if [ $? -eq 0 ]; echo "everything ok" else echo "something went wrong!" fi if need exact error message e...

c++ - Setting values in QPolygonF -

i'm trying set value in qpolygonf object value. example: qpolygonf *polygonpoints; polygonpoints->resize(2); polygonpoints[1] = qpointf(5.0,5.0); when try compile error says there no operator found takes right-hand operand of type 'qpointf'. qpolygon inherited qvector feel should work... above code works when use "<<" i'd modify specific values in polygon instead of appending values. thanks. qpolygonf (and other qt containers) best used without pointers or else you'll need dereference pointer: (*polygonpoints)[1] = qpointf(5.0,5.0);

Facebook "Recent Activity" from Asp.Net application -

i developing public website facebook login. once user has logged in facebook, want post website's url thumbnail facebook newsfeed "has read : url" i new facebook integration. how can achieve asp.net application ? right now, have added 2 iframes , recent activity. able see post liked. how can post url read me ? thanks. note : testing purpose have used www.yahoo.com in iframe. below source code taken http://www.abelski.com/courses/facebookplugins/abelski_facebook_plugins_page.html <iframe src="http://www.facebook.com/plugins/activity.php?site=sg.news.yahoo.com&width=300&height=300&header=true&colorscheme=light&font=arial&recommendations=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:300px;" allowtransparency="true"></iframe> <iframe src="http://www.facebook.com/plugins/like.php?href=http%3a%2f%2fsg.news.yahoo.com&lay...

html - jquery recently added higlighted css can not be remove after alert generate -

http://jsfiddle.net/cyjye/ m new jquery.i have made html table shown in jsfiddle.firstly selection made second row second cell in html table selection made first row second cell.i have allot time patient not more 30 minutes.if user selects more 30 minutes gives alert "time slot not more 30 minutes". alert works correctly added css not removed after alert. , whenever mouse after alert .cell highlighted css. dont want if alert generate added css cell removed , whenever mouseup after alert no cell highlighted css.i tried lot not getting correct way. when highlight 30 minute time , click on select patient button(below html table there select patient(patient getting textbox)button) highlight css removed. <!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> <meta http-equiv="content-type" cont...

jquery - Click event not working on iPad with touch event -

i using click event on page link. works on ipad's safari , when use touch events on same page click event stops working; touch event works there on ipad. click event: link.onclick = onlinkclick; touch event: $('#sdiv').bind({ 'touchstart': function (e) { ontouchstart(e, sdiv); } }); $('#sdiv').bind({ 'touchend': function (e) { ontouchend(e); } }); $('#sdiv').bind({ 'touchmove': function (e) { ontouchmove(e); } }); $('#sdiv').bind({ 'touchcancel': function (e) { ontouchcancel(e); } }); finally, differentiate both platforms, ipad , desktop . using ' navigator.platform ', if it's ipad touch event works, else click event . var platform = navigator.platform; if( platform == 'ipad') { _link.ontouchend = onlinkclick;} else { _link.onclick = onlinkclick; } thanks all,

Compare and contrast REST and SOAP web services? -

this question has answer here: representational state transfer (rest) , simple object access protocol (soap) 14 answers i figure out similar both using internet protocol (http) exchange data between consumer , provider. the difference is: soap xml-based message protocol, while rest architectural style soap uses wsdl communication between consumer , provider, whereas rest uses xml or json send , receive data soap invokes services calling rpc method, rest calls services via url path soap doesn't return human readable result, whilst rest result readable plain xml or json soap not on http, uses other protocols such smtp, ftp, etc, rest on http that's know differences between them. correct me , add more. soap uses wsdl communication btw consumer , provider, whereas rest uses xml or json send , receive data wsdl defines contract between...

architecture - How to write Unit Test for manager running dao? -

i'm having simple test design problem, solve once , all. i'm pretty used regular java design pattern there manager interface (or facade) , set of dao interfaces . concrete implementation of managerimpl using concrete implementations of daoimpl . right i'm @ point of implementation, don't have database connected project yet, guess perfect time write proper unit tests without db :-) i able mock methods of manager using mockito, since test under method (or called system under test) using dao internally, have mock dao well. unfortunately cannot without setting concrete dao implementation in manager, mymanager.setmydao(mockeddao) , have pull out setmydao method interface, of course breaks encapsulation , makes clean , perfect interfaces garbage. so question is: how mock dao in tests while preserving clean manager-dao architecture? you should unit test concrete implementations, i.e. managerimpltest , explicitly create managerimpl , therefore have s...

python deque/list filtering -

i have list of actions database. copied deque since want deal in order, popping stuff off left go. so have actions = deque(actions) fine. each action item list psycopg module using dictcursor. each list has item 'phase'. so things go in phases. actions in phase 'a', in phase 'b', etc. not best way store data that's given. so make life easier want split deque several deques phase. so if actions[0]['phase'] == 'a' goes in list containing items phase a, , on with, b, etc. i bunch of ifs , appending seems lot of effort. think answer might filter(), i'm not sure how use it. random stuff note: each item in order, order needs preserving within each deque. the phases known , sequential. example, if phase c doesn't exist, know phase d doesn't exist. there finite number of phases, 5 if recall. clarification attempt: i have deque, actions. like: actions = [ ['phase': 'a', 'something_else...

log4net with asp.net mvc - can't watch file for changes -

so in console .net application can watch log4net events stream (the powershell command) get-content .\log.log -wait similar linux tail command , assume uses filesystemwatcher under hood. for reason, whenever have asp.net mvc application not work. clear, log file written to. can get-content .\log.log many times want , recent results, -wait parameter never see changes scroll past. does have insight might going on here? update: found working solution case, not sure whether out. instead of using powershell, downloaded win-bash , i'm using familiar unix command works me. tail -f access.log i'm not familiar .net programming. working solution in case use win-bash project's bash.exe instead of powershell? i experiencing similar issue when trying "tail" apache access log in powershell. get-content .\access.log -wait i noticed when apache http server running, has handle open acccess.log , -wait doesn't work. stopping http server rele...

Double-click seems to disrupt Wicket-Spring injection -

our application uses wicket front-end, spring injection load our doas , manage transactions. we have discovered several of our users double clicking on links/buttons , somehow disrupting spring injection, subsequent calls whateverdao.dostuff(obj) throw n.p.e. application runs on our client's internal network, , now, have politely requested client spread word amongst team single clicks work on features. apparent becoming problem them. a common use case involves "search" screen showing list of foo objects in system, can filtered via search parameters if desired, , when item clicked user taken detail page specific foo, in read-only mode. next, user may click "edit" button in corner switch edit mode. then, user might make changes , click "save" (or possibly click "delete" remove item.) this scenario involves dao calls @ 3 steps: 1. on search page, when item clicked, load basic details of item. 2. on detail page in read-only mode, whe...

php - Building a fast semantic MySQL search engine for private articles from scratch -

i working on project involve full-text and semantic searches of articles within site (if it's not possible combine it, user can select either option). these articles subscription-based , can searched after logging in; not accessible external search engines or apis. i read sphinx full text keywords searches (and intend implement aspect) not sure how go building semantic search engine out of this. e.g. searching "u.s. president" should list articles contain references actual names of u.s. presidents e.g. george washington, bill clinton (or william jefferson clinton). i have ideas maybe sort of tagging system can used relate various keywords e.g. relate president george washington , president bill clinton, since data huge , many such relations exist don't know how further idea. please advice me on how go building semantic search engine (i guess sphinx can handle full-text keyword search) scratch. otherwise, please inform me of internet-based resources or if...

Twisted Python: how to make a deferred object that waits for data from child process? -

in method linereceived in echo protocol, generate deferred object each time write child. wait result, , print result once data done being processed child process. need find way that. right now, mypp's function outreceived gets result child process. thank from sys import executable os import environ import os twisted.internet import reactor, defer twisted.internet.protocol import protocol twisted.internet.protocol import factory twisted.internet import protocol twisted.protocols.basic import linereceiver import sys import time import math implementation = """ filter import censor censor() """ class echo(linereceiver): def linereceived(self, data): if self.factory.pp == none: pp = mypp() self.factory.pp = reactor.spawnprocess(pp, executable, [executable, "-c", implementation], env=environ, childfds = {0:...

SQL Group By Sub Query -

i dont understand sub queries on how can accessed outer query, need question. here 4 schema's. movie(title, year, director, budget, earnings) actor(stagename, realname, birthyear) actedin(stagename, title, year, pay) canworkwith(stagename, director) find name(s) of actors(s) highest pay acting in movie. got, asking find highest paid actor each movie...but on second thought brackets may indicate has been paid highest , maybe couple have same amount. anyways.. what have select a.realname actedin a.stagename in ( select a1.title, a1.year, max(pay) actedin a1 group title, year ) i know a.stagename in wrong, have no idea how link back. this should enough if understood : select a.realname actedin pay = (select max(pay) actedin b b.stagename = a.stageman)

android - onItemSelected / setOnItemSelectedListener not triggering -

i opening spiiner onclick on button spinner not trigger setonitemselectedlistener portion of code not working public void onitemselected(adapterview arg0, view arg1, int pos, long id) { language = appconstants.language_arr[pos]; } public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } spinner opens onitemselected not working import com.privy.constants.appconstants; import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.button; import android.wid...