Posts

Showing posts from January, 2011

PHP autocomplete in Eclipse PDT function documentation not formatted -

i installed eclipse pdt. autocomplete works, , when pop-up box comes shows list of functions. problem descriptions of functions right in box not formatted. description describe function , list parameters plain text, , has visible css styling, not parsed such. how start of str_getcsv function described: /* font definitions */ html { font-family: 'sans',sans- serif; font-size: 10pt; font-style: normal; font-weight: normal; } body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; } pre { font-family: monospace; } /* margins */ has had problem. can't seem find reference this. it's because library eclipse uses render html inside autocomplete missing. in ubuntu or debian can solve installing libwebkitgtk-1.0-0 sudo apt-get install libwebkitgtk-1.0-0 then restart eclipse

adding gridlines to background in HTML and Javascript similar to VisualStudios grid -

i have grid snap implemented, want make light grey lines show both horizontally , vertically. reasoning making designing application has similar , feel visual studios' form designing aspect. i have globals way know pixel spacing. want working javascript. page can go infinitely in x , y directions, cannot have static length. needs dynamic. it coming along far, unsure if there current way implement this. <hr style ="position:absolute;" width = "1" size = "500" /> <hr style ="position:absolute;" width = "500" size = "1" /> if have modern browser, way : body{ background-size:15px 15px; background-position: 0 -5px; } body:hover{ background-image: -webkit-linear-gradient(top, #ffffff, #ffffff 98%, #000000 100%); } hover, nice, think can add second background , add more css prefix. edit : better html{ background-size:200px 200px,200px 200px; background-position: 0 0,0...

WCF Net.tcp service randomly faults -

this code modified , taken straight examples off internet of getting net.tcp duplex service running publish / subscribe mechanism. works great awhile clients randomly fault channel being used communicate. clients still communication 24 - 48 hours before faulting. question: know why socket randomly being aborted or how find out causing exception in error logs? using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.servicemodel.web; using system.text; namespace wcfservice1 { [servicecontract(callbackcontract = typeof(iclientcallback))] interface iservice { //the alert server function called client [operationcontract(isoneway = true)] void subscribetobenotifiedserver(string empid); [operationcontract(isoneway = true)] void updatepricingserver(string reservationid, string customerid); [operation...

java - JTextArea Document Listener updating text -

i have jtextarea , i'd listen when user pastes text in jtextarea. specifically, i'd following: get text pasted, remove whitespaces, , replace jtextarea text edited text without spaces (rather original text user pasted). how can using documentlistener, , avoiding java.lang.unsupportedoperationexception: not supported yet. , comes result of following code: public void insertupdate(documentevent de) { final string replace = jtextarea1.gettext().replaceall("\\s",""); swingutilities.invokelater(new runnable() { public void run() { jtextarea1.settext(replace); } }); } i haven't issue method insertupdate(documentevent documentevent) , sure jtextarea can accepting chars input, if you'll have issue use jeditorpane, there can importing java awt , swing objects too code example private documentlistener doclistener = new documentlistener() { @override public void ...

actionscript 3 - as3 if statment to check number range -

can tell me how amend can check if number in range? example 0-10 , 11-20. i've tried && , other things can't works. i'd keep simple possible. thanks stop(); value_enter.addeventlistener(mouseevent.click, release1); function release1(evt:mouseevent):void { if ( number(inputfield.text) > 0) { gotoandstop(2); } else if ( number(inputfield.text) < 21) { gotoandstop(3); } } i use switch statement instead of multiple else if statements. cleaner , more readable code. allow add in more cases ease. stop(); value_enter.addeventlistener(mouseevent.click, release1); function release1(evt:mouseevent):void { switch(true){ case ( number(inputfield.text) >=0 && number(inputfield.text) <= 11): gotoandstop(2); break; case ( number(inputfield.text) >=10 && number(inputfield.text) <= 21) : gotoandstop(3); break; default: // inputfield.text value not in bounds }...

asp.net - Is converting a DataTable stored in Viewstate to a List<T> a bad option? -

i've started new job , inherited nightmare webforms .net 4.0 project that's going wrong in lots of places. i've got user control storing datatable in viewstate. code referencing columns throughout code index number making totally unreadable. know can reference columns name make more readable i'd prefer break out list. the previous developer storing list in viewstate because changes can't persisted database, read in data, sales people can make modifications pricing , information pushed xml format generate sales order form in pdf. need mechanism storing temporarily. if had luxury of starting scratch i'd pull data down in json , client side don't have luxury yet. it's been long, long time since worked datatables , i'm pretty sure it's not placing in viewstate, correct? kind of load placing on viewstate; we're looking @ 44 columns , around 25 rows. :s secondly, if there big difference between placing list in viewstate opposed datat...

vb.net - Firefox does not accept ASP.NET authentication cookies -

i'm having issue firefox browser when deploy our application qa environment. have asp.net 4 application form authentication. in our application, have 2 cookies: 1 authentication ticket, other information. issue is: everytime login system using firefox, i'm bounced login page. when use fiddle investigate issue, found out reason firefox doesn't "accept" our cookies: 1st request login page, our server returns cookies fine in headers: set-cookie: .aspxauth_imp=...; expires=thu, 07-jun-2012 06:37:24 gmt; path=/ set-cookie: .aspxauth=...; expires=wed, 06-jun-2012 09:57:24 gmt; path=/ however, in next response, our cookies not present in request header. issue not happen in other browsers (ie, chrome, etc). in other browsers, cookies accepted , passed along in next requests. when view cookies stored in firefox, can see website, has asp.net_sessionid cookie. there's no trace of other 2 cookies. 1 more interesting point issue happens in qa environment ( has l...

c - Any reason to use 32 bit integers for common operations on 64 bit CPU? -

i wonder if it's idea keep using int (which 32 bit on both x86 , x86_64) on 64 bit programs variables have nothing special , not need span 2^64, iteration counters, or if it's better use size_t matches word size of cpu. for sure if keep using int save half of memory, , mean speaking cpu cache, don't know if on 64 bit machine every 32 bit number has extended 64 bit before use. edit: i've ran test program of mine (see self answer , still keep janneb's accepted though because good). turns out there significant performance improvement. for array indices , pointer arithmetic, types of same size pointer (typically, size_t , ptrdiff_t) can better, avoid need 0 or sign extend register. consider float onei(float *a, int n) { return a[n]; } float oneu(float *a, unsigned n) { return a[n]; } float onep(float *a, ptrdiff_t n) { return a[n]; } float ones(float *a, size_t n) { return a[n]; } with gcc 4.4 -o2 on x86_64 following asm generated: ...

algorithm - How to approximate a polygon with n rectangles? -

is there algorithm can approximate given polygon n non overlapping rectangles gives maximum coverage? maximum coverage mean, sum of rectangle areas maximized. rectangles not equal sized. the polygons dealing convex. if exact solution hard/expensive find (which expecting be), simple heuristics welcome too. edit thought of approximating polygon rectangles inside polygon, solutions rectangles not totally inside polygons fine. if case, maximization of area becomes minimization of area. edit 2 forgot mention these rectangles orthogonal rectangles, i.e. aligned axises. one approach create (in general case rectangular) bounding box polygon. calculate difference between area of bounding box , area of polygon. if difference small enough, you're done, if not, continue ... divide box 4 equal-sized rectangles, 2x2. figure out of these rectangles entirely inside polygon. calculate difference between total area of rectangles inside polygon , of polygon. if difference s...

php - how to escape string in mysqli -

in old mysql() code, escape string, did this: t.teacherusername = '".mysql_real_escape_string($teacherusername)."' i changing code mysqli, want know sure , safe, escape string in mysqli below: t.teacherusername = '".mysqli_real_escape_string($teacherusername)."' also connect mysqli database below: $username="xxx"; $password="xxx"; $database="xxx"; mysqli_connect('localhost',$username,$password); mysqli_select_db($database) or die( "unable select database"); all have done change mysql mysqli, correct? update: is correct way connect database using mysqli: $username="xxx"; $password="xxx"; $database="mobile_app"; $mysqli = new mysqli("localhost", $username, $password, $database); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } your use of function incorrect. you mus...

c# - How to prevent a listview from adding a blank line? -

currently code. textreader reader = new stringreader(richtextbox1.text); string[] stritems = null; while (reader.peek() != -1) { string nextrow = reader.readline(); if (!listview1.items.containskey(nextrow.gethashcode().tostring())) { listviewitem item = new listviewitem(); item.name = nextrow.gethashcode().tostring(); stritems = nextrow.split("-".tochararray()); item.text = stritems[0].tostring(); try { item.subitems.add(stritems[1].tostring()); } catch (exception) { } try { item.subitems.add(stritems[2].tostring()); } catch (exception) { } try { item.subitems....

c# - linq as dataset issue with column names -

how can avoid using magic strings in linq query against datatable? this works: public ienumerable getdisplaynames() { ienumerable nameqry = row in displaytable.asenumerable() select row.field("display"); return nameqry; } but fails "specified cast not valid.": public ienumerable getdisplaynames() { string disp = mydictionary["d"]; ienumerable nameqry = row in displaytable.asenumerable() select row.field(disp); return nameqry; } my preference use local string (or direct reference off of mydictionary) instead of hard coding strings in place. want use string disp instead of phrase "display" in query. try using static ienumerable<datarow> gettherows(datatable dt, string name) { return dt.asenumerable().where(r => r.field<string>("yourcolumn") == name); } or whatever correct data type in given scenario. need specify type when using field...

iphone - NSTimer - Multiple instances are created -

i have app, polls server @ regular intervals. polling performed using timer task. timer needs used on 1 screen, when move other screen, timer invalidated. i observed timer gets invalidated, not. , when not invalidated, multiple instances keep on getting created. i have initialized timer follows: timer = [nstimer scheduledtimerwithtimeinterval: 2 target: self selector: @selector(timertask:) userinfo: nil repeats: yes]; and invalidated follows: if(timer){ [timer invalidate]; timer = nil; } please help, needs done in case. thanks in advance. are creating multiple timers? in code snipped posted above, if timer defined when execute: timer = [nstimer scheduledtimerwithtimeinterval: 2 target: self selector: @selector(timert...

Primefaces Charts without shadow -

i using primefaces barchart in 1 of projects in small area need display chart contains multiple data points. when chart rendered, bars become thin, ok me. however, there shadows of each of bars confusing on chart. is possible disable shadows in primefaces charts? the bar chart has 'shadow' attribute. setting false should make shadow dissapear. however, @ least in version 3.1.1 not able make shadow dissapear using attribute, seems doesn't work. if have same issue, add following style css file: .jqplot-series-shadowcanvas { display: none; } it hides shadows of bar chart (and shadow of other charts too, haven't tested it).

symfony - using sonata_type_collection against a custom form type instead of a property/relationship with another entity -

is possible use sonata_type_collection against custom form type instead of property/relationship entity? something this: $formmapper->add('foo', 'sonata_type_collection', array('type' => new \myvendor\mybundlebundle\form\type\blocktype() )); which throws me following error the current field `contingut` not linked admin. please create 1 target entity : `` edit: something did trick: $formmapper->add('contingut', 'collection', array( 'type' => new \myvendor\mybundlebundle\form\type\block1type(), 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false )); instead of custom type in example, can use native entity type. $formmapper->add('cars', 'collection', array( 'type' => 'entity...

java - How to find words sysnonyms using GATE ANNIE? -

i have been working on information extraction , able run standaloneannie.java http://gate.ac.uk/wiki/code-repository/src/sheffield/examples/standaloneannie.java my question is, how can use gate annie similar words if input (dine) result (food, eat, dinner, restaurant) ? more information: doing project assigned develop simple webpage take user input , pass gate components tokenize query , return semantic grouping each phrase in order make recommendation. for example user enter "i want have dinner in kuala lumpur" , system break down (search :dinner - required: restaurant, dinner, eat, food - location: kuala lumpur. annie default has 15 annotations, see demo http://services.gate.ac.uk/annie/ implemented demo question is. can using gate annie, mean possible find words synonyms or group words based on type (noun, verbs)? plain vanilla annie doesn't support kind of thing there third party plugins such phil gooch's wordnet suggester might help. o...

jsf - Growl primefaces 3.2 -

i work jsf 2.0 , primefaces 3.2. have problem growl, when click on buttons, don't see growl. code: demarragearretservices.xhtml : <p:growl id="gr" showdetail="true" /> <p:panel header="etat du service postfix" style="width:375px;height:200px;top:20px;left:20px;position:absolute;border-color:#66cccc;border-style:solid;border-width:3px;"> <p:graphicimage value="/images/stop.png" style="top:4px;left:310px; position: absolute;width:30px;height:30px;"/> <p:graphicimage value="/images/start.png" style="top:4px;left:340px; position: absolute;width:30px;height:30px;"/> <h:outputlabel value="ce service est " style="top:70px;left:20px;position:absolute;font-size:17px;" /> <p:commandlink id="ajax1" update="et1,bt1" actionlistener="#{servicesbean.consulteretatpostfix()}" style=...

.net - asp.net membership for two projects in a solution -

i have 2 web projects both using same database , in same solution. 1 of them using asp.net membership.i want include other one.how can manage this? configure second app use same membership database. change applicationname property of membership provider config in web.config different first app.

haskell - Handling nested variable scopes when implementing an interpreter -

i'm writing interpreter simple programming language , wanted ask on best approach tackle it. the environment program follows: type env = [[(var, int)]] so i've coded lookup , update i'm bit stuck on how deal the scope each begin block. example shown below: begin [a,b,c] read n = 1 while < 0 begin n = 2 * n = - 1 end; write n end from understanding scope of first begin [a,b,c,i,n] , second begin contain [i, n] therefore env [ [ ("a",0), (b",0), ("c",0), ("i",3), ("n",2) ], [("n",8), ("i",0) ] ]` currently lookup function returns first occurrence of variable, i'm having problems 2nd scope (2nd begin). i'm not quite sure how can make update , lookup function return value associated particular scope. basically have code working 1 begin statement, having issues 2 or more statements in sample program.

compression - Compressing images - get image size PHP -

i have script recursively loops through sub directories , compresses jpegs. print file size, before , after compression prints same number. script running is: set_time_limit (86000); ob_implicit_flush(true); $main = "files"; function readdirs($main){ $dirhandle = opendir($main); while($file = readdir($dirhandle)){ $newfile = $main.'/'.$file; if(is_dir($newfile) && $file != '.' && $file != '..'){ readdirs($newfile); } else{ if($file != '.' && $file != '..' && stristr($newfile,'.jpg')) { //echo $newfile.'</br>'; $img = imagecreatefromjpeg($newfile); echo 'compressing '.$newfile.'... ('.filesize($newfile).' bytes) ('; imagejpeg($img,$newfile, 30); echo filesize($newfile).' bytes)...<br>'; for($k = 0; $k < 40000; $k++) ...

insert query using ajax drupal 7 -

i have searched internet way use our history database on our drupal 7 site. have database built names, marriage dates, etc. have basic page insert. found site helped code, not working. not programmer, can follow directions. here code have: on basic page using php code input format, <script language="javascript" type="text/javascript"> //browser support code function ajaxfunction(){ var ajaxrequest; // variable makes ajax possible! try{ // opera 8.0+, firefox, safari ajaxrequest = new xmlhttprequest(); } catch (e){ // internet explorer browsers try{ ajaxrequest = new activexobject("msxml2.xmlhttp"); } catch (e) { try{ ajaxrequest = new activexobject("microsoft.xmlhttp"); } catch (e){ // went wrong alert("your browser broke!"); return false; } } } ajaxrequest.onreadystatechange = function(){ if(ajaxrequest.readystate == 4){ var ajaxdisplay = document.getelementbyid("ajaxdiv"); ajaxdisplay.innerhtml = ajaxrequest....

MySQL distinct+sort query performance issue -

problem the following query takes in excess of 30 seconds run unless: i remove sort (query <1 sec) i remove distinct keyword: (query <1 sec) start removing joins (query <5 secs) question how can make query run in under 1 sec. required: how can unique list of meetings related data described joins below including sort of kind. the related data used both determining if there related field , doing group_concat operations - hence requirement have 3 different joins same bookeditems table. thanks in advance & or suggestions! i've been banging head on 1 few hours! query select distinct( `meetings`.`id` ) `meeting_id`, `meetings`.`uid` meeting_uid, `meetings_serv`.`id` meetings_serv_id, `meetings_transp`.`id` meetings_transp_id, `meetings_acco`.`id` meetings_acco_id, `meetings_bookeditems`.`id` meetings_bookeditems_id `meetings` meetings left outer join `bookeditems` `meetings_serv` on `meetings`.`uid` = `meetings_serv`.`meeting_uid` , 'ser...

Javascript to wait the end of a function including asynchronous MYSQL Queries from node.js? -

i'm having javascript problem wait function done before below line called. previous function including javascript mysql queries calls (one of library of node.js). looks like: function first() { /** * lot processes execute * including asynchronous processes * running queries using javascript mysql library node.js */ console.log("i first one!"); } first(); console.log("i second one!"); then when execute this, happening like: i second one! first one! how make them run keeping queue order? note: confusing question, please jump/follow newly created question again: everyone please follow/jump new question: node.js mysql detect insert/update completeness of query? pass callback 2nd function call 1st function. @ end of 1st function, invoke theh callback: function one(parm, callback) { // callback(); } function two() { // else } one("my parm", two);

Perl Recurse through Directory -

so i'm trying go through directory , perform action on of files, in case, sub searchforerrors. sub works. have far is: sub proccessfiles{ $path = $argv[2]; opendir(dir, $path) or die "unable open $path: $!"; @files = readdir(dir); @files = map{$path . '/' . $_ } @files; closedir(dir); (@files){ if(-d $_){ process_files($_); } else{ searchforerrors; } } } proccessfiles($path); any help/suggestions great. , again, i'm new perl, more explanation better. thank you! you should use file::find module instead of trying reinvent wheel: use strict; use warnings; use file::find; @files; $start_dir = "somedir"; # top level dir search find( sub { push @files, $file::find::name unless -d; }, $start_dir ); $file (@files) { searchforerrors($file); } a problem current code including . , .. directories in recursive search, no doubt cause deep recursi...

Ruby On Rails 3.2.3 - Displaying Information From Two Models On The Same View -

i trying display country name on view. have user model country_id belongs_to :countries. have country model id, iso & name has many :users. this have in controller show view: @user = user.find(params[:id]) i thought relationship setup user.country.name or user.countries.name , country name. following error, both in view or in user controller. not matter if have user, country or countries capitalized or not. failure/error: click_button "save changes" actionview::template::error: undefined local variable or method `user' #<#:0x007fb9548a7ae0> i thought try in view: country.find(@user.country_id).name this works expected in rails console. showing correct country id value want name for. stated when command in rails console correct value. in console first assigned @user in controller. afterwards country.find command. in view following error on country.find command: failure/error: click_button "save changes" actionvi...

hql - how to show table values with no refernece in other table in hibernate -

i using hibernate , want display records of table not have refrence in table b.i.e. table has primary key jobid,which foreign key in table b. want display id values not present in table b. select a a.jobid not in (select b.jobid b b)

android - Phonegap file writing throws error code 1 -

i trying write file in android using phonegap cordova 1.5.0. below code snippet. snippet working fine in simulator when run on android mobile goes till gotfs() "fail error code" alert of fail() pops message "fail error code 1" that means failing @ line filesystem.root.getfile("projectfilename", {create: create: true, exclusive: false}, gotfileentry, fail); . code snippet function ondeviceready() { window.requestfilesystem(localfilesystem.persistent, 0, gotfs, fail); } function gotfs(fs) { filesystem = fs; filesystem.root.getfile("projectfilename", {create: create: true, exclusive: false}, gotfileentry, fail); } function gotfileentry(fe) { fileentry = fe; fileentry.createwriter(gotfilewriter, fail); } function gotfilewriter(writer) { .......... file writing code. ...

shell - How to move one directory back in unix / linux when path contains symbolic links? -

i have created symbolic link nested directory. using symbolic link can move directory home directory. want move 1 directory target directory shell comes home directory. [root@pe1800xs ~]# pwd /root [root@pe1800xs ~]# mkdir -p abc/def/ghi/jkl/mno/pqr [root@pe1800xs ~]# ln -s abc/def/ghi/jkl/mno/pqr/ xyz [root@pe1800xs ~]# cd xyz [root@pe1800xs xyz]# pwd /root/xyz [root@pe1800xs xyz]# pwd -p /root/abc/def/ghi/jkl/mno/pqr [root@pe1800xs xyz]# cd .. [root@pe1800xs ~]# pwd /root what want achieve when cd.. in pqr directory shell should come mno directory. you must use cd -p xyz to enter directory follow original structure of folders, can move wish because have resolved link real path.

algorithm - Finding largest and second-largest out of N numbers -

given n numbers, how find largest , second largest number using @ n+log(n) comparisons? note it's not o(n+log(n)), n+log(n) comparisons. pajton gave comment. let me elaborate. as pajton said, can done tournament selection. think of knock out singles tennis tournament, player abilities have strict order , outcome of match decided solely order. in first round half people eliminated. in next round half etc (with byes possible). ultimately winner decided in last , final round. this can viewed tree. each node of tree winner of match between children of node. the leaves players. winner of first round parents of leaves etc. this complete binary tree on n nodes. now follow path of winner. there log n matches winner has played. consider losers of log n matches. second best must best among those. the winner decided in n-1 matches (you knock out 1 per match) , winner among logn decided in logn -1 matches. thus can decide largest , second largest in n+log...

php - JSON not showing responnse -

the following code not work me. <?php $json_string = file_get_contents("http://api.wunderground.com/api/7ec5f6510a4656df/geolookup/forecast/q/40121 .json"); $parsed_json = json_decode($json_string); $temp = $parsed_json->{'forecast'}->{'date'}; echo "current date ${temp}\n"; ?> it works when put so: $temp = $parsed_json->{'location'}->{'city'}; what missing here lol it should be: $temp = $parsed_json->{'forecast'}->{'txt_forecast'}->{'date'}; for better way of viewing json objects, @ this site .

entity framework - Decouple EF queries from BL - Extension Methods VS Class-Per-Query -

i have read dozens of posts pros , cons of trying mock \ fake ef in business logic. have not yet decided - 1 thing know - have separate queries business logic. in this post saw ladislav has answered there 2 ways: let them , use custom extension methods, query views, mapped database views or custom defining queries define reusable parts. expose every single query method on separate class. method mustn't expose iqueryable , mustn't accept expression parameter = whole query logic must wrapped in method. make class covering related methods repository (the 1 can mocked or faked). implementation close implementation used stored procedures. which method think better why ? are there any downsides put queries in own place ? (maybe losing functionality ef or that) do have encapsulate simplest queries like: using (mydbcontext entities = new mydbcontext) { user user = entities.users.find(userid); // encapsulate ? // bl code here } s...

database - MySQL Query Optimization -

i have following query select users , locations, etc mysql (all innodb). table user , blocked_user , blocked_countries have 2mil rows each, countries 250, regions 3500 , cities 2.8mil. the problem query quite fast (0.05sec) without and co.country_id='us' in where clause. however, tried around have feeling there must easier , better way query, no? what missing? highly appreciated! thank in advance! thank again help. finally, i've found direction solve problem. performance problem caused because of mixture between range scan , order ... limit . so, i've learned lot (new me) indexing , found if have range scan (as in case age between x , y), ranging column must last in concatenated index, otherwise index cannot used entirely. in addition, column used sort results, must last in index. so, given mixture between range scan , order by , need decide if index should used sort or select. in case means thinking of combinations several indexes, left on r...

ajax - How to get Facebook share count of specific url using javascript -

hi i've looked on internet days find answer question. i'd know how share count of specific url using javascript , sending value server side using ajax. i'd appreciate if me out :) you can use graph functional: http://graph.facebook.com/ you have load page this: http://graph.facebook.com/http://graph.facebook.com/ , results returned via json. carefull long urls, not returned correctly. hope it'll help!

Make connection to Solr with PHP -

i've installed solr , got default schema working me. when change schema default simplier one, cannot connect through solr through php can through tomcat still. php code looks this: require_once 'apache/solr/service.php'; $solr = new apache_solr_service( 'xxx.xx.xxx.xxx', 8080, '/dev.example.com/'); if(!$solr->ping()){ echo 'solr down'; } and schema in solr <?xml version="1.0" ?> <schema name="testschema1" version="1.5"> <types> <fieldtype name="string" class="solr.strfield" sortmissinglast="true" omitnorms="true"/> </types> <fields> <!-- general --> <field name="id" type="string" indexed="true" stored="true" multivalued="false" required="true"/> <field name="type...

java - Dice Emulation - onClickListener in loop -

i'm working on yahtzee program mobile app class, , running trouble. loop have written run through loop (13 turns , 3 rolls) when onclick() pressed once. have moved them several different orders can't seem right. guide me in right direction have onclick accurately keep tally of turns , rolls? code import java.util.random; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imagebutton; public class yahtzee4activity extends activity { /** called when activity first created. */ imagebutton dice1, dice2, dice3, dice4, dice5; button roll, begin; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); playgame(); } public void playgame() { final random rand = new random(); final int max_turns = 13; final int max_rolls = 3; ...

sql - MySQL Multilevel parent child SP and IN Clause -

Image
i working on table referrals contains parent child relations i need parent -> children -> ther children -> .... for above table data desired result is i have seen code sof didn't how working , tried myself easy logic in mind unfirtunately not working strange reason i have written stored procedure stuck issue in clause delimiter $$ drop procedure if exists `gethierarchy3`$$ create definer=`root`@`localhost` procedure `gethierarchy3`() begin declare idss varchar(225); set @currentparentid := 999999; set @lastrowcount := 0; ## ## insert referrals_copy select * referrals uid1 = @currentparentid; set @lastrowcount := row_count(); ## b ## select group_concat(uid2) @idss referrals uid1 = @currentparentid; #select @lastrowcount; select * referrals_copy; while @lastrowcount > 0 select "here"; select @idss; ## c ## insert referrals_copy select uid1, uid2 referrals ...