text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I'm working on a small utility application in Python.
The networking is gonna send and receive messages.
The GUI is gonna display the messages from the GUI and provide user input for entering messages to be sent.
There's also a *storage* part as I call it, which is gonna get all the network messages and save them in ... | [
0.5585948824882507,
0.20793263614177704,
-0.030511585995554924,
0.2198348343372345,
0.1281888633966446,
-0.011107088066637516,
-0.1099117174744606,
0.39209669828414917,
-0.2160009741783142,
-0.740513801574707,
0.5231807231903076,
0.5400198101997375,
-0.2264745682477951,
0.12121783941984177... | |
the best way? What kind of signal passing / thread locking available in Python should I use to avoid possible problems?
I think that you could use a [Queue](http://docs.python.org/library/queue.html) for passing messages between the GUI and the network threads.
As for GUI and threads in general, you might find the [Py... | [
0.24536746740341187,
-0.15602949261665344,
0.2875141203403473,
0.12931574881076813,
-0.02669631317257881,
0.05281620845198631,
0.09224259108304977,
0.15688255429267883,
-0.2249312549829483,
-0.523647129535675,
0.2448759227991104,
0.6481254696846008,
-0.13723252713680267,
-0.034377891570329... | |
I've been mostly working with VB.Net for over a year and just noticed this
Am I going insane, or does VB.Net **NOT** have an "Unreachable code" warning?
The following compiles quite happily with nary a warning or error, even though there is a return between the two writeline calls.
```
Sub Main()
Console.WriteLi... | [
0.27842578291893005,
0.23122066259384155,
0.3479301333427429,
0.040532056242227554,
0.18966403603553772,
-0.38312387466430664,
0.7222101092338562,
0.19572357833385468,
-0.2751186192035675,
-0.34616222977638245,
-0.07221188396215439,
0.572215735912323,
-0.2230219542980194,
0.519068896770477... | |
woeful state of affairs)
Forgive the air of rant about this question, it's not a rant, I would like an answer.
Thanks
---
I've raised this on [MS Connect](http://connect.microsoft.com), as bug# 428529
**Update**
I received the following from the VB Teams program manager
> Thanks for taking the time to report
> t... | [
0.14072579145431519,
0.24560123682022095,
0.397224485874176,
0.10405503958463669,
0.01790240965783596,
0.01824255846440792,
0.5097370147705078,
0.13129816949367523,
-0.07158583402633667,
-0.4702734351158142,
-0.2675754129886627,
0.34337297081947327,
-0.2773043215274811,
0.44992026686668396... | |
In this case you'll get a warning that
> x has never been assigned. For the
> case you mentioned however we'll have
> to look at implementing that for a
> future release.
My guess is that it's an oversight in the compiler. Flow control is a very difficult problem to get correct in any language, but especially in a lang... | [
0.33437007665634155,
-0.04222888872027397,
0.46926137804985046,
0.25642484426498413,
-0.077742800116539,
-0.17667004466056824,
0.25822049379348755,
0.49887335300445557,
-0.21018007397651672,
-0.7887061238288879,
-0.11163557320833206,
0.4031427204608917,
-0.3188492953777313,
0.0882434770464... | |
seriously and do our best to fix as many as possible. | [
0.6761197447776794,
0.36391356587409973,
-0.5485648512840271,
0.2739827632904053,
0.15372508764266968,
0.11047498881816864,
0.5033134818077087,
0.6717316508293152,
0.17651261389255524,
-0.3621314465999603,
0.04758903756737709,
0.6885311007499695,
0.054176852107048035,
-0.27489548921585083,... | |
Despite all the advances in 3D graphic engines, it strikes me as odd that the same level of attention hasn't been given to audio. Modern games do real-time rendering of 3D scenes, yet we still get more-or-less pre-canned audio accompanying those scenes.
Imagine - if you will - a 3D engine that models not just the phys... | [
0.26660141348838806,
0.39478015899658203,
-0.24379880726337433,
0.49305519461631775,
0.21485303342342377,
-0.10287304222583771,
-0.07344164699316025,
-0.16082872450351715,
-0.17131735384464264,
-0.38017356395721436,
-0.0516330748796463,
0.8289127349853516,
0.0977301150560379,
-0.1543059796... | |
your head, each one will yield a unique and realistic sound.
The obvious application of such a technology would be gaming, but I'm sure there are many other possibilities.
Is such a technology being actively developed? Does anyone know of any projects that attempt to achieve this?
Thanks,
Kent
I once did some resear... | [
0.7476477026939392,
0.3697393834590912,
0.23545613884925842,
0.5470852255821228,
-0.1646239012479782,
-0.14495819807052612,
0.1355305016040802,
0.2742769420146942,
-0.156367689371109,
-0.6504210233688354,
0.18658384680747986,
0.5724871754646301,
0.2745106518268585,
0.06948591023683548,
0... | |
are not quite the same for anyone else!
If you want, say, a pair of headphones to really make it sound like a creature is in the leaves ahead and in front of the character in a game, then you actually have to take that player into a studio, measure how their own particular ears and head change the amplitude and phase ... | [
0.5502276420593262,
-0.1531600058078766,
-0.1377817839384079,
0.4766685664653778,
0.5283359885215759,
-0.19665645062923431,
0.18242889642715454,
-0.00485778646543622,
0.0104551175609231,
-0.3099868595600128,
0.06627772748470306,
0.5564330220222473,
0.010914500802755356,
-0.2905508279800415... | |
do exist "standard heads" that have been mocked up with plastic and used to get generic frequency-response curves for the various directions around the head, but an average or standard will never sound quite right to most players.
Thus the current technology is basically to sell the player five cheap speakers, have th... | [
0.45922431349754333,
0.2664010524749756,
0.5742986798286438,
0.3012159764766693,
0.25852906703948975,
-0.2128041833639145,
-0.2077968269586563,
0.011351066641509533,
0.1116543710231781,
-0.2682853043079376,
0.2131224125623703,
0.7316845655441284,
0.2520701289176941,
0.18599145114421844,
... | |
compute how sound would be muffled and attenuated through walls and doors (which can get difficult to simulate, because the ear receives the same sound at a few milliseconds different delay through various materials and reflective surfaces in the environment, all of which would have to be included if things were to sou... | [
0.28718456625938416,
0.07950636744499207,
-0.05664408951997757,
0.2666635513305664,
0.1880793571472168,
-0.12510612607002258,
0.24036414921283722,
-0.03098885715007782,
-0.11667117476463318,
-0.40768614411354065,
0.061410509049892426,
0.4218939542770386,
-0.019094480201601982,
-0.261025369... | |
more realistic OpenAL sound field, from MIT:
<http://sound.media.mit.edu/resources/KEMAR.html>
Enjoy! :-) | [
0.2556072771549225,
-0.2034095674753189,
0.4277403950691223,
0.18293100595474243,
0.4528005123138428,
-0.49451103806495667,
-0.0297617856413126,
-0.22368453443050385,
-0.1454259306192398,
-0.4013780951499939,
-0.6414344310760498,
0.7635166049003601,
0.08043336123228073,
-0.1162452101707458... | |
Are there any in-memory/caching solutions for java that allow for a form of Querying for specific attributes of objects in the Cache?
I realize this is something that a full blown database would be used for, but I want to be able to have the speed/performance of a cache with the Querying ability of a database.
Nowaday... | [
0.034888774156570435,
0.06825178116559982,
0.057391729205846786,
0.09857505559921265,
0.10187329351902008,
-0.29563915729522705,
0.18921074271202087,
0.06109439581632614,
-0.4023539423942566,
-0.6965367794036865,
-0.0552985705435276,
0.3075704276561737,
-0.12031152099370956,
-0.01963181607... | |
Is there any way in MySQL to put the name of the database into a variable?
For example, when I have a database called 'db1', can I do something like this:
```
set @db= 'db1';
select * from @db.mytable;
```
EDIT: There is another example of what I want to do:
```
set @dbfrom= 'db1';
set @dbto= 'db2';
insert into @db... | [
-0.1449793130159378,
0.006825956515967846,
0.328722208738327,
-0.12025249749422073,
-0.03376471996307373,
0.12557344138622284,
0.03169644996523857,
-0.20458173751831055,
0.07992152869701385,
-0.4959074854850769,
-0.12134999781847,
0.2082872837781906,
-0.44356343150138855,
0.106028214097023... | |
Hello all and thanks for your time reading this.
I need to verify certificates issued by my own CA, for which I have a
certificate. How can I do the equivalent to openssl's
openssl verify -CAfile
in Ruby code? The RDoc for OpenSSL is not very helpful in this regard.
I've tried:
```
require 'openssl'
ca = OpenSSL... | [
0.26875752210617065,
0.4550366699695587,
0.471613347530365,
0.04674101620912552,
-0.13241823017597198,
-0.046099405735731125,
0.16765250265598297,
-0.08204987645149231,
-0.10174501687288284,
-0.45932891964912415,
-0.18777082860469818,
0.7027308344841003,
-0.27542605996131897,
0.36936399340... | |
[Japanese help page](http://doc.loveruby.net/refm/api/view/class/OpenSSL=X509=Certificate) to get the list of available methods :) | [
0.11174365878105164,
-0.07411064952611923,
0.21763502061367035,
0.31286558508872986,
-0.030942635610699654,
-0.2779906392097473,
0.42094355821609497,
-0.40080294013023376,
-0.052703339606523514,
-0.22337716817855835,
-0.23534250259399414,
0.3292704224586487,
0.1375412791967392,
0.008957660... | |
Many methods that used to return lists in Python 2.x now seem to return iterators in Py3k
Are iterators also generator expressions? Lazy evaluation?
Thus, with this the memory footprint of python is going to reduce drastically. Isn't it?
What about for the programs converted from 2to3 using the builtin script?
Does... | [
0.2591308355331421,
-0.09486288577318192,
0.08178109675645828,
0.08096978813409805,
-0.46733975410461426,
-0.015142349526286125,
0.2062738984823227,
-0.2236262559890747,
-0.4974985420703888,
-0.4001660645008087,
0.0368913859128952,
0.7429407238960266,
-0.5471288561820984,
-0.36424693465232... | |
old xrange object - it can still be indexed, but lazily constructs the integers as needed.
Similarly dict.keys() gives a dict\_keys object implementing a view on the dict, rather than creating a new list with a copy of the keys.
How this affects memory footprints probably depends on the program. Certainly there's mor... | [
0.003319293260574341,
-0.1609804630279541,
0.1851489543914795,
0.15584632754325867,
-0.19428054988384247,
0.09387537837028503,
0.08436417579650879,
-0.09587955474853516,
-0.43856245279312134,
-0.6490651369094849,
0.02875373698771,
0.5663803815841675,
-0.44629234075546265,
-0.13620108366012... | |
in python2 programs however, as really large memory usage will stand out, and is more likely to be already addressed. (eg. the file iterator is already much more memory efficient than the older `file.readlines()` method)
Converting is done by the 2to3 tool, and will generally convert things like range() to iterators w... | [
0.16122004389762878,
-0.013686704449355602,
0.19540448486804962,
-0.39542585611343384,
-0.23762516677379608,
-0.02465531975030899,
0.28081831336021423,
-0.3211587369441986,
-0.29771703481674194,
-0.3324998915195465,
-0.1406686156988144,
0.7568568587303162,
-0.5046407580375671,
-0.437191158... | |
know if the code expects a *real* list object in x. | [
0.4775831699371338,
-0.14074517786502838,
0.17268849909305573,
0.02649591490626335,
0.0019531568977981806,
-0.3744060695171356,
0.18077616393566132,
0.18201181292533875,
-0.05254821106791496,
-0.5641973614692688,
-0.26736751198768616,
0.3236074447631836,
-0.11228609830141068,
-0.2566471099... | |
I maintain a touch screen application that I'm re-writing into .Net. Through the years the resolution of the touch screens has increased greatly. Not only is the resolution higher, but the pixels are also much more dense making it harder to see/operate the touch buttons.
Is there a way with WPF to force application w... | [
0.15772783756256104,
0.21814623475074768,
0.6480178236961365,
-0.17079377174377441,
-0.1423565000295639,
-0.020806504413485527,
-0.04066977649927139,
-0.1357429325580597,
-0.27002739906311035,
-0.5282832384109497,
0.3058195114135742,
0.4070521891117096,
-0.08704747259616852,
0.233148306608... | |
Height="300" Width="300">
<Viewbox Stretch="Uniform">
<StackPanel Background="Azure" Height="400" Width="300" Name="stackPanel1" VerticalAlignment="Top">
<Button Name="testBtn" Width="200" Height="50">
<TextBlock>Test</TextBlock>
</Button>
</StackPanel>
<... | [
-0.04182475060224533,
-0.4178050756454468,
0.4563613533973694,
-0.12108887732028961,
-0.10423221439123154,
-0.0283981841057539,
0.18807461857795715,
-0.49932825565338135,
-0.33595550060272217,
-0.5253015160560608,
-0.2549999952316284,
0.2782406508922577,
0.19042783975601196,
-0.22545033693... | |
I need a replacement for `System.Net.Mail.MailMessage` that is able to send signed and/or encrypted e-mails.
Is there an open source library covering that?
Or do you have some experiences with some of those:
* [Chilkat Mail](http://www.chilkatsoft.com/mime-dotnet.asp)
* [Easymail](http://www.quicksoftcorp.com/emdo... | [
0.3132452070713043,
-0.12889595329761505,
0.10475614666938782,
0.14293092489242554,
-0.07900159060955048,
-0.05392375588417053,
0.3879295289516449,
0.04395328834652901,
-0.34052959084510803,
-0.7787830829620361,
0.023637909442186356,
0.29682037234306335,
-0.39947760105133057,
0.11913741379... | |
product, if you're having no luck with the BCL solution. Saying that, I would definitely recommend using the solution provided in the System.Net namespace if at all possible, despite requiring a bit of custom configuration. | [
0.6313110589981079,
-0.298917293548584,
0.24275217950344086,
-0.06385694444179535,
0.07877468317747116,
-0.14092399179935455,
0.03384655341506004,
0.303292453289032,
-0.2603318393230438,
-0.4687792658805847,
-0.17199595272541046,
0.3370564579963684,
0.0161890909075737,
0.1784517914056778,
... | |
I want to implement UNDO and REDO option(as we see in MS word etc). Can you suggest me a data structure for it, and how can i implement it.?
It isn't a data structure but a design pattern. You're looking for the [Command Pattern](http://en.wikipedia.org/wiki/Command_pattern).
The standard is to keep the Command object... | [
0.3051252067089081,
-0.17746566236019135,
0.26676544547080994,
0.012098134495317936,
0.09697883576154709,
0.1506507247686386,
0.036328282207250595,
-0.23495393991470337,
-0.35621559619903564,
-0.6665902137756348,
-0.13329097628593445,
0.6001371145248413,
-0.15410415828227997,
0.13233134150... | |
reverse when you redo a command. You pop the redo stack and push the popped command back into the undo stack. | [
-0.42811205983161926,
-0.16065190732479095,
0.2499672770500183,
-0.12903675436973572,
0.10845987498760223,
0.39424628019332886,
0.1635802835226059,
-0.04960425943136215,
-0.06540681421756744,
-0.28753697872161865,
-0.37253665924072266,
0.8016341328620911,
-0.11917778849601746,
-0.004264293... | |
I have a very simple function which takes in a matching bitfield, a grid, and a square. It used to use a delegate but I did a lot of recoding and ended up with a bitfield `&` operation to avoid the delegate while still being able to perform matching within reason. Basically, the challenge is to find all contiguous elem... | [
0.20728299021720886,
-0.09888697415590286,
-0.09996078908443451,
0.2443731725215912,
-0.0062850285321474075,
0.12074451148509979,
0.008682049810886383,
-0.38682544231414795,
-0.039438750594854355,
-0.4805760383605957,
0.1894177794456482,
0.17022117972373962,
-0.32205745577812195,
0.0712041... | |
(500 elements in this test).
**Edit:** It's worth noting that this function is called over 200,000 times per second. In truth, in the long run my goal will be to call it less often, but that's really tough, considering that my end goal is to make the grouping system be handled with scripts rather than being hardcoded.... | [
0.02510376088321209,
-0.05753251165151596,
-0.15752334892749786,
0.04865504056215286,
-0.15324775874614716,
-0.11993549019098282,
0.4851188659667969,
-0.43651318550109863,
-0.21572019159793854,
-0.5019737482070923,
-0.20111222565174103,
0.2177499681711197,
-0.2659350633621216,
-0.244144976... | |
some cases it will).
**Things tried unsuccessfully:**
* Initializing the dictionary and stack with a capacity.
* Casting the int to an enum to avoid a cast.
* Moving the dictionary and stack outside the function and clearing them each time they are needed. This makes things slower!
**Things tried successfully:**
*... | [
0.18650628626346588,
-0.2502145767211914,
-0.002307554706931114,
-0.0462447926402092,
-0.14541150629520416,
0.035160042345523834,
0.6375735402107239,
-0.3445810377597809,
-0.27771392464637756,
-0.7497280836105347,
-0.1469271183013916,
0.6486272811889648,
-0.21079836785793304,
-0.1649103611... | |
Both `Contains` and `Add` are forced to seek a key, so just checking if an add succeeds is more efficient than adding if a `Contains` fails check fails. That is, `if (RetVal.Add(s)) curStack.Push(s);`
```
public static List<Square> GetGroup(int match, Model grid, Square leader)
{
Stack<Square> curStack = new Stack... | [
-0.013744105584919453,
-0.1771198809146881,
0.8410413265228271,
-0.4778883457183838,
-0.08182908594608307,
-0.0584973581135273,
0.2927059829235077,
-0.9085169434547424,
-0.23840618133544922,
-0.28036653995513916,
-0.7442761659622192,
0.5066066980361938,
-0.3487873673439026,
0.1311085522174... | |
Retval.Add(curItem, true);
foreach (Square s in curItem.Neighbors)
{
if (0 != ((int)(s.RoomType) & match))
{
curStack.Push(s);
}
}
}
return new List<Square>(Retval.Keys);
}
```
=====
``` | [
0.13188472390174866,
-0.12843963503837585,
1.1341842412948608,
-0.3919043242931366,
-0.33958637714385986,
0.292964905500412,
0.49996694922447205,
-1.135561466217041,
-0.18745961785316467,
-0.2998398542404175,
-0.48011112213134766,
0.49668601155281067,
-0.4124171733856201,
0.418339103460311... | |
public static List<Square> GetGroupMquander(int match, Model grid, Square leader)
{
Stack<Square> curStack = new Stack<Square>();
Dictionary<Square, bool> Retval = new Dictionary<Square, bool>();
Retval.Add(leader, true);
curStack.Push(leader);
while (curStack.Count != 0)
... | [
-0.13187967240810394,
-0.3605364263057709,
0.7182290554046631,
-0.13625262677669525,
-0.2572876214981079,
0.23150816559791565,
0.40957963466644287,
-0.6241026520729065,
-0.28758880496025085,
-0.13690347969532013,
-0.5680720806121826,
0.4721844792366028,
-0.49918848276138306,
0.180242702364... | |
foreach (Square s in curItem.Neighbors)
{
if (0 != ((int)(s.RoomType) & match))
{
if (!Retval.ContainsKey(s))
{ | [
-0.03438017889857292,
0.21706049144268036,
0.7324526309967041,
-0.3507218360900879,
-0.04483655467629433,
0.3384620249271393,
0.30132028460502625,
-0.9318463206291199,
0.03900083899497986,
-0.615273654460907,
-0.573738694190979,
0.2360345423221588,
-0.3390035331249237,
0.2794078290462494,
... | |
curStack.Push(s);
Retval.Add(curItem, true);
}
}
} | [
-0.13963429629802704,
-0.1471269577741623,
0.6142308712005615,
-0.4448937475681305,
-0.12176581472158432,
0.20448775589466095,
0.5533315539360046,
-0.19593602418899536,
-0.05440095439553261,
-0.26300379633903503,
-0.3724380135536194,
0.6832572817802429,
-0.44666990637779236,
0.390707939863... | |
}
return new List<Square>(Retval.Keys);
}
```
The code you posted assumes that the `leader` square matches the bitfield. Is that by design?
I assume your `Square` class has implemented a `GetHashCode` method that's quick and provides a good distribution.
You did say micro-optimization . . .
If you have ... | [
0.09389307349920273,
-0.005984621588140726,
0.3535710275173187,
-0.043943773955106735,
-0.06725616008043289,
0.02900354005396366,
0.11987532675266266,
-0.5592122673988342,
-0.19218286871910095,
-0.6613658666610718,
-0.11132007837295532,
0.6622005701065063,
-0.3867892622947693,
-0.046762194... | |
having to grow the dictionary and re-hash everything. You can also do the same thing with your stack: pre-allocate it to some reasonable maximum size to avoid resizing later.
Since you say that the grid is pretty small it seems reasonable to just allocate the stack and the dictionary to the grid size, if that's easy t... | [
0.3199528157711029,
-0.11343692243099213,
0.13445761799812317,
0.07675164192914963,
0.1483001559972763,
0.1025727391242981,
0.026610910892486572,
-0.22563934326171875,
-0.29237696528434753,
-0.6937846541404724,
0.17284218966960907,
0.4857766032218933,
0.06411570310592651,
0.141759529709815... | |
relative speed of a dictionary lookup as opposed to the overhead of having a duplicate item in the stack. Might be worth it to give this a try, although I'd be surprised if it made a big difference.
```
if (0 != ((int)(s.RoomType) & match))
{
if (!Retval.ContainsKey(curItem))
curStack.Push(s);
}
```
I'm ... | [
0.19845187664031982,
0.14589810371398926,
0.203507199883461,
-0.1402871161699295,
-0.10658158361911774,
0.004926355555653572,
0.39849328994750977,
-0.3372305929660797,
-0.031058771535754204,
-0.7598024010658264,
0.2381027340888977,
0.6256013512611389,
-0.15223762392997742,
0.00302254990674... | |
compiler. You could remove that cast from your inner loop by creating a local variable of the enum type and assigning it the value of `match`:
```
RoomEnumType matchType = (RoomEnumType)match;
```
Then your inner loop comparison becomes:
```
if (0 != (s.RoomType & matchType))
```
No cast, which might shave some c... | [
0.21909484267234802,
0.15024326741695404,
0.007769470568746328,
-0.025324184447526932,
-0.18285812437534332,
-0.0714375302195549,
0.4431722164154053,
-0.3526131510734558,
-0.04216640815138817,
-0.7172449827194214,
0.06585300713777542,
0.5535620450973511,
-0.6162516474723816,
0.088732831180... | |
items that do match, you can keep track of the non-matching items by giving them a value of `false`. Then at the end you simply create a `List` of those items that have a `true` value.
```
public static List<Square> GetGroup(int match, Model grid, Square leader)
{
Stack<Square> curStack = new Stack<Squ... | [
0.04601259529590607,
-0.13508081436157227,
0.6688186526298523,
-0.10678121447563171,
-0.18531382083892822,
-0.049677737057209015,
0.3188292980194092,
-0.6680281162261963,
-0.082522913813591,
-0.3936236500740051,
-0.5394497513771057,
0.6157500743865967,
-0.3381528854370117,
0.08382602035999... | |
int numMatch = 1;
while (curStack.Count != 0)
{
Square curItem = curStack.Pop();
foreach (Square s in curItem.Neighbors)
{
if (Retval.ContainsKey(curItem)) | [
-0.06647409498691559,
-0.10856892168521881,
0.5897866487503052,
-0.3538273572921753,
-0.15631669759750366,
0.30344876646995544,
0.4357183873653412,
-0.7196968197822571,
-0.18665608763694763,
-0.2585940659046173,
-0.4011394679546356,
0.3104380965232849,
-0.161335289478302,
0.308886200189590... | |
continue;
if (0 != ((int)(s.RoomType) & match))
{
curStack.Push(s);
Retval.Add(s, true); | [
0.15919560194015503,
-0.383994996547699,
0.9880971312522888,
-0.4034186005592346,
0.5306025743484497,
0.13726510107517242,
0.7409723401069641,
-0.3942975699901581,
-0.07753362506628036,
-0.21026235818862915,
-0.694402813911438,
0.5286129713058472,
-0.23394815623760223,
0.38082563877105713,... | |
++numMatch;
}
else
{
Retval.Add(s, false);
} | [
0.22714786231517792,
-0.3208160698413849,
0.34248578548431396,
-0.34752190113067627,
-0.1272161453962326,
0.1273694783449173,
0.541316568851471,
-0.5533600449562073,
-0.04586368426680565,
-0.27492013573646545,
-0.5028489828109741,
0.5577266216278076,
-0.2929820418357849,
-0.037392295897006... | |
}
}
// LINQ makes this easier, but since you're using .NET 2.0...
List<Square> matches = new List<Square>(numMatch);
foreach (KeyValuePair<Square, bool> kvp in Retval)
{
if (kvp.Value == true)
{ | [
0.13140936195850372,
-0.2822244465351105,
0.7383548617362976,
-0.2478058785200119,
0.0474499836564064,
-0.06433609127998352,
0.43165698647499084,
-0.9108107089996338,
-0.07248500734567642,
-0.18952862918376923,
-0.35128697752952576,
0.6381849646568298,
-0.16787968575954437,
0.0877863168716... | |
matches.Add(kvp.Key);
}
}
return matches;
}
``` | [
-0.09387125819921494,
0.0472780205309391,
0.23202262818813324,
-0.24991436302661896,
-0.13578462600708008,
-0.18404121696949005,
0.3130545914173126,
-0.3532070815563202,
-0.0031038005836308002,
-0.5768551826477051,
-0.29538971185684204,
0.7365382313728333,
-0.658072292804718,
0.20824950933... | |
My goal is to get a query written. I have three tables, A, B and C. The tables are written such that A.bID = B.bID, and B.cID = C.cID. This basically allows me to write a query where I link a record from a to b, and link the b record to a record from c. So far so good, simple query.
What my problem is... one of the co... | [
0.16954344511032104,
0.4308541417121887,
0.4178369343280792,
0.07825853675603867,
-0.23404695093631744,
0.11282020807266235,
-0.1894788295030594,
-0.23347210884094238,
-0.24123331904411316,
-0.5303910970687866,
0.5181481838226318,
0.2743396759033203,
-0.27763187885284424,
0.260033488273620... | |
the other tables do not have this requirement.
Can anybody help me write this query?
Thanks...
**Update 1:**
Here is the table layout (sorry, I have to use generic names)
**Table A**
aID, bID, aCol1, aCol2, aCol3 ... aCol10
**Table B**
bID, cID, bCol1, bCol2, bCol3 ... bCol10
**Table C**
cID, cCol1, cCo... | [
-0.4884902834892273,
0.40299278497695923,
0.7136843204498291,
0.3473820984363556,
-0.19721637666225433,
0.2660963833332062,
-0.2787003815174103,
-0.05171658471226692,
-0.35484153032302856,
-0.61131751537323,
0.22547249495983124,
0.3644287884235382,
-0.26126348972320557,
-0.1831700354814529... | |
A.bID = B.bID AND B.cID = C.cID
```
... but of course that doesn't make sure the that values in C.col3 are unique.
**Update 2:**
More info...
Table A and Table B have a one to many relationship; A is the "header", B is the "item".
Table B and Table C have a one to one relationship.
These tables are part of... | [
-0.07667895406484604,
0.0032052122987806797,
0.42609742283821106,
0.305253267288208,
-0.08290206640958786,
-0.224001944065094,
-0.3446573317050934,
-0.04719092324376106,
-0.3072498142719269,
-0.6736281514167786,
0.15756891667842865,
0.2650092542171478,
-0.1432204246520996,
0.40277346968650... | |
to order the rows by A.aID, but then after that I only need the first rows returned, where the value for C.col3 does not appear in a previous row for that col.
Does that make things a little clearer, or am I still not making any sense? :)
**Final Update:**
I chose Bartosz Klimek's answer as it was the closest to... | [
0.017496054992079735,
0.24899354577064514,
0.4836576581001282,
0.1342192441225052,
-0.13019974529743195,
0.2707166075706482,
0.37134242057800293,
-0.14061355590820312,
-0.09973792731761932,
-0.5778694152832031,
-0.19028526544570923,
0.3911832571029663,
0.00007864009239710867,
0.05862254276... | |
JOIN A ON A.bID = B.bID
JOIN
(
SELECT id = min(aID)
FROM C
JOIN B ON B.cID = C.cID
JOIN A ON A.bID = B.bID
GROUP BY col3
) D ON D.id = A.aID
```
Note that the subquery at the end assures that for each col3 value you will have at most | [
-0.5013209581375122,
0.09557866305112839,
0.8361748456954956,
-0.035486552864313126,
-0.18234166502952576,
0.18076778948307037,
-0.16388259828090668,
-0.6520072221755981,
-0.04345273971557617,
-0.48743635416030884,
-0.3136126399040222,
0.2993584871292114,
-0.10060001909732819,
0.1060547456... | |
one record in the final resultset. The record selected is the one with the minimal aID. Obviously I assume that aID, bID and cID are primary keys of A, B and C, respectively. | [
-0.04634430631995201,
0.14221490919589996,
0.24203245341777802,
0.3441983163356781,
-0.0041010379791259766,
-0.11274802684783936,
-0.028870820999145508,
-0.19462963938713074,
0.10577401518821716,
-0.5067091584205627,
-0.22593364119529724,
0.6854978799819946,
0.19165100157260895,
-0.0920655... | |
One mistake I see people making [over](https://stackoverflow.com/questions/699708/variable-order-regex-syntax) and [over again](https://stackoverflow.com/questions/457015/regular-expression-help) is trying to parse XML or HTML with a regex. Here are a few of the reasons parsing XML and HTML is hard:
People want to tre... | [
0.04908742383122444,
0.06359121203422546,
0.23664796352386475,
0.14188961684703827,
-0.2114858627319336,
-0.3697061836719513,
0.32952114939689636,
-0.19301864504814148,
-0.2877589762210846,
-0.6141247749328613,
-0.24533502757549286,
0.3054036796092987,
-0.4247995615005493,
0.06105809286236... | |
to match against the content of a document (such as the famous "find all phone numbers on a given page" problem), but the data may be marked up (even if it appears to be normal when viewed):
```
<span class="phonenum">(<span class="area code">703</span>)
<span class="prefix">348</span>-<span class="linenum">3020</span... | [
0.15059180557727814,
0.11561112105846405,
0.43463432788848877,
0.10704565793275833,
-0.32378703355789185,
-0.02779345028102398,
0.09582377225160599,
-0.3796670436859131,
-0.22434566915035248,
-0.696426510810852,
-0.0907461941242218,
0.33596980571746826,
-0.16057349741458893,
-0.25694587826... | |
bundle of joy is valid HTML:
```
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" [
<!ENTITY % e "href='hello'">
<!ENTITY e "<a %e;>">
]>
<title>x</TITLE>
</head>
<p id = a:b center>
<span / hello </span>
&<br left>
<!---- >t<!---> <... | [
-0.12976816296577454,
0.04523734003305435,
0.438736230134964,
0.43385249376296997,
-0.37335124611854553,
-0.01469783391803503,
-0.05843162536621094,
-0.31620195508003235,
-0.41191643476486206,
-0.39503079652786255,
-0.3476872146129608,
0.2592122554779053,
0.16213175654411316,
-0.0354604721... | |
"http://www.w3.org/TR/html4/strict.dtd">
<HTML/
<HEAD/
<TITLE/>/
<P/>
``` | [
0.3974177837371826,
0.10062551498413086,
0.3653874397277832,
-0.1472405195236206,
-0.09622771292924881,
-0.2706194818019867,
0.28254252672195435,
-0.3190862536430359,
-0.26335763931274414,
-0.37527740001678467,
-0.6323896646499634,
0.3147616982460022,
0.12220796942710876,
0.191483914852142... | |
i'm having a memory issue while testing a find/replace function.
Say the search subject is:
```
$subject = "I wrote an article in the A+ magazine.
It'\s very long and full of words.
I want to replace every A+ instance in this text by a link
to a page dedicated to A+.
";
```
the string to be found :
```
$fin... | [
0.1780257374048233,
0.07628576457500458,
0.6246083974838257,
-0.15497484803199768,
-0.011097309179604053,
-0.1294746845960617,
0.365914523601532,
-0.18907751142978668,
0.07903893291950226,
-0.36506545543670654,
-0.11088437587022781,
0.7874662280082703,
-0.40755537152290344,
0.0734535008668... | |
. stripslashes($match[0]) . '</a>';
}
}
```
and the call:
```
$result = preg_replace_callback($find, 'replaceCallback', $subject);
```
now, the complete searched pattern is drawn from the database. As of now, it is:
```
$find = '/(?![^<]+>)\b(voice recognition|test project reference|test|synesthesia|S... | [
-0.018300862982869148,
0.047077726572752,
0.7752622961997986,
0.10348358005285263,
-0.09808405488729477,
0.3211590051651001,
-0.00584100466221571,
-0.2918015122413635,
-0.3753109574317932,
-0.4366903007030487,
-0.6168646216392517,
0.36855486035346985,
-0.365192711353302,
-0.343893826007843... | |
solved the memory issue, but i'm having new issues down the path: the subject returned by preg\_replace() is missing a lot of content...
UPDATE:
the content loss is due to using preg\_quote($find,'/');
It now works, except for... 'A+' which becomes 'A ' after the process.
Alright - I can see, now, why you're using t... | [
-0.01899200864136219,
-0.012038588523864746,
0.6670930981636047,
-0.23755872249603271,
-0.17588487267494202,
-0.08475398272275925,
0.36112141609191895,
-0.13708457350730896,
-0.07689086347818375,
-0.4583290219306946,
-0.26241737604141235,
0.718214213848114,
-0.5694788098335266,
0.020063143... | |
$urlVersion = urlencode( $match[1] );
return '<a class="tag" rel="tag-definition" title="Click to know more about ' . $htmlVersion . '" href="?tag=' . $urlVersion. '">' . $htmlVersion . '</a>';
}
return $match;
}
```
The stripslashes commands aren't going to do you any good.
As far as addressing... | [
0.24589787423610687,
-0.20895852148532867,
0.682481050491333,
-0.03782261162996292,
-0.41441217064857483,
-0.17307442426681519,
0.47998347878456116,
-0.21421167254447937,
-0.23643822968006134,
-0.47609764337539673,
-0.2668822407722473,
0.4790439009666443,
-0.4282008111476898,
0.01497496291... | |
I have a project that references the System.Web.Mvc assembly in the GAC. I also have the ASP.NET MVC source code from Codeplex. I want to get a better understanding of the DefaultControllerFactory by stepping through its methods. How could I set this up?
Thanks!
1. Compile the MVC code.
2. Uninstall the MVC (To make s... | [
0.8046063780784607,
0.030817128717899323,
0.19542457163333893,
-0.1019861027598381,
-0.41217997670173645,
-0.13301382958889008,
0.3544777035713196,
-0.23716066777706146,
-0.06060624495148659,
-0.49399515986442566,
-0.2291296124458313,
0.9523782730102539,
-0.40200212597846985,
0.11211635172... | |
I want to find low-level C/C++ APIs, equivalent with "write" in linux systems, that don't have a buffer. Is there one?
The buffered I/O such as fread, fwrite are not what I wanted.
Look at [CreateFile](http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx) with the FILE\_FLAG\_NO\_BUFFERING option | [
0.27972540259361267,
-0.03801700100302696,
-0.040111903101205826,
-0.060465212911367416,
0.25682878494262695,
-0.043581243604421616,
0.08906383812427521,
0.23969411849975586,
-0.28192073106765747,
-0.6464759707450867,
-0.10529018193483353,
0.453859806060791,
-0.2627118229866028,
-0.0144847... | |
I have a Javascript function that returns the innerHTML of a div. I am attempting to call this function from Actionscript and store the return value. I know that the Javascript function is being called because there is an alert that displays the return data, The data that is returned to Actionscript, however, is null. ... | [
0.3417360186576843,
0.1901523768901825,
0.28104323148727417,
-0.4587012529373169,
-0.196394681930542,
0.11250552535057068,
0.28197044134140015,
-0.3083142042160034,
-0.06043782830238342,
-0.618423581123352,
-0.12518607079982758,
0.6313635110855103,
-0.6173917055130005,
-0.0712592676281929,... | |
var retData:Object = ExternalInterface.call("JSFunc");
if(retData != null) {
textField.text = retData.toString();
} else {
textField.text = "Returned Null";
}
} else {
textField.text = "External Interface not available";
}
```
Like I said earlier, the alert shows up with the co... | [
-0.10528741776943207,
-0.2524197995662689,
0.6662822365760803,
-0.6187071204185486,
0.08703926205635071,
0.0020538053940981627,
0.6784262657165527,
-0.3165574073791504,
-0.005685717333108187,
-0.35760870575904846,
-0.5679430365562439,
0.985436201095581,
-0.5968359708786011,
0.0029564828146... | |
only test this in IE7 and IE8. Any advice on what to do would be much appreciated.
The source of the problem that I have been having has to do the object tag that I was using to embed the flash movie. I was using a tag that followed this example <http://www.w3schools.com/flash/flash_inhtml.asp>, I changed it to match t... | [
0.5142286419868469,
0.1643105149269104,
0.3299408257007599,
-0.353729784488678,
-0.07795942574739456,
-0.3809571862220764,
0.2842859625816345,
-0.26161617040634155,
-0.018574150279164314,
-0.5148957967758179,
0.25829657912254333,
0.8575760722160339,
-0.05418774113059044,
-0.185061901807785... | |
Should developers have administrator permissions on their PC or is giving them power user access sufficient?
Some comments:
* If they want to try out some new
application that would need
installing, then they could try it on
a virtual machine and later get the
network administrator to install it
for them. Do you thi... | [
0.6879780292510986,
0.08328009396791458,
0.056464795023202896,
0.331438809633255,
0.09681839495897293,
-0.08518258482217789,
0.3505599796772003,
-0.3662557899951935,
-0.22646518051624298,
-0.5484249591827393,
-0.012150269001722336,
0.7108355760574341,
0.1130204126238823,
-0.015894727781414... | |
whatever they happen to be developing), poke about the registry and run software that will not work properly without admin privileges (just to list a few items). There are a host of other tasks integral to development work that require administration privileges to do.
Bearing in mind that development staff do not nece... | [
0.551743745803833,
0.42461130023002625,
0.2013268917798996,
0.315678209066391,
0.22507484257221222,
-0.30771833658218384,
0.15786835551261902,
0.023962942883372307,
-0.16867248713970184,
-0.4426960051059723,
-0.5530272126197815,
0.5896820425987244,
0.2333855926990509,
0.31141093373298645,
... | |
to provide administrative access is that setting up a compromised or second rate development environment sends a message to your development staff:
> *'We value your work so little that we
> are prepared to significantly
> compromise your ability to do your job
> for no good reason. In fact, we are
> quite happy... | [
0.4647076725959778,
0.23736174404621124,
0.09859244525432587,
0.37161150574684143,
0.1695532202720642,
-0.12101012468338013,
0.2551920711994171,
0.39745622873306274,
0.05562908202409744,
-0.516234815120697,
-0.3992421627044678,
0.4540245831012726,
-0.015794461593031883,
0.05763796344399452... | |
of control freaks that view it as
> our perogative to tell you how to
> do your job and what you do or don't
> need to do it. Make do with what
> you're given and be grateful
> that you've got a job at all.'*
Generally, providing a second-rate (let alone fundamentally flawed) work environment for development staf... | [
0.35831308364868164,
0.1549590826034546,
-0.1372521072626114,
0.15193016827106476,
-0.06716195493936539,
-0.017840256914496422,
0.46109646558761597,
0.2037055939435959,
0.07146027684211731,
-0.1441081464290619,
-0.4461390972137451,
0.36793673038482666,
-0.3046586811542511,
0.22056660056114... | |
overtone of pandering to bureaucratic whim - is just irresponsible.
Bear in mind that your staff turnover doesn't just incur costs of replacing the staff. The most serious cost of staff turnover is that most of the ones that stick around will be the deadwood that can't get a better job. Over time this degrades the ca... | [
0.3262738585472107,
0.24807439744472504,
0.03069997765123844,
0.17055219411849976,
-0.10136253386735916,
-0.2333434373140335,
0.0527377612888813,
0.23214055597782135,
-0.3519776463508606,
-0.43879812955856323,
-0.23034603893756866,
0.5743851065635681,
0.1673828363418579,
0.4873432219028473... | |
On these platforms a user can do far more in their own domain without needing system-wide permissions. You will probably still want root or sudo access for developers, but not having this will get underfoot much less often. This flexibility is a significant but lesser known reason for the continuing popularity of unix-... | [
0.18578952550888062,
-0.09904032200574875,
-0.13175711035728455,
0.5194814801216125,
0.07024203985929489,
-0.4286419153213501,
-0.05254695937037468,
0.3567047715187073,
-0.30242592096328735,
-0.4523901045322418,
-0.33183470368385315,
0.5616939067840576,
0.2032412737607956,
0.05082368850708... | |
I'm on OS X (with bash) and a newbie at unix. I want to know if it's possible to amend some file such that to run a ruby program, I don't need "ruby file.rb", but instead can just run "ruby.rb".
Is there a reason NOT to do this?
Thanks!
Yes you can do this.
Assuming `ruby.rb` has something like this in it:
```
#!/u... | [
0.1259138584136963,
0.5167327523231506,
0.11757445335388184,
-0.24838778376579285,
-0.1331530660390854,
-0.25454968214035034,
0.8826096653938293,
0.268277645111084,
-0.31454551219940186,
-0.40702107548713684,
-0.10683198273181915,
0.4875394105911255,
-0.13809697329998016,
0.350754320621490... | |
produced in the last 20 years, the `env` command is known to live in `/usr/bin`, whereas Ruby installations are typically all over the place. (E.g., mine lives in `/home/joerg/jruby-1.2.0/bin/ruby`.) | [
0.36026090383529663,
0.36274784803390503,
0.1566782295703888,
-0.32073673605918884,
0.28674885630607605,
0.013357886113226414,
0.46466121077537537,
0.11640708893537521,
-0.029668694362044334,
-0.5002617835998535,
-0.3956274390220642,
0.2810266315937042,
0.3978867828845978,
0.41267418861389... | |
We're getting an odd bug in a production server. We have a stack trace, but no line numbers, so I know the method where the bug is, but not the exact line. It's complaining of a "Object reference not set to an instance of an object." Something is null.
After looking at the code, the only two potential culprits that I ... | [
0.24957768619060516,
-0.04492047429084778,
0.3226260244846344,
0.06284726411104202,
0.2574974596500397,
0.04496755450963974,
0.12682126462459564,
0.17486925423145294,
-0.45197880268096924,
-0.5077234506607056,
0.08057583123445511,
0.4359130561351776,
-0.3949691355228424,
0.4862629473209381... | |
this can happen. Am I barking up the wrong tree here? (This code seems to be running during the Load portion of the page lifecycle).
Do you have PDB output enabled for your release build?
If you do you would only need to deploy the pdb to your production server to get line numbers in your stack trace.
(pdb and dlls ... | [
0.41733938455581665,
0.0371614508330822,
0.4593753516674042,
-0.06888316571712494,
-0.10082138329744339,
-0.2848147749900818,
0.37402981519699097,
0.0990748405456543,
-0.5122039318084717,
-0.7318467497825623,
0.015910733491182327,
0.3721117675304413,
-0.39074355363845825,
-0.05414256080985... | |
I need to draw [ternary/triangle plots](http://en.wikipedia.org/wiki/Ternary_plot) representing mole fractions (*x*, *y*, *z*) of various substances/mixtures (*x* + *y* + *z* = 1). Each plot represents iso-valued substances, e.g. substances which have the same melting point. The plots need to be drawn on the same trian... | [
0.6531664133071899,
0.4113266170024872,
0.061678629368543625,
0.05510304495692253,
-0.08027231693267822,
-0.06489406526088715,
-0.0025032104458659887,
-0.31476810574531555,
-0.033159442245960236,
-0.39819738268852234,
0.11196881532669067,
0.24387653172016144,
-0.33817529678344727,
0.569513... | |
can draw multiple plots on the same triangle.
I need something that runs under Linux or Windows. I'm open to any suggestions, including libraries for other languages, e.g. Perl, PHP, Ruby, C# and Java.
R has an external package called [VCD](http://www.math.yorku.ca/SCS/vcd/) which should do what you want.
The docume... | [
0.29828765988349915,
0.01734914258122444,
0.32160109281539917,
0.08101910352706909,
-0.27994176745414734,
0.22541454434394836,
-0.10191812366247177,
-0.5322862863540649,
-0.04893621429800987,
-0.684889554977417,
0.1484362781047821,
0.48206835985183716,
-0.24411772191524506,
-0.049191191792... | |
method signature is very simple; only a single parameter (the m x 3 data matrix) is required; and all of the keyword parameters relate to the plot's aesthetics, except for scale, which when set to 1, normalizes the data column-wise.
To plot data points on the ternary plot, the coordinates for a given point are calcula... | [
0.06391634047031403,
-0.21945986151695251,
0.8318276405334473,
0.3921024203300476,
-0.0673825666308403,
0.3219010829925537,
-0.10509288311004639,
-0.3574230968952179,
-0.14364273846149445,
-0.5384561419487,
0.14859457314014435,
0.24649707973003387,
-0.05061352625489235,
0.29503265023231506... | |
represent four different chemical mixtures, each comprised of varying fractions of three substances (x, y, z). I scaled the input (so x + y + z = 1) but the function will do it for you if you pass in a value for its 'scale' parameter (in fact, the default is 1, which i believe is what your question requires). I used di... | [
0.5971158742904663,
0.23681522905826569,
0.33727186918258667,
0.17117173969745636,
-0.12368711829185486,
0.4386134743690491,
0.02600833587348461,
-0.6474749445915222,
-0.004581442102789879,
-0.10357534140348434,
0.04924290254712105,
0.15240469574928284,
-0.5331441760063171,
0.3283158242702... | |
What are some ways you can shoot yourself in the foot when using [`boost::shared_ptr`](http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm)? In other words, what pitfalls do I have to avoid when I use [`boost::shared_ptr`](http://www.boost.org/doc/libs/release/libs/smart_ptr/shared_ptr.htm)?
Cyclic refe... | [
0.293313592672348,
0.16333360970020294,
0.26984575390815735,
-0.14373697340488434,
0.12844547629356384,
0.19298133254051208,
0.06753548979759216,
-0.38859111070632935,
-0.3537973463535309,
-0.34511372447013855,
-0.11795378476381302,
0.45687156915664673,
-0.3715326488018036,
-0.002817970002... | |
child->set_parent(shared_from_this());
}
void frob() {
do_frob();
if (parent_) parent_->frob();
}
private :
void do_frob();
shared_ptr<node> parent_;
vector< shared_ptr<node> > children_;
};
```
In this example, you have a tree of nodes, each of which holds a pointer to its p... | [
-0.0337650403380394,
-0.2155226171016693,
0.39065054059028625,
-0.016779083758592606,
0.35044628381729126,
0.06531183421611786,
0.17121925950050354,
-0.11326158791780472,
-0.3112398087978363,
-0.6721283793449402,
-0.3105178773403168,
0.141578808426857,
-0.35495755076408386,
0.4918854236602... | |
you lose reference to the topmost node, then the topmost node still holds strong references to its children, and all its children also hold a strong reference to their parents. This means that there are circular references keeping all the instances from cleaning themselves up, while there is no way of actually reaching... | [
0.018757624551653862,
0.08232922852039337,
0.3142397701740265,
-0.034589238464832306,
0.6163053512573242,
0.09267961978912354,
0.334214985370636,
-0.11866641044616699,
-0.08793361485004425,
-0.761163055896759,
-0.37227749824523926,
0.24094867706298828,
-0.20916058123111725,
0.5204119086265... | |
child->set_parent(shared_from_this());
}
void frob() {
do_frob();
shared_ptr<node> parent = parent_.lock(); // Note: parent_.lock()
if (parent) parent->frob();
}
private :
void do_frob();
weak_ptr<node> parent_; // Note: now a weak_ptr<>
vector< shared_ptr<node> > child... | [
-0.12924571335315704,
-0.24448923766613007,
0.4579758048057556,
-0.11605983227491379,
0.6053529977798462,
0.09838864207267761,
0.06446980684995651,
-0.04996105656027794,
-0.18971297144889832,
-0.5774774551391602,
-0.4833597242832184,
0.12274378538131714,
-0.3415301442146301,
0.565924048423... | |
node goes out of scope as in the previous example, then while it holds strong references to its children, its children don't hold strong references to their parents. Thus there are no strong references to the object, and it cleans itself up. In turn, this causes the children to lose their one strong reference, which ca... | [
-0.3248705267906189,
-0.18735268712043762,
0.15052323043346405,
0.06573863327503204,
0.3604344427585602,
-0.14022746682167053,
0.6064937114715576,
0.07754829525947571,
-0.11880064010620117,
-0.7147447466850281,
-0.3145386278629303,
0.05906686186790466,
-0.273563951253891,
0.504557788372039... | |
Given a list of IP addresses how do I programmatically check if the local machine still has active TCP connections to these IP Addresses? I am using C#.
```
using System.Net.NetworkInformation
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
TcpConnectionInformation[] tcpInfoList = prope... | [
0.20048873126506805,
-0.053823474794626236,
0.5038038492202759,
0.28549453616142273,
0.19273589551448822,
-0.3259691894054413,
0.1444011777639389,
-0.14817243814468384,
-0.4611835479736328,
-0.7838695645332336,
-0.06374158710241318,
0.5136883854866028,
-0.3348698019981384,
0.26466339826583... | |
Is there a nicer way of doing the following:
```
try:
a.method1()
except AttributeError:
try:
a.method2()
except AttributeError:
try:
a.method3()
except AttributeError:
raise
```
It looks pretty nasty and I'd rather not do:
```
if hasattr(a, 'method1'):
... | [
-0.16702492535114288,
0.16976942121982574,
0.21610473096370697,
-0.2044963389635086,
-0.09305424243211746,
-0.027621865272521973,
0.3616950511932373,
-0.1978772133588791,
-0.17738744616508484,
-0.26403847336769104,
0.06263209134340286,
0.4654290974140167,
-0.3926135003566742,
-0.2734846472... | |
raise AttributeError
```
to maintain maximum efficiency.
Perhaps you could try something like this:
```
def call_attrs(obj, attrs_list, *args):
for attr in attrs_list:
if hasattr(obj, attr):
bound_method = getattr(obj, attr)
return bound_method(*args)
raise AttributeError
``... | [
-0.3128977417945862,
-0.017693279311060905,
0.5591726899147034,
0.054246265441179276,
-0.44944921135902405,
0.0012066606432199478,
-0.14018858969211578,
-0.603935718536377,
-0.18391691148281097,
-0.3057488203048706,
0.04948920011520386,
0.5155448317527771,
-0.3591516315937042,
-0.013880443... | |
pass them along after the list like so:
```
call_attrs(a, ['method1', 'method2', 'method3'], arg1, arg2)
``` | [
-0.08227545768022537,
0.2290736883878708,
0.364475280046463,
-0.21720358729362488,
0.0368209071457386,
0.13279132544994354,
0.11543246358633041,
-0.274451345205307,
-0.21509572863578796,
-0.25770682096481323,
-0.2115488350391388,
0.5125618577003479,
-0.3904932737350464,
-0.0405672378838062... | |
I have read this excellent [Multi-column list article](http://www.alistapart.com/articles/multicolumnlists), as well as [this question on SO](https://stackoverflow.com/questions/486349/dividing-long-list-of-li-tags-into-columns). I've come to the conclusion that there is no cross-browser way to turn a long unordered li... | [
-0.25130102038383484,
0.0866178348660469,
0.5860185623168945,
-0.3347685933113098,
-0.2490677833557129,
0.13560490310192108,
0.25494736433029175,
-0.45791611075401306,
-0.25164198875427246,
-0.4866788387298584,
-0.19068875908851624,
0.34220948815345764,
-0.5201181173324585,
0.0337146334350... | |
{
col2 = col2 + item.someProperty
}
else
{
col3 = col3 + item.someProperty
}
}
string allColumns = @"<ul>" + col1 + "</ul><ul>"
col2 + "</ul><ul>" + col3 + "</ul>";
Response.Write(allColumns);
```
Is there a simpler way to separate my list into groups of three, or better yet, ... | [
-0.2661539316177368,
0.002750779502093792,
0.7874526977539062,
-0.3125114440917969,
-0.2794908881187439,
0.2689703702926636,
0.14143134653568268,
-0.3120456635951996,
-0.3343670964241028,
-0.5673064589500427,
-0.3171430230140686,
0.1938227415084839,
-0.4379216432571411,
0.08524785190820694... | |
would choose to implement it.
```
const int numColumns = 3;
const int numColumns = 3;
var columnLength = (int)Math.Ceiling((double)myItemCollection.Count / 3);
for (int i = 0; i < myItemCollection.Count; i++)
{
if (i % columnLength == 0)
{
if (i > 0)
Response.Write("</ul>");
Respon... | [
-0.23765379190444946,
-0.07628776878118515,
0.6366296410560608,
-0.3782925009727478,
-0.09455709904432297,
0.20015482604503632,
0.44650399684906006,
-0.37583407759666443,
-0.07285419851541519,
-0.4172233045101166,
-0.22383323311805725,
0.4826141595840454,
-0.3677615225315094,
0.00620346376... | |
a stream, and if you weren't you'd want to xse `StringBuilder`) as well as those nasty floating point operations which could potentially cause inaccuracies for long lists (at the very least they're unnecesary).
Anyway, hope that helps... | [
0.42835086584091187,
0.04113245755434036,
0.19597291946411133,
0.3347938060760498,
0.0020926999859511852,
-0.14410972595214844,
0.31955569982528687,
0.45088323950767517,
-0.21567094326019287,
-0.2759888768196106,
0.026015087962150574,
0.2623690068721771,
-0.1389748901128769,
0.125712618231... | |
I understand that this is a very broad question, but a short “it depends” kind of answer will not be accepted. Strategies are born to deal with broad issues.
1. What issues should an application designer take into consideration when devising the error and exception handling strategy?
2. How the strategy will differ de... | [
0.32832422852516174,
0.4074637293815613,
-0.02817990817129612,
0.17769773304462433,
-0.03241575136780739,
0.06524062156677246,
0.16478535532951355,
-0.24655050039291382,
-0.21122533082962036,
-0.630713164806366,
0.1218068078160286,
0.6269803047180176,
-0.2449255883693695,
-0.17854520678520... | |
automatic admin notification).
* [Defence in depth](http://en.wikipedia.org/wiki/Defense_in_depth_%28computing%29) and robustness (failover contingency and fail-safe mechanisms, recovery against problems that are not yet known).
* Treating users and customers fairly (i.e. minimising the impact on software users and oth... | [
0.014620783738791943,
0.20781145989894867,
0.39304137229919434,
-0.1567748486995697,
-0.3625977337360382,
0.02222640998661518,
0.606020450592041,
-0.38427403569221497,
0.05656927451491356,
-0.5034938454627991,
-0.24008408188819885,
0.8613333702087402,
0.23486700654029846,
-0.31932315230369... | |
is certainly not. Most legacy systems I was asked to work on did not have a clear error handling strategy.
*Could this be made a community wiki?* No. It seems as a good question and good questions are hard to come up with.
*What do you mean by the strategy?* A long term plan that gives direction, focus, brings consi... | [
0.17670834064483643,
-0.009481688030064106,
-0.1479121297597885,
0.14106814563274384,
0.02514374442398548,
-0.26479649543762207,
0.29242780804634094,
-0.13818299770355225,
-0.37931695580482483,
-0.46781066060066223,
-0.1449529379606247,
0.4049682915210724,
-0.06507840007543564,
-0.11773122... | |
C](https://stackoverflow.com/questions/409563/best-practices-for-exception-management-in-java-or-c) and [Which and why do you prefer exceptions or return codes](https://stackoverflow.com/questions/99683/which-and-why-do-you-prefer-exceptions-or-return-codes))* These questions deal with a certain perspective on error ha... | [
0.2168463170528412,
0.4337308704853058,
0.058862242847681046,
0.04042763635516167,
0.17651204764842987,
0.03252268582582474,
-0.18326163291931152,
-0.16925041377544403,
-0.34700730443000793,
-0.4358866810798645,
-0.09022518992424011,
0.8502988815307617,
-0.30803579092025757,
-0.58237367868... | |
all the time where a failure could occur halfway through a process and cause wierd data inconsistencies because the entire operation was not rolled back properly.
3. Consider criticality when you handle exceptions. For example, if you have an online ordering system and part of that workflow is to have an e-mail sent to... | [
-0.025294726714491844,
0.1304546743631363,
0.141043022274971,
-0.017213303595781326,
-0.10584057122468948,
-0.052148327231407166,
0.36057785153388977,
-0.22538304328918457,
-0.39038151502609253,
-0.5527805089950562,
-0.3534783124923706,
0.4079838991165161,
-0.31369948387145996,
-0.03925095... | |
web app, embedded etc)? Is the software type important?*
1. For desktop type or embedded apps, recording information about the environment (os version, hardware, other apps running, etc) can be very useful when investigating error reports.
2. For enterprise apps and web apps, things like e-mail error notifications, SM... | [
0.47140270471572876,
0.31430190801620483,
0.07401575893163681,
0.23704804480075836,
0.043074388056993484,
-0.12497261166572571,
0.28528496623039246,
-0.11382844299077988,
-0.3414550721645355,
-0.6707268953323364,
-0.03296027332544327,
0.6663992404937744,
-0.38197994232177734,
-0.3813423812... | |
(user, developer, business support, management).*
1. From a user perspective, try to avoid errors by designing the interface in such a way that it is difficult for them to make mistakes. Don't ask questions that the user probably won't be able to answer (Abort, Retry, Fail anyone?)
2. From a developer perspective, you... | [
0.22767454385757446,
0.49721434712409973,
0.12822146713733673,
0.13657650351524353,
0.22363077104091644,
-0.02221556380391121,
0.3788158595561981,
-0.25279104709625244,
-0.23575253784656525,
-0.5694631338119507,
-0.31523463129997253,
0.634017825126648,
-0.27639326453208923,
-0.216768309473... | |
call/page/etc?) as well as the criticality and any possible side effects (e.g. if this batch job fails, what business processes will that affect?). Written documentation is your friend here. | [
0.406184583902359,
0.15450499951839447,
0.49887722730636597,
0.07894494384527206,
0.15649068355560303,
-0.17638279497623444,
0.242817685008049,
-0.025176892057061195,
-0.28454503417015076,
-0.742983341217041,
0.02548208273947239,
0.8095688223838806,
0.0027152157854288816,
-0.10422849655151... | |
What is the difference between Big Endian and Little Endian Byte order ?
Both of these seem to be related to Unicode and UTF16. Where exactly do we use this?
Big-Endian (BE) / Little-Endian (LE) are two ways to organize multi-byte words. For example, when using two bytes to represent a character in UTF-16, there are t... | [
-0.04420238360762596,
0.16603127121925354,
0.5242781639099121,
-0.27785658836364746,
-0.3663650453090668,
0.4211556911468506,
0.012736803852021694,
-0.23266908526420593,
-0.11053520441055298,
-0.5287407636642456,
-0.1849914789199829,
0.29611554741859436,
-0.12834471464157104,
-0.1436172574... | |
a **Byte Order Mark** (BOM) to the string, representing the character U+FEFF. So, if the first two bytes of a UTF-16 encoded text file are `FE`, `FF`, the encoding is UTF-16BE. For `FF`, `FE`, it is UTF-16LE.
A visual example: The word "Example" in different encodings (UTF-16 with BOM):
```
Byte Index: 0 1 2 3 ... | [
-0.10294392704963684,
0.2298678159713745,
0.6271018385887146,
-0.15278984606266022,
-0.07886011153459549,
0.41944581270217896,
0.1147727444767952,
-0.45683953166007996,
-0.25926080346107483,
-0.530027449131012,
-0.49495434761047363,
0.369937926530838,
-0.3177455961704254,
0.058935631066560... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.