Posts

javascript - What would be the best practice for retaining a state on refresh in React/Flux? -

this typically solved using local storage or cookies in angular. i'm assuming similar process appropriate in flux. use localstorage within store retain state? or make fresh set of requests on refresh? pointers appreciated. local storage or cookies work fine, yes. in store, can use local storage or firebase keep data -- , cache in javascript object. way, when asked data, store can check see if has data in memory and, if not, check against more permanent storage mechanism of local storage, firebase -- or going server if need be.

go - What does lexical file name order mean? -

in package initialization part of go specification, "lexical file name order" mean? to ensure reproducible initialization behavior, build systems encouraged present multiple files belonging same package in lexical file name order compiler. from wikipedia : lexical order generalization of way alphabetical order of words based on alphabetical order of component letters. in practice means files names compared strings, using character codes decide order. order of character codes of english alphabet follow natural order of letters, character code order important if non-letters part of file name (e.g. digits , other characters '-' ). this convention define (arbitrary) order of source files if package contains multiple source files, order remains same if package recompiled (and of course files not renamed). the purpose source files processed in same order, , therefore package init() functions executed in same order, , observe same behavio...

sprintf in C (pointer to an array of char elements) -

i newbie in c, , want like uint8_t message[12]; message[0] = 0x00; message[1] = 0x00; message[2] = 0x00; message[3] = 0x00; message[4] = 0x00; message[5] = 0x00; message[6] = 0x00; message[7] = 0x00; message[8] = 0x00; message[9] = 0x00; message[10] = 0x00; message[11] = 0x00; sprintf(_smess,"at$ss=%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", message[0], message[1], message[2], message[3], message[4], message[5], message[6], message[7], message[8], message[9], message[10], message[11]); but don't know how declare variable _smess, i've tried char *_smess or uint8_t _smess[12] got error anyway if declare char _smess[43]; got error: multiple markers @ line - incompatible implicit declaration of built-in function 'sprintf' [enabled default] - implicit declaration of function 'spr...

javascript - JQuery Sortable Drag and Drop issue -

Image
i've implemented jquery drag , drop functionality , i've found slight bug. can drag element smallest amount , it'll still assigned when decide drop because don't want drag element anymore. how check element above table want drop selected element into? how drag , drop works @ moment (only have drag slightly) how should work (don't want able drag) sortable code: $(document).ready(function () { $("#assign tbody").sortable( { connectwith: "#assign tbody", scroll: false, cursor: 'move', stop: function (event, info) { alert("done assign"); } }).disableselection(); $("#remove tbody").sortable( { connectwith: "#remove tbody", scroll: false, cursor: 'move', stop: function (event, info) { alert("done remove"); } }).disableselection(); }); js fiddle example: http://jsfiddle.net/lhk941tc/

java - I received javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake -

when tried make ajax call httpclient 4.4.1 hit web service located in other site, , i'm seeing following problem: javax.net.ssl.sslhandshakeexception: remote host closed connection during handshake @ sun.security.ssl.sslsocketimpl.readrecord(unknown source) @ sun.security.ssl.sslsocketimpl.performinitialhandshake(unknown source) @ sun.security.ssl.sslsocketimpl.starthandshake(unknown source) @ sun.security.ssl.sslsocketimpl.starthandshake(unknown source) @ org.apache.http.conn.ssl.sslconnectionsocketfactory.createlayeredsocket(sslconnectionsocketfactory.java:394) @ org.apache.http.impl.conn.defaulthttpclientconnectionoperator.upgrade(defaulthttpclientconnectionoperator.java:185) @ org.apache.http.impl.conn.poolinghttpclientconnectionmanager.upgrade(poolinghttpclientconnectionmanager.java:369) @ org.apache.http.impl.execchain.mainclientexec.establishroute(mainclientexec.java:415) @ org.apache.http.impl.execchain.mainclientexec.execute(mainclientexec.java:236) @ org.apache.http...

All possible subsets of a set using bit manipulations in Java -

how can generate possible subsets of set using bit manipulations in java? example, if have int array [1, 2, 3] , possible subsets are: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] count 0 (2 set.size() - 1) (inclusive). retrieve elements corresponding 1 bits in current count. set have ordered retrieve elements index, of course. the tricky part pulling out elements corresponding 1 bits in current count. here's pseudocode 1 way that: for (int pos = 0, mask = 1; mask <= currentcount; mask <<= 1; ++pos) { if ((currentcount & mask) != 0) { include element @ pos in current subset } } note assumes original set size no more number of bits available whatever integer type using count , mask.

How to use environment variables in Jenkins by the Java? -

Image
i trying access environment variables in jenkins through java: public static webdriver getjenkinsdriver() throws malformedurlexception { desiredcapabilities caps = new desiredcapabilities(); string url = ""; map<string, string> env = system.getenv(); (string envname : env.keyset()) { system.out.format("%s=%s%n", envname, env.get(envname)); } if (system.getenv("selenium_service").equalsignorecase("saucelabs")) { caps.setbrowsername(system.getenv("selenium_browser")); caps.setversion(system.getenv("selenium_version")); caps.setcapability(capabilitytype.platform, system.getenv("selenium_platform")); url = "http://ricardo...saucelabs.com:80/wd/hub"; ... } } output of command for: path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/...