text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
doesn't necessarily have to be. This class is responsible for configuring your other classes with the appropriate strategy based on system state or configuration. The concrete strategy is created and injected via a constructor or property settor and thus "control" over which strategy class is instantiated is "inverted"...
[ 0.2178349792957306, -0.49123167991638184, -0.10250483453273773, 0.29602837562561035, 0.04012497514486313, 0.09418293833732605, 0.18684633076190948, -0.010081147775053978, 0.08021872490644455, -0.6249607801437378, -0.13740187883377075, 0.5005199313163757, -0.27169498801231384, 0.04856175929...
I have a condition in which I need to close the application and so I call this.Dispose () when I set a certian flag. At first I thought it was a problem of calling functions after I call this.Dispose () and so I moved the code to be the last thing called, but I still get an "ArgumentException was unhandled" "Parameter...
[ 0.16329464316368103, 0.07919028401374817, 0.7100985050201416, -0.2162189483642578, 0.46323132514953613, -0.21973483264446259, 0.6046223044395447, 0.043028656393289566, -0.21699830889701843, -0.5694917440414429, -0.24295049905776978, 0.5773604512214661, -0.4261404573917389, 0.54848992824554...
`Application.Run(new MyForm());`, a message loop is created on the thread using the form object as the main form. It tries to deliver Win32 messages that are coming to the application to their respective objects. However, when you call `Dispose()` on the form object, you haven't exited the message loop yet. When it tri...
[ 0.4715304672718048, -0.1650848090648651, 0.4811584949493408, -0.20745955407619476, 0.06830301880836487, -0.16834518313407898, 0.40615469217300415, -0.08546251058578491, -0.07762500643730164, -0.7453547716140747, -0.36592087149620056, 0.23759247362613678, -0.5469822287559509, 0.516454219818...
exit the message loop afterwards. The other way (more direct way) is to shut down the message loop on the thread altogether by calling `Application.Exit()` which will cause all related forms to be closed.
[ 0.11335236579179764, -0.07149773836135864, 0.4736213982105255, -0.12888917326927185, 0.13251559436321259, -0.314509779214859, 0.6027337312698364, 0.09266690164804459, -0.12005811184644699, -0.4886241555213928, -0.6009147763252258, 0.07019420713186264, -0.46744608879089355, 0.71015077829360...
If I have an ObjectDataSource defined at design time, can I get a DataTable from that ObjectDataSource at runtime? I have a method that returns a DataTable that I am using for the Select method property of the ObjectDataSource. Try using `Application.Exit()` to exit the application. When you use `Application.Run(new M...
[ 0.25073617696762085, -0.3115735948085785, 0.28068915009498596, -0.06165555492043495, 0.12867183983325958, -0.174351766705513, 0.3441195487976074, -0.034751154482364655, -0.008020833134651184, -0.8442237377166748, -0.017374632880091667, 0.18347620964050293, -0.42836666107177734, 0.589864492...
to deliver the next message to your form object, it fails since it's already disposed and throws the exception. You should either request the form to be closed (by calling `Close` on the form), which will then ask the form to process the event and if completed, exit the message loop afterwards. The other way (more dire...
[ 0.10771568864583969, -0.3000028431415558, 0.6032053828239441, -0.17158904671669006, -0.08391179889440536, -0.08525527268648148, 0.5426709651947021, -0.06684944033622742, -0.06879506260156631, -0.7281458377838135, -0.5381985306739807, 0.13978157937526703, -0.2846262753009796, 0.444179952144...
My technical lead insists on this exception mechanism: ``` try { DoSth(); } catch (OurException) { throw; } catch (Exception ex) { Util.Log(ex.Message, "1242"); // 1242 is unique to this catch block throw new OurException(ex); } ``` 1242 here is an identifier of the catch method which we handle an ex...
[ 0.23037433624267578, 0.12839461863040924, 0.07583507895469666, -0.0347464382648468, 0.018724847584962845, -0.27385878562927246, 0.18161846697330475, -0.29345110058784485, -0.1365569680929184, -0.37023770809173584, -0.2452920377254486, 0.2128996104001999, -0.3406622111797333, 0.253419220447...
it and mask it by OurException before rethrowing it. Is this a reasonable approach? If there are any, what are the better alternatives? **Edit:** I've been told the stack trace does not produce meaningful results in release mode. Are you suggesting catching and throwing generic exceptions is OK? **Edit2:** Thank you...
[ 0.2502824068069458, -0.025266477838158607, 0.030736124143004417, 0.1979350596666336, 0.023198682814836502, -0.5182870030403137, 0.45207926630973816, -0.1452217847108841, -0.3924095332622528, -0.4010814130306244, -0.032361194491386414, 0.4441401958465576, -0.24269695580005646, -0.2674064636...
projects and it is very useful. Especially if you want to later change how your exception handling works, and what information to capture.
[ 0.650402307510376, 0.04518567770719528, -0.058662064373493195, 0.45450538396835327, 0.2212453931570053, -0.19845373928546906, -0.14920741319656372, 0.1392146795988083, -0.49794626235961914, -0.6036112308502197, 0.0308303851634264, 0.4763588309288025, 0.22410587966442108, -0.181339174509048...
I've been searching for information for a common kernel implementation of queues, that is, first-in-first-out data structures. I thought there may be one since it's likely something that's common to use, and there's a standard for linked lists (in the form of the list\_head structure). Is there some standard queue impl...
[ 0.2573002874851227, -0.21791744232177734, 0.06756652891635895, 0.15330667793750763, -0.07430221140384674, -0.2081710249185562, -0.028245320543646812, 0.3931420147418976, -0.4100392758846283, -0.7699400782585144, -0.1445751041173935, 0.4027826189994812, -0.49574941396713257, -0.017129387706...
// ... case CPU_UP_CANCELED: list_for_each_entry(wq, &workqueues, list) { if (!per_cpu_ptr(wq->cpu_wq, hotcpu)->thread) ```
[ 0.13074149191379547, -0.009690212085843086, 0.44928690791130066, 0.07058990746736526, 0.38107892870903015, -0.04571353271603584, 0.15440714359283447, -0.046889811754226685, -0.32948026061058044, -0.42802712321281433, -0.32253727316856384, 0.45793434977531433, -0.1641804426908493, 0.5307226...
The following code for a co-worker throws the following error when he tries to compile it using VS 2008: Error: > A new expression requires () or [] > after type Code: MyClass Structure: ``` public class MyClass { public MyClass() {} public string Property1 { get; set; } public string Property2 { get...
[ 0.12863223254680634, 0.10504653304815292, -0.008013036102056503, -0.15457428991794586, -0.012613493017852306, 0.07399019598960876, 0.5520325899124146, -0.5275251865386963, 0.18101751804351807, -0.5966087579727173, -0.029394345358014107, 0.4563307464122772, -0.6121266484260559, 0.0525148697...
using the System.Collections.Generics namespace The MyClass object does have a constructor **UPDATE 1:** @Funky81 - Your example and my example were able to compile on my PC. **Update 2:** Included schema of MyClass in sample **UPDATE 3:** @DK - I had my co-worker add the following configuration section ...
[ -0.06793943792581558, 0.05994756147265434, 0.14572235941886902, 0.10555890947580338, -0.128244087100029, 0.010177535004913807, 0.2622795104980469, -0.026677994057536125, -0.2744392156600952, -0.8223516941070557, 0.052741993218660355, 0.05755072087049484, -0.15749087929725647, 0.28546148538...
<providerOption name="WarnAsError" value="false"/> </compiler> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption...
[ 0.34483566880226135, -0.14876703917980194, 0.2796352505683899, -0.3078261613845825, -0.0813978761434555, 0.1815914362668991, 0.37700268626213074, -0.19336211681365967, 0.11851177364587784, -0.5798791646957397, -0.2842555046081543, 0.5988932251930237, -0.39709174633026123, -0.39425334334373...
name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> ``` And he received the following compilation error: Unrecognized element 'providerOption'. Here's what seems to be the only similar, but not exactly the same, error available in VS.2008: > Compiler Error CS1526 : A...
[ 0.24536782503128052, 0.14327150583267212, 0.1786649227142334, -0.3122718632221222, -0.2304122895002365, 0.14326004683971405, 0.6347742676734924, -0.5834812521934509, 0.11708655953407288, -0.5249377489089966, -0.01389214675873518, 0.32629355788230896, -0.5149236917495728, 0.0010368116199970...
of compiler was used. Added: this looks like a likely issue with ASP.Net. Place to check is in .config file(s), element ``` configuration\system.codedom\compilers\compiler @language="c#..." ``` there should be ``` <providerOption name="CompilerVersion" value="v3.5"/> ```
[ 0.2736947536468506, 0.11870478838682175, -0.02775433659553528, 0.1583613157272339, -0.0343872532248497, -0.12822102010250092, 0.24756884574890137, -0.15864615142345428, -0.05110497400164604, -0.6650936603546143, -0.2525758445262909, 0.42420631647109985, -0.43578583002090454, -0.23757342994...
I was wondering how can I set a timeout on a `socket_read` call? The first time it calls `socket_read`, it waits till data is sent, and if no data is sent within 5 secs I want to shutdown the connection. Any Help? I already tried `SO_RCVTIMEO` with no luck. I'm creating a socket with `socket_create()` and listening on...
[ 0.6093465089797974, 0.12596583366394043, 0.3004014492034912, 0.023759273812174797, 0.06932157278060913, -0.17565177381038666, 0.2765142321586609, 0.14437364041805267, -0.18152451515197754, -0.789206862449646, -0.1289954036474228, 1.0164425373077393, -0.21401216089725494, 0.3469679355621338...
while loop with nonblock set and socket\_read() inside. Seems to be working ok. Any alternatives? UPDATE: I found that setting the socket as nonblocking and then using socket\_listen provided the timeout I needed.
[ 0.3592812120914459, -0.18151013553142548, 0.027208425104618073, 0.10716663300991058, -0.02012893185019493, -0.1716126650571823, 0.7431496381759644, 0.00918352697044611, -0.1667284369468689, -0.7060232758522034, -0.08307092636823654, 0.7905450463294983, -0.13116680085659027, -0.077397920191...
I have a Database table that I want to display in a DataGridView. However, it has several foreign keys and I don't want to show the integer that represents the other Table to the user. I have this DataTable with a column userId I have another DataTable with a column id, and a column username I want the DataGridView t...
[ 0.35358068346977234, 0.10054825991392136, 0.5785412788391113, 0.14574362337589264, -0.08057259768247604, -0.11569864302873611, 0.1456044465303421, -0.1033819168806076, -0.3318883180618286, -1.0642906427383423, 0.28087037801742554, 0.4344039261341095, -0.4839188754558563, 0.3060888946056366...
specify custom SQL with the joins and appropriate columns to the .SelectCommand of a DataAdapter or specify the custom SQL in the .CommandText of a xxxCommand object. Eg ``` myAdapter.SelectCommand = "Select a.column1, a.column2, b.username from tablea a inner join tableb b on b.userid = a.userId" ``` Or ``` myCom...
[ 0.3147362768650055, -0.02950466237962246, 0.5847095847129822, 0.09858689457178116, -0.023426933214068413, 0.22167927026748657, -0.11653969436883926, -0.20251312851905823, -0.2537521719932556, -0.5642472505569458, 0.03012070618569851, 0.6364139914512634, -0.21368537843227386, 0.227069005370...
What is the best method to determine if the current time is AM or PM using VB.NET? Currently I'm using If Date.Today.ToString.Contains("AM") but I'm sure there is a better method. ``` Good <%If Date.Today.ToString.Contains("AM") Then Response.Write("Morning") Else Response.Write("Afternoon")%> ``` `If Date.Now.Hour ...
[ 0.2236601859331131, -0.06665961444377899, 0.7660006284713745, -0.08810935169458389, 0.42561790347099304, -0.0769319236278534, 0.1501414030790329, -0.26774024963378906, -0.30236682295799255, -0.6384387612342834, -0.004424390848726034, 0.46651414036750793, 0.1071077510714531, 0.3976540863513...
Is there a way to (ab)use the **C** preprocessor to emulate namespaces in **C**? I'm thinking something along these lines: ``` #define NAMESPACE name_of_ns some_function() { some_other_function(); } ``` This would get translated to: ``` name_of_ns_some_function() { name_of_ns_some_other_function(); } ``` ...
[ 0.27583789825439453, 0.14170798659324646, 0.17910166084766388, -0.17139792442321777, 0.060991451144218445, -0.09331195056438446, -0.09703048318624496, -0.14618152379989624, -0.34564438462257385, -0.5571749210357666, -0.11992615461349487, 0.5140859484672546, -0.44137534499168396, -0.0676906...
useful solution than using namespace macros as described by Vinko Vrsalovic (in the comments).
[ -0.3939526081085205, 0.025591544806957245, -0.12647642195224762, -0.015734262764453888, 0.3769608438014984, 0.0576041042804718, 0.11893507093191147, -0.12310294061899185, -0.30541905760765076, -0.5167316198348999, -0.20853827893733978, 0.11450549960136414, -0.5122658610343933, -0.213280335...
Is there any way to have a Windows batch file directly input SQL statements without calling a script? I want the batch file to login to SQL and then enter in the statements directly. **EDIT:** I'm using Oracle v10g For a single command you can use this trick: ``` echo select * from dual; | sqlplus user/pw@db ```
[ 0.6117702126502991, 0.05575653165578842, -0.06885587424039841, -0.09596996009349823, -0.16493795812129974, 0.010657164268195629, 0.2732413709163666, -0.19888590276241302, -0.1931968778371811, -0.42176881432533264, 0.19166778028011322, 0.754092812538147, -0.4290042519569397, 0.1215517967939...
I found a bunch of scripts in the project I have been newly assigned to that are the "shutdown" scripts. They just do some basic searches and run the Unix `kill` command. Is there any reason they shouldn't shutdown the process this way? Does this ensure that dynamically allocated memory will return properly? Are there ...
[ 0.44067785143852234, -0.05553550273180008, 0.14622047543525696, 0.08800540864467621, 0.22592754662036896, -0.23942208290100098, 0.13935498893260956, 0.3826240301132202, -0.2205665111541748, -0.30951833724975586, -0.3156701922416687, 0.38185569643974304, -0.11430780589580536, 0.456326991319...
process exits for any reason, the Unix OS **does** clean up its memory allocations, file handles and other resources. The only resources that do not get cleaned up are those that are supposed to be shared, like the contents of files and of shared memory (like System V IPC). Many programs do not need to do any special ...
[ -0.20046354830265045, -0.11741925030946732, 0.3408151865005493, 0.12234827876091003, 0.16943757236003876, -0.39188501238822937, 0.42066967487335205, 0.10801995545625687, -0.40609630942344666, -0.6043359041213989, -0.16742782294750214, 0.1372772753238678, -0.2629653513431549, 0.330030709505...
signal, which is number 9, **is** evil, but also necessary. This signal never gets to the process itself, the OS simple stops the process. This should only be used when really, really necessary. It often becomes necessary in multithreaded programs that get into deadlocks or programs that have installed a TERM signal ha...
[ -0.004783443175256252, 0.08940283209085464, 0.3154354691505432, 0.01116051897406578, 0.17242538928985596, -0.05075936019420624, 0.6521744728088379, -0.0350567102432251, -0.13812679052352905, -0.52256178855896, -0.3250541388988495, 0.2776664197444916, -0.42672836780548096, 0.103054367005825...
> **Possible Duplicate:** > > [What static analysis tools are available for C#?](https://stackoverflow.com/questions/38635/what-static-analysis-tools-are-available-for-c) Guys, I'm looking for an open source or free source code analysis tool for C#. The tool should be able to generate metrics from the source code s...
[ 0.584088921546936, -0.008381180465221405, 0.3446230888366699, 0.2387775182723999, -0.29306572675704956, -0.0754559263586998, 0.1517145335674286, 0.1120443046092987, -0.14748768508434296, -0.6088816523551941, 0.13769544661045074, 0.5169966220855713, -0.14445853233337402, 0.14784108102321625...
Is there any straightforward way to get the mantissa and exponent from a double in c# (or .NET in general)? I found [this example](https://jonskeet.uk/csharp/DoubleConverter.cs) using Google, but I'm not sure how robust it would be. Could the binary representation for a double change in some future version of the fram...
[ 0.3383323550224304, 0.059876661747694016, 0.3546113073825836, 0.08599772304296494, -0.07757505029439926, 0.20220308005809784, 0.2898696959018707, -0.07410615682601929, -0.4597621560096741, -0.3505387604236603, 0.06942913681268692, 0.312113881111145, -0.3118991255760193, -0.0608817785978317...
language spec section 1.3; ECMA 335 section 8.2.2). The code in DoubleConverter should be fine and robust. For the sake of future reference, the relevant bit of the code in the example is: ``` public static string ToExactString (double d) { … // Translate the double into sign, exponent and mantissa. long...
[ 0.5682651996612549, -0.24922248721122742, 0.44292518496513367, -0.3973146677017212, -0.05199574679136276, 0.014340751804411411, 0.6039730906486511, -0.3145087957382202, -0.06823363900184631, -0.21646487712860107, -0.21861951053142548, 0.7558033466339111, -0.41346392035484314, -0.1164124161...
& 0x7ffL); long mantissa = bits & 0xfffffffffffffL; // Subnormal numbers; exponent is effectively one higher, // but there's no extra normalisation bit in the mantissa if (exponent==0) { exponent++; } // Normal numbers; leave exponent as it is but add extra // bit to the front o...
[ -0.41272595524787903, -0.42791056632995605, 0.7663625478744507, -0.12768463790416718, -0.07868201285600662, 0.39548394083976746, 0.45723408460617065, -0.6422629356384277, -0.28573963046073914, -0.39040762186050415, -0.4371413290500641, 0.41882193088531494, -0.2639309763908386, -0.115291558...
(1L << 52); } // Bias the exponent. It's actually biased by 1023, but we're // treating the mantissa as m.0 rather than 0.m, so we need // to subtract another 52 from it. exponent -= 1075; if (mantissa == 0) { return negative ? "-0" : "0"; } /* Normalize */ while((man...
[ -0.31473636627197266, -0.35307952761650085, 0.3641110360622406, -0.25771358609199524, -0.07699323445558548, 0.27968841791152954, 0.4733167588710785, -0.8941890597343445, -0.3323461711406708, -0.18361884355545044, -0.21141338348388672, 0.3368266820907593, -0.23682650923728943, -0.0094776218...
/* i.e., Mantissa is even */ mantissa >>= 1; exponent++; } … } ``` The comments made sense to me at the time, but I'm sure I'd have to think for a while about them now. After the very first part you've got the "raw" exponent and mantissa - the rest of the code just helps to treat them in a s...
[ -0.2836875021457672, 0.20814387500286102, 0.04716531187295914, -0.037457842379808426, -0.545808732509613, 0.2662106156349182, 0.3242766261100769, 0.08636220544576645, -0.2115534394979477, -0.6859332323074341, 0.06359075754880905, 0.6201995611190796, 0.15913479030132294, 0.1309279352426529,...
Whats the best way to separate the string, "Parisi, Kenneth" into "Kenneth" and "Parisi"? I am still learning how to parse strings with these regular expressions, but not too familiar with how to set vars equal to the matched string & output of the matched (or mismatched) string. ``` my ($lname, $fname) = split(/,\s*/...
[ 0.09010728448629379, -0.07341400533914566, 0.0326644666492939, -0.016009988263249397, 0.04859040305018425, 0.0962870642542839, 0.23195745050907135, -0.4040934145450592, 0.01651344820857048, -0.45924773812294006, -0.041999250650405884, 0.5676831007003784, -0.24867257475852966, 0.00311662233...
I want to write an Exception to an MS Message Queue. When I attempt it I get an exception. So I tried simplifying it by using the XmlSerializer which still raises an exception, but it gave me a bit more info: > {"There was an error reflecting type > 'System.Exception'."} with InnerException: > {"Cannot serialize m...
[ -0.09215730428695679, -0.06130064278841019, 0.22667033970355988, -0.04996116831898689, 0.06001949682831764, 0.00773766590282321, 0.4599217176437378, -0.009420366957783699, -0.2613338530063629, -0.5973135232925415, -0.11699964106082916, 0.22487914562225342, -0.7079282999038696, 0.2299926429...
= new XmlSerializer(e.GetType()); // Exception raised on this line x.Serialize(stream, e); stream.Close(); ``` EDIT: I tried to keep this a simple as possible, but I may have overdone it. I want the whole bit, stack trace, message, custom exception type, and custom exception properties. I may even wa...
[ 0.32708248496055603, 0.01563042774796486, 0.35183706879615784, -0.07743339240550995, -0.08729318529367447, -0.25522446632385254, 0.38681942224502563, -0.24398139119148254, -0.23250114917755127, -0.6936599612236023, -0.18601442873477936, 0.5331637859344482, -0.4922690987586975, 0.2513790130...
your own custom (serializable) exception class, inject data from the thrown Exception into your custom one and serialize that.
[ 0.18961301445960999, -0.19860665500164032, -0.2406613677740097, 0.4318223297595978, 0.09618919342756271, -0.13141600787639618, -0.02071584202349186, -0.10159507393836975, -0.29156672954559326, -0.5005302429199219, -0.05902449041604996, 0.36618661880493164, -0.29343387484550476, 0.209433659...
I'm using the MVC pattern in a .NET winform app. There are places in the Controller that can cause an exception. Rather than catching the exception and dislpaying a messagebox, which is a View responsibility, I do nothing in the Controller and let the View wrap that area in a try/catch. So far, there isn't anything tha...
[ 0.3623889684677124, 0.025585176423192024, 0.16117054224014282, -0.05788769572973251, -0.1096128523349762, -0.26077041029930115, 0.4581630825996399, 0.18490900099277496, -0.24350155889987946, -0.809533417224884, 0.07502086460590363, 0.43103116750717163, -0.4395833909511566, 0.23439852893352...
So, the View is reaching directly into the Model to gain access to the exceptions. But, how else can it be done and still follow the MVC pattern? I could have the Controller handle the exception and throw a string back to the UI. How is that done though? If functionA returns void, I don't want to modify its return typ...
[ 0.0828351378440857, -0.054215509444475174, 0.4169138967990875, -0.004309623967856169, -0.1174689456820488, 0.028934961184859276, 0.26475173234939575, -0.23611631989479065, -0.27946966886520386, -0.4518495798110962, 0.09022392332553864, 0.7036799788475037, -0.4098147749900818, 0.38826000690...
exception in the Controller. That way the controller does the exception handling that the view still manages the details of displaying a message box with the message I tell it to use.
[ -0.03958813473582268, -0.18157413601875305, 0.33086642622947693, -0.09702935069799423, -0.1506347954273224, -0.24784375727176666, 0.00477778073400259, -0.08049998432397842, -0.2751328945159912, -0.6072176694869995, -0.13523350656032562, 0.48258262872695923, -0.2856462001800537, 0.104357890...
Say I need to call a javascript file in the `<head>` of an ERb template. My instinct is to do the usual: ``` <head> <%= javascript_include_tag :defaults %> <!-- For example --> </head> ``` in my application's layout. The problem of course becoming that these javascript files are loaded into every page in my applicat...
[ 0.47801777720451355, 0.2441512644290924, 0.1898190975189209, -0.368682324886322, -0.025711413472890854, -0.19169040024280548, 0.09541585296392441, -0.20642857253551483, -0.13816502690315247, -0.8008626103401184, -0.12091650813817978, 0.24983936548233032, -0.41122889518737793, -0.0538328401...
in the application layout: ``` <head> <title>Merry Christmas!</title> <%= yield(:head) -%> </head> ``` And send it there from a view: ``` <%- content_for(:head) do -%> <%= javascript_include_tag :defaults -%> <%- end -%> ```
[ -0.17989788949489594, 0.21484513580799103, 0.9979515075683594, -0.2432967871427536, 0.06047261878848076, -0.19835752248764038, 0.40375372767448425, 0.06244843453168869, -0.033856116235256195, -0.38372179865837097, -0.8484633564949036, 0.13067226111888885, 0.1437712013721466, 0.084100507199...
I am looking for a C# example implementation of a class derived from Microsoft's XPathNavigator class. Can any one point me at such an article? As you may (or may not) know, the XmlNavigator is designed to allow one to superimpose XPath navigation on most any data model. I have implemented my derived XPathNavigator ...
[ 0.3370220959186554, 0.07842811197042465, 0.2823443114757538, 0.20507611334323883, 0.05085894837975502, -0.13923592865467072, 0.09349805116653442, 0.3659191131591797, 0.06474819034337997, -0.8884503841400146, 0.10078983753919601, 0.5459997057914734, -0.17028005421161652, 0.11251544952392578...
one exists. Also, I am sure that I have seen magazine articles that discuss this. My searches have proved yielded nothing. Maybe someone remembers such an article. Look at this article by Aaron Skonnard: "[**XPath Selections and Custom Functions, and More**](http://msdn.microsoft.com/en-us/magazine/cc188773.aspx)", ...
[ 0.1731000393629074, -0.028449811041355133, -0.3649863004684448, 0.3642629086971283, -0.0408591590821743, -0.026177948340773582, 0.32040074467658997, 0.2054242491722107, -0.3390042185783386, -0.45166096091270447, -0.20993174612522125, 0.12489404529333115, -0.11165977269411087, 0.38999804854...
When I define an object of a class using new like this ``` $blah = new Whatever(); ``` I get autocomplete for $blah. **But how do I do it when I have $blah as a function parameter?** Without autocomplete I am incomplete. **Edit**: **How do I do it if it's in an include and PDT or Netbeans can't figure it out?** Is ...
[ 0.340449720621109, 0.046188775449991226, 0.21944107115268707, -0.2518167197704315, -0.2959882616996765, -0.07938004285097122, 0.4598724842071533, -0.22414027154445648, -0.1328868269920349, -0.46226367354393005, -0.14617837965488434, 0.5177178978919983, -0.34464141726493835, -0.098590217530...
$blah-> // Now $blah is Whatever object, autocompletion will work. } ``` You can also use an inline phpDoc comment which does exactly the same thing. ``` public function myFunction($blah) { /* @var $blah Whatever */ $blah-> // Now $blah is Whatever object, autocompletion will work. } ```
[ 0.37949344515800476, 0.2157244086265564, 0.516802191734314, -0.03413739055395126, -0.05181971937417984, -0.1356038898229599, 0.21025310456752777, 0.21867169439792633, -0.20906952023506165, -0.49069514870643616, -0.25831711292266846, 0.8282052278518677, -0.5594397783279419, -0.1884274631738...
I'm trying to convert all instances of the > character to its HTML entity equivalent, >, within a string of HTML that contains HTML tags. The furthest I've been able to get with a solution for this is using a regex. Here's what I have so far: ``` public static readonly Regex HtmlAngleBracketNotPartOfTag = new...
[ 0.06838399916887283, 0.15866339206695557, 0.4699290096759796, -0.14853984117507935, -0.2393154501914978, 0.011789446696639061, 0.3445357382297516, -0.07274574041366577, -0.07327912747859955, -0.9307739734649658, -0.05508473515510559, 0.48820796608924866, -0.46458929777145386, 0.27104970812...
I don't convert the > characters, I get malformed HTML, which causes rendering issues in the browser. This is an example of a test string to parse: ``` "Ok, now I've got the correct setting.<br/><br/>On 12/22/2008 3:45 PM, jproot@somedomain.com wrote:<br/><div class"quotedReply">> Ok, got it, hope the angle bracket q...
[ 0.14687713980674744, -0.10327114909887314, 0.7644771933555603, 0.08201165497303009, -0.44583719968795776, -0.19253459572792053, 0.730453610420227, -0.24085131287574768, -0.08016280084848404, -0.7680412530899048, -0.02570696547627449, 0.3827843964099884, -0.13695485889911652, 0.087680421769...
the fact that the match is in group 1. I'm not quite sure how to do a replace only on group 1 and preserve the rest of the match. It appears that a MatchEvaluator doesn't really do the trick, or perhaps I just can't envision it right now. I suspect my regex could do with some lovin'. Anyone have any bright ideas? Th...
[ 0.005174967460334301, -0.02524835243821144, 0.4031776189804077, 0.14656515419483185, -0.1651892364025116, -0.07652849704027176, 0.24584810435771942, -0.1886969804763794, -0.05449061840772629, -0.5821308493614197, 0.08643138408660889, 0.6062262058258057, -0.43036380410194397, -0.29120871424...
regexes is tricky; for example, comments and CDATA can contain practically anything, so a robust regex would have to match them specifically.
[ 0.11447636783123016, -0.07932887971401215, 0.12710362672805786, 0.32781240344047546, -0.32317736744880676, -0.33828121423721313, 0.02099018730223179, -0.032158367335796356, -0.05092737078666687, -0.5954346060752869, -0.45284825563430786, 0.2661769986152649, -0.35186800360679626, 0.07062052...
I'm looking for ways to display a single row of data as a single column (with multiple rows). For example, ``` FieldA FieldB ------- --------- 1 Some Text [row] Header Value [col] ------ ------ FieldA 1 [row1] FieldB SomeText [row2] ``` Is there a way to do this with SQL Server 2005? Yup, there's...
[ 0.11037890613079071, 0.1752234548330307, 0.40783947706222534, -0.28027650713920593, -0.3933759033679962, -0.10044732689857483, -0.10620841383934021, 0.15498541295528412, -0.2818673253059387, -0.4612612724304199, 0.24400950968265533, 0.3282163441181183, -0.4024319350719452, -0.0329398401081...
it's a pretty easy way to deliver value to end-users. But YMMV.
[ 0.5959508419036865, 0.2297302931547165, 0.27318084239959717, 0.23382927477359772, -0.12922514975070953, -0.2034890204668045, -0.08756233006715775, 0.6880790591239929, 0.13041087985038757, -0.18556436896324158, 0.29476404190063477, 0.5827448964118958, 0.23972894251346588, 0.1292682290077209...
I always seem to see if a string (querystring value usually) has a value but first I have to check that it is not nothing first so I end up with 2 if then statements - am I missing somethign here - there has to be a better way to do this: ``` If Not String.IsNullOrEmpty(myString) Then If CBool(myString) Then //co...
[ 0.04180821031332016, 0.13240018486976624, 0.564487874507904, -0.21025364100933075, -0.09347176551818848, -0.3478254973888397, 0.26998552680015564, -0.07027161121368408, -0.4418318569660187, -0.40889450907707214, 0.04720437154173851, 0.4374946653842926, -0.2273215800523758, 0.29510211944580...
I've been hearing things lately about the [LiteSpeed](http://litespeedtech.com/) webserver as being a drop-in replacement for Apache webserver. Even my web host is going to replace their shared webhost environment with LiteSpeed (I'm currently not sure if I must be happy about that or not). Does anyone have any experi...
[ 0.3411940932273865, -0.006836690939962864, 0.22393783926963806, 0.011195184662938118, -0.5911524295806885, -0.10249775648117065, 0.27649375796318054, -0.06121568754315376, 0.08116495609283447, -0.634956955909729, 0.15367719531059265, 0.6933170557022095, 0.13799919188022614, 0.2689015567302...
What are the cons and pros of windows services vs scheduled tasks for running a program repeatedly (e.g. every two minutes)? **Update:** **Nearly four years after my original answer and this answer is very out of date. Since [TopShelf](http://docs.topshelf-project.com/en/latest/overview/faq.html) came along Windows Se...
[ 0.12523560225963593, 0.14544475078582764, 0.35147541761398315, -0.15013934671878815, -0.004116636235266924, -0.2925388514995575, 0.4439881443977356, 0.38333553075790405, -0.45844167470932007, -0.5830458402633667, -0.01795535907149315, 0.5610681772232056, -0.045736487954854965, 0.2388783693...
When 15 MS-DOS windows pop up every 20 minutes during an RDP session, you'll kick yourself that didn't install them as Windows Services instead. Whatever you choose I certainly recommend you separate out your processing code into a different component from the console app or Windows Service. Then you have the choice, ...
[ 0.3285960555076599, 0.029780888929963112, 0.2938596308231354, 0.0448821485042572, -0.010264360345900059, -0.027342645451426506, 0.203963503241539, -0.00832196231931448, -0.5986896753311157, -0.7990322113037109, -0.20512479543685913, 0.6318234205245972, -0.28889188170433044, 0.3307034969329...
you are processing a queue, then you really don't want two instances of the same worker processing the same queue. So you need to manage the timer, to make sure if your long running process has run longer than the assigned timer interval, it doesn't kick off again until the existing process has finished. After you hav...
[ 0.61566561460495, -0.3171684443950653, 0.2570646107196808, -0.021341050043702126, 0.24995248019695282, 0.04866200312972069, 0.03194521367549896, 0.12192560732364655, -0.7120465040206909, -0.6343799829483032, 0.3181094527244568, 0.36745685338974, -0.24402077496051788, 0.17533724009990692, ...
time. Neat! Then you then read all the advice on the internet with lots of experts telling you how it is really bad programming practice: <http://msmvps.com/blogs/peterritchie/archive/2007/04/26/thread-sleep-is-a-sign-of-a-poorly-designed-program.aspx> So you'll scratch your head and think to yourself, WTF, Undo Pen...
[ 0.5374444723129272, 0.2594008445739746, 0.593855619430542, -0.2819807529449463, 0.3798832893371582, -0.23137043416500092, 0.604418933391571, 0.0799301341176033, -0.3836156725883484, -0.9811913967132568, -0.11567876487970352, 0.4853745400905609, -0.1598341464996338, 0.3782646059989929, -0...
// Since we use a separate worker thread, the main service > // thread will return quickly, telling Windows that service has started > ThreadStart st = new ThreadStart(WorkerFunction); > workerThread = new Thread(st); > > // set flag to indicate worker thread is active > serviceStarted = true; > > /...
[ 0.13015294075012207, -0.05224483460187912, 0.7989359498023987, -0.268606036901474, 0.09294185787439346, 0.011303351260721684, 0.5763755440711975, -0.05730351805686951, -0.11924999952316284, -0.8399056196212769, -0.3920165002346039, 0.4909232258796692, -0.20935580134391785, 0.36548751592636...
event > complete, so that Windows doesn't think the service is hung. > > > **Worker method for the single-thread approach.** > > > > ``` > /// <summary> > /// This function will do all the work > /// Once it is done with its tasks, it will be suspended for some time; > /// it will continue to repeat this until th...
[ 0.17482848465442657, -0.3893708884716034, 0.492218554019928, -0.28062841296195984, -0.23798692226409912, -0.009484870359301567, 0.4729650020599365, 0.029604217037558556, -0.673287570476532, -0.34110599756240845, -0.18557313084602356, 0.1578766256570816, -0.3767509460449219, 0.3758762776851...
// do something > // exception handling omitted here for simplicity > EventLog.WriteEntry("Service working", > System.Diagnostics.EventLogEntryType.Information); > > // yield > if (serviceStarted) { > Thread.Sleep(new TimeSpan(0, interval, 0)); > } > } > > // time...
[ 0.2906566858291626, -0.3322329819202423, 0.38801315426826477, -0.16491684317588806, 0.3426484167575836, -0.14311347901821136, 0.5894883275032043, -0.27151942253112793, -0.2066117376089096, -0.6479439735412598, -0.23001018166542053, 0.3125357925891876, -0.034718338400125504, 0.2300018817186...
single-thread approach.** > > > > ``` > protected override void OnStop() { > > // flag to tell the worker process to stop > serviceStarted = false; > > // give it a little time to finish any pending work > workerThread.Join(new TimeSpan(0,2,0)); > } > > ``` Source: [http://tutorials.csharp-online.net...
[ 0.2629467248916626, -0.013094956055283546, 0.5234734416007996, -0.30264008045196533, -0.1384044587612152, -0.0029560993425548077, 0.3162584900856018, 0.05346215143799782, -0.2679476737976074, -0.8828993439674377, 0.0635351836681366, 0.46639788150787354, -0.494926780462265, 0.06364276260137...
I am using .NET 2.0 and SQL Server 2005. For historical reasons, the app code is using SQLTransaction but some of the stored procedures are also using T-SQL begin/commit/rollback tran statements. The idea is that the DBTransaction can span many stored procedures, which each individual sproc controls what's happening in...
[ 0.1293349266052246, 0.28568533062934875, 0.5039445161819458, -0.3750873804092407, 0.01292615570127964, -0.12933368980884552, 0.1545661985874176, -0.242924764752388, -0.07777905464172363, -0.4763858914375305, 0.005074274726212025, 0.5309072136878967, -0.5366562604904175, -0.1422258615493774...
the outer transaction should continue executing the remaining sprocs in its sequence, then at the end, since we know there were failures, we rollback the entire SQLTransaction. The problem is that, at least as it is presently coded, is that if any of the sprocs does a ROLLBACK, the outer SQLTransaction appears to lose...
[ 0.24683736264705658, 0.09807709604501724, 0.35283899307250977, 0.2845729887485504, 0.1595512479543686, -0.10225816071033478, 0.31812411546707153, 0.13393953442573547, -0.14085938036441803, -0.16798943281173706, -0.07520651817321777, 0.5133640766143799, -0.17231003940105438, 0.1688979268074...
is that there is not always an outer transaction, so I can't just remove the T-SQL rollbacks, ie. sometimes a sproc is executed on its own; sometimes in the context of a transaction. Would switching to TransactionScope make things easier? Thanks for any suggestions...Mike ``` class Foo { public virtual void virt...
[ 0.34611523151397705, -0.23430490493774414, 0.6081281900405884, -0.08590014278888702, 0.4500904381275177, -0.18262669444084167, 0.1516290009021759, -0.35365861654281616, -0.23525458574295044, -0.15135236084461212, -0.10869178920984268, 0.6893105506896973, -0.297626793384552, -0.126955881714...
{ Console.Writeline("BAR"); } } List<Foo> list = new List<Foo>(); // then populate this list with various 'Bar' and other overriden Foos foreach (Foo foo in list) { foo.virtualPrintMe(); // prints BAR or FOO foo.nonVirtualPrintMe(); // always prints FOO } ```
[ 0.2741442620754242, 0.015343490988016129, 0.9098079204559326, -0.2774297297000885, 0.5335677862167358, -0.026135072112083435, 0.16094690561294556, -0.4885478615760803, -0.2163407802581787, -0.48985904455184937, -0.13126248121261597, 0.6657474040985107, -0.5137388706207275, 0.12345037609338...
Is there a way to stop Google from indexing a site? robots.txt ``` User-agent: * Disallow: / ``` this will block all search bots from indexing. for more info see: <http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=40360>
[ 0.4487820267677307, 0.12562723457813263, 0.3291134536266327, 0.42724332213401794, 0.3434976041316986, -0.11223859339952469, 0.1426927000284195, -0.1441889852285385, -0.5395634770393372, -0.4809596836566925, -0.19537030160427094, 0.3218595087528229, -0.4297364056110382, 0.17427541315555573,...
Does anyone know of a way to issue commands to a hard drive within Java? Does Java even support this kind of hardware interaction? For example, if I have a SCSI hard drive that I would like to inquiry, is there a pre-existing Java method to do this, or would I have to write my own? <http://en.wikipedia.org/wiki/SCSI>...
[ 0.3718775510787964, -0.20976996421813965, -0.12942826747894287, 0.2910936772823334, -0.12791438400745392, -0.26090529561042786, -0.049173325300216675, 0.28031525015830994, -0.36752864718437195, -0.5215277671813965, 0.05746857449412346, 0.6712957620620728, -0.35056304931640625, 0.0002877082...
I want to add a "Select One" option to a drop down list bound to a `List<T>`. Once I query for the `List<T>`, how do I add my initial `Item`, not part of the data source, as the FIRST element in that `List<T>` ? I have: ``` // populate ti from data List<MyTypeItem> ti = MyTypeItem.GetTypeItems(); ...
[ -0.05732346326112747, -0.1563321352005005, 0.37492454051971436, -0.18427971005439758, 0.20633304119110107, 0.0620700940489769, -0.16341562569141388, -0.39348140358924866, 0.12999005615711212, -0.7863926291465759, -0.13691909611225128, 0.07070615887641907, -0.5383555293083191, 0.12455555796...
the TOP! // then DropDownList1.DataSource = ti; ``` Use the [Insert](http://msdn.microsoft.com/en-us/library/sey5k5z4.aspx) method: ``` ti.Insert(0, initialItem); ```
[ -0.3890374004840851, -0.17196111381053925, 0.6012037396430969, 0.07105328887701035, 0.3602891266345978, -0.30984094738960266, -0.038774628192186356, -0.18122680485248566, -0.25855687260627747, -0.3161027431488037, -0.6677788496017456, 0.48954933881759644, -0.2165134847164154, -0.0711982026...
According to [MSDN](http://msdn.microsoft.com/en-us/library/system.drawing.aspx), it is not a particularly good idea to use classes within the **System.Drawing** namespace in a Windows Service or ASP.NET Service. Now I am developing a class library which might need to access this particular namespace (for measuring fon...
[ 0.356694757938385, -0.036178939044475555, 0.0854605883359909, 0.08078208565711975, -0.10020189732313156, 0.10905657708644867, 0.15820743143558502, -0.07287811487913132, -0.22857949137687683, -0.7314457297325134, 0.11385981738567352, 0.37957456707954407, -0.10459615290164948, 0.023653047159...
and if it is, use it, otherwise fall back to the suboptimal option. My problem is: **How could I possibly detect if System.Drawing is safe to use?** I think I should either * Detect if the current process is a Windows Service or ASP.NET service * Detect if GDI is available * Or maybe there is a way to ask System.Dra...
[ 0.3228971064090729, -0.22231557965278625, 0.2082005739212036, 0.30325454473495483, -0.09670227766036987, -0.2496153563261032, 0.013836342841386795, -0.002764443401247263, -0.25300705432891846, -0.7417381405830383, 0.12651273608207703, 0.5418763756752014, -0.2328561246395111, 0.045277532190...
with high load (running out of unmanaged resources), memory or resource leaks (badly implemented or called dispose patterns) and/or dialogs being popped when there's no desktop to show them on. Testing will take care of the latter, and monitoring will alert you to the former. But, if/when you have a problem, don't exp...
[ 0.22318127751350403, -0.2092013955116272, 0.182526633143425, 0.3195408582687378, 0.12065371125936508, -0.1831093430519104, 0.3212117552757263, 0.24209707975387573, -0.49448707699775696, -0.6859439015388489, -0.19301286339759827, 0.4017240107059479, -0.3014998435974121, -0.20049186050891876...
them have been bitten, but there's alot more success than failure stories. If you want something supported, then you need to know if you're running interactively or not. Personally, I'd probably just leave it up to the hosting app to set a non-interactive flag somewhere or other. After all, the app is in the best posi...
[ 0.5011829733848572, 0.2192666232585907, 0.23761428892612457, 0.17960049211978912, -0.2991562783718109, 0.14206986129283905, 0.49287149310112, 0.25009745359420776, -0.3015913665294647, -0.37655332684516907, 0.05176512151956558, 0.6618081331253052, 0.027883045375347137, -0.002915217541158199...
EntryAssembly to see if it inherits from ServiceBase, or try to access System.Console. For ASP.NET, along the same lines, detecting HttpContext.Current should be sufficient. I'd *think* there'd be a managed or p/invoke way to look for a desktop (which is really the defining factor in all this, I think) and/or somethin...
[ 0.008231572806835175, 0.06360083073377609, 0.4592476189136505, 0.23181553184986115, 0.09265053272247314, -0.1824747771024704, 0.2690970003604889, 0.29207050800323486, -0.2938963770866394, -0.8495849967002869, -0.06991522759199142, 0.18665626645088196, -0.022988835349678993, 0.2423310577869...
find [GetProcessWindowStation()](http://msdn.microsoft.com/en-us/library/ms683225(VS.85).aspx) which returns a handle to the current window station. Passing that handle to [GetUserObjectInformation()](http://msdn.microsoft.com/en-us/library/ms683238(VS.85).aspx) will get you a [USEROBJECTFLAGS](http://msdn.microsoft.co...
[ -0.06877249479293823, 0.0343138724565506, 0.8022167682647705, -0.0029650756623595953, 0.025568217039108276, -0.056143712252378464, 0.38019633293151855, 0.0409754142165184, -0.5328209400177002, -0.7768045663833618, -0.14845959842205048, 0.246979758143425, -0.10599436610937119, 0.13690392673...
may well *want* the faster, but slightly riskier System.Drawing path), but UserInteractive seems a good default to have without having it pinvoke it yourself.
[ 0.034568510949611664, -0.21686632931232452, 0.28427910804748535, 0.016612989827990532, -0.0980902761220932, -0.2541007697582245, 0.4845540225505829, -0.07014422863721848, 0.09145604074001312, -0.6953446865081787, -0.09781171381473541, 0.5564417839050293, 0.015527293086051941, 0.00657904846...
I'm trying to install SQL Server 2005 Express SP3 on two of my machines. When I try to do this I get this error message: "None of the selected features can be installed or upgraded. Setup cannot proceed since no effective change is being made to the machine. To continue, click Back and then select features to install."...
[ -0.2555738389492035, 0.5115596055984497, 0.5124338865280151, -0.20867949724197388, 0.1654009222984314, -0.18780970573425293, 0.6325045824050903, 0.24493294954299927, -0.1612844318151474, -0.7565303444862366, -0.06150249391794205, 0.4157988727092743, -0.23244786262512207, 0.3043669164180755...
I'm assuming this is the "none of the selected features" it's talking about in the error message. I tried this on two different computers, both running Windows Server 2003. Both also have MSDE (SQL server 2000), not sure if this matters. The reported SQL 2005 version is 9.0.3068 for both machines. The link I used to d...
[ -0.08909697830677032, 0.26378342509269714, 0.371303528547287, 0.020931629464030266, 0.033024322241544724, -0.11555180698633194, 0.4669628143310547, 0.014550210908055305, -0.24524375796318054, -0.4976322054862976, 0.10405027866363525, 0.7106746435165405, -0.1313924342393875, 0.1973569542169...
Server 2005 Setup Help or SQL Server 2005 Books Online. Edition check: Your upgrade is blocked because of edition upgrade rules. For more information about edition upgrades, see the Version and Edition Upgrades topic in SQL Server 2005 Setup Help or SQL Server 2005 Books Online. ``` SELECT * from foo where timestamp =...
[ -0.22818267345428467, 0.2280031442642212, 0.6346051096916199, -0.06891492754220963, -0.2843211889266968, -0.21619664132595062, 0.400997132062912, -0.33704179525375366, -0.17055393755435944, -0.5136421322822571, -0.12481465935707092, 0.6846076250076294, -0.3463314175605774, 0.00884926039725...
I'm interested in Collaborative Developing and I was wondering if there are alternative solutions than using [UNA (example video)](http://www.vimeo.com/1653402) from N-Brain. Free would be even better, but I guess that's not an option which such technology. PS: The main future I'm looking for is working real-time with...
[ 0.425520122051239, -0.14138175547122955, 0.1056298017501831, 0.45927494764328003, 0.1697719395160675, -0.021925542503595352, 0.24629072844982147, 0.2566677927970886, -0.22488664090633392, -0.7722960114479065, -0.17269793152809143, 0.47540047764778137, 0.1411532759666443, -0.156729921698570...
Suppose I have the following class: ``` public class TestBase { public bool runMethod1 { get; set; } public void BaseMethod() { if (runMethod1) ChildMethod1(); else ChildMethod2(); } protected abstract void ChildMethod1(); protected abstract void ChildMethod2(); } ``` I also have ...
[ 0.4780956506729126, 0.006832221057265997, -0.12100094556808472, -0.055329445749521255, 0.32110267877578735, 0.18697048723697662, 0.36802998185157776, -0.3915203809738159, 0.2484275847673416, -0.5564178824424744, -0.1909143030643463, 0.515714168548584, -0.2318001240491867, 0.036754988133907...
like to write a test that verifies ChildMethod1() is being called when I call BaseMethod() and runMethod1 is true. Is it possible to create an implemention of TestBase with Moq, call BaseMethod() and verify that ChildMethod was called on the Moq implementation? ``` [Test] public BaseMethod_should_call_correct_child_me...
[ 0.6900638937950134, -0.06224764883518219, 0.25639086961746216, -0.11107698827981949, 0.36501896381378174, 0.11031274497509003, 0.5342704653739929, -0.4888218939304352, 0.1274891048669815, -0.4525330662727356, 0.2193783074617386, 0.8865684270858765, -0.4267567992210388, -0.00957872718572616...
.Verifiable(); ... //make sure the method was called testBase.Verify(); ``` **Edit** This syntax does not work in current versions of Moq. See [this question](https://stackoverflow.com/questions/3728873/verify-the-number-of-times-a-protected-method-is-called-using-moq) for how to do it as of at least 4.0.1082...
[ 0.457092821598053, 0.25724032521247864, 0.3571488857269287, 0.21216192841529846, 0.18538996577262878, -0.6366491317749023, 0.5517264604568481, -0.33059799671173096, -0.04649645462632179, -0.3964717984199524, -0.0806715339422226, 0.5170786380767822, -0.15052802860736847, -0.0819285586476326...
I have to following code: <http://www.nomorepasting.com/getpaste.php?pasteid=22987> If `PHPSESSID` is not already in the table the `REPLACE INTO` query works just fine, however if `PHPSESSID` exists the call to execute succeeds but sqlstate is set to 'HY000' which isn't very helpful and `$_mysqli_session_write->errno...
[ -0.05826001986861229, 0.1392533779144287, 0.6208926439285278, -0.19609718024730682, -0.02588605135679245, -0.10775580257177353, 0.5946036577224731, -0.36486849188804626, -0.1510312706232071, -0.6439527869224548, 0.07021600008010864, 0.9366453289985657, -0.11290603131055832, 0.0442288294434...
#10795: REPLACE reallocates new AUTO\_INCREMENT](http://bugs.mysql.com/bug.php?id=10795) (Which according to the comments is not actually a bug but the 'expected' behaviour) As a result my id field keeps getting incremented so the better solution is to use something along the lines of: ``` INSERT INTO session(phpses...
[ 0.11653611063957214, 0.22560426592826843, 0.5084103941917419, -0.06560216099023819, 0.20085296034812927, 0.04804490506649017, 0.5799013376235962, -0.06898950040340424, -0.30812525749206543, -0.34864675998687744, -0.13721315562725067, 0.6768608093261719, -0.3910401165485382, 0.2842899858951...
While looking at online code samples, I have sometimes come across an assignment of a String constant to a String object via the use of the new operator. For example: ``` String s; ... s = new String("Hello World"); ``` This, of course, compared to ``` s = "Hello World"; ``` I'm not familiar with this syntax and...
[ 0.30966874957084656, -0.11834210902452469, -0.2006179839372635, 0.04511227086186409, -0.1177520751953125, -0.06093136966228485, 0.14465482532978058, 0.0038574461359530687, -0.40168944001197815, -0.41743072867393494, -0.0809471607208252, 0.3894062340259552, -0.22939369082450867, 0.412941753...
force a distinct copy of the internal character array, as in ``` small=new String(huge.substring(10,20)) ``` However, this behavior is unfortunately undocumented and implementation dependent. I have been burned by this when reading large files (some up to 20 MiB) into a String and carving it into lines after the f...
[ 0.11209769546985626, 0.04922489449381828, 0.3750915825366974, -0.27374622225761414, 0.005255092866718769, 0.12193613499403, 0.4630819857120514, -0.3400876224040985, -0.11813260614871979, -0.5832321047782898, -0.047743041068315506, 0.4012572467327118, -0.272023469209671, 0.21308308839797974...
it, since processing 20,000 files very quickly consumed huge amounts of RAM. The only implementation agnostic way to do this is: ``` small=new String(huge.substring(10,20).toCharArray()); ``` This unfortunately must copy the array twice, once for `toCharArray()` and once in the String constructor. There needs to ...
[ 0.21138817071914673, 0.15656116604804993, 0.2918061316013336, -0.13865672051906586, 0.08069265633821487, -0.12728719413280487, 0.46083706617355347, -0.1926049143075943, -0.3993518352508545, -0.5537917017936707, -0.08560829609632492, 0.6679998636245728, -0.3467557430267334, 0.05888060480356...
what the Apache Harmony implementation of `new String()` was: ``` public String(String string) { value = string.value; offset = string.offset; count = string.count; } ``` That's right, no copy of the underlying array there. And yet, it still conforms to the (Java 7) String documentation, in that it: > I...
[ -0.023775644600391388, 0.10157332569360733, 0.17640984058380127, -0.22111085057258606, 0.04574783891439438, -0.2227727472782135, 0.2872048616409302, -0.21678705513477325, -0.12852415442466736, -0.27849236130714417, -0.07264194637537003, 0.4380124807357788, -0.4023149609565735, 0.2428841590...
are immutable. The salient piece being "copy of the argument ***string***"; it does not say "copy of the argument string and the underlying character array supporting the string". Be careful that you program to the *documentation* and not **one** *implementation*.
[ 0.5661112666130066, 0.4512384235858917, 0.2707819640636444, 0.11670579761266708, 0.1570078283548355, -0.32526662945747375, 0.05823982134461403, -0.06800627708435059, -0.13662362098693848, -0.5421674251556396, -0.4799412190914154, 0.541211724281311, -0.2844510078430176, 0.13740982115268707,...
I'm just finishing a web page for our sales guy to quickly go through a list of contacts. Is it possible to initiate a call from our Vonage line via a Hyperlink? They offer an application called "Click-2-Call" but I hope it's possible to initiate it using only a Hyperlink. This would probably require an addon to sup...
[ 0.3193213939666748, -0.0011250658426433802, 0.581250011920929, 0.10141423344612122, 0.10040615499019623, -0.10701961070299149, 0.20817235112190247, -0.14701443910598755, -0.23192383348941803, -0.5537187457084656, 0.04219667240977287, 0.6461915969848633, -0.23134785890579224, 0.132184356451...
handle that protocol would allow this to work. But, I don't believe that this is currently the case.
[ 0.42707911133766174, 0.339922159910202, 0.2748588025569916, 0.2937909662723541, 0.18212072551250458, -0.35604196786880493, 0.3558976948261261, -0.18955716490745544, -0.008112529292702675, -0.31102705001831055, 0.2865960896015167, 0.2992608845233917, -0.22033587098121643, 0.1241259425878524...
How do you open a file from a java application when you do not know which application the file is associated with. Also, because I'm using Java, I'd prefer a platform independent solution. With JDK1.6, the [`java.awt.Desktop`](http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html) class can be useful. ``` public...
[ 0.060821399092674255, 0.19313275814056396, 0.3300832211971283, -0.12696461379528046, -0.009801847860217094, 0.07503030449151993, 0.09482499212026596, -0.12095040082931519, -0.38166573643684387, -0.978695809841156, -0.25695323944091797, 0.6642671227455139, -0.5202401280403137, 0.15342211723...
For whatever reason, I have a lot of clients that have existing data that's stored in spreadsheets. Often there are hundreds, if not thousands of items in each spreadsheet, and asking the client to manually enter them through a website (or heaven forbid importing them that way myself) is out of the question. Typically,...
[ 0.6437593698501587, 0.21624962985515594, 0.05010164529085159, 0.25180861353874207, 0.3719581961631775, -0.008158037438988686, -0.16697575151920319, 0.15820752084255219, -0.5239471197128296, -0.5734792351722717, 0.08676595240831375, 0.1332574188709259, -0.02701239474117756, 0.29195412993431...
Or both. I'm asking this question, not because I don't know of a multitude of ways to do it, but because I haven't settled on a way that doesn't feel like it takes more work than it should. So far I've taken all of the following approaches (and probably more that I've forgotten): * Using Excel to modify the data, so ...
[ 0.3290218412876129, 0.07105973362922668, -0.20022359490394592, -0.015513378195464611, -0.1472521424293518, 0.28435593843460083, -0.3291019797325134, -0.007797498721629381, -0.2270907610654831, -0.7288076281547546, 0.0501219667494297, 0.4445842206478119, -0.19226285815238953, -0.41035869717...
been the way that seemed most flexible, but it still feels a little clunky. I have to perform this task enough that I've even contemplated writing a little DSL for it, just to speed things up. But before I do that, I'm curious, is there a better way? You have to set boundaries, if you can. You should try and provide ...
[ 0.6398083567619324, 0.015895161777734756, 0.6901862025260925, 0.24607659876346588, 0.17899090051651, -0.17383985221385956, -0.05530021712183952, -0.07338304817676544, -0.27018845081329346, -0.4661496579647064, 0.05210794508457184, 0.40025216341018677, -0.03404862806200981, 0.22121286392211...
is uploaded, you need to do validation and importation. You can use ADO.NET, file streams, DTS/SSIS, or Office Automation to do this (if you are using the Microsoft stack). In the validation portion, you should tell the user *exactly* what they did wrong or need to change. This might include having the validation page ...
[ 0.3687610626220703, 0.04475978761911392, 0.4802216589450836, 0.3739175796508789, 0.12065134197473526, -0.1413707137107849, 0.04001900926232338, -0.04240936040878296, -0.38196101784706116, -0.6803674697875977, -0.09307584911584854, 0.283964604139328, -0.3112145960330963, 0.05604463443160057...
the information however you like. I prefer putting it into a staging table and using a stored proc to load it, but that's just me. Some prefer to use the object model, but this can be very slow if you have a lot of data. If you are personally loading these files manually and having to go in and manipulate them, I woul...
[ 0.7918308973312378, -0.01082700490951538, 0.18705248832702637, 0.372168630361557, 0.1536312848329544, -0.27075859904289246, -0.3700907826423645, 0.11718612164258957, -0.28445369005203247, -0.4840896725654602, 0.026734132319688797, 0.4842512309551239, 0.08063196390867233, 0.0245554465800523...
this is a lot of work, but in the long wrong, when there is a program that works 95% of the time, everybody wins. If this is going to be a situation which just can’t be automated, then you will probably just have to have a vanilla staging table and have sql to to the importation. You will have to load the data into on...
[ 0.40615734457969666, -0.13976119458675385, -0.04778071492910385, 0.36425548791885376, 0.19045403599739075, -0.1958313137292862, -0.4278000295162201, -0.19705091416835785, -0.13974356651306152, -0.4118655323982239, 0.1456247866153717, 0.5516378283500671, -0.19816766679286957, -0.14939776062...