Posts

java - Synchronise ArrayList over two threads -

i'm having difficult time understanding how synchronise arraylist on 2 threads. basically, want 1 thread appending objects list , other 1 reading list @ same time. here class deploys threads: public class main { public static arraylist<good> goodlist = new arraylist(); public static void main(string[] args) { thread thread1 = new thread(new goodcreator()); thread thread2 = new thread(new weightcounter()); thread1.start(); thread2.start(); } } then 2 runnable classes: this 1 reads lines of 2 values text file , appends new objects. public class goodcreator implements runnable{ private arraylist<good> goodlist = main.goodlist; private static scanner scan; @override public void run() { system.out.println("thread 1 started"); int objcount = 0; try { scan = new scanner(new file(system.getproperty("user.home") + "//goods.txt")); } ...

coldfusion - Styling a cfcontent which produced an excel sheet with an external stylesheet -

i trying incorporate stylesheet cfcontent tag produce excel spreadsheet shown below. however, stylesheet ignored when linked explicit reference. ensure excel spreadsheet incorporate stylesheet? <cfsetting enablecfoutputonly="yes"> <cfsavecontent variable="stest"> <cfoutput> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="www.somesite.com/bootstrap/another.css" media="all"> <link rel="stylesheet" type="text/css" href="../cssbootstrap/css/another.css" media="all"> </head> <body> <cfinclude template="../reports/reportexportedasexcel.cfm"> </body> </cfoutput> </cfsavecontent> <cfcontent type="application/vnd....

date - D3 time.parse with colon in time-zone format -

i'm trying use d3.time.format on date this: 2016-02-10t12:40:16-05:00 basically, utc date timezone offset. the issue is, %z formatter in d3 looks timezone written follows: -0500 . in other words, colon missing. does know workaround?

wpf - Binding datacontext viewmodel to usercontrol view when using Mvvm -

i need binding viewmodel 2 usercontrol views have created. have created reservation window should contain these 2 usercontrols. what got: reservationview (window) reservationlistview (usercontrol) reservationdetailview (usercontrol) reservationview (window) class public partial class reservationview : window { public reservationview() { initializecomponent(); //datacontext = null; } } reservationlistview (usercontrol) class: public partial class reservationlistview : usercontrol, iviewreservationlistviewmodel { public reservationlistview(iviewreservationlistviewmodel viewmodel) { initializecomponent(); datacontext = viewmodel; } } the iviewreservationlistviewmodel empty interface makes contact between usercontrol view , viewmodel. reservationlistviewmodel public class reservationlistviewmodel : inotifypropertychanged, iviewreservationlistviewmodel { public reservationlistviewmodel() ...

Combine multiple tables to act as a single table on BigQuery? -

i have several tables same schema on bigquery: dataset.table00 dataset.table01 dataset.table02 ... dataset.table99 i want make table dataset.table combines tables together. you can use comma union all feature of bigquery select * dataset.table00, dataset.table01, dataset.table02, ... dataset.table98, dataset.table99 you can save above view , use select * myview you can use table wildcard functions select * table_query([project:dataset], 'regexp_match(table_id, r"^table[\d]{2}")')

php - How to run Multiple querys at the same time? -

i stuck @ point want run multiple queries cannot it. i have code https://gyazo.com/d98f6e68c9c6d4e09620e96a29f3f910 have there 4 queries want run @ same time don't know how it, read lot of other questions on forum already. can separate them of ; signs or use mysqli_multi_query .. don't know anymore. here printscreen of mysql db: https://gyazo.com/15ae4be5831665064b2cf8b4f703f3f3 and connection code: define('db_host', 'localhost'); define('db_user', 'root'); define('db_pass', ''); define('db_name', 'mysql_enquete'); $db_link = mysqli_connect(db_host, db_user, db_pass, db_name) or die ("verbindingsfout"); $mysqli = new mysqli(db_host, db_user, db_pass, db_name); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } if ($result = $mysqli->query("select database()")) { $row = $result->fetch_row(); printf(...

c# - Error on CSV to Dictionary -

not sure why isn't working, it's adapted code work. looks need explicit cast i'm not sure why or put it. error is: "cannot implicitly convert type 'system.collections.generic.ienumerable{system.collections.generic.dictionary{string,string}}' 'system.collections.generic.dictionary{string,string}'" public static dictionary<string, string> data_entry(string dataentity, string datacategory, string datastream = "") { var lines = file.readalllines(@"c:\myfile.csv"); var header = lines.first().split(','); return (from line in lines.skip(1) let cols = line.split(',') cols[0].toupper() == dataentity & cols[1].toupper() == datacategory & cols[4].toupper() == datastream select header.select((h, i) => new { header = h, index = }) .todictionary(o => o.header, o => cols[o.index]) ); } your lin...