Posts

Showing posts from April, 2012

sql - Query Help required for newbie -

sql - Query Help required for newbie - i have created 3 tables. tblregion{regionid integer, regionname varchar(100)}, tblcountries{countryid integer, countryname varchar(100), regionid varchar(3)}, tblusrs{userid integer, username varchar(100), prefregion varchar(3), prefcountries varchar(100)} now info in each table: tblregion --------- regionid regionname: 1 asia -- 2 africa -- 3 europe -- 4 america tblcountries ------------- countryid countryname regionid: 1 china 1 -- 2 malaysia 1 -- 3 singapore 1 -- 4 afganistan 3 -- 5 uk 3 -- 6 kingdom of spain 3 -- 7 libiya 2 -- 8 kingdom of morocco 2 -- 9 4 -- 10 canada 4 -- 11 united mexican states 4 tblusrs ------- usrid usrname prefregion prefcountries: 1 mike 2 -1 -- 2 john -1 '1,5,9' -- 3 michael -1, '1' -- 4 tango -1 '8,9' from above info if user passes part 2, both userid 1 & 4 displayed. i have written query seems thing wrong. select * tblusers (prefregion = '2...

swing - Java GUI JButton to actionlistner -

swing - Java GUI JButton to actionlistner - i have made gui in netbeans. it's chat programme , have 4 commandos /join, /leave, /whisper , /leave private void commandoactionperformed(java.awt.event.actionevent evt) { joptionpane.showmessagedialog(rootpane, "the next commandos are:" + "\n" + "\n" + "/join channel name" + "\n" + "/leave channel name" + "\n" + "/whisper nick message" + "\n" + "/quit - quit program"); } and ok, want actionlister instead of showmessagedialog can force on of them , comes in jtextfield. think can them there don't know how actionlistener combined this. edit: want force commando button , windows have 4 new buttons, each 1 commando (/join, /leave, /whisper , /exit) when force 1 of these buttons commando in text field need write rest. if force "/join" button, need w...

Simplest way to Import a shared python script relative to the current script -

Simplest way to Import a shared python script relative to the current script - i trying import 1 python script another. have few mutual functions defined in 1 script , lots of other scripts want import functions. no classes, functions. the importing script needs import relative path e.g. ../../sharedscripts/python/common.py i have few functions def f1(...) defined call. i found imp module seemed right thing utilize unable figure out exact syntax work example. can suggest right code utilize or simplest approach if imp not right module? solution answers below able working... projectkey = 'thor' # load shared script relative script sys.path.append(os.path.dirname(__file__) + '/../../sharedscripts/python') import jira jira.checkjiracommitmessage(sys.argv[1], sys.argv[2], projectkey) where had empty __init__.py , jira.py in sharedscripts/python directory plain function definitions. why not adding ../../sharedscripts/python/ python pa...

Using html with style tags in php code -

Using html with style tags in php code - i have been given next template utilize in email. using phpmailer mail service out, having problem way style tags begin , end conflicting php. if go through thier template, move styles seporate style sheet or utilize classes , set styles @ top of page, dont want unless have to. below generic illustration of going wrong code. font names wrapped in "s opening , closing tags of style 's , these 's clashing opening , closing tags of php. cant seem find way round though if put, style=""font-name","another-font"" wont work, if utilize 's @ php screwed up. what happening in php mailer form contents declared $body = '<span style='font-size: 13.5pt;font-family:"georgia","serif";color:white'>some content</span></html>'; you need escape quotes. example: $body = '<div style=\'background:#000;\'><p>srs bu...

iphone - Crash when invoking popToRootViewControllerAnimated:NO, set animate to YES work no crash, strange. -

iphone - Crash when invoking popToRootViewControllerAnimated:NO, set animate to YES work no crash, strange. - my app based on uinavigationviewcontroller, there 3 viewcontroller in stack, named a, b, c, root view controller, in viewcontroller c next operation, app crash 100%. - (void) delaypopaction { [[self navigationcontroller] poptorootviewcontrolleranimated:no]; } - (void)searchtap:(id)sender{ [self performselector:@selector(delaypopaction) withobject:nil afterdelay:3.0]; } trace zombie , find crash dues c has been destroyed there still event available sent him. more strange, if alter animated parameter no yes, no crash happen, maybe dues c's life circle has been enlarged. see api doc. how no mean? don't understand clearly. animated set value yes animate transition. pass no if setting navigation controller before view displayed. any thought or suggestion appreciated, in advance. oh, view-controller implementation defect. iphone uinav...

hibernate - How we can Query object in hibernateTemplate -

hibernate - How we can Query object in hibernateTemplate - i want utilize query object in hibernatetemplate. can utilize query object hibernatetemplate deprecated spring. if 1 using other way please guide me thanks in advance dharmendra you can utilize either pure sql or can writing simplified queries like: session session = sessionfactory.getcurrentsession(); query query = session.createquery("from tablename id=:userid"); query.setstring("userid", userid); //userid of string type or can utilize userid+"" convert string list<myentitypojoname> result = query.list(); //this homecoming list of myentitypojoname objects or can write pure sql within createquery() function below: session session = sessionfactory.getcurrentsession(); query query = session.createquery("delete tablename myentitypojoname id=:userid , hid=:hospitalid"); query.setstring("userid",myuserid); query.setstring("hospitalid...

http - WCF Interoperability with other services, content type is text/html -

http - WCF Interoperability with other services, content type is text/html - i trying create wcf client operates http rest endpoint not based on microsoft technologies. wcf-foo pretty weak, don't understand doing incorrectly... i've created service contract looks this... [servicecontract] public interface ifilters { [operationcontract] [webget(uritemplate = "/api/filter.getavailable.xml?api_user={username}&api_key={password}")] string getavailablefilters(string username, string password); } which seek , run this... public string run(string username, string password) { var binding = new basichttpbinding(); binding.messageencoding = wsmessageencoding.text; binding.security.mode = basichttpsecuritymode.transport; var endpointaddress = new endpointaddress("https://sendgrid.com"); ifilters proxy = channelfactory<ifilters>.createchannel(binding, endpointaddress); var r...

php - Query to use in backend to retrieve all contacts with recent sent date less than or equal to some date -

php - Query to use in backend to retrieve all contacts with recent sent date less than or equal to some date - in task want query retrieve contacts recent sent date, on status less or equal fixed date. actually have 1 table name xxx contains email , name , , sentdate . each year 2006 2012, mail service sent each email contact. contacts still mail service sent every year 2006 2012. contacts mail service has not been sent after 2007. contacts have received mail service more others. i need query retrieve contacts lastly sent date less or equal date (for example, "01-01-2010"). select * `xxx` `last_sent_date`<='some_date' php mysql

bit - Convert decimal to sign and magnitude binary form -

bit - Convert decimal to sign and magnitude binary form - i want convert -95 sign/magnitude form using 12 bits. would 000001011111 magnitude , 1 bit left of lastly 1 create negative? => 000011011111 i wasn't sure whether set sign bit way on left (the msb). msb sign bit choice. languages c same. binary bit

ruby on rails - How to get I18n subtree entries? -

ruby on rails - How to get I18n subtree entries? - using rails 3.0.9 ruby 1.9.2. i have create list of places (which contains accents , non standard letters) fill select box. using helper doesn't work (already searched it), next error: invalid multibyte char (us-ascii) it apparently has ruby , not rails. i read best solution set list in translation file, , did, can't retrieve list. before, had: def madrid_area_array [ "chapinería", "ciempozuelos", "cobeña", ] end now, have in .yml: places: spain: madrid: chapin: "chapinería" ciempo: "ciempozuelos" cobena: "cobeña" when used helper (in case wonders, symbols &iacute; literally written in select drop boxes, don't 'í'), phone call madrid_area_array fill select menu. now, can't phone call translation file, , have create intermediate helper translations: def madrid_area_array ...

Regex to match words containing X, Y AND Z -

Regex to match words containing X, Y AND Z - i've been thinking of random things lately, , 1 caught fancy. how write regexp word contains x, y , z (or matter combination of letters), not in order. i tried [^xyz]*x[^xyz]*y[^xyz]*z but searches in order only we do [^xyz ]*[xyz][^xyz ]*[xyz][^xyz ]*[xyz] but useless because matches xy. i aiming regexp match words contain x, y , z in of next orders xyz xzy yzx yxz zxy zyx edit forgot add together before (sorry bout that) how making match words like abxcydz (x, y , z come in order above) if engine supports lookaheads: ^(?=.*x)(?=.*y)(?=.*z) or ^(?=[^x]*x)(?=[^y]*y)(?=[^z]*z) regex

php - Search for a YouTube link in twitter feed? -

php - Search for a YouTube link in twitter feed? - i wonder if can search tweets shared particular youtube video. , sort out users got followers sharing youtube video. using api , in php. given twitter (and other url shortening applications) encode url, you'll have following: 1) collect tweets hyperlinks 2) open hyperlinks see if redirect youtube 3) compile id's on redirects 4) utilize twitter api identify followers in short yes, no. php twitter youtube

How do I return a file at a specific location in Java? -

How do I return a file at a specific location in Java? - i using external library function returns file object. works fine making file @ default location, accommodate concurrent users, need have file in specific folder. without beingness able alter function makes file, there file function let's me specify go to? you can utilize renameto(file destination) in file api rename file storing in abstract path. ex: import java.io.file; public class mainclass { public static void main(string args[]) { seek { file oldfile = new file("/usr/bin/temp/"); file newfile = new file("/usr/bin/hunter/temp"); boolean result = oldfile.renameto(newfile); system.out.println(result); } grab (exception e) { e.printstacktrace(); } also note api says not guaranteed succeed, need check homecoming value of method phone call every time utilize method. java file

c# - Nhibernate and the case of Auto Updating Entities -

c# - Nhibernate and the case of Auto Updating Entities - best title come with, little more involved however. // nail database 1 time , categories; iqueryable<category> qrycategorylist = _repository.select<category>(); // initial parents var parentcategories = qrycategorylist.where(x => x.parentcategoryid == null); foreach (category parentcategory in parentcategories) { httpcontext.current.response.write(parentcategory.categoryname = "this should not happen"); buildcategorylist(qrycategorylist, parentcategory.categoryid); } this line httpcontext.current.response.write(parentcategory.categoryname = "this should not happen"); performs this update categories set parentcategoryid = null /* @p0_0 */, categoryname = '->' /* @p1_0 */, categorydescription = 'the fruit category' /* @p2_0 */, active = 1 /* @p3_0 */, datecreated = '2012-01-20t12:03:41.00' /* @p4_0 *...

ios - Force UITableView to call cellForRowAtIndexPath: for all cells -

ios - Force UITableView to call cellForRowAtIndexPath: for all cells - i having problem uitableview's reloaddata method. have found calls cellforrowatindexpath if there new cells beingness added or taken away. example: have 5 cells, each containing 5 strings. if add together new cell , phone call reloaddata , table updated , see it. yet if go 1 of 5 cells, add together new string, homecoming , phone call reloaddata , none of table view's delegate methods called. my question: possible forcefulness table view reload info in of visible cells? i found problem- had cell customization code in if(cell == nil) block, because cells beingness recycled, weren't beingness changed. taking customization code out of block fixed problem. ios reloaddata uitableview

if statement - Batch Syntax For Loop If Exists -

if statement - Batch Syntax For Loop If Exists - trying create batch convert .wtv files mpg files. code below want run 1 time night convert daily recordings utilize on media server. section concerned syntax loop line. want run script on files have not been converted , moved. cant delete original in case , error occurs. lastly move loop files couldn't move on first try. the input files : show.wtv the output in file show.wtv.mpg (which i'm ok with) i not sure how write loop desired functionality. help appreciated. original thought came http://ireckon.net/2009/10/converting-wtv-to-mpg-in-windows-7/ @echo off set recordedtv="d:\recorded tv\" set destfolder="d:\videos\recorded tv\" set ffmpeg="d:\tv converter\ffmpeg\ffmpeg.exe" set wtvconv="c:\windows\ehome\wtvconverter.exe" %%f in (%recordedtv%*.wtv) if not exist "%destfolder%%%f.mpg" ( %wtvconv% "%%f" "%%f.dvr-ms" %ffmpeg% -y -i "%%f.d...

javascript - Images placeholder getting stuck behind iframe (just on Windows machines) -

javascript - Images placeholder getting stuck behind iframe (just on Windows machines) - i'm trying clicking image play video underneath. works absolutely fine in mac browsers - here... http://jsfiddle.net/sparrwhawk/ktbyr/14/ but doesn't work on windows @ all. maybe it's windows security thing, maybe iframes can't have underneath? not sure why happens. can offer work around? i'm looking place still image on video - ones youtube generate blurry, whereas if place own on there can ensure it's of high quality. simply add together wmode=opaque url params. using code: http://jsfiddle.net/ktbyr/15/ edit: see this answer explanation javascript youtube-api

regex - Regexp: ProFTPD auth-logs -

regex - Regexp: ProFTPD auth-logs - i've configurated proftpd log authentifications on plesk powered server. setting not set default since plesk 10 (whyever...). want configure fail2ban, observe unsuccessful login-attempts brute forcefulness prevention. /etc/proftpd.include : extendedlog /var/log/proftpd/auth.log auth auth logformat auth "%v [%h] %s" example of unsuccessfull login (530): /var/log/proftpd/auth.log : proftpd [12.89.47.3] 331 proftpd [12.89.47.3] 530 what's right regexp fail2ban ? configuration seems not match pattern: /etc/fail2ban/filter.d/proftpd.conf : failregex = proftpd(.)+\[<host>\] 530$ <host> seems fail2ban variable, , $ ends rule (if want set several rules within failregex = variable). for me next working on plesk 10.4. proftpd.include: extendedlog /var/log/proftpd/auth.log auth auth logformat auth "%v %t \"%r\" [%h] %s" /etc...

linker - Linking failing for PCRE when using Android NDK stand-alone toolchain -

linker - Linking failing for PCRE when using Android NDK stand-alone toolchain - people have been able build pcre (or subset of) copying source files , creating appropriate andriod.mk. want similar, using android stand-alone toolchain , using configure , create process. have had success building other useful libraries using same flow, running issue pcre. specifically, late in create flow getting error: undefined reference to__dso_handle' .libs/pcre_stringpiece.o when doing this, /bin/bash ./libtool --tag=cxx --mode=link arm-linux-androideabi-g++ -o2 -version-info 0:0:0 -o libpcrecpp.la -rpath /usr/local/lib pcrecpp.lo pcre_scanner.lo pcre_stringpiece.lo libpcre.la libtool: link: arm-linux-androideabi-g++ -fpic -dpic -shared -nostdlib .libs/pcrecpp.o .libs/pcre_scanner.o .libs/pcre_stringpiece.o -wl,-rpath -wl,/home/corbin/applications/pcre-8.21/.libs ./.libs/libpcre.so -l/home/corbin/my-android-toolchain-mod/bin/../lib/gcc/arm...

actionscript 3 - Flash AS3: Resize SWF but keep elements the same size -

actionscript 3 - Flash AS3: Resize SWF but keep elements the same size - i trying create fullscreen chat programme using flash as3, , far, going well, except when window resized, whole thing proportionally resized. i resize chat text area, when resize done vertically, keeping controls same height consistently, buttons sending chat maintain size, input box increasing in width when size increased horizontally. obviously swf resizing done javascript/jquery .onresize() , able set mimimum width , height swf, maintaining usability. is there way this? stage's resize event triggers every time swf changes size, don't need utilize externalinterface (it's less reliable , adds complexity). also, should set stage.scalemode "noscale" , stage.align "tl" elements won't scale (you manually) , aligned top left corner (to maintain consistency display list). then, on each resize event can check new dimensions (stage.stagewidth , stage.stageheight) ...

c++ - How do I fill this vector? Stroustrup example -

c++ - How do I fill this vector? Stroustrup example - i reading stroustrup's programming principles , practice using c++. on page 287 gives illustration under heading of order of evaluation. not understand example. constructed, "stringy" inputs created , destroyed every time until types "quit". how alter code vector v contains every string inputted? written, think v.size() never more 1. want iterate through loop , insert looped on vector rather insert, delete , insert loops. (code book) vector <string> v; //this defined globally void function() { string s; while(cin>>s && s!="quit") { string stripped; string non_letters; (int i=0; i<s.size(); ++i) if (isalpha(s[i])) stripped +=i; else not_letters += s[i]; v.push_back(stripped); } } for every inputted s loop fills stripped letters of s. before end of while loo...

javascript - Word counter function not working with barcode scanner -

javascript - Word counter function not working with barcode scanner - $("#itemids").keypress(function(){ var value = $(this).val().replace(" ", ""); var words = value.split(","); $("#counter").html(words.length); }); this function works keyboard. when utilize barcode scanner, (i'm focusing cursor on textarea , starts scan barcode textarea delimiters comma.) doesn't work @ all. i think must other keypress(function() . because bc scanner enters words programmatically. how work both situations: keyboard , bc scanner? it looks solution use polling, not events. function update(){ var value = $("#itemids").val().replace(" ", ""); var words = value.split(","); $("#counter").html(words.length); } setinterval(update, 10); // poll every 10ms javascript jquery function counter

c - Is there a way to get warned about unused functions? -

c - Is there a way to get warned about unused functions? - i'd find unused functions in codebase - including across compilations units. i'm using gcc compiler. here's example: foo.c (assume appropriate foo.h ): void foo() { .... } void bar() { .... } main.c : #include <stdio.h> #include "foo.h" int main(void) { bar(); homecoming 0; } in example, i'd warned foo() not beingness used. there -wunused-function gcc option: -wunused-function warn whenever static function declared not defined or non-inline static function unused. warning enabled -wall. but it's static functions - won't produce warning on illustration above. i'll take suggestions of tools/scripts/other compilers can me - though i'd prefer stick gcc if possible. caolan mc namara, libreoffice developer, has made little tool observe type of thing in libreoffice source code. had around thousands f...

Trying to add a folder structure and eclipse projects to SVN -

Trying to add a folder structure and eclipse projects to SVN - it's funny, i've been working svn (tortoise on windows) relatively long time, i've never used other actions checkout, commit , merge since projects worked on existed. want set eclipse project under version command own , realize stupid that. there new svn server emtpy branches/tags/trunk folders, created person. 1.) my intention add together 3 subfolders trunk folder - these 3 folders improve structure, should not have to version command or eclipse project (apart fact want set eclipse project in 1 of 3 folders in sec step). how can that? created 3 folders on hard drive via windows explorer , tried set them in svn's trunk folder using import function of tortoise. failed next log message: command: import c:\new folder https://<svn-adress>/trunk adding c:\new folder\foldera adding c:\new folder\folderb adding c:\new folder\folderc commit blocked pre-commit hook svn: url file '<...

c - Matrix Multiplication CUDA -

c - Matrix Multiplication CUDA - i have been reading through several websites , used nvida's code guide still getting wrong answer. main inquire user size, , display , b display resulting matrix c. run 2x2 matrix both , b sample output: matrix 0.000000 8.000000 2.000000 2.000000 matrix b 3.000000 1.000000 5.000000 7.000000 matrix c (results) 0.000000 9.000000 7.000000 4.000000 but that's incorrect. should be: 40.000 56.000 16.000 16.000 i changed decimals whole numbers easier check, , found it's incorrect. not understand why incorrect, though took right code sample. #ifndef _matrixmul_kernel_h_ #define _matrixmul_kernel_h_ #include <stdio.h> // thread block size #define block_size 16 #define tile_size 16 // cuda kernel __global__ void matrixmul( float* c, float* a, float* b, int wa, int wb) { // block index int bx = blockidx.x; int = blockidx.y; // thread index int tx = threadidx.x; int ty = threadidx.y; // index of first s...

entity framework - LINQ 2 Entities-query is not working, but why? -

entity framework - LINQ 2 Entities-query is not working, but why? - everyone! )) here code. var existingentities = (from record in globalone.servicecontext.records_out record.timestamp.date == datetime.now.date select record ).tolist(); it doesn't work. another code: var existingentities = (from record in globalone.servicecontext.records_out record.timestamp.day == datetime.now.day select record ).tolist(); it work. so, problem id in next string: where record.timestamp.**date** == datetime.now.date also won't do where record.timestamp.date.equals(datetime.now.date) but why? have no clue. "timestamp" field datetime field in ms sql server. , - there no records in table. and forgot - mean - "doesn't work". app not reach breakpoint after query(first), without error, without anything. thanks. you can phone call record.timestamp.date ...

Blender exporting xml for android -

Blender exporting xml for android - i'm using blender draw 3d objects. want export 3d drwings xml. tried utilize orge meshes exporter, don't event know how set up? can help me? i'm using windows 7, blender 2.61 , python version 3.2.2. how can set exporter up? there tutorials? please.. check out link http://www.bayninestudios.com/2011/01/importing-3d-models-in-android/ used latest version of ogre2html create sure set activate add together on when install (put ogre xml in addon directory) it works html code upside down, don't know if why android programme doesn't it. maybe setting in blender, first time utilize 3d programme , have problems navigating , finding controls xml blender

Signed Request - how can i find if a facebook user liked my fb application? -

Signed Request - how can i find if a facebook user liked my fb application? - i trying find if user likes facebook application or not , utilize functions: function parse_signed_request($signed_request, $secret) { list($encoded_sig, $payload) = explode('.', $signed_request, 2); // decode info $sig = base64_url_decode($encoded_sig); $data = json_decode(base64_url_decode($payload), true); if (strtoupper($data['algorithm']) !== 'hmac-sha256') { error_log('unknown algorithm. expected hmac-sha256'); homecoming null; } // check sig $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true); if ($sig !== $expected_sig) { error_log('bad signed json signature!'); homecoming null; } homecoming $data; } function base64_url_decode($input) { homecoming base64_decode(strtr($input, '-_', '+/')); } $decodedsr = parse_signed_request($_request['signed_request'],$config['secret...

c++ - How to efficiently store equivalences (from Connected-component labeling algorithm)? -

c++ - How to efficiently store equivalences (from Connected-component labeling algorithm)? - i store equivalences connected-component labeling algorithm. it's making kind of map 1 value (one label's id) multiple values (ids labels equivalent former.) i have done not work well: std::map<unsigned short, std::list<unsigned int>> equivalences; for(int = 0; < max_number_of_labels; ++i ) { std::list<unsigned int> temp; temp.push_back(i); // note label equivalent equivalences.insert( std::pair< int, std::list<unsigned int>>(i, temp) ); } then add together proper equivalence by: equivalences.at( ).push_back( equivalent_labels_int ); the main drawback of method have declare map 's size front end (it has big enough) , big sizes (e.g. 9999) initialization time approximately 2.5s. anyone have improve idea? you not need size map up-front in c++ (or languages, matter). map s can dynamically grow having new...

Flash AS3-XML Gallery compile errors -

Flash AS3-XML Gallery compile errors - package { import flash.display.*; import flash.display.movieclip; import fl.transitions.*; import fl.transitions.easing.*; import flash.events.*; import flash.net.*; import flash.events.event; import flash.display.movieclip; import fl.controls.progressbar; import fl.transitions.tween; import fl.transitions.tweenevent; public class gallery extends movieclip { public function gallery() { // constructor code var columns:number; var my_x:number; var my_y:number; var my_thumb_width:number; var my_thumb_height:number; var my_images:xmllist; var my_total:number; var container_mc:movieclip; var preloaders_mc:movieclip; var full_mc:movieclip; var x_counter:number = 0; var y_counter:number = 0; var my_tweens:array = []; var container_mc_tween:tween; ...

debugging - Image convolution kernel does not function according to specified parameters, need help finding the cause -

debugging - Image convolution kernel does not function according to specified parameters, need help finding the cause - i working on opencl image convolution. looked kernel code sample @ amd website, included original sample here: __kernel void convolve_unroll(const __global float * pinput, __constant float * pfilter, __global float * poutput, const int ninwidth, const int nfilterwidth) { const int nwidth = get_global_size(0); const int xout = get_global_id(0); const int yout = get_global_id(1); const int xintopleft = xout; const int yintopleft = yout; float sum = 0; (int r = 0; r < nfilterwidth; r++) { const int idxftmp = r * nfilterwidth; const int yin = yintopleft + r; const int idxintmp = yin * ninwidth + xintopleft; int c = 0; while (c <= nfilterwidth-4) { int idxf = idxftmp...

android - Using WebView Like this would work? -

android - Using WebView Like this would work? - this question has reply here: @android display /res/viewable in webview 7 answers i using drawables in src tag in webview work? mwebview.loaddatawithbaseurl("","<table width=\"100%\"><tr><td style=\"text- align:center; background-color:grey;\"><img src=\""+r.id.button+"\"/></td></tr> </table>"+question, "text/html", "utf-8", ""); i using drawables in src tag in webview work? absolutely not. html expects urls images. not mention specifying widget id, not drawable resource. sir helped working correctly on emulator not on device .do know how solve it? perhaps device older -- 1 reply on question mr. clayson linked suggests file:///android_r...

java - EventHandler in JavaFX a class or interface -

java - EventHandler<T extends Event> in JavaFX a class or interface - i have picked basic illustration of printing "hello world" on screen when mouse clicked code goes this. package sample; import javafx.application.application; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.stackpane; import javafx.stage.stage; /** * * @author gauravp */ public class sample extends application { /** * @param args command line arguments */ button btn = new button("ok"); //label l = new label("done"); public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) { primarystage.settitle("first stage"); //created anonymous inner class eventhandler<actionevent> btn.setonaction(new eventhandler<actionevent>() { ...

jQuery clone/append creating multiple duplicates -

jQuery clone/append creating multiple duplicates - i'm attempting duplicate div , append on top of it's clone. unfortunately, seems creating duplicates. what's going on? here's example: http://jsfiddle.net/qen5n/ live apply new ones class to, getting mouse overs on created elements , it's making , on. remove searchresultitem class clone changing so. elem.addclass('created').removeclass('searchresultitem'); or: disclude created ones. so: $('.searchresultitem:not(.created)') either works :) jquery

facebook - how can i use late posting in android -

facebook - how can i use late posting in android - i have develop facebook application in android.in have post message in facebook wall. uncertainty is, if application loaded in mobile,i want post message in wall if wife/network connection on otherwise run on round until network connected 1 time network connect message post on facebook wall possible. from sounds of want defer network communications until have wifi connection, in case facebook wall posts. i first part of problem handle messages when posted. utilize service on receipt of message will, check wifi status , either post available, or store message in queue if not. the sec part register broadcastreciever start above service on next intents. android.net.wifi.wifi_state_changed android.net.wifi.supplicant.connection_change once receives 1 of these intents, can check status of message queue, check status of wifi, , if connected post messages. android facebook wifi

List all Freebase Domains with MQL query or API call -

List all Freebase Domains with MQL query or API call - i develop freebase java application lets browse freebase. thought starting point mimic freebase schema explorer , allow user of app "drill down" through domains, types in domain, instances in type. can please assist in how retrieve list of domains? list in domain? etc... user can select domain , preset list of types within domain , on until have found entry or entries investigating. mql domains: [{ "id": null, "name": null, "type": "/type/domain", "!/freebase/domain_category/domains": { "id": "/category/commons" } }]​ the "!/freebase/domain_category/domains" clause in there restrict things commons (official) domains - otherwise domain automatically created every user , isn't you're after. types in domain: [{ "id": null, "name": null, "type...

Indexing a CouchDB view with ElasticSearch -

Indexing a CouchDB view with ElasticSearch - using couchdb river, possible index couchdb databases. possible index couchdb view elastic search? not yet. see https://github.com/elasticsearch/elasticsearch-river-couchdb/pull/2 btw can checkout pull request, build , start query views... couchdb elasticsearch

c# - Delegate event issue -

c# - Delegate event issue - i new in c# development. trying study delegate feature. based on articles , notes read delegates, tried write sample code implement delegate based on understood notes , articles. but getting error while running sample "object reference not set instance of object." what problem here ?. or did implemented delegate in right way ? or concept delegate wrong ?.. please help. in advance. i posted code below. default.aspx.cs public partial class _default : system.web.ui.page { testclass myobject = new testclass(); protected void page_load(object sender, eventargs e) { myobject.mydelegateevent += new testclass.mydelegate(myobject_mydelegateevent); } void myobject_mydelegateevent(object sender, eventargs e) { console.writeline("delegate event called"); } } testclass public class testclass { public delegate void mydelegate(object sender, eventargs e); public event myde...

sql - Select two counts in one query -

sql - Select two counts in one query - i have users(user,pass,email) table , want count of user user='someuser' , count of email email='someemail' in 1 query , came that: select ( select count( user ) users user = 'someuser' ), ( select count( email ) users email = 'someemail' ) users but i'm wondering if there improve way of doing that? in advance :) no right way in case. counts 0 or 1 , satisfied nc index. in case want scan more data, can more efficient this: select sum(case when user = 'x' 1 end) usercount, sum(case when email = 'x' 1 end) emailcount users this scan table. depends on info version faster. in case, yours faster. sql count

php - sanitizing a string before serializing and inserting to db -

php - sanitizing a string before serializing and inserting to db - i'm facing odd problem.... $string user input $log = serialize(array('string' => $string); example: "test" be "string";s:4:"test"; however problems arise when user submits quotes , other characters ; of course of study escape string first, serialized info cannot unserialized. htmlentities before submitting db wouldn't work either since ; messes data... any suggestions? please don't tell me create db fields , not utilize serialize() i not sure if best practice quick hack using : http://php.net/manual/en/function.base64-encode.php , http://www.php.net/manual/en/function.base64-decode.php encrypt info when sending db , decrypting when retrieve it. if think there might security issues encrypting using base64 here link in improve way : best way utilize php encrypt , decrypt? php

gwt tablayoutpanel - In GWT how do I handle the tab click event? -

gwt tablayoutpanel - In GWT how do I handle the tab click event? - i have tab layout panel in ui.xml : <g:tablayoutpanel ui:field="tabpanel" barheight='30'> <g:tab> <g:header size='7'>tab1</g:header> <g:simplepanel ui:field="tab1" height="100%"/> </g:tab> <g:tab> <g:header size='7'>tab2</g:header> <g:simplepanel ui:field="tab2" height="100%"/> </g:tab> </g:tablayoutpanel> how handle event generated on clicking tab2? handle selectionevent<integer> or beforeselectionevent<integer> depending on requirements. e.g: tabpanel.addselectionhandler(new selectionhandler<integer>() { @override public void onselection(selectionevent<integer> event) { if (event.getselecteditem() == 1) { // code } } }); or: @uihandler("tabpanel") void ontabselection(...

Facebook Graph returns empty "likes" array for some users who have likes -

Facebook Graph returns empty "likes" array for some users who have likes - facebook graph returns empty "likes" array users have likes. added friends_likes permission , works fine of users of them (who checked , have likes) returns empty array. why happening? hot solve it? they have custom privacy on likes, blocked app, or opted-out or disabled facebook development platform. arrays facebook graph user

exception - java.io.FileNotFoundException -

exception - java.io.FileNotFoundException - i trying web scrape info can utilize in application. the site trying info off yahoo getting filenotfoundexception when it's trying stream info in. i have set ip address , port explicitly. would thankful if can tell me going wrong. i have posted sample code well. parenturl = "http://www.yahoo.com"; pageurl = new url(parenturl); system.out.println(parenturl); seek { in = new bufferedreader(new inputstreamreader(pageurl.openstream())); } catch(exception ex2) { ex2.printstacktrace(); } while ((inputline = in.readline()) != null) { out.write(inputline); in.close(); } out.close(); the problem in initialization of out . haven't shown code, like: outputstream out = new fileoutputstream("non/existent/path/somefilename"); it's due using relative path, help debug it, recommend alter to: file file = new file("non/existent/path/somefilename"); system...

objective c - Playing video in iPhone simulator with Media Player Framework -

objective c - Playing video in iPhone simulator with Media Player Framework - i giving entire code below if helps anyway..... #import "contentviewcontroller.h" #import "contentviewcontroller.h" #import "mediaplayerviewcontroller.h" #import "twitterviewcontroller.h" #import "youtubeviewcontroller.h" @implementation contentviewcontroller @synthesize imageview; @synthesize imageview1; @synthesize tableview; @synthesize navigationcontroller; @synthesize toolbar; @synthesize item; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } homecoming self; } - (void)didreceivememorywarning { // releases view if doesn't have superview. [super didreceivememorywarning]; // release cached data, images, etc aren't in use. } #pragma mark - xmlparser delegate -(void)parsexmlfileatu...

How to scale down an image on the server side with PHP? -

How to scale down an image on the server side with PHP? - i have images pulled server , $imgurl holds path of image. right utilize <img src="<?php echo $imgurl ?>" width="100" height="200"/> or css scale downwards image, want in php serve scaled images dom any ideas? thanks this solution cause thumb created when requested first time. future requests fetch created thumb. using imagemagick: html: <img src="script.php?img=example" /> php (script.php): $width = 140; $height = 80; $image = $_get['img']; $ext = 'png'; // check if file exists if ( ! file_exists('/path/to/the/'.$image.'.'.$ext)) { die('unable process requested file.'); } // check if thumb exists, otherwise create thumb if (file_exists('/path/to/the/'.$image.'_thumb.'.$ext)) { $img = new imagick('/path/to/the/'.$image.'_thumb.'.$ext); } else { $img ...

drop down menu - How to make a selectbox the label of a radio button in Zend Fw -

drop down menu - How to make a selectbox the label of a radio button in Zend Fw - not idea, need set of radio buttons, lastly buttons value select box. visual explanation: o opt 1 o opt 2 o |___selectbox| what in html: <input type="radio" name="radioset">opt1 </input> <input type="radio" name="radioset">opt2 </input> <input type="radio" name="radioset"><!-- opt 3 --> <select> <option value="a"> aaa</option> <option value="b"> bbb</option> </select> </input> what i've done in zf far: $picker = new zend_form_element_select('selectbox', array( 'multioptions' => array('a'=>'aaa', 'b' =>'bbb'), 'decorators' => array( array('label', array('escape'=>false)) ) )); $this->addelement( 'radi...

oop - How to understand the big picture in a loose coupled application? -

oop - How to understand the big picture in a loose coupled application? - we have been developing code using loose coupling , dependency injection. a lot of "service" style classes have constructor , 1 method implements interface. each individual class easy understand in isolation. however, because of looseness of coupling, looking @ class tells nil classes around or fits in larger picture. it's not easy jump collaborators using eclipse because have go via interfaces. if interface runnable , no help in finding class plugged in. it's necessary go di container definition , seek figure things out there. here's line of code dependency injected service class:- // myexpirycutoffdateservice injected, date cutoff = myexpirycutoffdateservice.get(); coupling here loose can be. expiry date implemented literally in manner. here's might in more coupled application. expirydateservice = new expirydateservice(); date cutoff = getcutoff...

c# - RadToolTip's RenderControl method -

c# - RadToolTip's RenderControl method - i have asp.net application uses web part framework allow users customise interface. 1 of features of catalog of available web parts, 1 provided default, can overriden if wish alter layout, etc. override void rendercatalogpart(htmltextwriter writer, catalogpart catalogpart) that, far can tell, way it. @ moment i'm creating panel necessary elements in it, , using panel's rendercontrol method output htmlwriter. far, good. problem occurs when seek add together radtooltip panel, using same rendercontrol method, , next runtime error: page cannot null. please ensure operation beingness performed in context of asp.net request. i can see why might problem, since tooltip presumably uses javascript , has write page - rendercatalogpart method has no knowledge of page it's going outputting to. there way around or going have come alternative? i've posted on telerik website though i'd inquire here incase has ...

c# - How can I non-recursively browse the contents of a directory with the AWS S3 API? -

c# - How can I non-recursively browse the contents of a directory with the AWS S3 API? - say have next directories , files in amazon s3 bucket (files in bold): bucketname/ bucketname/folder1/ bucketname/folder1/foobar.txt bucketname/folder1/subfolder1/ bucketname/folder1/subfolder1/hello.txt bucketname/folder1/subfolder2/ bucketname/folder1/subfolder2/world.txt bucketname/folder1/subfolder2/subsubfolder1/ bucketname/folder1/subfolder2/subsubfolder1/file.txt how can list objects , immediate subdirectories of given directory .net aws s3 api, without recursively getting below directory? in other words, how can "browse" contents of directory @ single level? for example, imagine want browse contents of bucketname/folder1/ . see following: bucketname/folder1/foobar.txt bucketname/folder1/subfolder1/ bucketname/folder1/subfolder2/ ...and nil else. don't want list files , directories in subdirectories, want list files , subdirectories @ folder1 level. is the...

java - Does WebSphere 7 HTTPSession implementation contravene J2EE spec? -

java - Does WebSphere 7 HTTPSession implementation contravene J2EE spec? - saw problem 200 web container threads became hung, meaning none available service incoming requests , application froze. here simple web app , jmeter test think demonstrates cause of problem. web app consists of 2 classes, next servlet: public class sessiontestservlet extends httpservlet { protected static final string session_key = "session_key"; protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // set info on session listener invoked string sessiondata = new string("session data"); request.getsession().setattribute(session_key, sessiondata); printwriter author = response.getwriter(); writer.println("<html><body>ok</body></html>"); writer.flush(); write...