Posts

Showing posts from January, 2011

java - How to respond with the result of an actor call? -

we looking @ using akka-http java api - using routing dsl. it's not clear how use routing functionality respond httprequest; using untyped akka actor. example, upon matching route path, how hand off request "handler" actorref, respond httpresponse in asynchronous way? a similar question posted on akka-user mailing list, no followup solutions such - https://groups.google.com/d/msg/akka-user/qhe3ko7evvg/kc-akz_o5aoj . this can accomplished combination of oncomplete directive , ask pattern. in below example requesthandleractor actor used create httpresponse based on httprequest . actor asked within route. i have never used java routing code response in scala. import scala.concurrent.duration._ import akka.actor.actorsystem import akka.http.scaladsl.model.httpresponse import akka.http.scaladsl.model.httprequest import akka.actor.actor import akka.http.scaladsl.server.directives._ import akka.actor.props import akka.pattern.ask import akka.util.timeo

foreach - Why/How does a lodash "[iteratee=_.identity] (Function)" in _foreach have a 'mystery' third param? -

i getting hang of lodash.js first time today , have discovered can access 'value' 'index' , 'list' within iterator function. i came across when using _.foreach function. for example: _.foreach(omyarray, function(value, index, list){ ... }) however api specifies 2 params "n" , "key" when dealing objects. why no mention of third? ? api link has 3 arguments listed right there: the iteratee bound thisarg , invoked 3 arguments: (value, index|key, collection)

sql - Can anyone tell me what is wrong with my query? -

select t1.description, t1.type, t1.salespotential , t2.startdate, t3.project_region, t3.job_type sysdba.opportunity t1, select t1.type, count(*) opportunity group by type, join sysdba.activity t2 on t1.accountid = t2.accountid join sysdba.c_opportunity_ext t3 on t1.opportunityid = t3.opportunityid closeprobability > 70 the line "group by type," has bad syntax. use 1 by. type reserved word. if refers field, use `type` (surround field name ` character). comma @ end shouldn't there. group `type` if using mysql, it's practice put sub-queries inside parentesis. becomes "derived table" , needs name. i've used "sometemptable" in example: (select t1.type, count(*) opportunity group `type`) sometemptable

internet explorer 9 - Add Class to parent, jquery and IE9 -

so simple, can't work in ie9. ive read tons of answers , nothing seems work. need add class elements parent, seems simple right? in other browsers, trick: $('#trigger').click(function(e){ e.preventdefault(); $(this).parent().addclass('bar'); }); not in ie9. solutions ive found don't work either: $('#trigger').click(function(e) { e.preventdefault(); var item = $(this).closest("li"); $(item).addclass('bar'); }); here's fiddle try in ie9 this working in ie9 $('#trigger').click(function(e) { e.preventdefault(); var item =$(this).parent('li'); $(item).addclass('bar'); }); <ul> <li class="foo"> <a href="javascript:void(0)" id="trigger">click me</a> </li> <li>other shit</li> </ul>

sql - MySQL checking last updated time on multiple devices -

i check last update date , time (recordtime) every treehugger id (treehuggerid) , below did. output not last update time according below query. please advice. thank you. select `recordtime`, distinct `treehuggerid` `sensor_treehuggers` `treehuggerid` < 20000 , `treehuggerid` > 10000 order `recordtime` desc you have select max(recordtime) every treehuggerid , don't need distinct select treehuggerid,max(recordtime) sensor_treehuggers then @ end group treehuggerid like this select treehuggerid,max(recordtime) sensor_treehuggers treehuggerid between 10000 , 20000 group treehuggerid

postgresql - How do I filter jsonb with multiple criteria? -

i have following table structure: create table mytable ( id serial primary key, data jsonb ); and following data (partial brevity...notice randomness of years , sales/expense yrs don't align each other): insert mytable (data) values ('{"employee": "jim romo", "sales": [{"value": 10, "yr": "2012"}, {"value": 5, "yr": "2013"}, {"value": 40, "yr": "2014"}], "expenses": [{"value": 2, "yr": "2007"}, {"value": 1, "yr": "2013"}, {"value": 3, "yr": "2014"}], "product": "tv", "customer": "1", "updated": "20150501" }'), ('{"employee": "jim romo", "sales": [{"value": 10, "yr": "2012"}, {"value": 5, "yr":

c# - How to stop the creation of a table when mapping to a stored proc MVC -

i have codefirst mvc 5 application. there spatial query involved, have wrapped in stored proc. using new class, i've mapped results of stored proc call model use in views. however, codefirst wants create new table model class. how prevent that? should bother (i'm never writing table or updating table.) model class: public class conflict { [key, column(order=0)] public int projectid { get; set; } [key, column(order=1)] public int conflictprojectid { get; set; } [datatype(datatype.date)] [displayformat(dataformatstring = "{0:dd/mm/yyyy}")] [display(name="start")] public datetime startdate { get; set; } [datatype(datatype.date)] [displayformat(dataformatstring = "{0:dd/mm/yyyy}")] [display(name = "end")] public datetime enddate { get; set; } public virtual project project { get; set; } } stored proc call: public actionresult index(int d = 0, int r = 0, int p = 0, bool f

Arithmetic with columns in different tables in mysql [optmization] -

Image
in following query: select (select nick nicks n n.pid=p.id limit 1 order id desc) nick , ( ( ( select count(*) kills k k.pid = p.id ) + ( select count(*) votos v v.pid = p.id ) ) - (select count(*) deaths d d.pid = p.id ) ) score , (select count(*) kills k k.pid = p.id ) kills , (select count(*) deaths d d.pid = p.id ) deaths , (select count(*) headshots h h.pid = p.id ) headshots , (select count(*) votos v v.pid = p.id ) reputation players p p.uuid='steam_x:x:xxxxxx' group kills this query works fine... think there exists better way this. can me optimize query? here better way write query: select p.*, (kills + reputation - deaths) score (select (select nick nicks n n.pid = p.id order id desc limit 1 ) nick, (select count(*) kills k k.pid = p.id ) kills, (select count(*) deaths d d.pid = p.id ) deaths, (select count(*)

java - What is wrong with my BMI Calculator? -

i trying make bmi calculator calls method of separate class calculate bmi, continue in main method. below source code. import java.util.scanner; public class testbmi { public static void main(string[] args) { string name; double bmi; string bmiclass; char z; scanner readinput = new scanner(system.in); { system.out.print("please enter name: "); name = readinput.nextline(); bmi.calculatebmi(); if (bmi < 18.5) { bmiclass = "(underweight)"; } else if (bmi >= 18.5 && bmi <= 25) { bmiclass = "(normal)"; } else if (bmi > 25.0 && bmi <= 30.0) { bmiclass = "(overweight)"; } else bmiclass = "(obese)";

java - How does a servlet handle more bytes than available RAM? -

lets have servlet running accepts files of size client application(s). file being sent loaded datahandler , transmitted web-services; such received , put datahandler. happens if file being sent exceeds size of available ram on receiving host? my initial thoughts are: 1)the jvm put in virtual memory, size of file been known through header messages , jvm sneaky , allocate space ahead of time. however, did not think virtual memory space big. 2)the jvm create "hidden" file hold data on hard disk , datahandlers output stream load data ram needed. in either case seems easier write file hard disk anyway avoid using data after receive it. server hosting servlet have many different clients sending large files around same time , wondering how jvm handle issues this. the servlet api provides streams on request , response. input stream on request load bytes jvm required. the stream not hold data in memory, call read() gets data out of small buffer or causes b

css3 - expanding/animating a div from center when width is 100% -

i have div border , used keyframes expand onload want expand center rather left right. http://andylilien.com/index2015.html the css: .navback { position:absolute; bottom:0px; padding-bottom:-8px; width:100%; height:17px; background-color:#fff; border-top: 1px solid #d0d0d0; z-index:999; } @-webkit-keyframes expandline{ 0%{width:0%;} 50%{width:50%;} 100%{width:100%;} } .navback{ -webkit-animation:expandline 2s; } adjust height , width doing, transform element positioning left , top appropriately. also, don't need keyframe animations if you're using common easing function or linear animation. #expander { position:absolute; width: 0; height: 17px; background-color: #fff; border-top: 1px solid red; z-index: 999; transform: translate(-50%, -50%); top: 50%; left: 50%; -webkit-animation: expandline 2s; } @-webkit-keyframes expandline{ 0% { width: 0%; } 50% { width: 50%; } 100% { width: 100%; } } <di

java - Is Map<String,AtomicLong> enough to be thread safe? -

i have simple class: public class idprovider { private map<string,atomiclong> idmap; public idprovider(){ idmap = new hashmap<>(); } public long getavailableid(string conversation){ atomiclong id = idmap.get(conversation); if(id == null){ id = new atomiclong(0); idmap.put(conversation,id); } return id.getandincrement(); } } different methods asynchronously may pass same conversation identifier , call getavailableid() returned unique id. is thread safe? i'm guaranteed no 2 methods receive same id or need opt else? there's multiple ways make thread safe, below simplest, think. first, need safely publish initial map. need make each access of map thread safe. public class idprovider { private final map<string,atomiclong> idmap; public idprovider(){ idmap = new hashmap<>(); } public synchronized long getavailableid(stri

Variable value changing after returning from a function in C -

i've been coding university working matrices , can't find error in code changing value of variable save columns of matrix. i've tried debugging , can´t find it, ends function allocate memory por matrix , enters next function (which gets values keyboard fill matrix) wrong column value. code next: #include <stdio.h> #include <stdlib.h> #define debug 1 void allocate (int ***mat,int n,int m){ int i; *mat = (int **) malloc (n*sizeof(int*)); (i=0; i<n; i++){ mat[i] = (int *) malloc (m*sizeof(int)); } #if debug printf ("allocate n: %d m: %d\n",n,m); #endif // debug } void initialize (int **mat, int n, int m){ int i,j; #if debug printf ("initialize n: %d m: %d\n",n,m); #endif // debug (i=0; i<n; i++){ (j=0; j<m; j++){ printf ("enter value position [%d][%d]: ",i,j); scanf ("%d",&(mat[i][j])); } } } int

python - newbody = ntob('').join(newbody) TypeError: sequence item 1: expected string, int found -

what best way troubleshoot error? typeerror: sequence item 1: expected string, int found the python file (not mentioned in traceback) 500 lines. request headers: cookie: admin_sess=c13d2f729d47c132b223e8f19ce77ac25aa12 origin: https://192.168.1.135:5001 remote-addr: 192.168.1.161 content-length: 36 user-agent: mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) ubuntu chromium/43.0.2357.81 chrome/43.0.2357.81 safari/537.36 connection: keep-alive referer: https://192.168.1.135:5001/ x-requested-with: xmlhttprequest host: 192.168.1.135:5001 accept: */* accept-language: en-us,en;q=0.8 content-type: application/x-www-form-urlencoded; charset=utf-8 accept-encoding: gzip, deflate [18/jun/2015:18:10:15] http traceback (most recent call last): file "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 661, in respond response.finalize() file "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 927,

python - Conditionally Combining/Reducing key-pairs -

i've had issue time now, , think has lack of understanding of how use combinebykey , reducebykey, can clear up. i working dna sequences, have procedure produce bunch of different versions of (forwards, backwards , complimented). have several reading frames, meaning string abcabc , want following series of keys: abc abc , a bca bc , ab cab c . right using following function break things (i run in flatmap procedure): # modified http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python def chunkcodons((seq, strand, reading_frame)): """ yield successive codons seq """ # first characters if reading_frame > 0: yield (0, seq[0:reading_frame], strand, reading_frame) in xrange(reading_frame, len(seq), 3): if % 1000000 == 0: print "base # = {:,}".format(i) yield (i, seq[i:i + 3], strand, reading_frame) i run so: reading_frames_rdd = n

c# - Sequence contains no elements -

can explain me why following linq query throws invalidoperationexception? (don't list has no elements,the value i'm looking exists in collection) class program { static int lastnumber; static void main() { int loopcount = 100; int minvalue = 1; int maxvalue = 10000; var numbers = enumerable.range(minvalue, maxvalue).tolist();//or toarray(); random random = new random(); (int = 0; < loopcount; i++) { //.first() throws exception obvious value exists in list int x = numbers.where(v => v == newmethod(minvalue, maxvalue, random)).first(); } console.writeline("finished"); console.readline(); } private static int newmethod(int minvalue, int maxvalue, random random) { var a1 = random.next(minvalue + 1, maxvalue - 1); lastnumber = a1; return a1; } } the problem appears when call newmethod

java - Primes and boolean logic -

i wanted write program find primes b wrote code (which worked): public static void main(string[] args) { int a; int c; boolean isprime; = 2; c = 0; while(a <= 100000 ){ isprime = true; (int b = 2;b<a; b++){ c = a%b ; //system.out.println(c); if ( c == 0){ // stores every not prime number isprime = false; } } if (isprime){ system.out.println(a); } a=a+1; } } // main end next tried write variation of code, did not work: public static void main(string[] args) { int q; int w; boolean isprimeone = false; q = 2; w = 0; while(q <= 100){ isprimeone = false; (int d = 2; d<q; d++){ w = q%d; if( w != 0 ){

php - http.newRequest not sending post data -

i have following code send post data server, server not detecting post data on request. client code: cookiejar, _ := cookiejar.new(nil) client := &http.client{ jar: cookiejar, } posturl := os.args[1] username := os.args[2] password := os.args[3] data := url.values{} data.set("username", username) data.add("password", password) data.add("remember", "false") r, _ := http.newrequest("post", posturl, bytes.newbufferstring(data.encode())) resp, _ := client.do(r) defer resp.body.close() body, err := ioutil.readall(resp.body) fmt.printf("%s\n", string(body)) server code: if(isset($_post['username'], $_post['password'], $_post['remember'])){ echo $username = md5(($_post['username'])); echo $password_original = $_post['password']; echo $password =

javascript - How to I sort child divs in a parent div by both visibility and id? -

i'm working configurator shows , hides divs. shows 4 tiled answers in fluid row. in scenario i'm dealing boats. if filter boat list length. divs hide still take space, result grid of images has missing spaces , doesn't line up. goal sort child divs inside of div, putting hidden ones @ bottom , sorting visible ones @ top id. below structure of data before filter applied. can me sort visibility , id? <div class="row-fluid"> <div data-ref="model/17slxde" class="span3" data-order="8"> <label> <div class=" item-label tile-answer" style="padding-top: 3px; border: none; background-color: rgba(0, 0, 0, 0);"> <input type="radio" data-ref="model/17slxde" id="5577aef88ff578876c419a0a" class="custom-radio"> <span class=""><p>17 slx</p></span>

vb.net - GroupBy Linq IEnumerable error -

i trying group on ienumerable. whenever try complete, keep getting error. dim query ienumerable(of credititem) = _ credits in unprocessedcredits _ group credits unprocessedcreditsgrouped = _ new {key .make = credits.make, _ key .part = credits.partnumber, _ key .customernumber = credits.customernumber, _ key .ordernumber = credits.ordernumber} _ group _ select new credititem { _ .make = unprocessedcreditsgrouped.make, _ .part = unprocessedcreditsgrouped.partnumber, _ .customernumber = unprocessedcreditsgrouped.customernumber, _ .ordernumber = unprocessedcreditsgrouped.ordernumber _ }) i need group multiple properties, example make, partnumber, customernumber. unprocessedcredits contains field "quantity" need sum of quantity based on group clause. select new credit

perl inheritance and directory structure -

i'm trying learn inheritance in perl. this directory structure: perldir perldir\child.pl perldir\mylib perldir\mylib\parent.pm parent.pm package parent; sub new { $class = shift; $self = { _first => shift, _last => shift }; bless $self, $class; } sub getfirstname { ($self) = @_; return $self->{ _first }; } 1; child.pl package child; use parent 'mylib::parent'; sub new { $class = shift; $self = parent->new( shift, shift ); bless $self, $class; } $obj = new child('jack', 'sparrow'); print $obj->{_first},' ',$obj->{_last}; print "\n",$obj->getfirstname(); #error the error thrown on last line is: can't locate object method "getfirstname" via package "achild" @ child.pl line 13; the program works if 1 of following: 1. have both files under directory mylib. 2. replace use parent 'mylib::parent' with use mylib::parent; @isa =

ruby - New Rails project internal server error -

i'm using ubuntu 15.04. installed rvm, ruby 2.2 , rails 4.2.2. when create new project doing rails new blog , when start server plain text message saying "internal server error". what's weird it's in plain text format . i can't figure out why. here's error log: started "/" 127.0.0.1 @ 2015-06-18 17:54:17 -0300 argumenterror (wrong number of arguments (2 1)): actionpack (4.2.2) lib/action_dispatch/http/request.rb:338:in `parse_query' rack (1.6.3) lib/rack/request.rb:191:in `get' actionpack (4.2.2) lib/action_dispatch/http/request.rb:300:in `get' actionpack (4.2.2) lib/action_dispatch/http/parameters.rb:14:in `parameters' actionpack (4.2.2) lib/action_dispatch/http/filter_parameters.rb:37:in `filtered_parameters' actionpack (4.2.2) lib/action_controller/metal/instrumentation.rb:22:in `process_action' actionpack (4.2.2) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' activere

Access Expression using a combo box to complete a text box -

the expression: =iif(([cbo1]is not null),dlookup("[thing1]","[tbl1]","[cbo1]= " & [forms]![frm1]![cbo1]), "") returns "#error" when try use populate text box based on value of combo box. values in combo box words, setting =iif([cbo1]>0 in first part creates different error. have expression on different part of form , works fine numerical values. =iif(([txt1]>0),dlookup("[thing1]","[tbl11]","[thing2]= " & [forms]![frm1]![txt1]),"") what missing on 1 dealing text? is not null supported in access sql, not in vba expressions. use isnull() . =iif(not isnull([cbo1]), dlookup("[thing1]", "tbl1", "[cbo1]=" & [cbo1]), "") note dlookup expression requires tbl1 includes numeric field named cbo1 , same combo box name. correct, looks suspicious me. double-check field name if error.

email - Cropping image in html without using div -

i working on email integration. know div tag not interpreted on various platform (some outlook version, webmails, etc). my problem : want crop unkown size image... without using div tag (so table...) ! think possible ? thanks ! stef there no real guaranteed work way crop images in html emails. closest use background image container declared width/height smaller actual size. issue clients may not ignore , display full size, others may instead warp image fit size of container listed. your best bet manually crop correct size beforehand , assume html/css resizing not work (thanks outlook), know automated templates not option. other choice in finding solution trial , error using this css guide , testing site email on acid. using data collected past emails find popular email clients , devices , try maximize those. have willing provide broken email smaller portion of audience well.

python - Conditional zip of two lists -

i'm trying zip 2 lists create new dictionary. list 1 list of column names represented string, while list 2 list of variables. if variable empty (none) don't want or corresponding column data (they share same index, 'foo' column @ index 0 , 'foo' variable) within dict. i've tried few ways construct using dict comprehension haven't been able create it. my dict needs ordered i'm using ordereddict module well. is possible this? edit: here's how data should look. list_1 = ['foo', 'bar', 'baz', 'whatever'] list_2 = [foo, bar, baz, whatever] now lets imagine whatever variable none. the dict, create should like d = { 'foo' : foo, 'bar' : bar, 'baz' : baz } as martijn points out in comments, want ordereddict((k, v) k, v in zip(list_1, list_2) if v not none) .

javascript - How to listen for a JS page load event using intern -

the application under test emits 'page-load' event after every page load , want take screenshot after page has loaded. tried listen event using leadfoot's execute method. not seem work. can point out if there way listen events page-load. return remote.get(url) .execute(function() { window.addeventlistener('page-load', function() { console.log("page ready"); }, false); }, []) .takescreenshot().then(function(data) { recordimage(newaddress, data); }) given event fires asynchronously , want wait proceed until event fires, should use executeasync instead of execute . in addition arguments passed through, executeasync adds callback argument code should call when asynchronous operation complet

c++ - Is it possible to execute multiple instances of a CUDA program on a multi-GPU machine? -

background: i have written cuda program performs processing on sequence of symbols. program processes sequences of symbols in parallel stipulation sequences of same length. i'm sorting data groups each group consisting entirely of sequences of same length. program processes 1 group @ time. question: i running code on linux machine 4 gpus , utilize 4 gpus running 4 instances of program (1 per gpu). possible have program select gpu isn't in use cuda application run on? don't want hardcode cause problems down road when program run on different hardware greater or fewer number of gpus. the environment variable cuda_visible_devices friend. i assume have many terminals open have gpus. let's application called myexe then in 1 terminal, do: cuda_visible_devices="0" ./myexe in next terminal: cuda_visible_devices="1" ./myexe and on. then first instance run on first gpu enumerated cuda. second instance run on second gpu (on

javascript - How do i add a Bootstrap carousel to Ruby on rails app? -

i new developer , trying add bootstrap carousel rails app. this carousel trying add in particular: http://arturssmirnovs.com/blog/bootstrap-carousel-100-height-and-width/ so far i've gotten white left , right pointers show carousel (ex: navigation pointers < >) here's html code, snabbed link above, inserted portion in about.html.erb page, static page want carousel appear in views/layouts/staticpages/about.html.erb: <div class="aboutslide"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> </ol> <div class="carousel-inner"> <div class="

javascript - Return variable function without parameters -

i'm trying write javascript function gets variables , returns function contains values without taking them parameters or referencing them. a simple example: function foo(a,b) { return function(x) { //doing values of , b, example: return a*x + b; } } so if do: var c = foo(2,3); var d = foo(4,5); c , d like: c: function(x) { return 2*x + 3; } d: function(x) { return 4*x + 5; } i want foo() replace variables a,b values before returning new function. c , d dont need refer vars outside themselves. i work casperjs , try dynamically create functions executed casper.evaluate() sandboxes executed functions. why wouldn't work way described in example. any ideas how solve this? alot! edit: why need this? try write abstract crawler casperjs. there "main"-function accesses object-variable (var site = {...}) containing multiple functions casper.evaluate() takes arguments, 1 one. these functions executed sandboxed on open

c - Why variable length arrays need to be declared at auto storage class? -

i read in books variables use declare variable length arrays must have auto storage class. can explain me why need variables auto storage class? and space variable length arrays allocated in stack or heaps? this covered in rationale international standard—programming languages—c says: all variably modified types must declared @ either block scope or function prototype scope. file scope identifiers cannot declared variably modified type. furthermore, array objects declared either static or extern storage class specifiers cannot declared variable length array type [...] and: restricting variable length array declarators identifiers automatic storage duration natural since “variableness” @ file scope requires notion of parameterized typing. there sentiment allowing structure members variably modified; allowing structure members have variable length array type introduces host of problems such treatment when passing these objects, or pointers t

python - Pandas logical indexing on a single column of a dataframe to assign values -

i r programmer , looking similar way in r: data[data$x > value, y] <- 1 (basically, take rows x column greater value , assign y column @ rows value of 1) in pandas seem equivalent go like: data['y'][data['x'] > value] = 1 but gives settingwithcopywarning. equivalent statements i've tried are: condition = data['x']>value data.loc(condition,'x')=1 but i'm confused. maybe i'm thinking in r terms , can't wrap head around what's going on in python. equivalent code in python, or workarounds? your statement incorrect should be: data.loc[condition, 'x'] = 1 example: in [3]: df = pd.dataframe({'a':np.random.randn(10)}) df out[3]: 0 -0.063579 1 -1.039022 2 -0.011687 3 0.036160 4 0.195576 5 -0.921599 6 0.494899 7 -0.125701 8 -1.779029 9 1.216818 in [4]: condition = df['a'] > 0 df.loc[condition, 'a'] = 20 df out[4]: 0 -0.063579 1 -1.0390

asp.net - Auto-Size Columns In DataGrid -

this html grid, how can set columns auto-fit 1 column not huge when not needed? know can manually set size, rather auto-size store names longer others , manager names longer others pre-determined size isn't option. <asp:datagrid runat="server" id="dtgmain" autogeneratecolumns="false" cssclass="datagrids" gridlines="both" showfooter="true" onitemcommand="dtgmain_onitemcommand"> <itemstyle cssclass="row" /> <footerstyle cssclass="datagridfooters" /> <headerstyle cssclass="datagridheaders" /> <columns> <asp:boundcolumn datafield="storename" headertext="storename"></asp:boundcolumn> <asp:boundcolumn datafield="hours" headertext="hours"></asp:boundcolumn> <asp:boundcolumn datafield="date" headertext="today's date" dataformatstring="

java - How to set Combobox value to one of the choices in the list -

i need change value of current jcombobox value. i got in settings gui class used main.class: package com.tominocz.cookieclicker; import java.awt.borderlayout; import java.awt.color; import java.awt.dimension; import java.awt.flowlayout; import java.awt.toolkit; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.imageicon; import javax.swing.jbutton; import javax.swing.jcombobox; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.border.lineborder; @suppresswarnings({ "serial", "rawtypes", "unchecked" }) public class settings extends jframe { private string[] choicelist = { "default (arial)", "comic sans ms" }; public class choicecombolistener implements actionlistener { public void actionperformed(actionevent ev) { jcombobox cb = (jcombobox) ev.getsource(); string currentcomboselection = (string) cb.getselecteditem();

java - Pause thread from another thread(s) and also stop/start it yet from another thread -

i've found good hints here . have more difficult task - additional requests are: - low priority forever thread can started/stopped main thread (that's same) - has lock 1 resource exclusive access. - low priority forever thread can paused/continued high priority thread(s) (they lock , use 1 resource) - want low priority thread not release lock in each loop, release lock once told (for speed purposes - cos need init/deinit resource) (if have release lock every loop may let java manage competing threads , expect high priority threads win every , then). i come solution , think safe , sound. i'm newbie i'm open finding bug in solution or suggestions improvements. questions are: 1) solution thread safe in cases? 2) optimal solution or can improve something? if agreed let used template. here core code: flagnotify lowpriorrunreq = new flagnotify(false); // low priority task run request flagnotify lowpriorpausereq = new flagnotify(false); // low priority task pau

jquery - How to animate object one by one? -

i trying animation object 1 one. using animate.css animation. have 7 li item in example below, zoom @ time, want product 1 zoom 1st 2,3.4---7 each delay 1s or 10ms like: <li class="animated zoomin prod pos1">product 1</li> <li class="animated zoomin prod pos2">product 2</li> <li class="animated zoomin prod pos3">product 3</li> <li class="animated zoomin prod pos4">product 4</li> <li class="animated zoomin prod pos5">product 5</li> <li class="animated zoomin prod pos6">product 6</li> <li class="animated zoomin prod pos7">product 7</li> i saw animate.css document said delay use -vendor-animation-delay: 2s; tried still not success yet. demo : http://jsfiddle.net/cyber007/6x9re4yf/ additional trying. whenever click on of them object zoom out same 1 one. idea how can that? your -vendor-anim