text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
else
search(root->right, x);
}
}
```
So this is my search function for my BST class with a T node. x is the data being searched for within the tree, len is just the amount of nodes it has to travel to come up with the matching node if | [
-0.20837655663490295,
-0.36160749197006226,
0.39855098724365234,
-0.12899747490882874,
-0.07937227934598923,
-0.07742694020271301,
0.0966222956776619,
0.03095831722021103,
-0.030696839094161987,
-0.4940849244594574,
-0.030475404113531113,
0.4514373540878296,
-0.1874629557132721,
0.16541534... | |
it exists. I have not implented that yet, I'm just incrementally developing my assignment. I'm calling it by doing this:
```
if(t.search(v[1], len) == true)
cout << endl << "true";
```
v is just a vector I had to create to compare it to, and so this is just supplying it with an int. The error I'm getting:
``... | [
-0.06102634221315384,
0.05284145846962929,
0.49656492471694946,
-0.053831662982702255,
0.08098471909761429,
-0.09704459458589554,
0.4803311228752136,
-0.018543755635619164,
-0.17844532430171967,
-0.6208708882331848,
-0.11292020976543427,
0.2609296441078186,
-0.46067193150520325,
0.36802846... | |
bool BST<T>::search(const T&, int&) const [with T = int]
BST.h:83: note: bool BST<T>::search(Node<T>*&, const T&) [with T = int]
```
So I'm not sure what I'm doing wrong or where I'm doing wrong.
Okay, `bool BST<T>::search(struct Node<T>*& root, const T& x)` should probably have const after it like so... | [
-0.08288421481847763,
0.40927448868751526,
0.2624678611755371,
-0.4328162968158722,
-0.1417439877986908,
-0.3192584216594696,
0.43167734146118164,
-0.10518621653318405,
-0.0477227158844471,
-0.21204903721809387,
-0.2893153727054596,
0.3183857202529907,
-0.5008480548858643,
0.21420609951019... | |
but maybe you need that because of the *struct*?
Also, this is C++, there is no reason to leave Node as a struct... needing to have **struct** in the parameter definition just looks bad, IMHO. Why not make Node a class? | [
-0.22844377160072327,
-0.12993815541267395,
-0.18562541902065277,
0.08686229586601257,
-0.10473544150590897,
-0.22472745180130005,
0.23972481489181519,
0.3063926100730896,
-0.11728186905384064,
-0.47523072361946106,
0.05402658134698868,
0.17730265855789185,
-0.4970565140247345,
0.087002046... | |
This is similar to [this question](https://stackoverflow.com/questions/105212/linux-recursively-list-all-files-in-a-directory-including-files-in-symlink-dire), but I want to include the path relative to the current directory in unix. If I do the following:
```
ls -LR | grep .txt
```
It doesn't include the full paths... | [
0.18867233395576477,
-0.026009412482380867,
0.27990761399269104,
-0.08057302981615067,
0.007999652065336704,
-0.3314542770385742,
-0.01154088880866766,
-0.15080171823501587,
-0.08808866888284683,
-0.8907793164253235,
-0.2773474156856537,
0.5071473121643066,
-0.4223567843437195,
-0.09489400... | |
When running PHP in CLI mode, *most* of the time (not always), the script will hang at the end of execution for about 5 seconds and then output this:
> `Error in my_thread_global_end(): 1 threads didn't exit`
It doesn't seem to actually have any effect on the script itself.
Some web searches turned up blogs which su... | [
0.23304279148578644,
0.14093726873397827,
0.6505027413368225,
-0.08697347342967987,
0.047623831778764725,
-0.4199211597442627,
0.671465277671814,
0.06506849080324173,
-0.30902209877967834,
-0.2916713058948517,
0.0005078032263554633,
0.39571404457092285,
-0.13645783066749573,
0.115024395287... | |
of the PHP 5.2.X version in the windows fast-cgi implementation
<http://bugs.php.net/bug.php?id=41350&edit=1>
I have encountered this bug before and downgrading my PHP install to 5.2.0 solved the problem. | [
0.011258482001721859,
0.20293529331684113,
0.16340123116970062,
-0.12954048812389374,
0.22096140682697296,
-0.22428111732006073,
0.45411020517349243,
0.3733246922492981,
-0.1433706432580948,
-0.6054867506027222,
-0.18770985305309296,
0.5587750673294067,
-0.7586362361907959,
0.0747766941785... | |
I have one website on my server, and my IIS Worker Process is using 4GB RAM consistently. What should I be checking?
```
c:\windows\system32\inetsrv\w3wp.exe
```
I would check the CLR Tuning Section in the [document](http://msdn.microsoft.com/en-us/library/ms998583.aspx#scalenetchapt17_topic9) Gulzar mentioned.
As t... | [
0.4205178916454315,
0.1806003749370575,
0.44180113077163696,
0.06855689734220505,
-0.08455734699964523,
-0.10455730557441711,
0.031552668660879135,
-0.6246225237846375,
-0.29783889651298523,
-0.7633626461029053,
0.19109851121902466,
0.44830211997032166,
-0.29610952734947205,
0.283708363771... | |
counter remains the same indicates unmanaged
> memory consumption.
>
>
> An increase in
> both counters indicates managed memory
> consumption | [
0.015379825606942177,
-0.1090739294886589,
0.33834850788116455,
0.10210477560758591,
-0.0032407462131232023,
0.16159291565418243,
0.30729079246520996,
-0.38674888014793396,
-0.48577141761779785,
-0.9525821208953857,
-0.14640116691589355,
0.48872509598731995,
0.16277608275413513,
0.19508279... | |
In this thread, we look at examples of good uses of `goto` in C or C++. It's inspired by [an answer](https://stackoverflow.com/questions/244445/best-refactoring-for-the-dreaded-while-true-loop#244644) which people voted up because they thought I was joking.
Summary (label changed from original to make intent even clea... | [
0.3843390643596649,
-0.12222085148096085,
0.35798078775405884,
0.1935906857252121,
-0.32608306407928467,
-0.30277836322784424,
0.30759960412979126,
0.051183879375457764,
-0.27333471179008484,
0.035531848669052124,
-0.23492419719696045,
0.432788610458374,
-0.22895167768001556,
0.08569438010... | |
early `goto`).
**Rules:**
* Pretend that the gotophobes didn't
win. It's understood that the above
can't be used in real code because
it goes against established idiom.
* Assume that we have all heard of
'Goto considered harmful' and know
that goto can be used to write
spaghetti code.
* If you disagree with an exampl... | [
0.61271733045578,
0.11262721568346024,
0.07761793583631516,
0.36668661236763,
-0.6376316547393799,
-0.48260849714279175,
0.5004470944404602,
-0.10348139703273773,
-0.1497766524553299,
-0.38753852248191833,
-0.07974369823932648,
0.3053765892982483,
-0.13934005796909332,
0.07536979019641876,... | |
scope. As @quinmars pointed out in a comment, you can always put braces around the
loop body. I note in passing that `for(;;)` and `while(true)` don't give you the braces
for free either (and omitting them can cause vexing bugs). Anyway, I won't waste any more
of your brain power on this trifle - I can live with the ... | [
1.2684129476547241,
0.014901332557201385,
-0.1264396756887436,
0.23591388761997223,
-0.2682226896286011,
-0.0487498976290226,
0.6617920398712158,
0.06603872030973434,
-0.28142279386520386,
-0.36312827467918396,
0.26898619532585144,
0.5243988037109375,
-0.29084569215774536,
-0.0471811778843... | |
a `goto` by introducing a loop,
an extra flag, a stack of nested `if`s, or whatever, but why not consider whether `goto` is
perhaps the best tool for the job? Put another way, how much ugliness are people prepared to endure to avoid using a built-in language feature for its intended purpose? My take is that
even addi... | [
0.5169231295585632,
-0.11896350234746933,
-0.3284865617752075,
0.423607736825943,
-0.19318322837352753,
-0.3067604601383209,
0.38682058453559875,
0.017030049115419388,
-0.07412547618150711,
-0.21172906458377838,
-0.2698984444141388,
0.3252994418144226,
-0.41469326615333557,
0.1188127547502... | |
cleanup block. IMO, this makes the strongest case for a `goto` of all the posted answers, certainly
if you measure it by the contortions a hater has to go through to avoid it.
Heres one trick I've heard of people using. I've never seen it in the wild though. And it only applies to C because C++ has RAII to do this mor... | [
0.2577075958251953,
-0.009962237440049648,
0.05588247999548912,
-0.33448606729507446,
0.10912355035543442,
-0.16385135054588318,
0.345241904258728,
-0.3801402449607849,
-0.14811253547668457,
-0.31038397550582886,
-0.23542442917823792,
0.5605822205543518,
-0.6376315951347351,
0.144576191902... | |
goto cleanupB;
/* everything has succeeded */
return;
cleanupB:
undoB();
cleanupA:
undoA();
exit:
return;
}
``` | [
0.08029472827911377,
-0.01710270531475544,
0.20085136592388153,
-0.3434147834777832,
0.25910770893096924,
-0.1568850427865982,
0.7364987134933472,
-0.24354618787765503,
-0.3086790442466736,
-0.2684955596923828,
-0.5739271640777588,
0.6464700698852539,
-0.40308454632759094,
0.03991826623678... | |
I'm looking at a new project where both Native and Managed approaches sound like a good idea. This is a Windows desktop application which should support an MDI interface. The client area will make extensive use of Direct3D. The developers on the project are equally skilled on C#, C++/CLI and MFC.
MFC Advantages:
* Do... | [
0.49611321091651917,
0.25174421072006226,
0.2568276822566986,
-0.08119963854551315,
-0.35600489377975464,
-0.2896333336830139,
-0.0917445719242096,
0.016932332888245583,
-0.06450606882572174,
-0.966478705406189,
0.11542513221502304,
0.5689550042152405,
-0.17296569049358368,
0.0276535581797... | |
mode. So count that out.
Why not use both?
You can write the UI (forms) using C#/VB.NET and render the window using C++.
Basically all you need to do is pass the HWND (Window Handle) from the C# to the C++ and initialize the C++ using that value.
You can see an example on my blog: [How-to Render managed (.NET) form ... | [
0.30336788296699524,
-0.3469192087650299,
0.7568134069442749,
-0.010346525348722935,
-0.2718425989151001,
-0.24306412041187286,
0.1187385842204094,
-0.09306096285581589,
0.062202926725149155,
-0.8184918165206909,
-0.1500844657421112,
0.9063054919242859,
-0.14827406406402588,
-0.07467064261... | |
I use screen to persist my work session and connect to the same session from multiple machines. How can I setup SSH and screen such that the XDISPLAY variable *inside* my persistent screen session is always set to the machine I am currently connecting from?
ie. I start the screen session at work and use gvim, which us... | [
0.16431573033332825,
0.11477401107549667,
0.6804332733154297,
-0.07336457073688507,
-0.25503721833229065,
-0.022542281076312065,
0.3071623146533966,
-0.002981005934998393,
-0.35550323128700256,
-1.129101276397705,
0.10014937072992325,
0.6364809274673462,
-0.4626520276069641,
0.309232473373... | |
update XDISPLAY every time I connect from a different machine but I'd rather have an automated system.
Bonus points if I can actually *move* gvim from my work machine to my home machine while it is running. I tried [xmove](http://manpages.ubuntu.com/manpages/hardy/man1/xmove.html) but could never get it to play nice.
... | [
0.16881829500198364,
-0.020330138504505157,
0.6614412665367126,
0.06344950199127197,
-0.197087824344635,
-0.04492737352848053,
0.19363167881965637,
0.1300874650478363,
-0.1383761614561081,
-0.9766061305999756,
0.10941726714372635,
0.7346635460853577,
-0.4295848608016968,
0.0103354668244719... | |
started by screen to have the correct XDISPLAY
% screen -X "setenv XDISPLAY $DISPLAY" #...
# set up the keystroke F1 to update the XDISPLAY in current shells
% screen -X "bindkey -k k1 stuff export XDISPLAY=$DISPLAY\015" #...
```
If you know that all your windows were left in a shell (not a running editor or some su... | [
0.06013931706547737,
-0.029151668772101402,
0.616672933101654,
-0.09746736288070679,
-0.07103773951530457,
-0.17805340886116028,
0.029827050864696503,
-0.14552386105060577,
-0.1888822317123413,
-0.8012268543243408,
-0.1221933513879776,
0.6465373039245605,
-0.41421687602996826,
0.1297759115... | |
with your shell's prompt hook to grab SCREEN's value of XDISPLAY (as set by setenv) and update it for the shell. | [
0.14164584875106812,
-0.3695206642150879,
0.3402058184146881,
0.10295126587152481,
0.11139816045761108,
-0.3496781289577484,
0.060291096568107605,
-0.12651391327381134,
0.05945691838860512,
-0.8160725831985474,
-0.2521752715110779,
0.8983997106552124,
-0.3715986907482147,
-0.00061134289717... | |
What does `InitializeComponent()` do, and how does it work in WPF?
In general first, but I would especially be interested to know the gory details of order of construction, and what happens when there are Attached Properties.
The call to `InitializeComponent()` (which is usually called in the default constructor of at... | [
-0.05506453290581703,
-0.21924373507499695,
0.5298593044281006,
-0.08211184293031693,
0.13607482612133026,
-0.20994965732097626,
-0.3101719915866852,
-0.20859159529209137,
-0.167792409658432,
-0.4576047956943512,
-0.5390342473983765,
0.31261831521987915,
-0.2975786030292511,
0.209318831562... | |
the XAML file that is located at the passed in URI, and converts it to an instance of the object that is specified by the root element of the XAML file.
In more detail, `LoadComponent` creates an instance of the `XamlParser`, and builds a tree of the XAML. Each node is parsed by the `XamlParser.ProcessXamlNode()`. Thi... | [
-0.07236309349536896,
0.18138498067855835,
0.6029251217842102,
-0.0007501806830987334,
-0.009006895124912262,
-0.0908232033252716,
0.06353408843278885,
-0.19149935245513916,
-0.3092074990272522,
-0.5707777142524719,
-0.19790150225162506,
0.2256266176700592,
-0.3078850209712982,
0.321864545... | |
interface, of which `Window`/`UserControl` implement in the partial generated class.
Hope this helps! | [
-0.19005946815013885,
-0.1103854849934578,
0.33261337876319885,
0.2722037732601166,
-0.04234672337770462,
-0.04044286534190178,
0.40290147066116333,
0.2750536799430847,
0.0058807795867323875,
-1.0347270965576172,
-0.06623928993940353,
0.4782690703868866,
-0.13280214369297028,
-0.2140146195... | |
I have a site behind basic authentication (IIS6).
Part of this site calls a web service that is also part of the site and thus behind basic authentication as well.
However, when this happens the calling code receives a 401 Authentication Error.
I've tried a couple of things, with the general recommendation being cod... | [
0.28670769929885864,
0.4656931161880493,
0.2816273868083954,
-0.3043271601200104,
0.15462380647659302,
-0.18635374307632446,
0.65631103515625,
-0.11867078393697739,
-0.08107860386371613,
-0.4989272654056549,
0.03015967644751072,
0.4876328408718109,
0.2134442925453186,
0.2627575397491455,
... | |
link](http://forums.asp.net/t/1172902.aspx) for the source of this solution in VB (thanks jshardy!), all I did was convert to C#.**
**NB:** You must be using ONLY basic authentication on IIS for this to work, but it can probably be adapted. You also need to pass a Page instance in, or at least the Request.ServerVariab... | [
0.1600223332643509,
0.1567806601524353,
0.6373454928398132,
-0.28413525223731995,
-0.1805846393108368,
-0.2254355549812317,
0.742737352848053,
0.0979335755109787,
-0.21224656701087952,
-0.980478823184967,
-0.17182709276676178,
0.3653135895729065,
-0.24946123361587524,
0.24896839261054993,
... | |
new LocalServices.ServiceName();
s.PreAuthenticate = true; /* Not sure if required */
string username = "";
string password = "";
string domain = "";
GetBasicCredentials(p, ref username, ref password, ref domain);
s.Credentials = new NetworkCredential(username, password, domain);
s.Service... | [
-0.05763562396168709,
-0.31629374623298645,
0.7619887590408325,
-0.1565794050693512,
-0.06552314013242722,
0.17077237367630005,
0.7442746162414551,
0.010329299606382847,
-0.40976482629776,
-0.9150264263153076,
-0.4233827590942383,
0.45220819115638733,
-0.11397804319858551,
0.34479963779449... | |
rstrUser = "";
rstrPassword = "";
rstrDomain = "";
rstrUser = p.Request.ServerVariables["AUTH_USER"];
rstrPassword = p.Request.ServerVariables["AUTH_PASSWORD"];
SplitDomainUserName(rstrUser, ref rstrDomain, ref rstrUser);
/* MSDN KB article 835388
BUG: The Request.ServerVariables("AUTH... | [
-0.5121440887451172,
-0.039731673896312714,
0.7237573862075806,
-0.3714240789413452,
-0.013826805166900158,
0.34022533893585205,
0.5430125594139099,
-0.34828755259513855,
-0.26740747690200806,
-0.4450874924659729,
-0.4672386050224304,
0.31340518593788147,
-0.5563542246818542,
0.20948873460... | |
lstrTicket = System.Text.Encoding.Default.GetString(Convert.FromBase64String(lstrTicket));
rstrPassword = lstrTicket.Substring((lstrTicket.IndexOf(":") + 1));
}
/* At least on my XP Pro machine AUTH_USER is not set (probably because we're using Forms authentication
But if the password is set (e... | [
-0.02896096184849739,
-0.02067979983985424,
1.1939165592193604,
-0.4697766900062561,
0.08717380464076996,
0.33588024973869324,
0.2794189751148224,
-0.36959028244018555,
-0.13927264511585236,
-0.6756481528282166,
-0.25577256083488464,
0.6305364370346069,
-0.6148527264595032,
0.0951767936348... | |
ref rstrUser);
}
}
/* Converted from: http://forums.asp.net/t/1172902.aspx */
private static void SplitDomainUserName(string pstrDomainUserName, ref string rstrDomainName, ref string rstrUserName)
{
rstrDomainName = "";
rstrUserName = pstrDomainUserName;
int lnSlashPos = pstrDomainUserName.IndexOf("\\... | [
-0.017734283581376076,
-0.25705844163894653,
0.9490959048271179,
-0.4067234992980957,
-0.12220537662506104,
-0.011810692958533764,
0.40598368644714355,
-0.28942739963531494,
-0.5253240466117859,
-0.30529308319091797,
-0.6553366780281067,
0.6140105724334717,
-0.3220135271549225,
0.257386714... | |
Is there any way of batch renaming files in sub directories?
For example:
Rename `*.html` to `*.htm` in a folder which has directories and sub directories.
Windows command prompt: (If inside a batch file, change %x to %%x)
```
for /r %x in (*.html) do ren "%x" *.htm
```
This also works for renaming the middle of t... | [
-0.030987795442342758,
-0.07399150729179382,
0.34449148178100586,
-0.18184666335582733,
-0.17826279997825623,
0.13816788792610168,
0.3105936348438263,
0.11232037097215652,
-0.09107927232980728,
-0.6099033951759338,
-0.46433284878730774,
0.276813805103302,
-0.052399180829524994,
0.590999662... | |
Given a System.Timers.Timer, is there a way from the main thread to tell if the worker thread running the elapsed event code is still running?
In other words, how can one make sure the code running in the worker thread is not currently running before stopping the timer or the main app/service thread the timer is runni... | [
0.5171504020690918,
-0.2895980477333069,
0.21901121735572815,
0.28383558988571167,
0.2744045555591583,
-0.0555029921233654,
0.09082075208425522,
-0.0842539593577385,
-0.6156126260757446,
-0.5812009572982788,
-0.039378054440021515,
0.6815620064735413,
-0.19212402403354645,
0.179974749684333... | |
an accessible queue that your main thread can use to see if any threads are still running.
```
// main thread owns this
private List<ManualResetEvent> _resetEvents;
...
// main thread does this to wait for executing threads to finish
WaitHandle.WaitAll(_resetEvents.ToArray(), 2000, false)
...
// worker threads do this... | [
0.30534401535987854,
-0.0004821947659365833,
0.277897447347641,
0.21060125529766083,
0.09212615340948105,
-0.10675178468227386,
0.20644542574882507,
0.1681205779314041,
-0.621609091758728,
-0.7507609128952026,
0.33100032806396484,
0.3495023250579834,
-0.49588724970817566,
0.165575221180915... | |
timer handler be very lean and do nothing more than prepare and start a new worker thread.
```
...
ThreadPool.QueueUserWorkItem(new WaitCallback(MyWorkerDelegate),
myCustomObjectThatContainsAResetEvent);
``` | [
0.34140169620513916,
-0.21688705682754517,
0.2523476481437683,
-0.11999066174030304,
0.30383986234664917,
-0.039485834538936615,
0.2747672200202942,
-0.2819923758506775,
-0.10423218458890915,
-0.7175135612487793,
0.1829485297203064,
0.8113518357276917,
-0.3622712790966034,
-0.0197869669646... | |
If I were to include .Net Framework setup file along with my apps (installation process is done by our own technician), to be install on a clean Windows (XP SP2/SP3 or Vista SP1) without prior installation of any framework, which of the .Net Framework setup do I need to install in sequence, to get to 3.5 SP1?
Currently... | [
0.6904546618461609,
0.22950032353401184,
0.6260362267494202,
-0.2264857441186905,
-0.08563511073589325,
-0.17214763164520264,
0.339040070772171,
-0.5352100133895874,
-0.1723119169473648,
-0.84816974401474,
-0.16892686486244202,
0.6755636930465698,
-0.2520756423473358,
-0.14206388592720032,... | |
install-and-forget-it procedure, so when we decided to use anything new within 3.5 SP1 later, we can rest assure that we can just simple apply update our apps without having to install another pre-requisite
The .Net Framework 3.5 SP1 redistributable (the one that's around 230MB) contains everything (2.0 + SP1 + SP2, 3.... | [
0.23651719093322754,
0.05876817926764488,
0.6392608880996704,
0.3027878403663635,
0.27780482172966003,
-0.4074103534221649,
0.4136224389076233,
-0.04565667733550072,
-0.3112201988697052,
-0.843507707118988,
-0.493065744638443,
0.8210224509239197,
-0.11963539570569992,
-0.2754005193710327,
... | |
package (either the bootstrapper or the full package) you should immediately install the update [KB959209](http://go.microsoft.com/fwlink/?LinkId=136730) to address a set of known application compatibility issues.
There are 3 updates (for 2.0, 3.0, and 3.5) for 2 OS "groups" (XP/2003 or Vista/2008) for 3 architectures... | [
0.007940057665109634,
-0.026803376153111458,
0.5408459901809692,
-0.14229588210582733,
-0.026799578219652176,
-0.14493179321289062,
0.45114371180534363,
-0.40413522720336914,
-0.14872585237026215,
-0.5512607097625732,
-0.31668031215667725,
0.8546059727668762,
-0.5164682269096375,
-0.082018... | |
requires that 2.0 and 3.0 be installed and updated to SP1 level. .Net 3.5 SP1 requires that 2.0/3.0 be updated to SP2 level. But the 3.5(SP1) installers will do this automatically. That is, by installing 3.5 SP1, you don't need to worry about installing and updating 2.0 and 3.0 to SP1 or SP2. **Just install 3.5 SP1 and... | [
0.3814148008823395,
0.1413390189409256,
0.9089203476905823,
-0.061670687049627304,
0.172364741563797,
-0.5653126239776611,
0.5857117176055908,
-0.41173315048217773,
-0.306322306394577,
-0.7196535468101501,
-0.41428816318511963,
0.7459144592285156,
-0.2492162436246872,
-0.2400321215391159,
... | |
Server version, nor any x64/ia64 OS. You can only install it on a Windows XP SP2+ (x86) that doesn't have any version of .Net installed, otherwise a full installation is done. The offline Client Profile installer is 255MB because it will try to do a client install first, if it can't it will fallback to a full install. ... | [
-0.00285144429653883,
-0.11472711712121964,
0.7027713060379028,
-0.2159142643213272,
-0.2808813750743866,
-0.5222616195678711,
0.34058091044425964,
0.5149222612380981,
-0.20610734820365906,
-0.76036536693573,
-0.21770085394382477,
0.5164148807525635,
-0.5553767085075378,
0.2981525361537933... | |
Some APIs, like the WebClient, use the [Event-based Async pattern](http://msdn.microsoft.com/en-us/library/wewwczdw.aspx). While this looks simple, and probably works well in a loosely coupled app (say, BackgroundWorker in a UI), it doesn't chain together very well.
For instance, here's a program that's multithreaded... | [
0.39237144589424133,
-0.25973689556121826,
0.08747238665819168,
0.14028765261173248,
-0.02704453095793724,
0.0664626955986023,
0.3192717730998993,
-0.20414356887340546,
-0.2451719492673874,
-0.6523159146308899,
0.0400359220802784,
0.2919516861438751,
-0.4564730226993561,
0.33781898021698,
... | |
(easy to add).
Using WebClient, things end up like the following (or you end up creating a bunch of objects to act like closures):
```
using System;
using System.Net;
class Program
{
static void onEx(Exception ex) {
Console.WriteLine(ex.ToString());
}
static void Main() {
var url1 = new... | [
0.10335081070661545,
-0.17033758759498596,
0.5041556358337402,
-0.10988593846559525,
0.10709448903799057,
-0.02409154362976551,
0.3597981631755829,
-0.014220555312931538,
-0.28915369510650635,
-0.7208190560340881,
-0.3921903669834137,
0.3213813602924347,
-0.5716538429260254,
0.617944598197... | |
WebClient();
DownloadDataCompletedEventHandler first = null;
webThingy.DownloadDataCompleted += first = (o, res1) => {
if (res1.Error != null) {
onEx(res1.Error);
return;
}
webThingy.DownloadDataCompleted -= | [
-0.319038450717926,
-0.5350371599197388,
0.5315827131271362,
0.16049185395240784,
0.0904269739985466,
0.2531123459339142,
0.2575007975101471,
-0.08847059309482574,
-0.20291532576084137,
-0.6448286771774292,
-0.21676240861415863,
0.5861855149269104,
-0.43625614047050476,
0.13602842390537262... | |
first;
webThingy.DownloadDataCompleted += (o2, res2) => {
if (res2.Error != null) {
onEx(res2.Error);
return;
} | [
-0.011773601174354553,
-0.7555974721908569,
0.4647694528102875,
0.3322308659553528,
0.28910309076309204,
0.259204238653183,
0.33314406871795654,
-0.05286605656147003,
-0.051613032817840576,
-0.7249132394790649,
-0.12888722121715546,
0.672387957572937,
-0.3615877330303192,
0.141724944114685... | |
try {
Console.WriteLine(someData + res2.Result);
} catch (Exception ex) { onEx(ex); }
};
try {
webThingy.DownloadDataAsync(new Uri(url2.ToString() + "?data=" + | [
-0.13211968541145325,
-0.43966203927993774,
0.6601895689964294,
-0.0785173773765564,
0.4947679042816162,
0.014905172400176525,
0.38540124893188477,
-0.16808614134788513,
0.05177786946296692,
-0.6303267478942871,
-0.31581375002861023,
0.3589467704296112,
-0.31783434748649597,
0.381945878267... | |
res1.Result));
} catch (Exception ex) { onEx(ex); }
};
try {
webThingy.DownloadDataAsync(url1);
} catch (Exception ex) { onEx(ex); }
Console.WriteLine("Keeping process alive");
Console.ReadLine();
}
```
}
Is there an generic way to refactor this ev... | [
0.07055189460515976,
-0.47345325350761414,
0.49802258610725403,
0.09154944121837616,
0.0522037036716938,
-0.06261890381574631,
0.5339552164077759,
-0.2194095253944397,
-0.30339500308036804,
-0.41639313101768494,
-0.29137393832206726,
0.4669443368911743,
-0.2709842622280121,
0.4524559378623... | |
extension methods for each API thats like this?) BeginXXX and EndXXX make it easy, but this event way doesn't seem to offer any way.
You might want to look into `F#`. `F#` can automate this coding for you with its «workflow» feature. The '08 PDC presentation of `F#` dealt with asynchronous web requests using a standard... | [
0.06055618077516556,
-0.311102956533432,
0.19352401793003082,
0.07869646698236465,
-0.2749006450176239,
-0.12510108947753906,
-0.028508977964520454,
-0.14981140196323395,
-0.3368918001651764,
-0.5214571356773376,
-0.2381710410118103,
0.628993570804596,
-0.4105718433856964,
-0.3059463500976... | |
I have to refactor a large C# application, and I found a lot of functions that are never used. How can I check for unused code, so I can remove all the unused functions?
Yes, ReSharper does this. Right click on your solution and selection "Find Code Issues". One of the results is "Unused Symbols". This will show you cl... | [
0.18068762123584747,
0.012969759292900562,
0.14358794689178467,
0.3356829881668091,
0.14956113696098328,
-0.05977573245763779,
0.41001203656196594,
-0.011404493823647499,
-0.24367544054985046,
-0.7028852701187134,
-0.02189529314637184,
0.594426155090332,
-0.059608343988657,
0.1284319609403... | |
Like many SO people, I'm in front of a computer almost all day. I like having a dark theme for Visual Studio (easier on the eyes), but since the rest of Windows and apps (explorer, dialogs, Outlook), have the full white background, it's even harder to switch between nice dark VS and sunshine bright Windows.
I tried a ... | [
0.6848320364952087,
0.01901770383119583,
0.2215765118598938,
-0.02100284770131111,
-0.18128348886966705,
-0.09325408190488815,
0.35977986454963684,
0.5185511112213135,
-0.20216695964336395,
-0.7043967247009277,
0.06263041496276855,
0.5229528546333313,
-0.036201462149620056,
0.2250683903694... | |
that can accomplish your task. Many software applications do not adhere to colors specified in Windows preferences and are not at all customizable--Notepad, for example, is black text on a white background, end of story.
For themes in general, Microsoft has released two official XP themes within the last year that may... | [
0.3343265652656555,
-0.22869493067264557,
0.357359379529953,
0.0625581219792366,
-0.1071157455444336,
0.012269899249076843,
-0.031352486461400986,
-0.05510891601443291,
-0.39378300309181213,
-0.2808963656425476,
0.09473664313554764,
0.24120786786079407,
-0.08161357790231705,
0.200014382600... | |
you use, perhaps you need to find new applications that provide similar features but also offer customization in terms of fonts and colors--for example, using [Notepad++](http://notepad-plus.sourceforge.net/uk/site.htm) instead of Notepad, which gives you an almost exhaustive amount of customization possibilities. | [
0.31620824337005615,
-0.20854754745960236,
0.5473760366439819,
-0.0056263660080730915,
0.10167903453111649,
0.03175986185669899,
-0.06492932140827179,
0.101833276450634,
-0.48922663927078247,
-0.7789797782897949,
-0.30106937885284424,
0.3813616633415222,
-0.01732337288558483,
-0.0845372453... | |
When I type `uname -a`, it gives the following output.
```
Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux
```
How can I know from this that the given OS is 32 or 64 bit?
This is useful when writing `configure` scripts, for example: what architecture am I building for?
Tr... | [
-0.15155673027038574,
0.1401672214269638,
0.32140323519706726,
-0.00300683849491179,
-0.10637980699539185,
0.1962672770023346,
0.13478823006153107,
-0.23410457372665405,
-0.24714776873588562,
-0.7579500675201416,
-0.10692938417196274,
0.7196459770202637,
-0.3090604245662689,
0.231434807181... | |
mean?](https://unix.stackexchange.com/a/43540)"
Among them, one is named `lm`: `Long Mode` ([x86-64](http://en.wikipedia.org/wiki/X86-64): amd64, also known as Intel 64, i.e. 64-bit capable)
```
lm ==> 64-bit processor
```
Or [using `lshw`](http://linux.die.net/man/1/lshw) (as mentioned [below](https://stackoverflow... | [
0.38201630115509033,
0.07526043057441711,
0.30903372168540955,
0.10491567850112915,
0.07901586592197418,
0.152154341340065,
0.03616224229335785,
-0.33299797773361206,
-0.05288317799568176,
-0.504943311214447,
-0.2607412338256836,
0.3671872317790985,
-0.41890639066696167,
0.1620073914527893... | |
What is the best way to unit test a method that doesn't return anything? Specifically in c#.
What I am really trying to test is a method that takes a log file and parses it for specific strings. The strings are then inserted into a database. Nothing that hasn't been done before but being VERY new to TDD I am wondering... | [
0.2946437895298004,
-0.16060632467269897,
-0.2700531482696533,
0.36885082721710205,
-0.16617451608181,
-0.30365684628486633,
0.015990598127245903,
-0.04355914890766144,
-0.039952948689460754,
-0.36067187786102295,
0.12777042388916016,
0.5909040570259094,
-0.32626837491989136,
0.02479481324... | |
change state (without expecting any confirmation.. its assumed that it will be done)
* **informational** - just notifying someone that something happened (without expecting action or response) respectively.
Imperative methods - you can verify if the task was actually performed. Verify if state change actually took pla... | [
0.2275107502937317,
-0.08326386660337448,
0.1097051352262497,
0.30742400884628296,
0.03982529044151306,
0.05232970416545868,
0.6055529117584229,
-0.34150606393814087,
-0.27645403146743774,
-0.3724159598350525,
-0.09504354000091553,
0.5083524584770203,
-0.0031759855337440968,
-0.19076937437... | |
on a notification takes place. e.g.
```
void OnAccountDebit( dAmount ) // emails account holder with info
```
can be tested by verifying if the email is being sent
*Post more details about your actual method and people will be able to answer better.*
**Update**: Your method is doing 2 things. I'd actually split... | [
0.45043841004371643,
0.08089645206928253,
0.41026830673217773,
-0.0732516348361969,
-0.08013824373483658,
-0.060646902769804,
0.45650553703308105,
-0.3121604025363922,
-0.11824806779623032,
-0.5932528376579285,
-0.02712847851216793,
0.5359866619110107,
-0.3128774166107178,
-0.0466158874332... | |
stackoverflow on mocking frameworks) to mimic the DB or hit the actual DB and verify if the strings were inserted in the right location. Check [this thread](https://stackoverflow.com/questions/31837/best-books-about-tdd) for some good books... I'd recomment Pragmatic Unit Testing if you're in a crunch.
In the code i... | [
0.19185833632946014,
0.10424774140119553,
0.34365418553352356,
0.03824980929493904,
-0.01895471103489399,
-0.15379920601844788,
0.41344746947288513,
-0.24872592091560364,
-0.1649177521467209,
-0.26085802912712097,
-0.06235431879758835,
0.47349870204925537,
-0.38077062368392944,
-0.05168284... | |
Im a coding a library including textual feedback that I need to translate.
I put the following lines in a `_config.py` module that I import everywhere in my app :
```
import gettext, os, sys
pathname = os.path.dirname(sys.argv[0])
localdir = os.path.abspath(pathname) + "/locale"
gettext.install("messages", localdir)
... | [
0.4620993435382843,
0.042665645480155945,
0.6031697392463684,
-0.2339983433485031,
0.11512041836977005,
0.01517412532120943,
0.31551027297973633,
-0.13945750892162323,
0.05170969292521477,
-0.8361531496047974,
-0.3868621587753296,
0.5968634486198425,
-0.72809237241745,
-0.18565689027309418... | |
straightforward like :
```
lib_object.message = "My message"
```
I used properties to make it clean, but what if my user whats to translate his own code (that uses mine) and does something like :
```
import gettext, os, sys
pathname = os.path.dirname(sys.argv[0])
localdir = os.path.abspath(pathname) + "/locale"
get... | [
0.05714051425457001,
0.17390567064285278,
0.1824960708618164,
-0.23919236660003662,
-0.05453035235404968,
-0.2867746651172638,
0.5432778596878052,
-0.25527292490005493,
-0.03817600756883621,
-0.6319791078567505,
-0.024042395874857903,
0.7729674577713013,
-0.5556628704071045,
-0.16909864544... | |
`_()` method in the local scope, bound to the specific gettext class. An example of a class with its own string catalog:
```
import gettext
class MyClass(object):
def __init__(self, locale_for_instance):
self.lang = gettext.translation("appname", localedir, \
local... | [
-0.12154575437307358,
-0.11516943573951721,
0.16629819571971893,
-0.20894838869571686,
-0.1517232060432434,
0.00661128107458353,
0.2455483227968216,
0.2831273376941681,
-0.14863111078739166,
-0.4752557873725891,
-0.3587490916252136,
0.4734647870063782,
-0.6142258048057556,
0.27475431561470... | |
method")
def other_method(self, arg): # does the same thing
_ = self.lang.gettext
return _("You called some method")
```
You could stick the code for adding the `_()` in a decorator, so all the methods that need it is prefixed with something like `@with_local_gettext`
(Note, I've not tested the ... | [
0.4137914478778839,
-0.09106718748807907,
0.3275986313819885,
-0.09187991917133331,
0.09612524509429932,
-0.295139342546463,
0.5016021728515625,
-0.11562858521938324,
-0.21659991145133972,
-0.429147332906723,
0.13973116874694824,
0.5214968323707581,
-0.5254759788513184,
-0.0134877804666757... | |
use the global one. | [
0.20691506564617157,
-0.07702639698982239,
-0.32595792412757874,
0.1328059285879135,
-0.11921796202659607,
-0.2186862677335739,
-0.3960011303424835,
0.22309114038944244,
0.05828211456537247,
-0.7544205188751221,
-0.16083309054374695,
0.4908943772315979,
-0.45722639560699463,
-0.06961478292... | |
We are building a framework that will be used by other developers and for now we have been using a lot of TDD practices. We have interfaces everywhere and have well-written unit tests that mock the interfaces.
However, we are now reaching the point where some of the properties/methods of the input classes need to be i... | [
0.33719736337661743,
0.1250813603401184,
0.04962654411792755,
0.3349095582962036,
-0.10788880288600922,
-0.12554821372032166,
0.15933777391910553,
-0.14821182191371918,
-0.03138876333832741,
-0.8381931781768799,
0.14221955835819244,
0.5229875445365906,
-0.4283682405948639,
0.13868007063865... | |
but that seems to defeat the purpose of interfaces.
2. Use classes as input parameters - breaking the TDD rule that *everything* should be interfaces
3. Provide another layer which does some translation between public interfaces and internal interfaces
Is there an existing pattern/approach to deal with this? What do t... | [
0.4334114193916321,
-0.1437462717294693,
-0.040371786803007126,
0.4453038275241852,
-0.35007670521736145,
-0.013143781572580338,
0.3499965965747833,
-0.29674819111824036,
-0.16543613374233246,
-0.7142663598060608,
0.05173284187912941,
0.6205617785453796,
-0.22120963037014008,
0.06702504307... | |
test. If these internal methods are calling other objects or doing a lot of work, you may need to refactor your design.
Good luck. | [
0.5053361654281616,
0.08994854986667633,
0.038234587758779526,
0.3952311873435974,
-0.05020182952284813,
-0.2626563608646393,
0.6389015913009644,
0.06591128557920456,
-0.10844484716653824,
-0.5829759836196899,
0.011681868694722652,
0.34458282589912415,
0.37273892760276794,
-0.0557867214083... | |
While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of
```
Name : Value
Name2 : Value2
```
etc.
The peoblem is that the values can sometimes be floats (with different precision), integers, or even in the form `2.20011E+17`. What I want to ou... | [
0.33772507309913635,
0.3227405846118927,
0.05211135372519493,
-0.05646326392889023,
-0.3227320909500122,
0.06888040900230408,
-0.03857339918613434,
-0.4731985628604889,
-0.08437153697013855,
-0.24426217377185822,
0.29184597730636597,
0.3565274477005005,
-0.2658397853374481,
0.0562431216239... | |
nearest integer
Number(number) // type cast your input
);
};
```
Or as a one liner:
```
function toInt(n){ return Math.round(Number(n)); };
```
Testing with different values:
```
toInteger(2.5); // 3
toInteger(1000); // 1000
toInteger("12345.12345"); // 12345
toInteger("2.20011E+17");... | [
-0.11217740178108215,
0.02578737959265709,
0.4530642330646515,
-0.2486995905637741,
-0.20224367082118988,
0.4281933307647705,
0.24703489243984222,
-0.831264853477478,
-0.06661780178546906,
-0.34584611654281616,
0.18373997509479523,
0.6188284158706665,
-0.09117424488067627,
0.20560415089130... | |
There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?
Like Apache, this is a quick edit to the source and recompile. From [Calomel.org](https://calomel.org/nginx.html):
> The Server: string is the header which
> is s... | [
0.4128722846508026,
-0.15091224014759064,
0.13550013303756714,
0.16190765798091888,
-0.3953021764755249,
0.0024622902274131775,
0.21282553672790527,
0.016465026885271072,
-0.21206475794315338,
-0.6390197277069092,
0.060806479305028915,
0.4197097718715668,
-0.236800879240036,
0.164541244506... | |
of web server are live on the
> Internet. To support the author and
> statistics for Nginx we recommend
> keeping this string as is. But, for
> security you may not want people to
> know what you are running and you can
> change this in the source code. Edit
> the source file
> `src/http/ngx_http_header_filter_... | [
0.33925339579582214,
0.045781560242176056,
0.7316208481788635,
-0.08070303499698639,
-0.31317242980003357,
-0.21642804145812988,
0.2894708812236786,
-0.19136106967926025,
-0.3571699559688568,
-0.7007285952568054,
-0.09138216823339462,
0.27486711740493774,
-0.2816501259803772,
0.12051992863... | |
Flavius below for pointing out a new option, replacing Nginx's standard [HttpHeadersModule](http://wiki.nginx.org/HttpHeadersModule) with the forked [HttpHeadersMoreModule](http://wiki.nginx.org/HttpHeadersMoreModule). Recompiling the standard module is still the quick fix, and makes sense if you want to use the standa... | [
0.22635628283023834,
-0.38564351201057434,
0.3926892876625061,
-0.05589130520820618,
-0.2636958360671997,
-0.31205737590789795,
0.3330442011356354,
-0.24616345763206482,
-0.12616309523582458,
-0.3551269471645355,
-0.06280536204576492,
0.6101040244102478,
-0.32325297594070435,
0.07916495203... | |
I have a problem with how ASP.Net generates the **img** tag.
I have a server control like this:
```
<asp:Image runat="server" ID="someWarning" ImageUrl="~/images/warning.gif" AlternateText="Warning" />
```
I expect it to generate this:
```
<img id="ctl00_ContentPlaceHolder1_ctl00_someWarning" src="../images/warni... | [
0.2694520354270935,
0.11506499350070953,
0.35964441299438477,
-0.17204143106937408,
-0.25337207317352295,
-0.24567751586437225,
0.43697813153266907,
-0.2523283064365387,
-0.30387914180755615,
-0.5847000479698181,
-0.1358959823846817,
0.5492814779281616,
-0.41337111592292786,
-0.00363772339... | |
that was generated. | [
0.3835486173629761,
-0.032608844339847565,
0.043509457260370255,
0.2887655794620514,
-0.1282021552324295,
-0.16979359090328217,
-0.24389676749706268,
0.17598842084407806,
-0.010660250671207905,
-0.23183317482471466,
0.10287681967020035,
0.26299265027046204,
-0.1788727194070816,
0.126720443... | |
This might be a naive question. I have to manually edit a .WXS file to make it support select features from command line.
For example, there are 3 features in .WXS file.
```
<Feature Id="AllFeature" Level='1'>
<Feature Id="Feature1" Level='1'> </Feature>
<Feature Id="Feature2" Level='1'> </Feature>
<Fe... | [
0.17987042665481567,
-0.024993719533085823,
0.6213034987449646,
-0.4064430296421051,
-0.13779038190841675,
0.05361718684434891,
0.16901648044586182,
-0.5455036163330078,
-0.09673784673213959,
-1.2571359872817993,
-0.4594841003417969,
0.8075948357582092,
-0.2700156271457672,
0.0040075569413... | |
to Feature 1 and 3.
How to accomplish this in WIX?
I would change Feature1, Feature2 and Feature3 to Components, then would declare something like this:
```
<Feature Id="FEATUREA" Title="Super" Level="1" >
<ComponentRef Id="Component1" />
<ComponentRef Id="Component2" />
</Feature>
<Feature Id="FEATUREB" Title="... | [
0.40568307042121887,
-0.2968077063560486,
0.721648633480072,
-0.30273255705833435,
-0.4031461477279663,
-0.050791434943675995,
0.2622758448123932,
-0.3982657790184021,
-0.009143972769379616,
-0.6409315466880798,
-0.313187837600708,
0.9069467186927795,
-0.414214551448822,
-0.067963689565658... | |
The problem is quite basic. I have a JTable showing cached data from a database. If a user clicks in a cell for editing, I want to attempt a lock on that row in the database. If the lock does not succeed, I want to prevent editing.
But I can't seem to find any clean way to accomplish this. Am I missing something?
Beca... | [
-0.13899736106395721,
0.19485363364219666,
0.314425528049469,
-0.018047351390123367,
0.13702203333377838,
-0.19440177083015442,
0.15152445435523987,
-0.31724098324775696,
-0.28967180848121643,
-0.38606205582618713,
0.13226953148841858,
0.4416569471359253,
-0.5965498685836792,
0.13512894511... | |
locked then don't call super.changeSelection and it should leave the row unselected. | [
0.07511114329099655,
0.05474524199962616,
0.650570273399353,
0.23004190623760223,
0.45282211899757385,
-0.2307901829481125,
0.1984785795211792,
-0.1685287207365036,
-0.4417895972728729,
-0.37162232398986816,
-0.08863998204469681,
0.37467822432518005,
-0.39053988456726074,
0.440477222204208... | |
I have a `char* p`, which points to a `\0`-terminated string. How do I create a C++ `string` from it in an exception-safe way?
Here is an unsafe version:
```
string foo()
{
char *p = get_string();
string str( p );
free( p );
return str;
}
```
An obvious solution would be to try-catch - any easier ways?
You... | [
0.3945792019367218,
0.19191579520702362,
0.41137391328811646,
-0.10689100623130798,
0.0831800326704979,
-0.0043186647817492485,
0.029151003807783127,
-0.3845204710960388,
-0.16138510406017303,
-0.21917733550071716,
-0.19376306235790253,
0.40982383489608765,
-0.312298446893692,
0.0965920016... | |
deleter; in this case, I'm using `free` as the deleter. | [
0.19750995934009552,
0.012772399932146072,
-0.2878279387950897,
-0.03807217627763748,
-0.3877638876438141,
0.1620582789182663,
0.32553961873054504,
0.046867482364177704,
-0.3325904905796051,
-0.4117449223995209,
-0.39224815368652344,
0.23720751702785492,
-0.3680203855037689,
0.536895096302... | |
I want to start using .NET 3.5 features in an app that is currently stuck in the past - how can I write in support for selected features like JSON serialization in a forward-compatible way?
In the case of JSON serialization I need to reference System.ServiceModel.Web - is it OK to reference a .NET 3.5 dll in a VS2005 ... | [
0.412018358707428,
0.012480510398745537,
0.24830669164657593,
0.1153901144862175,
-0.13985449075698853,
-0.36039915680885315,
0.25442367792129517,
0.055712077766656876,
-0.24381791055202484,
-0.6985452175140381,
-0.09525154531002045,
0.43293267488479614,
-0.11454178392887115,
0.13939192891... | |
libraries that will not be available on a user's computer if they do not have the .NET 3.5 runtime installed.
You can set your project to target .NET 3.5 if you like (from Project Properties|Application|Target Framework) which will overcome this problem - your app will then use its currently referenced .NET 2.0 librar... | [
0.5803040266036987,
-0.22685517370700836,
0.2934032380580902,
0.1723315417766571,
-0.05644522234797478,
-0.1783449649810791,
-0.004617440514266491,
-0.033101048320531845,
-0.15103887021541595,
-0.7109290957450867,
-0.2965862452983856,
0.21186791360378265,
-0.44163206219673157,
0.0279798507... | |
For example to create a hierarchy of categories you use a column 'parent\_id', which points to another category in the same table.
Should this be a foreign key? What would the dis/advantages be?
Yes. Ensures that you don't have an orphan (entry with no parent), and depending on usage, if you define a cascading delete,... | [
-0.09087925404310226,
-0.1637314110994339,
0.09584411233663559,
0.46603140234947205,
0.04901298135519028,
-0.1473996937274933,
0.1613517701625824,
-0.19122259318828583,
-0.10831038653850555,
-0.5166037678718567,
-0.17335955798625946,
0.29342684149742126,
-0.058410368859767914,
0.2929949164... | |
I'm trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected.
In the test I need to be able to create DateTime objects in a none local time zone to ensure that people running the test can do so successfully irrespective of where the... | [
0.23027709126472473,
-0.022493408992886543,
0.40260905027389526,
0.1667763739824295,
0.3320879340171814,
0.17766302824020386,
0.22054697573184967,
0.053629327565431595,
-0.24263174831867218,
-0.4814760088920593,
-0.01681375876069069,
0.2515612244606018,
-0.34663182497024536,
0.004923393949... | |
about [TimeZone](http://msdn.microsoft.com/en-us/library/system.timezone.aspx), but I'd suggest using [TimeZoneInfo](http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx) instead.
Personally I like keeping things in UTC where possible (at least for the past; [storing UTC for the *future* has potential issu... | [
0.15597021579742432,
-0.1216474175453186,
0.4710918962955475,
-0.05324406176805496,
0.28569650650024414,
-0.024734847247600555,
0.2817564606666565,
-0.024136170744895935,
-0.20518584549427032,
-0.6407903432846069,
-0.3102237284183502,
0.20725294947624207,
-0.1964171975851059,
0.29104867577... | |
}
public DateTime UniversalTime { get { return utcDateTime; } }
public TimeZoneInfo TimeZone { get { return timeZone; } }
public DateTime LocalTime
{
get
{
return TimeZoneInfo.ConvertTime(utcDateTime, timeZone);
}
}
}
```
You may wish to change th... | [
0.1594531536102295,
-0.372585266828537,
0.484253466129303,
0.027103444561362267,
0.6192860007286072,
-0.06372735649347305,
-0.07258319854736328,
0.5575055480003357,
-0.2439173460006714,
-0.6480119824409485,
-0.4623878598213196,
0.7603510618209839,
-0.37623411417007446,
0.23670600354671478,... | |
"TimeZoneInfo" to make things clearer - I prefer the briefer names myself. | [
0.6624352335929871,
-0.3831597864627838,
0.34770745038986206,
-0.19569317996501923,
0.2744843363761902,
0.10601325333118439,
-0.4037286341190338,
0.6569598317146301,
-0.08783147484064102,
-0.37211236357688904,
-0.2863740622997284,
0.4779854118824005,
-0.1275567263364792,
0.3267288208007812... | |
I'm writing a web application which uses windows authentication and I can happily get the user's login name using something like:
```
string login = User.Identity.Name.ToString();
```
But I don't need their login name I want their DisplayName. I've been banging my head for a couple hours now...
Can I access my org... | [
0.3339143395423889,
0.16075997054576874,
0.8454312086105347,
-0.1740683913230896,
0.5486440658569336,
-0.15273559093475342,
0.21373647451400757,
-0.11790058761835098,
-0.22014452517032623,
-0.6642681956291199,
-0.3439531922340393,
0.7076436281204224,
-0.09792884439229965,
0.255135565996170... | |
Environment.UserName);
return de.Properties["displayName"].Value.ToString();
}
catch { return null; }
}
``` | [
-0.17291457951068878,
-0.08304060250520706,
0.3889351189136505,
-0.23334364593029022,
0.26404809951782227,
-0.13221287727355957,
0.3020535111427307,
-0.12010804563760757,
-0.14450958371162415,
-0.8487271666526794,
-0.3943617045879364,
0.6824954748153687,
-0.38622429966926575,
0.25975069403... | |
I need to copy a set of DLL and PDB files from a set of folders recursively into another folder. I don't want to recreate the folder hierarchy in the target folder.
I want to use built in Windows tools, e.g. DOS commands.
```
mkdir targetDir
for /r %x in (*.dll, *pdb) do copy "%x" targetDir\
```
Use /Y at the end of... | [
0.4302530288696289,
0.2319793403148651,
0.3191418945789337,
-0.02118091844022274,
0.12606562674045563,
-0.1679052859544754,
0.059559550136327744,
-0.014451229013502598,
0.012542626820504665,
-0.9382473230361938,
-0.18156108260154724,
0.6714739203453064,
-0.21813856065273285,
0.287145525217... | |
Uphill about 5 years ago my career was going fairly well, but separation, family deaths and a bit of illness caused me to make a couple of BAD career decisions, and I ended up in a dead end job doing mainly vb 6, though it was the end as mid to late 30, but was recently handed a break, working with a forward thinking v... | [
0.43636035919189453,
0.11627628654241562,
0.23604771494865417,
-0.15383295714855194,
0.007927162572741508,
0.17914026975631714,
0.682266354560852,
0.4530130624771118,
-0.3989139497280121,
-0.5009090900421143,
0.8101965188980103,
0.022222748026251793,
0.724254846572876,
0.004947907291352749... | |
/ Machine Code / VB 5 &6 background, I'm finding the little intracity of .NET lost on me, if I write code I wouldn't think to use delegates for example, has anybody got any advice on making the 'brain' VB.NET jump, or training I should be looking at (bear in mind that I'm not rich)
Thanks for your time
Taking a introd... | [
0.7065920233726501,
0.022590909153223038,
-0.15904298424720764,
0.4593852758407593,
0.020234495401382446,
-0.15147988498210907,
0.4280915856361389,
0.11324527859687805,
-0.21862171590328217,
-0.6420376896858215,
0.2676352262496948,
0.5827726125717163,
0.3896717429161072,
-0.282601326704025... | |
of the ton that are out there) is to follow one of the webcast series available at <http://www.microsoft.com/events/series/modernsoftdev.aspx?tab=webcasts>. Although they are a little dates (they focus on Visual Studio 2005) they are designed for people like yourself.
The other suggestion is to find a local .NET user ... | [
0.4999774396419525,
-0.1314186006784439,
0.19496704638004303,
0.12923023104667664,
-0.29370924830436707,
0.12207690626382828,
-0.14783789217472076,
-0.040273815393447876,
-0.5767854452133179,
-0.4111489951610565,
0.31373801827430725,
0.1859356164932251,
0.3700300455093384,
0.10622122883796... | |
I want do something like this:
```
Result = 'MyString' in [string1, string2, string3, string4];
```
This can't be used with strings and I don't want to do something like this:
```
Result = (('MyString' = string1) or ('MyString' = string2));
```
Also I think that creating a StringList to do just this is too comple... | [
0.020680135115981102,
0.009383556433022022,
0.5188468098640442,
-0.22248132526874542,
-0.13361242413520813,
0.057200636714696884,
0.3043402433395386,
-0.358146995306015,
0.08164115250110626,
-0.4996515214443207,
-0.2730165421962738,
0.5553433895111084,
-0.5090202689170837,
-0.0012552407570... | |
in
> AValues that matches AText
> **case-insensitively**. If the string
> specified by AText does not have a
> (possibly case-insensitive) match in
> AValues, AnsiIndexText returns –1.
> Comparisons are based on the current
> system locale.
>
>
> MatchStr determines if any of the
> strings in the array AValues match ... | [
-0.3653491735458374,
-0.09687962383031845,
0.2684515118598938,
-0.14336061477661133,
-0.2494087666273117,
0.29155996441841125,
0.22733619809150696,
-0.28873971104621887,
0.09020066261291504,
-0.9408776760101318,
-0.25064677000045776,
0.4480932652950287,
-0.45207124948501587,
-0.07415704429... | |
thought I would add a note that, in Delphi 2010 there is also a `MatchText` function which is the same as `MatchStr` but case insenstive. -- Larry | [
-0.061181869357824326,
0.21150170266628265,
-0.07339666038751602,
-0.1361207813024521,
-0.1645667403936386,
-0.559120237827301,
0.18610171973705292,
0.2626144587993622,
0.1986534297466278,
-0.4426591098308563,
-0.43263503909111023,
0.6033357977867126,
-0.7657354474067688,
-0.38830441236495... | |
My WCF Service uses wsHttpBinding and works fine from the client when the service is gerenated by the client using the default options as follows:
```
RServiceClient R = new RServiceClient();
```
However, at some point I'll need to be able to specify the location of the service, presumably by changing the endpoint a... | [
-0.015984132885932922,
0.20957519114017487,
1.1225662231445312,
-0.31935563683509827,
0.08570484071969986,
-0.2657957077026367,
0.7357383370399475,
-0.2773424983024597,
-0.05009084939956665,
-0.7291337847709656,
-0.21641507744789124,
0.39639362692832947,
-0.2880078852176666,
0.569767355918... | |
when the client is run from the same machine as the service under an admin account - I havn't got to the scary part of running it over the net yet!
Any Ideas?
By default, wsHttpBinding uses Windows authentication. I'm not sure how hosting in IIS affects that scenario.
If you don't want security turned on, you can ad... | [
0.2681863307952881,
0.005827158689498901,
0.5351218581199646,
-0.010141310282051563,
-0.006532813422381878,
-0.6244478821754456,
0.5434256196022034,
0.01631535030901432,
-0.12434151768684387,
-0.5546656250953674,
-0.20863384008407593,
0.7449448108673096,
-0.2454836517572403,
0.121236011385... | |
to point to the newly added binding properties:
```
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBind">
<security mode="None">
<transport clientCredentialType="None" protectionLevel="EncryptAndSign" />
<message clientCredentialType="None" alg... | [
-0.2506229281425476,
0.038168132305145264,
0.7544287443161011,
-0.11087676137685776,
-0.02330821566283703,
0.033087294548749924,
0.12443169951438904,
-0.4102281630039215,
-0.5447343587875366,
-0.9018868207931519,
-0.3790239989757538,
0.163782998919487,
-0.374970018863678,
0.277578175067901... | |
<service behaviorConfiguration="ServiceBehavior"
name="RService">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="wsHttpBind"
name="RService" | [
-0.22586074471473694,
-0.021133990958333015,
0.47941267490386963,
-0.4509154260158539,
-0.23434242606163025,
0.058157168328762054,
0.5446619391441345,
-0.2890622615814209,
-0.20445559918880463,
-0.44984447956085205,
-0.36080577969551086,
0.2594946026802063,
-0.21356424689292908,
0.32549822... | |
contract="IRService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding" | [
-0.051779117435216904,
-0.26032954454421997,
0.5626611709594727,
-0.14465151727199554,
-0.2843937873840332,
-0.016174353659152985,
0.0038042040541768074,
-0.3151211142539978,
-0.07779120653867722,
-0.3620609641075134,
-0.22623834013938904,
0.1910182237625122,
-0.32446613907814026,
0.079249... | |
name="MetadataExchange"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint | [
0.28763332962989807,
-0.10065846890211105,
0.22512775659561157,
0.04904208704829216,
0.053600866347551346,
-0.1026826798915863,
0.28245019912719727,
-0.41854849457740784,
-0.0354033000767231,
-0.07584116607904434,
-0.01430077850818634,
0.6422824263572693,
-0.18832194805145264,
0.5959667563... | |
above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExcepti... | [
0.12720492482185364,
0.202128604054451,
0.13854797184467316,
-0.2323259562253952,
-0.028464747592806816,
-0.19365739822387695,
1.023093819618225,
-0.5065829157829285,
-0.11916407197713852,
-0.1222604513168335,
-0.13473621010780334,
0.8149271607398987,
-0.14879491925239563,
-0.0444622859358... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.