Posts

java - How to display a picture on JFrame? -

i'm doing exercise i'm supposed write program simulates race between 2 cars. i've created jframe , added 2 rectangles supposed tracks. but can't insert cars. have googled , tried solutions doesn not work out. here code. public class race extends jcomponent { private imageicon image; public void paint(graphics g) { g.setcolor(color.gray); g.fill3drect(30, 150, 530, 55,true); g.setcolor(color.gray); g.fill3drect(30, 250, 530, 55, true); g.setcolor(color.black); g.fill3drect(90, 130, 12, 189, true); } public static void main(string[] a) { jframe window = new jframe(); window.setpreferredsize(new dimension(600, 400)); window.getcontentpane().setbackground(color.green); window.setresizable(false); window.setdefaultcloseoperation(jframe.exit_on_close); window.getcontentpane().add(new race()); window.pack(); window.setvisible(true); } } where , how can add 2 pictures? thanks this how add image jf...

javascript - Scale element when print web page with IE/Edge -

i customizing styles on web page better printing experience. i using print media query hide header, footer , nav pane. since size of container may change, trying dynamically scale main container fit paper , keep container's aspect ratio. works in chrome mediaquerylistener (calculate scaling factor based on current container size , paper size, , generate "@media print {.containerclass{transform: scale(0.3)}}" . append body). blocked on how in ie (always :-( ). i looking @ onbeforeprint , onafterprint , thought me. but turned out onafterprint happened after onbeforeprint before print dialog, means not technically after print . , when onbeforeprint gets called, media query hasn't been applied page yet. here problem, scale factor calculation based on paper size , current container size. paper size available when in print mode. seems cannot detect if current page in print mode in ie. do guys know how achieve in ie/edge?

javascript - How many dependencies to I need to list in nested require calls? -

i have question. have module following : define(['jquery', 'amodule', 'anothermodule'], function () { .... } lets assign above module name 'mymodule' in requirejs config file. in other file this: require(['myconfigfile'], function () { require['mymodule'], function(module) { } } do need require modules part of 'mymodule' definition in nested require statement well? no, requirejs 'translate' 'jquery', 'amodule', 'anothermodule' . in other words, first load modules 'jquery', 'amodule', 'anothermodule' before loading 'mymodule'

How to commit backlog item to a sprint using Hansoft SDK -

Image
i trying add backlog items sprint using hansoft sdk. there function "hpmfunctiontask get linkedtosprint" gets id of sprint task linked. unfortunately there no function set sprint of task, in sdk. is there way commit item sprint? in gui looks this: thank you, ondras. i have got answer hansoft support. to add backlog item sprint have create proxy item: hpmtaskcreateunified proxytaskcreate = new hpmtaskcreateunified(); proxytaskcreate.m_tasks = new hpmtaskcreateunifiedentry[1]; hpmtaskcreateunifiedreference parent = new hpmtaskcreateunifiedreference(); hpmtaskcreateunifiedreference previous = new hpmtaskcreateunifiedreference(); parent.m_blocalid = false; parent.m_refid = sprint.uniqueid.m_id; // task reference id of sprint previous.m_blocalid = false; previous.m_refid = sprint.uniqueid.m_id; // task reference id of sprint proxytaskcreate.m_tasks[0] = new hpmtaskcreateunifiedentry(); proxytaskcreate.m_tasks[0].m_bisproxy = true; proxytaskcreate.m_tasks...

Is this C# 'closure' still valid across a parameter reference? -

let's take simple case .net smtpclient, can following (ignoring credentials, ssl , exception handling): async task sendmail() { var m = new mailmessage(...); var s = new smtpclient(host, port); s.sendcompleted += (s, e) => { m.dispose(); s.dispose(); }; await s.sendmailasync(m); } all fine; func dispose()ing called whenever async sending finishes. m , s within containing scope declared, no problem there. but had following: smtpclient setupmailclient(mailmessage mail) { var smtpclient = new smtpclient(host, port); smtpclient.sendcompleted += (s, e) => { mail.dispose(); smtpclient.dispose(); }; return smtpclient; } async task sendmail() { var m = new mailmessage(...); var s = setupmailclient(m); await s.sendmailasync(m); } now, calling await sendmail() still safe? closure still valid? pass in reference mailmessage 'mail' - copy of reference, valid in context of setupmailclient(). overthinking it, or still safe...

mariadb - how do I correlate time in mysql logs? -

i can't seem make sense of how correlate time in mariadb logs: 151004 15:34:36 [note] error reading relay log event: slave sql thread killed 151004 15:34:36 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151004 15:34:36 [note] slave i/o thread killed while reading event 151004 15:34:36 [note] slave i/o thread exiting, read log 'mariadb-bin.000078', position 376 151004 15:36:47 [note] slave sql thread initialized, starting replication in log 'mariadb-bin.000078' @ position 376, relay log './db4-relay-bin.000042' position: 537 151004 15:36:47 [note] slave i/o thread: connected master 'jf_slave@db2.example.com:3306',replication started in log 'mariadb-bin.000078' @ position 376 151007 4:24:12 [note] error reading relay log event: slave sql thread killed 151007 4:24:12 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151007 4:24:12 [no...

Plotting Hours in X axis MATLAB -

i need plot tp vs time . have following data extracted excel: y-axis x axis 28.72 13:02:55.58 28.21 13:08:49.53 23.32 13:14:43.48 28.85 13:20:34.48 28.84 13:26:28.51 28.37 13:32:22.51 28.75 13:38:16.49 26.85 13:44:10.55 25.99 13:50:03.51 27.65 13:55:55.54 5.99 14:01:48.51 11.28 14:07:26.52 16.15 14:13:10.56 15.19 14:18:57.49 24.32 14:24:44.50 26.13 14:30:36.49 27.92 14:36:29.53 17.96 14:42:22.54 10.08 14:48:10.54 14.73 14:53:54.52 18.12 14:59:41.48 i have tp in mbps on y-axis , time in hh:mm:ss format on x-axis. how can set tick marks on x-axis use time? use datetick datetick('x',hh:mm:ss) %// use required dateformat, see docs