text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
try {
process.exitValue();
return false;
} catch (IllegalThreadStateException ex) {
return true;
}
} | [
0.15247742831707,
-0.28694772720336914,
0.12303522229194641,
-0.14669574797153473,
0.5473347902297974,
0.2118355631828308,
0.7136126756668091,
-0.338176429271698,
-0.1182495504617691,
-0.19417117536067963,
-0.21539483964443207,
0.5440393686294556,
-0.353442907333374,
0.3182309865951538,
... | |
@Override
public void destroyObject(Process process) throws Exception {
// If PHP has a way to stop it, do that instead of destroy
process.destroy();
}
@Override
public void passivateObject(Process process) throws Exception {
// Should really try to r... | [
0.3480619490146637,
0.12109113484621048,
0.05547723546624184,
-0.06162109598517418,
-0.08143311738967896,
-0.24973298609256744,
0.6021845936775208,
-0.12467453628778458,
-0.06210215017199516,
-0.40316227078437805,
-0.1338864266872406,
0.4074476957321167,
-0.41867831349372864,
0.24239309132... | |
the InputStream of the Process
// to prevent lock-ups if Rediret.INHERIT is not used.
}
}
public static class CLIWorkItem implements Runnable {
private ObjectPool<Process> mPool;
private String mWork;
public CLIWorkItem(ObjectPool<Process> pool, String work) {
... | [
-0.06578417867422104,
-0.11577466875314713,
0.3808560073375702,
-0.015281040221452713,
0.35026201605796814,
0.2022523730993271,
0.03362135961651802,
-0.4303135573863983,
-0.34977298974990845,
-0.4418974220752716,
-0.4636750817298889,
0.5769907832145691,
-0.6974920034408569,
0.3031079173088... | |
mWork = work;
}
@Override
public void run() {
Process workProcess = null;
try {
workProcess = mPool.borrowObject();
OutputStream os = workProcess.getOutputStream(); | [
0.29778552055358887,
-0.32099148631095886,
0.2845880687236786,
-0.11177600920200348,
0.5713438987731934,
0.42126068472862244,
0.5965937972068787,
-0.19091279804706573,
-0.23167359828948975,
-0.4553520381450653,
-0.15380984544754028,
0.7239057421684265,
-0.4004366397857666,
0.44535675644874... | |
os.write(mWork.getBytes(Charset.forName("UTF-8")));
os.flush();
// Because of the INHERIT rule with the output stream
// the console stream overwrites itself. REMOVE THIS in production.
Thread.sleep(100); | [
0.07652448117733002,
-0.043077293783426285,
0.2765628695487976,
-0.39501678943634033,
0.8104256391525269,
-0.23843629658222198,
0.4205891788005829,
-0.13086706399917603,
-0.0784495621919632,
-0.8316566944122314,
-0.39856839179992676,
0.6981750726699829,
-0.37766677141189575,
0.244999200105... | |
} catch (Exception ex) {
sLogger.log(Level.SEVERE, null, ex);
} finally {
if (workProcess != null) {
try { | [
0.20047765970230103,
-0.5482200384140015,
0.23765279352664948,
-0.11241897940635681,
0.2925565540790558,
-0.11025714874267578,
0.4860870838165283,
-0.22949844598770142,
-0.2365105152130127,
-0.2716199457645416,
-0.22465023398399353,
0.6239214539527893,
-0.32264435291290283,
0.0101143969222... | |
// Seriously.. so many exceptions.
mPool.returnObject(workProcess);
} catch (Exception ex) {
sLogger.log(Level.SEVERE, null, ex); | [
0.32570505142211914,
-0.31588539481163025,
0.08576857298612595,
-0.15583617985248566,
0.3427780568599701,
-0.0850730910897255,
0.6495758891105652,
-0.14436189830303192,
-0.32307562232017517,
-0.23528094589710236,
-0.24039512872695923,
0.7615364193916321,
-0.3417634665966034,
-0.19049163162... | |
}
}
}
}
}
public static void main(String[] args) throws Exception {
// Change the 5 to 20 in your case.
// Also change mock_php.exe to /usr/bin/php or wherever.
ObjectPool<Process> | [
0.12779274582862854,
-0.027040081098675728,
0.3508531451225281,
-0.06833112984895706,
0.3551548421382904,
0.20333635807037354,
0.20735898613929749,
-0.1750582903623581,
-0.49991264939308167,
-0.5337064862251282,
-0.13004283607006073,
0.3605223298072815,
-0.20119646191596985,
0.360440641641... | |
pool =
new GenericObjectPool<>(
new CLIPoolableObjectFactory("mock_php.exe"), 5);
// This will only allow you to queue 100 work items at a time. I would suspect
// that if you only want 20 PHP processes running at a time and this queue | [
0.34805577993392944,
-0.2898310124874115,
0.5010420680046082,
0.15244081616401672,
0.02338576130568981,
0.1887226104736328,
0.13958390057086945,
-0.22424274682998657,
-0.5287555456161499,
-0.5198851227760315,
0.493886798620224,
0.4691941440105438,
-0.24080686271190643,
0.11794213205575943,... | |
// filled up you'll need to implement some other strategy as you are doing
// more work than PHP can keep up with. You'll need to block at some point
// or throw work away.
BlockingQueue<Runnable> queue =
new ArrayBlockingQueue<>(100, true);
ThreadPoolExecutor executor =
... | [
0.02822655253112316,
-0.3041589856147766,
0.6426905989646912,
-0.2035854309797287,
0.15593712031841278,
0.07557770609855652,
0.315022736787796,
-0.20260454714298248,
-0.5006053447723389,
-0.5621886849403381,
0.027647437527775764,
0.16955694556236267,
-0.4835719168186188,
0.2613230645656585... | |
TimeUnit.HOURS, queue);
// print some stuff out.
executor.execute(new CLIWorkItem(pool, "Message 1\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 2\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 3\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 4\r\n"))... | [
-0.09904409945011139,
-0.15552709996700287,
0.7061030268669128,
-0.04256821423768997,
0.6730877161026001,
-0.00002099063749483321,
0.28204357624053955,
-0.42048200964927673,
-0.4305455684661865,
-0.6986116170883179,
-0.6516271829605103,
0.2769487202167511,
-0.6319435238838196,
0.2006319761... | |
"Message 8\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 9\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 10\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 11\r\n"));
executor.shutdown();
executor.awaitTermination(4000, TimeUnit.HOURS);
pool.... | [
-0.16558201611042023,
0.2677478492259979,
0.42217981815338135,
0.08261340856552124,
0.6282780170440674,
0.10347730666399002,
0.34775790572166443,
-0.44393664598464966,
-0.36627548933029175,
-0.43009746074676514,
-0.688321053981781,
0.5236564874649048,
-0.6323209404945374,
0.319647848606109... | |
Message 9
11116 - Message 10
12172 - Message 11
```
Code of C++ program to just output what was input:
```
#include <windows.h>
#include <iostream>
#include <string>
int main(int argc, char* argv[])
{
DWORD pid = GetCurrentProcessId();
std::string line;
while (true) {
std::getline (std::ci... | [
-0.2025611698627472,
-0.17914330959320068,
0.7733899354934692,
-0.16564005613327026,
-0.013779375702142715,
0.41715624928474426,
0.4158272445201874,
0.09536939114332199,
-0.17287231981754303,
-0.6045904159545898,
-0.4051065146923065,
0.5953528881072998,
-0.6432921886444092,
-0.275368094444... | |
to run a separate thread to read all the input from the InputStream of the process. I've set this code up to spawn a new thread along side each new process. That thread always read from the process as long as it is alive. Instead of outputting directly to a file I set it up such that it uses the Logging framework. That... | [
0.7403396368026733,
-0.0031170472502708435,
0.13397018611431122,
0.02787303738296032,
0.11162659525871277,
0.2112530916929245,
-0.15549790859222412,
0.05614082142710686,
-0.4748700261116028,
-0.30135536193847656,
0.12351106852293015,
0.5551557540893555,
-0.37274348735809326,
0.168554246425... | |
process even though a Process has stdout and stderr. I redirect stderr to stdout just to make things easier. Apparently jdk6 only supports this type of redirect.
```
public class StackOverflow_10037379_jdk6 {
private static Logger sLogger = Logger.getLogger(StackOverflow_10037379_jdk6.class.getName());
// Sh... | [
-0.1460127979516983,
0.046782076358795166,
0.38816794753074646,
-0.14660535752773285,
0.06127797067165375,
-0.030972540378570557,
0.3639923930168152,
0.02146829664707184,
-0.38398778438568115,
-0.5403211116790771,
-0.1272437423467636,
0.3209059238433838,
-0.2940032482147217,
0.674575448036... | |
StreamGobbler(String logName, Level level, InputStream is) {
this.is = is;
this.logger = Logger.getLogger(logName);
this.level = level;
}
public void run() {
try { | [
0.3884546756744385,
-0.6665313839912415,
0.22159907221794128,
0.08475323766469955,
0.5233949422836304,
-0.1187211349606514,
0.45158931612968445,
0.29894810914993286,
0.06644691526889801,
-0.3732609748840332,
-0.06057342514395714,
0.6449363827705383,
-0.44318827986717224,
0.2807801067829132... | |
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
logger.log(level, line); | [
-0.4045070707798004,
-0.43367013335227966,
0.8035339117050171,
-0.29205334186553955,
0.18531014025211334,
0.24607756733894348,
0.11087916046380997,
-0.22511492669582367,
-0.2903392016887665,
-0.5044004321098328,
-0.5592408180236816,
0.3591143786907196,
-0.4853423237800598,
0.14150731265544... | |
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Failed to read from Process.", ex);
}
logger.log(
Level.INFO, | [
-0.002677559619769454,
-0.2363726794719696,
0.06192288547754288,
-0.02128652296960354,
0.42014598846435547,
0.12736397981643677,
0.3749476969242096,
0.018113700672984123,
-0.12455940991640091,
-0.3965801000595093,
0.09835266321897507,
0.6824987530708313,
-0.2994243800640106,
-0.01197581831... | |
String.format("Exiting Gobbler for %s.", logger.getName()));
}
}
public static class CLIPoolableObjectFactory extends BasePoolableObjectFactory<Process> {
private String mProcessToRun;
public CLIPoolableObjectFactory(String processToRun) {
mProcessToRun = processToRun;
... | [
0.04738549143075943,
-0.059370364993810654,
0.4747096300125122,
-0.12605714797973633,
0.30407074093818665,
0.4243897497653961,
0.2005874365568161,
-0.23303160071372986,
-0.03813623636960983,
-0.5798214673995972,
-0.17247262597084045,
0.4670124650001526,
-0.7067765593528748,
0.2660756409168... | |
ProcessBuilder builder = new ProcessBuilder();
builder.redirectErrorStream(true);
builder.command(mProcessToRun);
Process process = builder.start();
StreamGobbler loggingGobbler =
new StreamGobbler( | [
0.07162950932979584,
-0.14112256467342377,
0.6709904074668884,
-0.31121206283569336,
0.18495804071426392,
0.47802793979644775,
0.6545745134353638,
-0.45903125405311584,
-0.31492477655410767,
-0.4495214819908142,
-0.12967270612716675,
0.26196950674057007,
-0.3136714994907379,
0.548503577709... | |
String.format("process.%s", process.hashCode()),
Level.INFO,
process.getInputStream());
loggingGobbler.start();
return process;
}
@Override
public boolean validateObject(Process | [
0.0588836669921875,
-0.12389174848794937,
0.27295711636543274,
-0.11276090145111084,
0.3319453299045563,
-0.04980040341615677,
0.5003010034561157,
-0.32265231013298035,
-0.2425868958234787,
-0.07292909920215607,
-0.30322542786598206,
0.47766926884651184,
-0.45286816358566284,
0.44846642017... | |
process) {
try {
process.exitValue();
return false;
} catch (IllegalThreadStateException ex) {
return true;
} | [
0.21324418485164642,
-0.28758397698402405,
0.23551146686077118,
-0.18628907203674316,
0.5180528163909912,
0.295590341091156,
0.6564351320266724,
-0.4430815279483795,
-0.26106977462768555,
-0.10423977673053741,
-0.19250676035881042,
0.4721440374851227,
-0.33850786089897156,
0.46283128857612... | |
}
@Override
public void destroyObject(Process process) throws Exception {
// If PHP has a way to stop it, do that instead of destroy
process.destroy();
}
@Override
public void passivateObject(Process process) throws Exception { | [
0.21542906761169434,
0.13962209224700928,
-0.06003125011920929,
-0.06538017094135284,
-0.048881541937589645,
-0.10655322670936584,
0.39928415417671204,
-0.17779606580734253,
-0.1347782015800476,
-0.37453579902648926,
-0.2030000388622284,
0.334664523601532,
-0.4892563819885254,
0.3210472464... | |
// Should really try to read from the InputStream of the Process
// to prevent lock-ups if Rediret.INHERIT is not used.
}
}
public static class CLIWorkItem implements Runnable {
private ObjectPool<Process> mPool;
private String mWork;
public CLIWorkItem(ObjectPool<... | [
-0.09112240374088287,
-0.18650664389133453,
0.31155869364738464,
0.07537245750427246,
0.3714374899864197,
0.1344761997461319,
0.05785160884261131,
-0.294659823179245,
-0.37007343769073486,
-0.4899265766143799,
-0.33603107929229736,
0.5844844579696655,
-0.7627848386764526,
0.239407688379287... | |
= pool;
mWork = work;
}
@Override
public void run() {
Process workProcess = null;
try {
workProcess = mPool.borrowObject(); | [
0.4795924723148346,
-0.22387142479419708,
0.1533799022436142,
-0.18833357095718384,
0.669686496257782,
0.3655014634132385,
0.38502103090286255,
-0.340353399515152,
-0.1399402916431427,
-0.20534613728523254,
-0.20733655989170074,
0.8725139498710632,
-0.361142635345459,
0.5149538516998291,
... | |
OutputStream os = workProcess.getOutputStream();
os.write(mWork.getBytes(Charset.forName("UTF-8")));
os.flush();
// Because of the INHERIT rule with the output stream
// the console stream overwrites itself. REMOVE THIS in production. | [
0.0010958025231957436,
-0.18305666744709015,
0.4000738561153412,
-0.20877648890018463,
0.5315890908241272,
-0.0086247893050313,
0.37021249532699585,
-0.16719463467597961,
0.03198082745075226,
-0.7474105358123779,
-0.1362435668706894,
0.5792396068572998,
-0.3776434361934662,
0.2688116729259... | |
Thread.sleep(100);
} catch (Exception ex) {
sLogger.log(Level.SEVERE, null, ex);
} finally {
if (workProcess != null) {
try { | [
0.17515091598033905,
-0.492007315158844,
0.41031181812286377,
-0.2395191192626953,
0.46879974007606506,
-0.005115320440381765,
0.4980480372905731,
-0.12185683101415634,
-0.28252825140953064,
-0.4032402038574219,
-0.15190696716308594,
0.5556241869926453,
-0.2896132469177246,
0.2532299757003... | |
// Seriously.. so many exceptions.
mPool.returnObject(workProcess);
} catch (Exception ex) {
sLogger.log(Level.SEVERE, null, ex); | [
0.32570505142211914,
-0.31588539481163025,
0.08576857298612595,
-0.15583617985248566,
0.3427780568599701,
-0.0850730910897255,
0.6495758891105652,
-0.14436189830303192,
-0.32307562232017517,
-0.23528094589710236,
-0.24039512872695923,
0.7615364193916321,
-0.3417634665966034,
-0.19049163162... | |
}
}
}
}
}
public static void main(String[] args) throws Exception {
// Change the 5 to 20 in your case.
ObjectPool<Process> pool = | [
0.23317073285579681,
-0.1959487795829773,
0.13555866479873657,
-0.050537969917058945,
0.5047757029533386,
0.14732801914215088,
-0.0085084717720747,
-0.20940102636814117,
-0.5742934942245483,
-0.5038278102874756,
-0.06011131405830383,
0.4336020350456238,
-0.19619782269001007,
0.379013985395... | |
new GenericObjectPool<Process>(
new CLIPoolableObjectFactory("mock_php.exe"), 5);
BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(100, true);
ThreadPoolExecutor executor = new ThreadPoolExecutor(20, 20, 1, TimeUnit.HOURS, queue);
// print some stuff out.
... | [
-0.09664411097764969,
-0.351868599653244,
0.7342395186424255,
-0.3435002267360687,
0.10614194720983505,
0.07358722388744354,
0.4493781626224518,
-0.20487575232982635,
-0.44455984234809875,
-0.5788757801055908,
-0.10207359492778778,
0.356466680765152,
-0.6727285385131836,
0.5456014275550842... | |
executor.execute(new CLIWorkItem(pool, "Message 3\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 4\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 5\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 6\r\n"));
executor.execute(new CLIWorkItem(pool, "Message 7\r\n"))... | [
-0.5312206745147705,
-0.004759429953992367,
0.8770976662635803,
0.10087694972753525,
0.5401684641838074,
-0.07232663780450821,
0.22278420627117157,
-0.2815743088722229,
-0.358578622341156,
-0.3426598310470581,
-0.8539516925811768,
0.6042578220367432,
-0.8068882822990417,
0.2338426411151886... | |
executor.awaitTermination(4000, TimeUnit.HOURS);
pool.close();
}
}
```
*Output*
```
Apr 11, 2012 8:41:02 PM stackoverflow.StackOverflow_10037379_jdk6$StreamGobbler run
INFO: 9440 - Message 3
Apr 11, 2012 8:41:02 PM stackoverflow.StackOverflow_10037379_jdk6$StreamGobbler run
INFO: 8776 - Message 2
Apr 11... | [
-0.5738490223884583,
0.2682332992553711,
0.6264156103134155,
-0.08770754933357239,
0.11628277599811554,
0.2338545322418213,
0.4168431758880615,
-0.3769620358943939,
-0.2269364595413208,
-0.5268246531486511,
-0.35714712738990784,
0.5130361914634705,
-0.07086683064699173,
0.23292352259159088... | |
9
Apr 11, 2012 8:41:02 PM stackoverflow.StackOverflow_10037379_jdk6$StreamGobbler run
INFO: 10096 - Message 6
Apr 11, 2012 8:41:02 PM stackoverflow.StackOverflow_10037379_jdk6$StreamGobbler run
INFO: 9440 - Message 7
Apr 11, 2012 8:41:02 PM stackoverflow.StackOverflow_10037379_jdk6$StreamGobbler run
INFO: 6100 - Messag... | [
-0.737529456615448,
0.48009294271469116,
0.527143657207489,
-0.20263592898845673,
0.1584693342447281,
0.30886366963386536,
0.42182648181915283,
-0.10856702923774719,
-0.2875266373157501,
-0.39248421788215637,
-0.3105090260505676,
0.4709281027317047,
0.1022927388548851,
0.37283021211624146,... | |
I've been searching around on how to install it through the terminal on my mac. I'm using snow leopard.
When I use the command: rvm install 1.9.3
I've also followed the other procedures that led me up to this to install, right now the current version is 1.8.3
> Error running './configure --prefix="/Users/jose/.rvm/us... | [
-0.01538449339568615,
0.29864194989204407,
0.7270689010620117,
-0.13333293795585632,
-0.05499187484383583,
-0.08383805304765701,
1.0896351337432861,
-0.22491863369941711,
-0.03563680499792099,
-0.7814869284629822,
-0.3436643183231354,
1.0005232095718384,
-0.3339940905570984,
-0.06431102007... | |
for awhile now, and found out i need to have Xcode for snow leopard which I cannot find. So my last option will be to upgrade to lion but I don't know about upgrading. Kind of scared to upgrade and everything becomes buggy.
> Rails 2.3.5
>
> Jose-Gomezs-MacBook-Pro:~ josegomez$ ruby -v
>
> ruby 1.8.7 (2009-06-... | [
0.0641881674528122,
0.3499191105365753,
0.14245542883872986,
0.029970964416861534,
-0.2904781699180603,
0.138215571641922,
0.8141912817955017,
-0.09601810574531555,
-0.1355476975440979,
-0.38828200101852417,
-0.229152649641037,
0.636009156703949,
-0.4665532410144806,
-0.3836763799190521,
... | |
[https://rvm.beginrescueend.com/]
Just to close it off, I found out I had to push back my date on my mac to sometime before January 2012 and install xcode. After installation you can set the time back to normal and you should be good to go. But I got a copy of xcode from my instructor which is pretty cool. | [
0.5962744355201721,
0.0910988450050354,
0.6554773449897766,
0.02371332049369812,
0.16050590574741364,
-0.2597791850566864,
0.5461457371711731,
0.36020535230636597,
-0.0402921624481678,
-0.566755473613739,
0.2954873740673065,
0.1418095976114273,
0.25491592288017273,
0.3797367215156555,
0.... | |
I want to do the following :
At this moment we receive some xml-files where some xml-tags are filled wrongly.
To help our partner, we want to catch these false values by using a "Pass-through" folder where all the xml-files are placed before importing in our application.
This folder would be read every X minutes and f... | [
0.576758623123169,
0.15995310246944427,
0.17861416935920715,
0.20203635096549988,
0.12785093486309052,
-0.2036597728729248,
0.3344191908836365,
-0.2901528477668762,
-0.11717643588781357,
-0.5742504000663757,
0.11878865212202072,
0.21915917098522186,
-0.2374526709318161,
0.11024125665426254... | |
set-ups :
* Using java and calling an XSLT-file to transform every file and put it in another folder
* Using only java to check the xml-file and do the transformation.
Both of the cases would be called by a .bat that runs every X minutes.
Now my questions :
* What do you think that would be the best solution? a.k.a.... | [
0.3751468360424042,
-0.2687304615974426,
-0.001724851899780333,
0.3446269929409027,
-0.08914303034543991,
0.005296631716191769,
0.2594929039478302,
-0.13832464814186096,
-0.06687172502279282,
-0.7742525935173035,
0.0419396348297596,
0.48343774676322937,
-0.17556774616241455,
-0.26289117336... | |
I can make it on my own.
At the time of this writing, I'm already looking for solutions on other websites, but because it is urgent, it's also helpfull to ask the community.
Thank you for your answer,
Kind regards,
Maarten
EDIT : Both answers helped me a lot. Thank you guys.
If you really want a hash, LBg has given y... | [
0.45898374915122986,
0.20974847674369812,
0.06336136907339096,
0.3296174108982086,
-0.11719260364770889,
0.052294474095106125,
0.3542136549949646,
0.009191128425300121,
-0.20243215560913086,
-0.7592965960502625,
0.11795126646757126,
0.18015968799591064,
0.1670178920030594,
-0.1887461990118... | |
SomeSelectedPersonAttrs = Struct.new :first_name, :last_name, :zip
def some_selected_attributes
SomeSelectedPersonAttrs[ * SomeSelectedPersonAttrs.members.map{|a| send a } ]
end
end
pa = person.some_selected_attributes
pa.first_name # => "Joe"
pa[:first_name] # => "Joe"
pa['first_name'] # => "Joe"
p.zip ... | [
-0.11719977110624313,
0.0679401308298111,
0.2512590289115906,
0.023008272051811218,
0.0508640818297863,
0.09968370199203491,
0.04295755550265312,
-0.11062540858983994,
-0.3118392527103424,
-0.3212754428386688,
-0.2798493504524231,
0.17740212380886078,
0.0032999536488205194,
-0.011272349394... | |
This is in a simple test program. The main thread starts a number of child threads. I have added to main:
Runtime.getRuntime().addShutdownHook(hookThread);
When ^C is pressed on the JVM process, this hookThread will set a global shutdown flag, and call interrupt() to all the child threads.
I want all the child threa... | [
0.05697083845734596,
-0.0054222699254751205,
0.54883873462677,
-0.16116715967655182,
0.2524564564228058,
-0.013206004165112972,
0.2848982810974121,
0.2582949101924896,
-0.2701345682144165,
-0.7799570560455322,
-0.1178564578294754,
0.5842013359069824,
-0.24676424264907837,
0.313575625419616... | |
interrupt() has been called on it:
```
"Thread-0" prio=10 tid=0x0000000040b0f800 nid=0x3eab runnable [0x000000004211b000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.Buffer... | [
-0.1915273219347,
-0.19199959933757782,
0.1421041190624237,
-0.025156725198030472,
0.09715314954519272,
0.38863813877105713,
0.21910639107227325,
0.2816496789455414,
-0.5368282198905945,
-0.5606369972229004,
0.035541679710149765,
0.6057354211807251,
-0.5018572211265564,
0.30397215485572815... | |
- locked <0x00000000fd997670> (a sun.net.www.protocol.http.HttpURLConnection)
...
```
1. Yes
2. Use [Array#sort](http://www.ruby-doc.org/core-1.9.3/Array.html#method-i-sort)
Check it out:
```
Thing.where(:id => ids).sort! {|a, b| ids.index(a.id) <=> ids.index(b.id)}
```
`where(:id => ids)` will generate a query us... | [
-0.05399049073457718,
0.08840355277061462,
0.45719385147094727,
-0.045508500188589096,
0.06596751511096954,
-0.2343144565820694,
0.19703231751918793,
-0.6962345838546753,
-0.09723538905382156,
-0.42173823714256287,
-0.2849871814250946,
0.27781572937965393,
-0.29357776045799255,
0.267405897... | |
(Hi guys) I am trying to create a scenario where `<li>` elements fade in and fade out one after another - ***which I can get to work.***
I am also trying to stop the animation process when I hover over an `<li>` element that is currently being animated - ***which I can also get to work.***
However I am having trouble... | [
0.018686793744564056,
0.0348861888051033,
0.6296660304069519,
-0.2651174068450928,
-0.38367560505867004,
-0.06114692613482475,
0.1780436784029007,
0.3342530429363251,
-0.21743471920490265,
-0.991844892501831,
-0.20648466050624847,
0.144418865442276,
-0.38329970836639404,
-0.201697543263435... | |
class="two">two</li>
<li class="three">three</li>
</div>
```
However I thought if I could nest the `<li>` elements within a which does not get hidden by my jQuery, then I could set the `<li>` element back to display:block when I mouse over the `<div>`.
### Suggested markup;
```
<div id="content">
<div class... | [
-0.2324092984199524,
-0.18616610765457153,
0.428000271320343,
-0.35659950971603394,
-0.3850483000278473,
0.035793621093034744,
0.09602782130241394,
-0.5287464261054993,
0.15116654336452484,
-0.904817521572113,
-0.22360019385814667,
0.3540360629558563,
-0.5257666707038879,
-0.00937006995081... | |
function InOut(elem) {
elem.delay().fadeIn(1500).delay(5000).fadeOut(1500, function() {
if (elem.next().length > 0) {
InOut($(this).next());
}
else {
InOut($(this).siblings(':first')); | [
-0.05196331813931465,
-0.42692288756370544,
0.3632282614707947,
-0.133152037858963,
0.26180002093315125,
0.5329964756965637,
0.1925390213727951,
-0.558239758014679,
-0.14288192987442017,
-0.5378354787826538,
-0.0953163430094719,
0.4537164866924286,
-0.14324741065502167,
0.5813198089599609,... | |
}
});
}
$('#content li').mouseover(function() {
$(this).fadeIn(500).stop(true, true);
});
$('#content li').mouseout(function() {
if ($(this).is(":visible") == true) {
InOut($(this));
}
});
});
```
For the sake of an example I have created a Fiddle of ... | [
0.0015879498096182942,
-0.3363415002822876,
0.8327285051345825,
-0.03297051414847374,
0.024391230195760727,
0.02286793477833271,
0.399801105260849,
-0.057300303131341934,
-0.04554978013038635,
-0.7321747541427612,
-0.10498813539743423,
0.6075952053070068,
-0.165842667222023,
0.156616657972... | |
tell git that it should always assume that file is never changed:
```
git update-index --assume-unchanged oath.class
```
You can toggle it back by using --no-assume-unchanged
```
git update-index --no-assume-unchanged oath.class
```
Which will make git notice changes to the file again. | [
0.31937262415885925,
-0.028046442195773125,
0.1180281862616539,
-0.04204640910029411,
0.07899455726146698,
-0.4731296896934509,
0.14453545212745667,
0.0765041932463646,
0.18160328269004822,
-0.5704730749130249,
-0.26377493143081665,
0.661974310874939,
-0.3773393929004669,
-0.05768318474292... | |
Below is my entire class that I am using, I have two questions, 1 is this the proper use of Dispose() and also, why am I getting the error No Overload for method 'dispose' takes 1 argument.
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Crawler
{
class LoggingC... | [
0.29559844732284546,
-0.07630188018083572,
0.32848018407821655,
-0.03637276217341423,
0.2063809633255005,
0.024965189397335052,
0.32054460048675537,
-0.34601274132728577,
-0.34156277775764465,
-0.40872839093208313,
0.1051066443324089,
0.5041236281394958,
-0.41367805004119873,
0.32443729043... | |
" insert into tblLogs " +
"set SystemMsg='" + systemMsg.Replace("'","''") + "'" +
",SystemClass = '" + SystemClass.Replace("'", "''") + "'" + | [
-0.19874928891658783,
-0.2638823390007019,
0.37987351417541504,
0.02095046266913414,
0.3911602199077606,
0.10412110388278961,
0.29930275678634644,
-0.18686428666114807,
-0.06578357517719269,
-0.6523403525352478,
-0.37321412563323975,
0.6011439561843872,
-0.6210787296295166,
-0.021994115784... | |
",SystemSection = '" + SystemSection.Replace("'", "''") + "'" +
",ID = '" + CarID.Replace("'", "''") + "'" +
",FixID = '" + FixID.Replace("'", "''") + "'" + | [
-0.15237273275852203,
-0.12001841515302658,
0.39887356758117676,
0.18306143581867218,
0.38838616013526917,
0.5204304456710815,
-0.33795109391212463,
-0.35315343737602234,
0.030062159523367882,
-0.5451753735542297,
-0.4857477843761444,
0.3664208650588989,
-0.3605295419692993,
-0.03206353634... | |
",baseurl = '" + baseURL.Replace("'", "''") + "'" +
",mysqlqueryName = '" + mysqlQuery.Replace("'", "''") + "'" +
",mysqlquery = '" + mysqlQuery.Replace("'", "''") + "'" + | [
-0.17026691138744354,
0.17359568178653717,
0.612461268901825,
0.036293186247348785,
-0.23833009600639343,
0.3373311161994934,
0.335980623960495,
0.13545383512973785,
0.060155920684337616,
-0.8119811415672302,
-0.5244848132133484,
-0.00006729728193022311,
-0.19088132679462433,
-0.0381165109... | |
",TimeStamp = Now()";
MySQLProcessing.MySQLProcessor MYSQLP = new MySQLProcessing.MySQLProcessor();
MYSQLP.MySQLInsertUpdate(Loggingall, "Loggingall");
}
public void Dispose()
{
Dispose(true); | [
0.41136887669563293,
-0.24386823177337646,
0.4136905372142792,
-0.33473125100135803,
0.5023314356803894,
0.05154365673661232,
0.4423941373825073,
-0.41308125853538513,
-0.38987863063812256,
-0.18331378698349,
-0.2828681170940399,
0.5248311161994934,
-0.3139575719833374,
0.4167855679988861,... | |
// Take yourself off the Finalization queue
// to prevent finalization code for this object
// from executing a second time.
GC.SuppressFinalize(this);
}
}
}
```
Here is my updated code:
}
Is this the correct way to call it? Do i also have to call the dispose?
As oth... | [
0.4725329577922821,
-0.06071805581450462,
0.3130795955657959,
-0.31585830450057983,
0.15457044541835785,
-0.4080272614955902,
0.2915320098400116,
-0.3470514416694641,
-0.16217446327209473,
-0.6028242707252502,
-0.11026613414287567,
0.7281355857849121,
-0.2952364385128021,
0.126304596662521... | |
IDisposable. You have no class fields at all, so there's nothing to clean up.
Assuming there's more to the class than you've shown, you're following the pattern for implementing IDisposable, but you're only halfway done.
The pattern is to have `IDisposable.Dispose()` and the finalizer (`~LoggingClass`) both call a ... | [
0.1575751155614853,
-0.11587776988744736,
-0.22072461247444153,
-0.003661480965092778,
0.07727023959159851,
-0.23124904930591583,
0.33930620551109314,
-0.2693129777908325,
-0.06291241198778152,
-0.6847776770591736,
-0.13596829771995544,
0.6788543462753296,
-0.6320358514785767,
0.0275169201... | |
void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!this.Disposed)
{
if (disposing)
{
// Perform managed cleanup here.
}
// Perform unmanaged cleanup here.
this.Disposed = true;
... | [
0.4980300962924957,
-0.07616015523672104,
0.07601451128721237,
-0.17270547151565552,
0.35956546664237976,
-0.3529239594936371,
0.2357178032398224,
-0.23284752666950226,
-0.3082219660282135,
-0.5424260497093201,
-0.18799687922000885,
0.7161169648170471,
-0.40325430035591125,
0.4733627438545... | |
it. But, here's my comments on how you're calling it.
With the GenericLogging method as you currently have it, you don't need IDisposable at all. However, there are a couple things I would do to improve up your code.
1. Create the MySQLProcessing.MySQLProcessor instance in the
constructor, rather than in the Generi... | [
0.5119691491127014,
-0.2802509367465973,
0.1244199201464653,
0.2014869898557663,
-0.1839042454957962,
-0.4486692249774933,
0.3292229473590851,
-0.080453060567379,
-0.29702773690223694,
-0.6347381472587585,
0.03522924333810806,
0.4082013666629791,
-0.5830144882202148,
0.16528263688087463,
... | |
around for the entire
length of the program, not just for one log statement.
4. Call LoggingClass.Dispose() when your application is about to exit. Do this manually (not with a `using` statement). | [
0.5342491865158081,
-0.197978675365448,
0.2905377745628357,
-0.133089080452919,
0.1941208839416504,
-0.31015074253082275,
0.4130944013595581,
-0.13976536691188812,
-0.38019490242004395,
-0.3894790709018707,
-0.2124512940645218,
0.544921875,
-0.2755177915096283,
0.05124781280755997,
-0.05... | |
I've been trying to get a tabeView to display one of its columns as comboBoxes. In order to do this, I've written the code for a custom delegate:
```
class comboBoxDelegate(QStyledItemDelegate):
def __init__(self, model, parent=None):
super(comboBoxDelegate, self).__init__(parent)
self.parent= parent
self... | [
-0.12275190651416779,
-0.21562322974205017,
0.29411420226097107,
-0.03593908250331879,
-0.09925156086683273,
0.4099274277687073,
0.26853692531585693,
-0.46554020047187805,
-0.20905464887619019,
-0.6691460609436035,
-0.06525988131761551,
0.3131232261657715,
-0.28520894050598145,
0.461024194... | |
value = index.data(Qt.DisplayRole)
editor.setCurrentIndex(value)
def setModelData(self, editor, model, index):
if not index.isValid():
return False
index.model().setData(index, editor.currentIndex(), Qt.EditRole)
def paint(self, painter, option, index):
currentIndex= index.data(Qt.DisplayRol... | [
-0.0784829705953598,
-0.2602384090423584,
0.8210936188697815,
-0.34926775097846985,
0.1128309816122055,
0.32112324237823486,
0.2120639681816101,
-0.41049399971961975,
-0.23269253969192505,
-0.6863936185836792,
-0.11202634125947952,
0.7900514006614685,
-0.33931857347488403,
-0.0987060666084... | |
help will be appreciated.
I think you should call parent class paint() method. Add:
```
QStyledItemDelegate.paint(self, painter, option, index)
```
at the end of the paint method in your class, after the call to `drawComplexControl` | [
0.13177865743637085,
-0.1868666708469391,
0.37816324830055237,
0.04477143660187721,
-0.060958389192819595,
-0.2152220457792282,
0.3133101165294647,
0.058834560215473175,
0.15559488534927368,
-0.7109015583992004,
-0.021220536902546883,
0.6497371196746826,
0.14679403603076935,
-0.13411672413... | |
I've got a service that is used during phone calls and I am trying to find out if a bluetooth headset is connected. But when I use am.isBluetoothA2dpOn() it *always* returns false. During phone calls, not during phone calls, all the time!
Here's a sample of what I'm doing:
```
AudioManager am = (AudioManager) getSyst... | [
0.2068580836057663,
0.39823421835899353,
0.5045871734619141,
-0.03821020945906639,
0.25579601526260376,
-0.35438722372055054,
0.565238356590271,
-0.5456088185310364,
-0.11978252232074738,
-0.7530620694160461,
-0.332400918006897,
0.8993697166442871,
-0.29685643315315247,
0.05191894993185997... | |
great.
I think you should call parent class paint() method. Add:
```
QStyledItemDelegate.paint(self, painter, option, index)
```
at the end of the paint method in your class, after the call to `drawComplexControl` | [
0.3549196720123291,
-0.15071360766887665,
0.3071591854095459,
-0.13614942133426666,
-0.05880768597126007,
-0.26897913217544556,
0.2699122726917267,
0.1503952592611313,
-0.011846409179270267,
-0.7046855092048645,
0.016887271776795387,
0.6646261215209961,
-0.004074595868587494,
0.07572967559... | |
The Azure Training Kit includes a lab titled "IntroToACS2". In it, you create a WebRole and enable ACS so that you can login using your Google, Live, or Yahoo id. After logging in, if I wait 10 minutes or so and then refresh the page, I'm redirected back to the login page.
How can I increase the Azure ACS login timeo... | [
0.3665142357349396,
-0.25332584977149963,
-0.01028178445994854,
0.29753565788269043,
0.06868443638086319,
-0.3469403088092804,
0.1041450947523117,
-0.15918663144111633,
0.1144426241517067,
-0.6817323565483093,
-0.11403296887874603,
0.2899458408355713,
0.21665021777153015,
-0.24448062479496... | |
value is set to 10 minutes (600 seconds). In ACS, this value must be greater than zero but less than or equal to 24 hours (86400 seconds).

While the maximum lifetime is 24 hours it's possible to automatically renew the ACS token by adding the follow... | [
0.40203189849853516,
-0.3405914604663849,
0.7630774974822998,
0.10365907847881317,
0.49871349334716797,
-0.21275119483470917,
0.43594858050346375,
-0.05554873123764992,
-0.16593709588050842,
-0.39954134821891785,
-0.19324582815170288,
0.5225733518600464,
0.21202614903450012,
-0.06382869184... | |
} }
// Loop through the identity providers for (var i in identityProviders) {
...
```
For more info the automatic renewal approach see: <http://social.msdn.microsoft.com/Forums/en-US/windowsazuresecurity/thread/0430c4aa-ab10-4a72-b115-91b2600bfcd0> | [
-0.006421391852200031,
0.04341655597090721,
0.19097761809825897,
-0.004196232184767723,
0.43616482615470886,
-0.29595282673835754,
0.4540129601955414,
0.14239557087421417,
-0.22279684245586395,
-0.43946632742881775,
-0.325539231300354,
0.7783509492874146,
0.030539367347955704,
0.1544962525... | |
I have designed a parameter class which allows me to write code like this:
```
//define parameter
typedef basic_config_param<std::string> name;
void test(config_param param) {
if(param.has<name>()) { //by name
cout << "Your name is: " << param.get<name>() << endl;
}
unsigned long & n = param<ref<unsigned ... | [
0.22549179196357727,
0.022782010957598686,
0.2211080938577652,
-0.0471312440931797,
-0.14432063698768616,
0.11996482312679291,
0.34952619671821594,
-0.8224308490753174,
-0.2129305899143219,
-0.5226098299026489,
-0.053888339549303055,
0.25498881936073303,
-0.13584138453006744,
0.06564678996... | |
reference on the stack. And to save all the information I use an internal buffer of up to 5 arguments before it goes to heap allocation to decrease the size of every single object, but this can be easily changed.
Why isn't this syntax used more often, overloading `operator,()` to implement named parameters? Is it beca... | [
-0.028273120522499084,
0.3145996630191803,
0.39155009388923645,
-0.0038820775225758553,
-0.2021656036376953,
0.020378826186060905,
0.21814124286174774,
-0.4518269896507263,
-0.31101900339126587,
-0.3541894853115082,
0.06967788934707642,
0.6414437294006348,
-0.32449981570243835,
0.378720849... | |
does not suffer much either, even if it is slower than a normal function, so is it negligible in most cases.
I am probably not the first one to come up with a solution like this, but why isn't it more common? I have never seen anything like the syntax above (my example) before I wrote a class which accepts it, but fo... | [
-0.11206550896167755,
0.08122093230485916,
0.14653204381465912,
0.28687453269958496,
-0.2187681645154953,
-0.19392111897468567,
0.517758846282959,
0.07017260789871216,
-0.18318618834018707,
-0.6626015305519104,
-0.01625262387096882,
0.5291887521743774,
-0.16711609065532684,
-0.172917857766... | |
avoid doing that.
```
test(( name("Special :-)"), ref<unsigned long>(num) ));
```
Let's say I see this code fragment for the first time. My thought process goes like this:
1. At a first glance it looks like an example of ["the most vexing parse"](http://en.wikipedia.org/wiki/Most_vexing_parse) because you use doubl... | [
0.4505612850189209,
0.21593688428401947,
-0.34720367193222046,
-0.008174982853233814,
-0.10612502694129944,
-0.4619477093219757,
0.34092333912849426,
-0.04278221353888512,
-0.16848154366016388,
-0.5982568860054016,
-0.004152687732130289,
0.4542979598045349,
-0.28649234771728516,
0.28308480... | |
I discover it is actually a function call. Great.
3. The code fragment now looks like a function call with two arguments.
4. Now it becomes obvious to me that this can't be a function call with two arguments, because you used double parentheses.
5. So, NOW I have to figure what the heck is going on within `()`.
6. I re... | [
-0.035410333424806595,
0.12459246814250946,
0.15001927316188812,
-0.1419801563024521,
-0.24760684370994568,
-0.14626184105873108,
0.29669591784477234,
0.11003624647855759,
-0.28764498233795166,
-0.3064095675945282,
-0.05314631387591362,
0.7122500538825989,
-0.034646522253751755,
0.38364776... | |
name() is - a function call or a type (because you don't use uppercase/lowercase letters to distinguish between class/function (i.e. `Test` is a class, but `test` is a function), and you don't have `C` prefixes).
7. After looking up `name` in the source code, I discover that it is class. And that it overloads the `,` o... | [
0.11971808224916458,
0.2700766921043396,
0.018761875107884407,
-0.07143968343734741,
0.13217702507972717,
-0.27806082367897034,
0.35801130533218384,
-0.050606127828359604,
0.07302960008382797,
-0.33673349022865295,
-0.2664291560649872,
0.5315911173820496,
-0.19128666818141937,
0.2947993576... | |
actually does (you make a function call with one argument look like it has two arguments or that it is a variadic function). Which is a bad programming practice that is roughly equivalent to overloading operator+ to perform substractions instead of additions.
Now, let's consider a [QString](http://qt-project.org/doc/q... | [
0.22192423045635223,
0.07571631669998169,
0.8100661039352417,
-0.02485138550400734,
0.027303166687488556,
-0.21459749341011047,
0.17773856222629547,
-0.0842522531747818,
-0.19350028038024902,
-0.32831257581710815,
0.22076120972633362,
0.43184787034988403,
0.03511038050055504,
0.24975131452... | |
is a method).
4. I look up [.arg](http://qt-project.org/doc/qt-4.8/qstring.html#arg) in the documentation to see what it does, and discover that it replaces `%1`-style entries and returns QString&. So the chain of `.arg()` calls instantly makes sense. Please note that something like QString::arg can be templated, and y... | [
0.2870689928531647,
0.2067795991897583,
0.41082024574279785,
-0.20766577124595642,
-0.15909446775913239,
-0.08436570316553116,
0.3042272925376892,
-0.3703402280807495,
-0.1607673317193985,
-0.42711141705513,
-0.08581054210662842,
0.432517409324646,
-0.3323797881603241,
0.17957104742527008,... | |
if your code looks modern. It should be human-readable, it should do what it is intended to do, and you should waste the minimum possible amount of time in writing it. I.e. you should (personal recommendation) aim to "implement a maximum amount of functionality in a minimum amount of time at a minimum cost (includes ma... | [
0.08677227795124054,
0.23825332522392273,
0.16274458169937134,
0.19997386634349823,
0.19785529375076294,
-0.23773907124996185,
0.7795318365097046,
-0.003034238237887621,
0.2391497790813446,
-0.8293381333351135,
-0.5833421349525452,
0.5759957432746887,
-0.26079851388931274,
-0.4430044889450... | |
I am embedded in my application like so:
```
[Embed(source="/assets/arial.ttf", fontName="Arial")]
private const arial:String;
```
Flex errors with the following:
warning: incompatible embedded font 'Arial' specified for mx.core::UITextField (UITextField75) . This component requires that the embedded font be declar... | [
0.15033259987831116,
0.12906460464000702,
0.13795648515224457,
0.026494301855564117,
-0.052484650164842606,
0.007053378038108349,
0.7327237725257874,
-0.16580186784267426,
0.19576312601566315,
-0.5681725740432739,
-0.22587616741657257,
0.6276524662971497,
-0.24141189455986023,
0.2234901636... | |
happens when a font embed is bound to a variable.
If your component is MX (Halo), you want embedAsCFF to be false.
For Spark components, you embedAsCFF: true.
CSS implementation:
Spark Example:
```
@font-face
{
font-family: "Myriad Web Pro";
src: url("./assets/fonts/MyriadWebPro.ttf");
font-weight: nor... | [
0.12803402543067932,
-0.21158210933208466,
0.6085189580917358,
-0.14233645796775818,
0.07041403651237488,
-0.20523066818714142,
0.11146628111600876,
-0.5224313735961914,
0.05004994943737984,
-0.6513866186141968,
-0.029195651412010193,
0.38825666904449463,
-0.3018382787704468,
-0.3417360782... | |
U+0020-U+002F, /* Space + Punctuation [ !"#$%&'()*+,-./ ] */
U+003A-U+0040; /* Special Chars [ :;?@ ] */
}
```
MX Halo Example:
```
@font-face
{
font-family: "Myriad Web Pro";
src: url("./assets/fonts/MyriadWebPro.ttf");
font-weight: normal;
embedAsCFF: false; /* Halo */
advancedAntiAli... | [
0.10463441163301468,
-0.13056281208992004,
0.9386457204818726,
-0.09482484310865402,
0.056786082684993744,
0.10117852687835693,
-0.08253893256187439,
-0.3551659882068634,
-0.1783488243818283,
-0.5557612180709839,
-0.16162247955799103,
0.501886248588562,
-0.23569458723068237,
-0.23314666748... | |
U+0030-U+003F, /* Numbers [0..9] */
U+0020-U+002F, /* Space + Punctuation [ !"#$%&'()*+,-./ ] */
U+003A-U+0040; /* Special Chars [ :;?@ ] */
}
```
With Flex, I find it easier to work with CSS for fonts. Just link your style sheet in your main app:
```
<!--- CSS style -->
<fx:Style source="assets/css/... | [
0.0505642332136631,
0.23035113513469696,
0.7468006610870361,
0.09944329410791397,
-0.1186080053448677,
0.48062217235565186,
0.2271871417760849,
-0.3449402153491974,
-0.2046278715133667,
-0.7766003608703613,
-0.3856828212738037,
0.598706841468811,
-0.2583679258823395,
0.12200907617807388,
... | |
static const Arial:Class;
```
In your Embed, add `embedAsCFF=true` or `embedAsCFF=false` for Spark or MX Halo components respectively. | [
0.44150596857070923,
-0.13506971299648285,
0.2307422012090683,
0.00399828003719449,
-0.13408266007900238,
-0.1771387904882431,
0.09333901107311249,
-0.1618799865245819,
0.1801464706659317,
-0.061661235988140106,
-0.2675168514251709,
0.6826948523521423,
-0.5732560157775879,
0.03078821487724... | |
Remember "const poisoning" in C++, when you would mark one method as `const` and then you realized you had to mark all the methods it called as `const` and then all the methods they called, and so on?
I'm having a problem with asynchrony poisoning, in Javascript although I don't think that's relevant, although it prop... | [
0.2673833668231964,
0.2405584454536438,
-0.35066768527030945,
-0.16402795910835266,
-0.22197915613651276,
-0.3503716289997101,
0.19619828462600708,
0.03936399891972542,
-0.03577008098363876,
-0.14729386568069458,
0.26689600944519043,
0.5340886116027832,
-0.5995421409606934,
-0.099572464823... | |
someone had either (a) advice or (b) a reference that might have (a).
The best solution I've seen so far is [promises](http://en.wikipedia.org/wiki/Futures_and_promises). All that happens, of course, is that you trade asynchrony poisoning for promise poisoning (since any computation that depends on a promise itself mus... | [
0.27988380193710327,
-0.007966890931129456,
-0.06223200634121895,
0.29021814465522766,
0.3694348931312561,
-0.017284099012613297,
0.3664446175098419,
0.05119333043694496,
-0.024293161928653717,
-0.2671101689338684,
0.05983602628111839,
0.7869800329208374,
0.25957053899765015,
-0.1092030704... | |
I have a method for which the return type is object. How do I create a test case for this? How do I mention that the result should be an object?
e.g.:
```
public Expression getFilter(String expo)
{
// do something
return object;
}
```
try Something like this. If the return-type of your function is `Object` t... | [
0.3361782729625702,
0.07274872064590454,
0.15324752032756805,
-0.275634229183197,
-0.12032066285610199,
-0.1684345155954361,
0.4636417329311371,
-0.4331871271133423,
0.3550487756729126,
-0.46093156933784485,
-0.3255814015865326,
0.6255858540534973,
-0.3492261469364166,
-0.07040540874004364... | |
//check if the object is != null
//check if the returned object is of class Expression.
assertTrue(true, myReturnedObject instanceof Expression);
} catch(Exception e){
// let the test fail, if your function throws an Exception.
fail("got Exception, i want an Expression");
}
}
`... | [
0.16509473323822021,
-0.08726531267166138,
0.056038592010736465,
-0.08930578827857971,
0.2756531834602356,
-0.19163280725479126,
0.7352705001831055,
-0.17076903581619263,
0.11854266375303268,
-0.3234468102455139,
-0.4656044542789459,
0.7884407639503479,
-0.2728447914123535,
0.0324134044349... | |
I have a PHP page with a form. The form has `method="POST"` and the action is another PHP file which inserts the values into MySQL. This all works properly.
My problem is that the 2nd PHP page which sends the info to the database contains the username, password, databasename and tablename where the info should go. I a... | [
0.4567444622516632,
0.5234206318855286,
0.3575744032859802,
-0.06012983247637749,
-0.06630958616733551,
-0.17674818634986877,
0.3601258099079132,
-0.07590487599372864,
0.01888679526746273,
-0.6425289511680603,
0.20303155481815338,
0.29825225472450256,
-0.25741881132125854,
0.16592817008495... | |
and pass these as variables to the 2nd PHP form, thus eliminating the threat of someone else creating their own form and posting whatever they want. (If this is possible and the correct way to do it, can you suggest how to pass the variables?)
Is this the proper way to secure input to the database?
Don't put databasen... | [
0.35802382230758667,
0.17912037670612335,
0.4946439266204834,
0.15489767491817474,
-0.0845903530716896,
-0.07897760719060898,
0.23339629173278809,
0.10405036062002182,
0.043046873062849045,
-0.6436687111854553,
-0.02086642198264599,
0.4860236346721649,
-0.17773891985416412,
-0.149417236447... | |
for bluepill and "evil\_users" for redpill.
If the form is a registration form, you can think of other methods of verifying users, such as email link, captcha, etc. | [
0.3872408866882324,
-0.0869583934545517,
0.21412543952465057,
0.06433749943971634,
0.10252473503351212,
0.02425621822476387,
0.4475994110107422,
0.24777519702911377,
-0.1586339771747589,
-0.3746716380119324,
-0.3222130239009857,
0.3729695677757263,
-0.3309065103530884,
-0.02821900509297847... | |
As a part of the programming Assignment, I have to maintain a linked list in text file. I am pretty convenient with Linked List datastructure, but not so much with files in C++. Can some one give me an idea or overview of how to approach it. I should be able to add or delete the linked list, also able to add or delete ... | [
0.18144440650939941,
0.2353581041097641,
0.3159715235233307,
0.13251246511936188,
0.047901079058647156,
-0.2262011021375656,
-0.09024041891098022,
-0.025619035586714745,
-0.336740106344223,
-0.7292758822441101,
-0.09077903628349304,
0.523236870765686,
-0.21360109746456146,
0.03066453896462... | |
be,
1) maintain a file with numbers(that contain linked List numbers)
```
0 - NULL
1 - head_offset for_linked_list_num 1
0 - NULL
1 - head_offset_for_linked_list_num 3
1 - head_offset_for_linked_list_num 3
1 - head_offset_for_linked_list_num 3
```
etc
where -1 is the termiator indication, 1 in a position indicates... | [
0.38874414563179016,
0.12005620449781418,
0.39510416984558105,
-0.26429104804992676,
-0.07322847843170166,
0.010529287159442902,
-0.15848907828330994,
-0.5961952805519104,
0.12436270713806152,
-0.7446704506874084,
-0.23304753005504608,
0.6692605018615723,
-0.5736501216888428,
-0.2490895241... | |
as an basic level of functions. Please advise. Thanks in advance
Don't put databasename and tablename in the form. Put some meaningful value there, and on ther serverside code, select the appropriate table name and database.
For instance, add a select field that can take the values "bluepill" or "redpill".
On receivin... | [
0.01830100268125534,
0.03764534369111061,
0.6585034132003784,
0.3572756052017212,
0.03331809490919113,
-0.2282123863697052,
0.2344006448984146,
-0.006422996520996094,
0.008785336278378963,
-0.7118675112724304,
-0.30463239550590515,
0.2563038468360901,
-0.04576888680458069,
0.05822041258215... | |
I have the following Message-level entry in my Error List from CodeContracts:
*CodeContracts: Checked 410 assertions: 404 correct (6 masked)*
I can't figure out:
1. What masked assertions are
2. How to locate the 6 that it mentions
3. Whether or not I should be concerned about them
Sorry for not posting code... I h... | [
0.5553082823753357,
0.16796879470348358,
0.5376402735710144,
0.22268296778202057,
-0.41487234830856323,
-0.32560256123542786,
0.5949433445930481,
-0.0775664821267128,
-0.28501224517822266,
-0.5415441989898682,
0.12609782814979553,
0.3960542380809784,
-0.11878051608800888,
0.326483309268951... | |
I want to write a function to analyze a data set where I need to aggregate/group by/split on each combination of identification variables. Unfortunately the measurement variable are numerous, often change and enumerating them leads to brittle code and bugs in the inputs.
```
dat <- data.frame(id.a=c('aa','bb','aa','b... | [
0.5428133606910706,
0.28124457597732544,
0.24488666653633118,
-0.1358531415462494,
-0.16748540103435516,
0.391276091337204,
0.24079462885856628,
-0.8779793977737427,
-0.013341525569558144,
-0.4673061966896057,
0.15088807046413422,
0.5389518737792969,
-0.4934702515602112,
0.1558356732130050... | |
6
3 bb x 4 8
```
I think that reshape2 or ddply is likely to be a solution.
With plyr:
```
ddply(dat, .(id.a,id.b), numcolwise(function(x) sum(x)))
``` | [
0.06101084500551224,
-0.10715717077255249,
0.4697137475013733,
-0.27714481949806213,
-0.2987237274646759,
0.18214617669582367,
0.06302773952484131,
-0.6196792125701904,
0.003032199339941144,
-0.445565789937973,
-0.3516944646835327,
0.6249485015869141,
-0.2994253933429718,
0.096815496683120... | |
I have an href with data-toggle="dropdown", which I'm trying to remove.
This snippet doesn't seem to work:
```
$(document).on('click','a',function() {
$(this).data('toggle','Phillip Senn');
});
```
Instead, Firebug is showing that data-toggle still equals "dropdown" and there is a new "toggle" attribut equal to "Phi... | [
0.09474699944257736,
0.1830710619688034,
0.6514288187026978,
-0.02769472636282444,
-0.11726681143045425,
-0.013620671816170216,
0.17408959567546844,
-0.2226438820362091,
-0.1987331658601761,
-0.3093098998069763,
0.013238138519227505,
0.4984818398952484,
-0.5359171032905579,
0.3809212148189... | |
I set up 301 redirect in my GoDaddy settings. It still hasn't updated and I am getting impatient.
What will happen if I set the DNS A entries to google's servers?
If you are using Go Daddy domain forwarding you need to be on the parked nameservers and you need to ensure that you are using the IP 64.202.189.170. If yo... | [
0.5823506116867065,
0.13960330188274384,
0.565524697303772,
0.08795235306024551,
-0.09812092036008835,
-0.14160384237766266,
0.23427678644657135,
0.11887818574905396,
-0.15395542979240417,
-0.6508447527885437,
0.4783793091773987,
0.46068257093429565,
-0.1178552508354187,
0.4544626176357269... | |
I have a query like this
```
SELECT [Year], Month, AVG(salary) AS [salary] FROM table1
GROUP BY [Year],[Month]
ORDER BY Year,Month
```
But the months are populated as jan, feb,... etc. When i say `order by month` I will be ordering them by letters. I was thinking if there is any scope like giving jan as 1, ... | [
0.07275139540433884,
0.35949578881263733,
0.4614505469799042,
-0.2317718267440796,
-0.18147224187850952,
0.6357451677322388,
-0.0654991865158081,
-0.11526945978403091,
-0.5151809453964233,
-0.37751540541648865,
-0.1669042557477951,
0.14806893467903137,
0.11424770951271057,
0.45609101653099... | |
I started creating a API for a new site I'm working on.
I originally wanted to make it an normal REST API but I keep thinking about how cool thrift would be with the ability to compile multiple client libraries in one batch.
Is Thrift a viable option for a public API ,sockets and all, or should I stick with REST?
A... | [
0.6352847814559937,
-0.030737338587641716,
-0.15688663721084595,
0.42898842692375183,
-0.19621139764785767,
0.01845938339829445,
0.034391891211271286,
0.15286391973495483,
-0.2925753891468048,
-0.5062813758850098,
0.47797006368637085,
0.5145838856697083,
-0.21714408695697784,
0.24429188668... | |
give the developers the .thrift file to generate their own library ?
**Note: It's still a small site so I would create the Thrift Specification file just for the API.**
First, REST and Thrift are apples to oranges -- former is a general style, latter specific binary RPC system.
But for public interfaces I think that ... | [
0.4073353707790375,
-0.033552031964063644,
0.024974364787340164,
0.005098369903862476,
-0.26358485221862793,
0.12310575693845749,
-0.22317859530448914,
0.4372796416282654,
-0.29326316714286804,
-0.8175634741783142,
-0.01471177488565445,
0.7171427607536316,
-0.14602689445018768,
-0.23133058... | |
having to use specific Thrift client library.
So question would rather be what exactly are you trying to gain? What exactly do you consider "cool" there? If you just want to play with new technology, there's nothing wrong with that but you should first play with it, then see if it makes sense. | [
0.8332167267799377,
-0.21666361391544342,
-0.0305043812841177,
0.7194986343383789,
0.1438072770833969,
-0.5205525755882263,
-0.2811287045478821,
0.4972796142101288,
-0.2658907175064087,
-0.42058122158050537,
0.46209588646888733,
0.5532764196395874,
0.2593373954296112,
-0.04804414510726929,... | |
I create a `ThreadPool` with 10 fixed threads in it. At times I need to interrupt a longrunning thread in the thread pool, mostly because they are blocking in some operation and a timeout happens and I interrupt the thread. I catch the `InterruptedException` and set the Thread's status to interrupt as well. In that cas... | [
0.2395390272140503,
-0.19169476628303528,
0.08832887560129166,
0.1906808465719223,
0.4289630055427551,
-0.040086958557367325,
-0.24311557412147522,
0.32521122694015503,
-0.5088307857513428,
-0.5850824117660522,
0.20547549426555634,
0.44396793842315674,
-0.5016106963157654,
0.37684020400047... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.