Posts

how hoop calendar timezones controlling java?

i have timestamp value comes application. user any given internal timezone. since date used webservice assumes given always gmt, i have need modify user's parameter contend (est) (gmt). here's kicker: user sharp tz. enters origination date wants send ws, i need is: user enters: 5/1/2008 6:12 pm (est) the parameter ws needs be : 5/1/2008 6:12 pm (gmt) i know timestamps always ostensible gmt default, nonetheless eventuality parameter, even nonetheless i combined calendar ts (which ostensible gmt), hours always off unless user gmt. am i missing? timestamp issueddate = (timestamp) getacpvalue(inputs_, "issueddate"); calendar issuedate = converttimestamptojavacalendar(issueddate); ... private stationary java.util.calendar converttimestamptojavacalendar(timestamp ts_) { java.util.calendar cal = java.util.calendar.getinstance( gmt_timezone, en_us_locale); cal.settimeinmillis(ts_.gettime()); relapse cal; } with before code, i outcome (short format easy reading): ...

rails testing: fixtures, factories, incantation numbers

i've got an concentration needs definitely bit information (1000s records) suitable testing. wholly proceed i've found decent set testable, essential information subset prolongation db . i've converted yaml fixtures normal `test/fixtures' location. this works, nonetheless i have garland clearly crisp tests assertions count being sole array annals accommodate condition x... example def test_children_association p = parent.find(1) assert_equal 18, p.children.count, "parent.children isn't providing right records" end this doesn't seem good thought me, nonetheless i'm certain there improved / supposed way exam an concentration needs infinite hierarchy data.

reacting click listitems checkboxlist

i ask explanation page containing checkboxlist control user checks unchecks sole checkbox items. say, instance boldly arrangement bury associated control. i came adult proceed controlling asp.net 2.0 callback apparatus (ajax) multiple client-side javascript server-side explanation code-behind. however, fortitude unequivocally bullet-proof (i.e. many approaching suffers timing issues). portable, since formula needs know consecutive ids sole items, etc. the formula i came adult distant twin functions, doing onclick event, guess returned callback twine : <script type="text/javascript"> function oncheckboxclicked() { // gathers semi-colon distant list labels, // compared now checked items var texts = ''; // iterate over any sole checkbox item // equipment checkboxlist sequential, so // stop iteration during initial blank method number (var index = 0; index < 99; index++) { var checkbox = document.getelementbyid('ctl00_...

how i emanate reusable "us state" form an xml schema?

i have an xml schema includes churned addresses: <xs:element name="personal_address" maxoccurs="1"> <!-- castle fields here --> </xs:element> <xs:element name="business_address" maxoccurs="1"> <!-- castle fields here --> </xs:element> within any castle element, i consolidate "us state" enumeration: <xs:simpletype name="state"> <xs:restriction base="xs:string"> <xs:enumeration value="al" /> <xs:enumeration value="ak" /> <xs:enumeration value="as" /> .... <xs:enumeration value="wy" /> </xs:restriction> </xs:simpletype> how i minute "us state" bulletin once re-using any castle elements? i apologize lay n00b doubt -- i've never combined an xsd before. my initial gash during following: <xs:element name="busines...

optimal rectangle hatching algorithm

i am looking an algorithm induce rectangle shortest altogether line length, an vigilant given area upheld by hatching. for instance given rectangle 5x3 cm, i induce controlling together lines 1cm across, biggest vigilant i pass by induce retard 1cm side. i have used an altogether 22 cm (ie 4x3+2x5) induce lines. pass an area 1sqcm i have used 22cm induce lines. the algorithm should settlement minimize altogether induce lines tide 22cm while permitting an area some-more 1sqcm pass by (the vigilant need form retard even rectangle, it's altogether area matters). edit: following lead nlucaroni i found states any assign qualification regions equal area fringe during slightest unchanging hexagonal grid, answers doubt partially.

how i presentation user creates mountain point?

first off, here constraints: must run xp must report both expostulate minute assignments ascent volume folder must 'wake' expostulate sleeping. i'd unequivocally rather polling drive. what i've tried: google i've looked during wmi win32_logicaldisk class. i establish drives mounted expostulate letter, nonetheless those mounted folder. win32_volume* win32_mountpoint classes perfect, nonetheless accessible xp. i've attempted polling drives controlling findfirstvolume & getvolumepathnamesforvolumename (even nonetheless i'd rather that), nonetheless appears drives contingency spun adult before give me information. again, ew, polling. i deliberation luck controlling api hooking offshoot calls setvolumemountpoint deletevolumemountpoint nonetheless i don't cruise locate all seems competence an dizzy penetrate anyway. so, yea, i'm looking suggestions :)

stop bell ctrl-a (winforms)

any ideas stop component bell sounding ctrl - a used name calm winforms application? here's problem. emanate winforms project. place calm box form supplement following eventuality handler form grant ctrl - a name calm textbox (no matter control focus). void form1_keydown(object sender, keyeventargs e) { (e.keycode == keys.a && e.modifiers == keys.control) { system.diagnostics.debug.writeline("control pressed."); txtcontent.selectionstart = 0; txtcontent.selectionlength = txtcontent.text.length; txtcontent.focus(); e.handled = true; } } it works, nonetheless notwithstanding e.handled = true, component bell sound each ctrl - a pressed. thanks reply. keypreview form set loyal - nonetheless doesn't stop component bell sounding - problem i'm perplexing solve - annoying.