text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
differences in the respective stacks mean you end up doing the same thing differently and if you do them the same for the purpose of comparison it's not a very realistic test.
PHP, which I like, is in its most basic form loaded with every request, interpreted and then discarded. It is very much like CGI in this respec... | [
0.28240489959716797,
0.024113770574331284,
0.3880462348461151,
-0.1661408245563507,
-0.32801759243011475,
-0.15540571510791779,
-0.10848088562488556,
-0.05371515452861786,
-0.28162702918052673,
-0.3449626863002777,
0.23206566274166107,
0.372942179441452,
-0.2330307811498642,
-0.22549697756... | |
PHP 6 and not an optional module like it is now).
But still PHP scripts are basically transient. Session information is (normally) file based and mutually exclusive (session\_start() blocks other scripts accessing the same user session until session\_commit() or the script finishes) whereas that's not the case in ASP.... | [
-0.11825500428676605,
-0.14359302818775177,
0.5212401747703552,
-0.06032048165798187,
-0.3629893362522125,
-0.3477151095867157,
0.4703664481639862,
0.11732921749353409,
-0.3765681982040405,
-0.3443119525909424,
0.09046213328838348,
0.38323336839675903,
-0.2270541489124298,
0.28313177824020... | |
whereas .Net/Java will nearly always use persistent connection pools and build on top of this to create ORM frameworks and the like, the caches for which are beyond any particular request.
As a bytecode interpreted platform, ASP.NET is theoretically faster but the limits to what PHP can do are so high as to be irrelev... | [
0.12782633304595947,
-0.016312312334775925,
0.31539976596832275,
0.2333497703075409,
-0.2944177985191345,
-0.3054324984550476,
0.3536367416381836,
-0.08254995197057724,
-0.5684556365013123,
-0.7346294522285461,
-0.14020444452762604,
0.11087185889482498,
-0.04493012651801109,
0.058921333402... | |
.Net has primitive types, type safety and these sorts of things that will make code faster than PHP can run it. If you want to do a somewhat unfair test, sort an array of one million random 64 bit integers in both platforms. ASP.NET will kill it because they are primitive types and simple arrays will be more efficient ... | [
0.146928071975708,
-0.059270862489938736,
0.12652212381362915,
0.30562955141067505,
-0.5596299171447754,
-0.31694379448890686,
0.3922381103038788,
0.04637231305241585,
-0.16822311282157898,
-0.7332322597503662,
0.11663467437028885,
0.2259608954191208,
-0.4421809911727905,
-0.15708045661449... | |
whereas PHP is interpreted on-the-fly (excluding opcode caching), which can make a difference but the flexibility of PHP in this regard is a good thing. Being able to deploy a script without bouncing your server is great. Just drop it in and it works. Brilliant. But it is less performant ultimately.
Ultimately though ... | [
0.5413950681686401,
-0.09593774378299713,
-0.197946697473526,
0.2050570398569107,
-0.4017857313156128,
-0.48605477809906006,
0.21936103701591492,
-0.023100746795535088,
-0.18146272003650665,
-0.4827888607978821,
0.15661486983299255,
0.6116093993186951,
-0.1578863561153412,
-0.4213169515132... | |
In spirit of the existing ["what's your most useful C/C++ snippet"](https://stackoverflow.com/questions/469696/what-is-your-most-useful-c-c-snippet) - thread:
Do you guys have short, monofunctional Python snippets that you use (often) and would like to share with the StackOverlow Community? Please keep the entries sma... | [
0.4801263213157654,
-0.024709342047572136,
0.34448039531707764,
0.2583361864089966,
-0.010892057791352272,
0.08569885790348053,
0.1275813728570938,
0.1700776368379593,
-0.5062805414199829,
-0.3874381482601166,
-0.23456859588623047,
0.21480035781860352,
-0.16231994330883026,
-0.194192379713... | |
pyfiles in os.walk(cur_path):
for pyfile in pyfiles:
if pyfile.endswith(".py") and pyfile not in ignore_set:
totalpath = os.path.join(pydir, pyfile)
loclist.append( ( len(open(totalpath, "r").read().splitlines()),
totalpath.split(cur_path)[1]) )
for li... | [
-0.10180509090423584,
-0.6763162016868591,
0.7555314898490906,
-0.0875658392906189,
0.10348489135503769,
0.5278587341308594,
0.11889734864234924,
-0.20517633855342865,
-0.4719029366970062,
-0.6988778114318848,
-0.42428767681121826,
0.396491676568985,
-0.2697928249835968,
-0.182998001575469... | |
(linenumbercount, filename)
print "\nTotal: %s lines (%s)" %(sum([x[0] for x in loclist]), cur_path)
```
Initializing a 2D list
While this can be done safely to initialize a list:
```
lst = [0] * 3
```
The same trick won’t work for a 2D list (list of lists):
```
>>> lst_2d = [[0] * 3] * 3
>>> lst_2d
[[0, 0, 0], ... | [
0.017801646143198013,
-0.31664663553237915,
0.7682633996009827,
-0.4231780767440796,
-0.02879989519715309,
0.22168812155723572,
0.06663759052753448,
-0.7581969499588013,
-0.1154380813241005,
-0.7630117535591125,
-0.12558971345424652,
0.27687129378318787,
-0.32478657364845276,
-0.1723052412... | |
0, 0], [0, 0, 0], [0, 0, 0]]
>>> lst_2d[0][0] = 5
>>> lst_2d
[[5, 0, 0], [0, 0, 0], [0, 0, 0]]
``` | [
0.11609716713428497,
0.16090838611125946,
0.5980735421180725,
-0.3279648721218109,
0.22405938804149628,
0.2290787398815155,
-0.25895559787750244,
-0.37451717257499695,
-0.19738450646400452,
-0.678352415561676,
-0.33555570244789124,
0.5438833832740784,
-0.36386892199516296,
0.11708126962184... | |
I have shoes raisins (0.r1134) [i686-darwin8.9.1] +video
I'm trying to set up a Shoes.setup block like this:
```
Shoes.setup do
gem 'mini_exiftool'
gem 'xml-simple > 1.0'
require "mini_exiftool"
require 'xmlrpc/client'
require 'xmlsimple.rb'
require "my_webservice_api_wrapper"
mwa = MyWebserviceApiWr... | [
0.9616942405700684,
-0.03774986043572426,
0.4706606864929199,
-0.04493408650159836,
0.21131166815757751,
-0.12090934813022614,
0.8493108153343201,
-0.7063456773757935,
-0.041629958897829056,
-0.5050245523452759,
0.039057668298482895,
0.9466235041618347,
-0.5724307894706726,
0.1709300577640... | |
when.
Any help appreciated. Shoes looks really cool.
I hope your login module doesn't use HTTPS as I don't think that is supported in Shoes yet. | [
0.7407289147377014,
-0.41283294558525085,
-0.02416304126381874,
0.2560043931007385,
0.1495935171842575,
-0.3916047215461731,
0.5597366094589233,
0.5015740990638733,
-0.3053310513496399,
-0.7673494815826416,
-0.008438573218882084,
0.4574311673641205,
0.08892807364463806,
-0.0566061213612556... | |
So with LINQ-to-SQL I know you can update the database from the LINQ objects and update the LINQ objects from the SQL.
I am using LINQ's **entity framework** (a.k.a. LINQ-to-entities) and I can update the entities from the SQL database, but I can't update the database schema by changing the entities.
This is frustra... | [
0.36370834708213806,
0.2890530228614807,
0.505939245223999,
0.069884292781353,
-0.1363145262002945,
-0.2801041305065155,
-0.0019291425123810768,
-0.285459041595459,
-0.1708608716726303,
-0.5100539326667786,
0.10759150981903076,
0.7635489702224731,
-0.513495147228241,
0.12733887135982513,
... | |
be generated from the model.
Something that is talked about for future versions. | [
0.7618663311004639,
-0.42093661427497864,
0.24416843056678772,
0.39671656489372253,
0.22614558041095734,
-0.06563131511211395,
-0.46449223160743713,
0.0030935429967939854,
0.10889981687068939,
-0.6889076232910156,
-0.10733835399150848,
0.4056348502635956,
0.02554740570485592,
0.08620017021... | |
OK, true confession first: Maybe it's just me, but sometimes "best practices for program settings" on Windows machines feels like it's changed more than Microsoft's data access strategies. I'm still running XP, and somewhere along the way just kind "glazed over" about where MS wanted me to store all my app's data, etc.... | [
0.3792581260204315,
0.11027310788631439,
-0.01898355595767498,
0.36450856924057007,
-0.09433802962303162,
-0.2863019108772278,
0.5880038738250732,
0.1884240359067917,
-0.14041216671466827,
-0.23373526334762573,
0.2796321213245392,
0.8515573740005493,
0.20105606317520142,
-0.171853542327880... | |
a big fan of using the registry for app settings -- I prefer using INI files, and have some older INI components that I use for the task (Raize, usually). I'm open to suggestions to other third-party components, if they'll make this easier / less hassle.
Basically, I need to store app settings (like remembering option... | [
-0.08578653633594513,
0.24887464940547943,
0.31685423851013184,
0.0365632027387619,
0.21510829031467438,
0.14577016234397888,
0.19905614852905273,
0.02550593949854374,
-0.3537781238555908,
-0.9375566840171814,
-0.10930265486240387,
0.7356230616569519,
-0.12368109077215195,
-0.1502958983182... | |
program?](https://stackoverflow.com/questions/269893/best-place-to-store-config-files-and-log-files-on-windows-for-my-program)
...so at least I'm not alone in this question... ; )
(w/apologies for what is somewhat of a repeat question, albeit from a slightly different angle).
It SOUNDS like I can just use %APPDATA... | [
-0.04488369822502136,
0.2128363698720932,
0.30345794558525085,
0.04896678775548935,
0.2872283160686493,
0.01956908404827118,
0.14797919988632202,
0.03325985372066498,
-0.4695762097835541,
-0.4664091169834137,
-0.07739904522895813,
0.7074457406997681,
-0.0737217515707016,
0.094801165163517,... | |
and all instances. Will the above accomplish that?
Head over to [Making Delphi programs Vista-Ready](http://www.theabsolute.net/sware/delphivista.html "example") and scroll down to the bottom for: "Where to save your application data?"
> function GetRoamingUserAppDataPath : string;
> //works so long as people have at... | [
0.19974081218242645,
-0.3214082419872284,
0.4447430670261383,
0.0855686143040657,
0.42894449830055237,
-0.3005390763282776,
0.40371349453926086,
-0.0013813867699354887,
-0.14224381744861603,
-0.8863233327865601,
-0.3509121239185333,
0.7400600910186768,
-0.27185940742492676,
-0.262509346008... | |
I know how to use `tee` to write the output ([standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29)) of `aaa.sh` to `bbb.out`, while still displaying it in the terminal:
```none
./aaa.sh | tee bbb.out
```
How would I now also write [standard error](https://en.wikipedia.org/wik... | [
0.8424400091171265,
0.3596178889274597,
0.2687969207763672,
-0.1579207181930542,
0.03748156502842903,
-0.13550414144992828,
0.3357667922973633,
-0.2028665989637375,
-0.20890618860721588,
-0.5281398892402649,
0.15064089000225067,
0.41735488176345825,
-0.16742253303527832,
0.1174682453274726... | |
and technically should be doing that in a `trap '...' EXIT`.
There is a better way to do this, and you've already discovered it: `tee`.
Only, instead of just using it for your standard output, have a tee for standard output and one for standard error. How will you accomplish this? Process substitution and file redire... | [
0.5797715187072754,
0.05163712054491043,
0.3527500331401825,
-0.09440823644399643,
0.05811138451099396,
-0.2923041880130768,
0.13482309877872467,
-0.5478540062904358,
-0.09838585555553436,
-0.8426627516746521,
-0.21638023853302002,
0.9970529675483704,
-0.41295722126960754,
-0.2368681281805... | |
is listening on.
The same thing for the second:
```
2> >(tee -a stderr.log >&2)
```
We use process substitution again to make a `tee` process that reads from standard input and dumps it into `stderr.log`. `tee` outputs its input back on standard output, but since its input is our standard error, we want to redirect... | [
0.5326787233352661,
0.009714082814753056,
0.29717952013015747,
-0.28669512271881104,
-0.063746377825737,
-0.20983104407787323,
0.1257554590702057,
-0.4591817259788513,
-0.19875729084014893,
-0.5676820874214172,
-0.04726463928818703,
1.2945683002471924,
-0.5075464248657227,
-0.0510491579771... | |
to `sh` (POSIX or Bourne).
---
In `sh`, you'd have to do things manually:
```
out="${TMPDIR:-/tmp}/out.$$" err="${TMPDIR:-/tmp}/err.$$"
mkfifo "$out" "$err"
trap 'rm "$out" "$err"' EXIT
tee -a stdout.log < "$out" &
tee -a stderr.log < "$err" >&2 &
command >"$out" 2>"$err"
``` | [
0.23461328446865082,
0.3542478084564209,
0.4509199559688568,
-0.46058759093284607,
-0.17281189560890198,
0.08686656504869461,
0.5194711685180664,
-0.5612375140190125,
-0.10540097951889038,
-0.3337183892726898,
-0.32003653049468994,
0.4801267683506012,
-0.4621352553367615,
-0.35462844371795... | |
How would I go about adding values from a tab delimited string to a plist?
```
(dolist (x *lines*)
(cl-ppcre:split "\t" x))
```
`*lines*` is a list of tab delimited strings loaded from a file, and I want to make a plist of the form
```
(:a value1 :b value2 :c value 3)
```
Thanks!
You should read the lines... | [
0.028593873605132103,
-0.03175532817840576,
0.7441567778587341,
0.017215143889188766,
-0.23414850234985352,
0.07332737743854523,
-0.02792474441230297,
-0.3209698796272278,
-0.24194979667663574,
-0.33812496066093445,
-0.17271244525909424,
0.48186221718788147,
-0.22881487011909485,
-0.331495... | |
value))
``` | [
-0.03935224935412407,
0.3384236991405487,
0.46862632036209106,
-0.26271024346351624,
-0.06897871941328049,
0.08809541165828705,
0.3055155873298645,
-0.36131182312965393,
0.01229234877973795,
-0.20849962532520294,
-0.3993319869041443,
0.748993992805481,
-0.3476622402667999,
0.57091403007507... | |
I've looked at several approaches to enterprise architecture for databases that store massive amounts of data, and it usually comes down to more hardware, database sharding, and storing JSON objects. Has any group been doing research, or does anyone have a more dynamic approach that processes the available data and tel... | [
0.29148048162460327,
0.0674319639801979,
-0.133496955037117,
0.27082446217536926,
0.2704007923603058,
-0.35617390275001526,
-0.19871382415294647,
0.22007647156715393,
-0.5198862552642822,
-0.47778838872909546,
-0.11388266831636429,
0.28350546956062317,
0.08184848725795746,
0.06412634253501... | |
What's the best way to make a website localized to multi languages?
I'm working on a website, and our manager wants it to be like:
<http://www.website.com> - default to english
<http://fr.website.com> - french
<http://de.website.com> - german
He says it's good for SEO, some developers wants to make it based on cooki... | [
0.1550026684999466,
0.11417269706726074,
0.3860470950603485,
0.0008532613865099847,
-0.058243390172719955,
-0.3686370849609375,
0.5270581841468811,
0.48492780327796936,
-0.303984135389328,
-0.635321319103241,
-0.2969953119754791,
0.22020281851291656,
-0.16635443270206451,
-0.08683659136295... | |
your localized content. | [
0.3338905870914459,
-0.0519736185669899,
0.3775610327720642,
0.2310386300086975,
-0.20831909775733948,
-0.5709941387176514,
0.18576647341251373,
0.7096118330955505,
-0.09790043532848358,
-0.8910277485847473,
-0.594063401222229,
0.36939921975135803,
-0.06735767424106598,
0.2023128718137741,... | |
I need a way to upload large files (600 mb to 4 gb) in an asp.net mvc website.
Currently I am using [swfupload](http://blog.codeville.net/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/); it works well enough, but it is a huge hit on the webserver because it sends it in one big upload, plus I have to set it ... | [
0.14192433655261993,
0.2747114896774292,
0.20442001521587372,
-0.2310820072889328,
-0.4632858633995056,
-0.06587331742048264,
0.1781168133020401,
-0.16251589357852936,
-0.5309735536575317,
-0.8496411442756653,
0.05158335343003273,
0.22423681616783142,
-0.046631935983896255,
0.1474539190530... | |
in mvc that uploads via chunking it up. Any ideas on how I could do this?
[Silverlight File Upload](http://www.codeplex.com/SilverlightFileUpld) | [
0.7736135721206665,
-0.009238812141120434,
0.06745563447475433,
-0.022094974294304848,
-0.24684856832027435,
-0.27298086881637573,
0.27435508370399475,
-0.14742501080036163,
-0.48579543828964233,
-0.4442194700241089,
0.12266639620065689,
0.3932851552963257,
-0.4294443428516388,
-0.01067372... | |
How do you guys treat empty strings with Oracle?
**Statement #1**: Oracle treats empty string (e.g. '') as NULL in "varchar2" fields.
**Statement #2**: We have a model that defines abstract 'table structure', where for we have fields, that **can't** be NULL, but **can** be "empty". This model works with various DBM... | [
0.13922162353992462,
0.16193340718746185,
-0.09850764274597168,
0.1837468445301056,
-0.2828483581542969,
-0.357438325881958,
0.19501890242099762,
-0.04203321039676666,
-0.269050657749176,
-0.2916525602340698,
-0.19720853865146637,
0.3754139542579651,
-0.30431777238845825,
0.097777850925922... | |
why I've never understood why Oracle is so popular. They don't actually follow the SQL standard, based on a silly decision they made many years ago.
The Oracle 9i SQL Reference states (this has been there for at least three major versions):
> Oracle currently treats a character value with a length of zero as null. Ho... | [
0.2203056812286377,
0.30971559882164,
-0.22819484770298004,
-0.16285479068756104,
-0.16998372972011566,
0.032865166664123535,
0.3955419063568115,
0.350722998380661,
-0.17122295498847961,
0.004397868178784847,
0.04318857192993164,
0.059007953852415085,
-0.20794421434402466,
0.21652588248252... | |
a sentinel value that cannot occur in your real data to represent NULL (e.g, "deoxyribonucleic" for a surname field and hope that the movie stars don't start giving their kids weird surnames as well as weird first names :-).
* have a separate field to indicate whether the first field is valid or not, basically what a r... | [
0.3565995395183563,
-0.014188670553267002,
-0.15940609574317932,
0.46684467792510986,
-0.2459486424922943,
-0.2045680284500122,
0.4909636974334717,
0.11818905174732208,
-0.07035034149885178,
-0.24300143122673035,
-0.06194761022925377,
0.05041881278157234,
-0.1740667223930359,
0.60991311073... | |
I am trying to workout how my silverlight application is going to work.
I want it to fill the browser.
I will have a like home page that will allow login.
Then it will open up a search page to list data
And then on selection goto the detail page of selected item.
But my question is how do I structure the app to go... | [
0.6126664876937866,
0.2149541825056076,
0.298252671957016,
0.4353555142879486,
-0.22051136195659637,
-0.16477543115615845,
-0.06745311617851257,
-0.1916828453540802,
-0.5935948491096497,
-0.39053115248680115,
0.00567994499579072,
0.17447714507579803,
-0.23462679982185364,
0.138790711760520... | |
easiest way to go about it in Silverlight 2.0 is to put a ContentControl in your Page, along with navigation controls (a menu or some buttons to select pages if you have several root pages).
Each "Page" is created as a user control, and you display it by setting the Content property of the contentcontrol to an instanc... | [
0.20001327991485596,
-0.12350592762231827,
0.6642298698425293,
0.18725593388080597,
-0.28088024258613586,
-0.5147672891616821,
0.06148012727499008,
-0.19822965562343597,
-0.1583346575498581,
-0.7601302862167358,
-0.2789611518383026,
0.1074315756559372,
-0.3975996971130371,
-0.1341459602117... | |
= New Details(SelectedItem.Id)
Let me know if you need more details, depneding on your proficiency with xaml and silverlight.
Side Note: Silverlight 3 comes with a built-in mechanism for that, but that's not gonna elp you right now.
EDIT: The Silverlight afficionados will have noted that there is no "Page" class in ... | [
0.27225354313850403,
0.06664688885211945,
0.3674485981464386,
0.22636839747428894,
-0.30138781666755676,
-0.3369257152080536,
0.5219417810440063,
-0.14429108798503876,
-0.08005843311548233,
-0.7701878547668457,
0.04019135609269142,
0.5736672878265381,
0.013492743484675884,
-0.2737148404121... | |
I'm writing an iPhone native app using the JSON framework.
My app is accessing web services using JSON. The JSON data we send has nested objects, below is an example of the data served up:
```
{
"model": {
"JSONRESPONSE": {
"authenticationFlag": true,
"sessionId": "3C4AA754D77BFBE3... | [
0.0338318757712841,
0.22560442984104156,
0.43407171964645386,
-0.07173068076372147,
0.29872244596481323,
0.16604337096214294,
0.6024186611175537,
-0.1603153496980667,
0.021661881357431412,
-0.67332524061203,
-0.26508674025535583,
0.4959091544151306,
-0.26265060901641846,
-0.258036285638809... | |
1,
"userName": "Joe Schmoe"
}
}
}
```
I'm having problem parsing using the objectForKey and valueForKey NSDictionary methods. I keep getting invalidArgumentException runtime errors.
For instance, I want to query the response data for the "authenticationFlag" element.
Thanks,
Mike
Seattle
It ... | [
0.24475835263729095,
0.4055079519748688,
0.17632551491260529,
-0.08257308602333069,
-0.10704756528139114,
-0.4258108139038086,
0.6577638983726501,
-0.011827458627521992,
-0.15369640290737152,
-0.7861585021018982,
-0.04552125558257103,
0.5450104475021362,
-0.6700536608695984,
-0.34316608309... | |
the json response, and only then ask the json response dictionary for the authenticationFlag value:
`[[[jsonDict objectForKey:@"model"]
objectForKey:@"JSONRESPONSE"] objectForKey:@"authenticationFlag"]`
2. perhaps you're using c-strings (`""`) rather than NSStrings (`@""`) as keys (although this would likely crash nas... | [
-0.1504637449979782,
-0.11047220230102539,
0.34529638290405273,
0.0007903785444796085,
-0.1487821787595749,
-0.15226317942142487,
0.2619886100292206,
-0.3416803777217865,
-0.10129310935735703,
-0.3259076178073883,
-0.41550636291503906,
0.5776178240776062,
-0.1173907145857811,
-0.1913996785... | |
Can't remember where I read it, but I remember a MS guy saying that once you create a reader around a System.IO.Stream, then the stream is not longer responsible for the disposal of the stream.
Is this true? Can someone confirm this? Maybe provide a reference.
This means the outer using in this code is redundant
```... | [
0.21925529837608337,
-0.08077643811702728,
0.29594025015830994,
0.13194437325000763,
0.22769831120967865,
-0.19124317169189453,
0.2513207197189331,
-0.2806723713874817,
-0.07333332300186157,
-0.604163408279419,
0.05488504096865654,
0.6738532185554504,
-0.3159330487251282,
0.336540281772613... | |
implementation were to change, however unlikely, your code would still be good. | [
0.6193239688873291,
0.11265469342470169,
0.13674810528755188,
0.110458604991436,
0.11550450325012207,
-0.10071969777345657,
0.29807454347610474,
-0.09421241283416748,
-0.06242135912179947,
-0.7002249956130981,
0.052306853234767914,
0.5117974877357483,
0.05669255927205086,
-0.31400910019874... | |
What are the best options for connecting PHP apps to logic located in .NET libraries?
PHP, since v5.0, supports [a DOTNET class](http://us2.php.net/manual/en/class.dotnet.php) that is supposed to let me invoke .NET logic from a PHP script. But it seems there are many problems - I've not been able to get it to work rel... | [
0.08437175303697586,
0.1513328105211258,
0.4636334478855133,
0.060665253549814224,
-0.004501786082983017,
0.04718753695487976,
0.23169195652008057,
0.11765466630458832,
-0.28889575600624084,
-0.6437919735908508,
0.2650164067745209,
0.6617528200149536,
-0.2744359076023102,
0.041721906512975... | |
- but this requires that the .NET class be ComVisible. And as far as I know, because of the COM requirement, this works on Windows only.
I've heard of the [Phalanger project](http://phalanger.codeplex.com/) but don't know many details. Does it work with arbitrary PHP scripts? Work on Linux? Does it have heavy perf or... | [
0.7172183394432068,
-0.128599151968956,
-0.15646617114543915,
0.35333219170570374,
-0.28662002086639404,
-0.28565940260887146,
0.0015370524488389492,
-0.0006572639103978872,
-0.30152368545532227,
-0.5793753266334534,
0.13208390772342682,
0.26538240909576416,
-0.3565041422843933,
0.12347414... | |
take advantage of them from different environments, including PHP. Examples might be encryption, logging, data access, clients to HPC clusters. The particular immediate scenario is a ZIP library with AES encryption, available in .NET.
I think the best way is to do it via COM. | [
0.5165156126022339,
-0.02486543357372284,
-0.06716618686914444,
0.37407010793685913,
0.2197781354188919,
-0.3400682210922241,
-0.010174470953643322,
0.09098509699106216,
-0.22879092395305634,
-0.6993266940116882,
-0.16555927693843842,
0.28176239132881165,
-0.22806532680988312,
-0.101298280... | |
I am in a situation where when I get an HTTP 400 code from the server, it is a completely legal way of the server telling me what was wrong with my request (using a message in the HTTP response content)
However, the .NET HttpWebRequest raises an exception when the status code is 400.
How do I handle this? For me a 4... | [
0.48754146695137024,
0.2556556463241577,
0.34708142280578613,
0.12254495918750763,
0.10102859139442444,
-0.3944210112094879,
0.5835838913917542,
-0.16105970740318298,
-0.22762411832809448,
-0.4956042766571045,
-0.029965637251734734,
0.32124534249305725,
0.1172909140586853,
0.24309198558330... | |
you catch WebException you can at least use the response:
```
using System;
using System.IO;
using System.Web;
using System.Net;
public class Test
{
static void Main()
{
WebRequest request = WebRequest.Create("http://csharpindepth.com/asd");
try
{
using (WebResponse respons... | [
0.2587258815765381,
-0.3139808177947998,
0.47110503911972046,
-0.08525054901838303,
-0.02593948505818844,
-0.018872343003749847,
0.5388062000274658,
-0.09636672586202621,
-0.028712671250104904,
-0.6916829347610474,
-0.38734734058380127,
0.2496195137500763,
-0.3053898513317108,
0.3626981377... | |
}
}
catch (WebException e)
{
using (WebResponse response = e.Response)
{
HttpWebResponse httpResponse = (HttpWebResponse) response; | [
-0.07536670565605164,
-0.665536642074585,
0.3803791403770447,
-0.17301006615161896,
-0.011117557995021343,
0.2339283674955368,
0.39509451389312744,
-0.46710333228111267,
0.017405536025762558,
-0.578335702419281,
-0.3348344564437866,
0.5187399387359619,
-0.5008772015571594,
-0.0392061471939... | |
Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
using (Stream data = response.GetResponseStream())
using (var reader = new StreamReader(data))
{
string text = reader.ReadToEnd(); | [
-0.4918016493320465,
-0.4121396243572235,
0.8721382021903992,
-0.03871176764369011,
0.3129933178424835,
0.22539833188056946,
0.1713276207447052,
-0.232779398560524,
0.31933706998825073,
-0.8955888152122498,
-0.3594144582748413,
0.6280328631401062,
-0.3508929908275604,
0.3585397005081177,
... | |
Console.WriteLine(text);
}
}
}
}
}
```
You might like to encapsulate the "get me a response even if it's not a success code" bit in a separate method. (I'd suggest you still throw if there isn't a response, e.g. if you couldn't connect.)
If the error response may be large (whi... | [
-0.12200067937374115,
-0.13103409111499786,
0.45458054542541504,
0.17490814626216888,
0.22577926516532898,
-0.05956806242465973,
0.4417386054992676,
-0.2565036714076996,
0.028374038636684418,
-0.7529692649841309,
-0.3910027742385864,
0.7056728601455688,
-0.11727149039506912,
0.059192385524... | |
the whole error. | [
0.2384224832057953,
0.22424179315567017,
0.20553544163703918,
0.03305664658546448,
0.06648930162191391,
-0.007829619571566582,
0.30884963274002075,
0.22665762901306152,
-0.10386861860752106,
-0.07343272864818573,
0.2890722453594208,
0.2559492588043213,
-0.2699812650680542,
0.00783068500459... | |
Is there a way to identify in which OS we are running mono, with C# code?
Some sort of Hello World, but instead of using a fixed string as an output use the current OS?
Try `System.Environment.OSVersion`
You can also detect if your code is run under Mono or MS.NET:
```
if (Type.GetType("Mono.Runtime") != null)
{
... | [
0.5792761445045471,
0.17419718205928802,
0.13906994462013245,
0.21025840938091278,
0.2867802679538727,
-0.20017483830451965,
0.4829203188419342,
-0.06347911059856415,
-0.36836084723472595,
-0.37576189637184143,
-0.1807868331670761,
0.8788275122642517,
-0.34895026683807373,
0.12825472652912... | |
I have a question about `boost::shared_ptr<T>`.
There are lots of thread.
```
using namespace boost;
class CResource
{
// xxxxxx
}
class CResourceBase
{
public:
void SetResource(shared_ptr<CResource> res)
{
m_Res = res;
}
shared_ptr<CResource> GetResource()
{
return m_Res;
}
private:... | [
0.18180224299430847,
-0.3248652517795563,
0.6102941632270813,
-0.12577469646930695,
0.26801127195358276,
0.1443687081336975,
0.275200217962265,
-0.4138435423374176,
-0.3165677487850189,
-0.5500093698501587,
-0.31015852093696594,
0.8282564282417297,
0.009881600737571716,
0.2786864936351776,... | |
}
// Thread_B:
shared_ptr<CResource> nowResource;
base.SetResource(nowResource);
//...
```
Q1
--
If **Thread\_A** do not care the `nowResource` is the newest, will this part of code have problem?
I mean when **Thread\_B** do not `SetResource()` completely, **Thread\_A** get a wrong smart point by `GetR... | [
0.013855675235390663,
0.060964830219745636,
0.2474784404039383,
-0.08791687339544296,
0.3076225817203522,
-0.4104051887989044,
0.19641339778900146,
-0.2035628855228424,
-0.511991024017334,
-0.4328153729438782,
-0.4009529650211334,
0.7678971886634827,
-0.18118685483932495,
0.332432717084884... | |
be
> "read" (accessed using only const
> operations) simultaneously by multiple
> threads. *Different* `shared_ptr`
> instances can be "written to"
> (accessed using mutable operations
> such as `operator=` or reset)
> simultaneously by multiple threads
> (even when these instances are copies,
> and share the... | [
0.618823766708374,
-0.18260416388511658,
0.5025985836982727,
-0.11462961137294769,
0.005867552012205124,
0.07016026228666306,
0.4503864645957947,
-0.48891931772232056,
0.06763824075460434,
-0.7767192721366882,
-0.2589697241783142,
0.8917698860168457,
-0.4236018657684326,
0.3078247010707855... | |
`SetResource`/`GetResource`. | [
0.23804567754268646,
-0.289710134267807,
-0.10988947749137878,
0.3695806562900543,
0.09076684713363647,
-0.4446796774864197,
-0.09098750352859497,
0.12938494980335236,
-0.37840360403060913,
-0.6056400537490845,
-0.8127665519714355,
0.2411309778690338,
0.08249969035387039,
-0.14505611360073... | |
I have two questions.They both are concerning a void in C++,which I am trying to translate in C#.
C++ code
```
void Func_X_2(LPBYTE stream, DWORD key, BYTE keyByte)
{
stream[0] ^= (stream[0] + LOBYTE(LOWORD(key)) + keyByte);
stream[1] ^= (stream[1] + HIBYTE(LOWORD(key)) + keyByte);
stream[2] ^= (stream[2] + LOBYTE(HI... | [
-0.03373106196522713,
-0.04172201454639435,
0.3448639512062073,
-0.14902392029762268,
-0.10442913323640823,
0.24835291504859924,
-0.1112523153424263,
-0.36216986179351807,
0.0033674261067062616,
-0.4758061170578003,
-0.2908972203731537,
0.7279314994812012,
-0.21138647198677063,
-0.16655613... | |
called:
C++ code
```
Func_X_2((LPBYTE)keyArray, dwArgs[14], keyByte);
```
keyArray is a DWORD(UInt32),dwArgs is an array of dword.KeyByte is a byte.
Thanks in advance.
LPBYTE is a pointer to a byte array. The equivalent in C# would be a variable of type byte[]. So you could translate your function like so:
```
pub... | [
-0.04785102605819702,
-0.0560285821557045,
0.5549297332763672,
-0.02685154229402542,
0.011150783859193325,
-0.022060096263885498,
-0.07482240349054337,
-0.3186400830745697,
-0.05460105836391449,
-0.358633428812027,
-0.5454495549201965,
0.7787784337997437,
-0.4018622934818268,
-0.0673590898... | |
stream[6] ^= (byte)(stream[6] + BitConverter.GetBytes(HiWord(key))[0]);
stream[7] ^= (byte)(stream[7] + BitConverter.GetBytes(HiWord(key))[1]);
}
public static int LoWord(int dwValue)
{
return (dwValue & 0xFFFF);
}
public static int HiWord(int dwValue)
{
return (dwValue >> 16) & 0xFFFF;
}
``` | [
-0.01961534656584263,
-0.267671674489975,
0.5405205488204956,
-0.3504839241504669,
0.3641148805618286,
0.05633868649601936,
0.3377770781517029,
-0.3623243272304535,
0.2889041602611542,
-0.4877396821975708,
-0.47057145833969116,
1.0345011949539185,
-0.3574851453304291,
0.22653554379940033,
... | |
I am a newbie to python. I do have two modules. Model M1 and module m2.
From m2 , i need to refer m1 and m2 and m1 resides at two different locations in disk.
When I am trying to import m1 before executing m2 , of course it's saying can't find m1.
How I can point my interpreter to m1's location.
Thanks
J
It's not *e... | [
0.22195513546466827,
0.15356774628162384,
-0.011009449139237404,
-0.2859169840812683,
0.20154322683811188,
0.012726042419672012,
0.5194050669670105,
0.017711957916617393,
-0.3610678017139435,
-0.6447702050209045,
-0.08512970805168152,
0.702802836894989,
-0.36494916677474976,
-0.00830096937... | |
PYTHONPATH
* Manipulating sys.path before importing
However, if m2 depends on m1, and they're distributed together, perhaps it's a better idea to place them in the same directory tree using [packages](http://www.packtpub.com/article/writing-a-package-in-python). | [
0.4067244231700897,
-0.3469146490097046,
-0.1026734858751297,
-0.3465479612350464,
-0.34347259998321533,
-0.17715781927108765,
0.28033074736595154,
-0.245278999209404,
-0.2455059438943863,
-0.4027016758918762,
0.001666454249061644,
0.45403939485549927,
-0.9019189476966858,
-0.5349043011665... | |
I am trying to pass a variable frm php to a javascript function, however a space keeps getting appeneded, and I can not see how.
The relevant php code snippet:
```
<p><a href='#' onclick=\"makewindows(" . $html . "); return false;\">Click for full description </a></p>".$brand."
<p><a href=\"#\" onclick=\"dele... | [
0.06205432862043381,
0.29661500453948975,
0.8541587591171265,
-0.2587330937385559,
-0.11841278523206711,
-0.022613290697336197,
0.3063693046569824,
-0.012810220941901207,
0.29687923192977905,
-0.4032752513885498,
-0.2817245125770569,
0.2568575441837311,
-0.15776367485523224,
0.222414806485... | |
that is genereated for deleteRec however, clearly contains a space, and I don't know where it is coming from.
```
<a href="#" onclick="deleteRec('190274380300', ' o', '2', '250343889611')">DELETE</a>
```
Do var\_dump($brand) and look closely - there's almost certainly a space in it!
In which case, you can guard aga... | [
0.07634701579809189,
0.0047073629684746265,
-0.1262447088956833,
-0.184732124209404,
0.43782445788383484,
-0.15487788617610931,
0.13121716678142548,
0.00490711210295558,
0.013967109844088554,
-0.885297954082489,
-0.13387951254844666,
0.07713042199611664,
-0.2208085060119629,
0.386771917343... | |
I was just reading about RDBMS,
and one property of an RDBMS is
atomicity. So, if money is withdrawn
from an account and transferred to
another, either the transaction
will happen completely or not
at all. There are no partial
transactions. But how is actually
ensured?
Sql queries for the above scenario
might look lik... | [
0.25790709257125854,
0.048065200448036194,
0.3644477427005768,
0.20042289793491364,
0.3829079270362854,
-0.2500815689563751,
-0.13935114443302155,
-0.20320169627666473,
-0.4718936085700989,
-0.1947520524263382,
-0.2081388235092163,
0.5347394943237305,
-0.2515579164028168,
0.068270467221736... | |
amount WHERE ac_num = 102
COMMIT TRANSACTION
```
The database system will write notes to what is has done for changes on account 101. And then if the work on account 102 would fail, the RDBMS uses those notes to undo the work on 101.
Furthermore, when it has started work on account 101 is takes a lock on the databas... | [
0.16204364597797394,
0.2792532444000244,
0.4119405150413513,
-0.2284550666809082,
0.17467810213565826,
-0.05860116705298424,
-0.14322379231452942,
-0.30456647276878357,
-0.4044781029224396,
-0.4261723458766937,
-0.019289933145046234,
0.5395171046257019,
-0.09053104370832443,
0.205592572689... | |
I want to do something like this in TSQL (SQL Server 2005):
```
IF (Column1 = x)
{
--CTE statement
}
ELSE
{
--SQL statement
}
```
Any help is appreciated.
Is that part of a query? or on its own?
Outside of `SELECT`, you have:
```
IF ([test])
BEGIN
[true branch]
END
ELSE
BEGIN
[false branch]
END
... | [
-0.16569207608699799,
-0.11120661348104477,
0.3938351571559906,
-0.024106308817863464,
-0.020817147567868233,
-0.3010195195674896,
0.11584289371967316,
-0.028925487771630287,
-0.28545016050338745,
-0.49581384658813477,
-0.01418481208384037,
0.38210391998291016,
-0.3221558928489685,
0.13563... | |
I have a file. When I open it in Notepad I see charachters in a single line. However, if I open that file in any other application like [WordPad](http://en.wikipedia.org/wiki/WordPad) or [Notepad++](http://en.wikipedia.org/wiki/Notepad++). I can see irregular line breaks between charachters and they appear in multiple ... | [
0.015529144555330276,
0.08464254438877106,
0.3448905646800995,
-0.15850380063056946,
-0.11365081369876862,
0.08546781539916992,
0.33521753549575806,
-0.06111910566687584,
-0.1497805118560791,
-0.8410462737083435,
-0.15730132162570953,
0.1942494958639145,
-0.05901148542761803,
-0.0080210864... | |
(var reader = new StreamReader(stream, Encoding.ASCII))
{
var lineBuilder = new StringBuilder();
string line;
char currentChar;
int nextChar;
while (!reader.EndOfStream)
{
currentChar = (char)reader.Read();
nextChar = reader.Peek();
if (!(currentChar == '\r' && nextChar ... | [
-0.5825981497764587,
-0.7788189053535461,
1.0530245304107666,
-0.28758689761161804,
0.17095690965652466,
0.5319489240646362,
0.4619881510734558,
-0.33027365803718567,
0.007633588742464781,
-0.43100905418395996,
-0.6871557831764221,
0.3772897720336914,
-0.35459914803504944,
0.36682659387588... | |
}
if((currentChar == '\r' && nextChar == '\n') || nextChar == -1)
{
line = lineBuilder.ToString();
Console.WriteLine(line);
lineBuilder = new StringBuilder();
reader.Read();
}
}
}
``` | [
-0.5278343558311462,
-0.4072704315185547,
0.9025919437408447,
-0.3850836753845215,
0.38595718145370483,
0.1255137175321579,
0.31931889057159424,
-0.2999224364757538,
-0.06871556490659714,
-0.48902925848960876,
-0.4597325026988983,
0.3976821005344391,
-0.21421153843402863,
0.343970537185668... | |
### Duplicate:
> [Cross-platform gui toolkit for deploying Python applications](https://stackoverflow.com/questions/520015/cross-platform-gui-toolkit-for-deploying-python-applications)
I want to create a GUI application in python. Which library is best one?
From the question [Cross-platform gui toolkit for deploying ... | [
0.08577518910169601,
0.21038617193698883,
0.40990766882896423,
0.2712778151035309,
0.018103068694472313,
0.07159285247325897,
0.012853570282459259,
-0.00376113411039114,
-0.21060888469219208,
-0.507792055606842,
-0.07593636214733124,
0.4039660394191742,
-0.4456665813922882,
0.0402178764343... | |
by Nokia. The bindings
> for Python are developed by Riverbank.
>
>
> Nokia announced that they'd start to
> use LGPL for the Qt-Framework starting
> with Qt 4.5 (to be released in April,
> I think), but it's not yet sure if
> Riverbank follows this and releases
> the bindings for Python under LGPL
> too. (The... | [
0.4622216820716858,
0.2346954196691513,
0.3686670958995819,
0.02609866112470627,
-0.2260580211877823,
0.04007355868816376,
0.26411232352256775,
-0.2158544510602951,
0.10073386877775192,
-0.45533066987991333,
-0.2306642234325409,
0.4241836369037628,
-0.5055082440376282,
0.029997149482369423... | |
(Like SQL, networking…)
>
>
> Qt doesn't use native GUI elements,
> but wikipedia mentions that in recent
> versions [Qt uses native
> widgets](http://en.wikipedia.org/wiki/Qt_toolkit#Use_of_native_UI-rendering_APIs) where
> possible. I haven't found evidence in
> [the documentation but for Mac OS
> X](http://d... | [
0.17704741656780243,
-0.022605206817388535,
0.39469021558761597,
-0.03300626203417778,
-0.4684032201766968,
-0.17452752590179443,
0.46745267510414124,
-0.27347853779792786,
0.15638278424739838,
-0.8265426158905029,
-0.3079727590084076,
0.3833957016468048,
-0.3830428719520569,
0.19928516447... | |
is usable.
>
>
> One thing I should mention is that I
> found a bug in the tab-view despite
> the fact that I didn't use anything
> advanced. (Only on Mac OS X) I think
> [wxWidgets](http://www.wxwidgets.org/) isn't as
> polished as [Qt](http://qt.nokia.com/).
>
>
> wxPython is really only about the
> GUI-cla... | [
-0.11956803500652313,
0.05912860855460167,
0.27738478779792786,
0.05204160884022713,
-0.22475379705429077,
-0.06363495439291,
0.3960610628128052,
-0.04092399403452873,
0.03896182402968407,
-0.8281874060630798,
0.10553190112113953,
0.8613126277923584,
-0.1323871910572052,
-0.132657065987586... | |
I'm currently building a small website where I write down problems that arise and answers to them for others to see. Currently I'm using a DAL much like the one described [here](http://weblogs.asp.net/scottgu/archive/2006/01/15/435498.aspx). Now I have been looking at other models, and in particular linq based models u... | [
0.19552692770957947,
0.1935521960258484,
0.12726221978664398,
-0.19565482437610626,
-0.42006024718284607,
0.0956389456987381,
0.0007433400605805218,
-0.26187747716903687,
-0.12934909760951996,
-0.5700644850730896,
0.06306861340999603,
0.25406262278556824,
-0.1204197034239769,
0.13739338517... | |
and nullable types became not nullable when I changed something in the DB. Then if I would reimport the tables into the data table my queries would be lost.
My simple question is really, if you want a good DAL for ASP.net today, what would that be? Suggestions, experiences are more than welcome.
I personally preffer *... | [
0.4096619486808777,
-0.009531223215162754,
0.11502806842327118,
0.17804424464702606,
-0.17388904094696045,
-0.14173755049705505,
-0.268084317445755,
-0.15658165514469147,
-0.30208832025527954,
-0.685237467288971,
0.11285974830389023,
-0.007370700594037771,
-0.16390104591846466,
-0.01327468... | |
when I need maximum control over it's functionality and implementation.
Other alternatives are: [NHibernate](http://www.hibernate.org/), [SubSonic](http://subsonicproject.com/), different ORM solutions like [LLBLGen Pro](http://www.llblgen.com/).
---
Great books on this subject:
* [Pro LINQ: Language Integrated Que... | [
-0.2549673020839691,
0.05638628825545311,
0.029162339866161346,
0.13804620504379272,
-0.23884116113185883,
-0.12392348796129227,
0.3494808077812195,
-0.5009567141532898,
-0.21006515622138977,
-0.34406131505966187,
-0.17879371345043182,
0.7020336985588074,
0.008507574908435345,
-0.345575064... | |
I usually like to create the database connection myself and control its lifetime manually with `using{}'. For example:
```
SqlConnection sqlConnection = new SqlConnection( connectionString );
using( sqlConnection ) {
BusinessObject myBusinessObject = new BusinessObject( sqlConnection );
// do stuff with the bu... | [
0.35234734416007996,
0.35439229011535645,
0.12996135652065277,
-0.059823065996170044,
0.11765918880701065,
-0.33382630348205566,
0.3892991244792938,
0.12396149337291718,
-0.31414559483528137,
-0.8693051934242249,
0.12862525880336761,
0.5210740566253662,
-0.4119564890861511,
0.7038560509681... | |
the connection in the Dispose() method.
```
using( BusinessObject myBusinessObject = new BusinessObject() ) {
// do stuff with myBusinessObject
...
}
```
The problem I'm having is that it might not be that obvious that the business object needs to be disposed unless you see it in use.
How would you guys do ... | [
0.3707367777824402,
0.14959238469600677,
0.07174207270145416,
0.08351603150367737,
0.11810090392827988,
-0.2795226275920868,
-0.11725348234176636,
-0.06036590039730072,
-0.2120526134967804,
-0.6295981407165527,
0.1074969545006752,
0.6227331161499023,
-0.5256520509719849,
0.4148422181606293... | |
the code in each of your business objects. Your repository or context would be disposable so that it could clean up after itself. @Marc's suggestion that you follow the Unit of Work pattern is a good one.
You might want to look at LINQtoSQL, nHibernate, Subsonic, etc. to either use them or at least for ideas on how to... | [
0.5985627770423889,
0.14087124168872833,
-0.10867606103420258,
0.3985818922519684,
0.00600071158260107,
0.014214792288839817,
0.2183154672384262,
0.1775456815958023,
-0.24754659831523895,
-0.5235670804977417,
0.08499875664710999,
0.4842371642589569,
0.013671422377228737,
-0.029601173475384... | |
I'm going to make a small site which requires advanced search capabilities. Since reinventing the wheel isn't such a worthwhile activity, I've done a little googling and found there are some PHP based search frameworks, one of which is integrated into Zend framework.
What I would like to have in the framework:
1. Bot... | [
0.2278449386358261,
-0.032087016850709915,
0.2822326123714447,
0.3034226596355438,
-0.08914395421743393,
-0.13812677562236786,
-0.07918880879878998,
0.062030743807554245,
-0.256730318069458,
-0.480837345123291,
0.12538520991802216,
0.5073770880699158,
0.018002929165959358,
0.04579680413007... | |
there any (free) frameworks that could meet the above requirements? Suggestions, tips and ideas are more than welcome. It'd be great if you could share your experiences implementing a search system.
Have a look at **Omega** (based on Xapian) - [a link to the Xapian project page](http://xapian.org/features)
You can int... | [
0.5146896243095398,
-0.33595654368400574,
0.026015128940343857,
0.6021592020988464,
-0.15542851388454437,
-0.2993362545967102,
0.22223374247550964,
0.14553935825824738,
-0.10912676155567169,
-0.6083539724349976,
-0.1050615906715393,
0.4703049659729004,
-0.19025330245494843,
-0.031953137367... | |
option) would off course be [Apache Lucene](http://lucene.apache.org/java/docs/features.html) --> it's this one that is included in the Zend framework you referenced ("Zend Search"). It can do all the same tricks, although i personally prefer Xapian.
**Edit:** be aware that Omega (and Xapian) are GPL whereas Apache Lu... | [
0.050961535423994064,
-0.4654773473739624,
0.41998594999313354,
0.04038641229271889,
0.15009668469429016,
-0.24247804284095764,
-0.08949606865644455,
0.022076139226555824,
0.06641971319913864,
-0.5720053315162659,
-0.2802952229976654,
0.6073634028434753,
-0.1909179985523224,
-0.19336570799... | |
using: VS2008, C#
I have a COM dll I need to use in a .NET project. In there I have a class with a method that returns an IDictionary object. IDictionary is defined in the COM dll so I'm not sure if it's the same as IDictionary in .NET.
My problem: I know the dictionary keys and I want to retrieve the values. The doc... | [
0.01762116700410843,
0.07956667989492416,
0.22976480424404144,
0.059316229075193405,
0.09472375363111496,
0.008550001308321953,
0.15476663410663605,
-0.13543088734149933,
-0.09828662872314453,
-0.6115887761116028,
0.14621077477931976,
0.5455948710441589,
-0.28734254837036133,
0.07866840064... | |
reckons this dictionary object (interface) has the following methods and properties:
```
Cast<>
Count
Equals
GetEnumerator
GetHashCode
GetMultiple
GetType
let_Value
OfType<>
Prefix
PutMultiple
ToString
```
Sorry if this is a silly question, but I can't see how to retrieve a value passing a key.
Groovy classes are pu... | [
0.33661404252052307,
0.2454189509153366,
0.4299195110797882,
-0.3126331865787506,
-0.1601066142320633,
0.23770277202129364,
0.23402151465415955,
-0.48970985412597656,
-0.3424500823020935,
-0.24069608747959137,
0.1024523451924324,
0.578839123249054,
-0.10167770832777023,
-0.1825440526008606... | |
Is there any way to eager load a named\_scope from an association?
I have my Article model:
```
class Article < ActiveRecord::Base
has_many :comments
end
```
and my Comment model:
```
class Comment < ActiveRecord::Base
belongs_to :article
named_scope :approved, :conditions => { :approved => true }
named_s... | [
0.2007530927658081,
-0.08486714959144592,
0.10025358945131302,
0.09384128451347351,
-0.2315247356891632,
-0.299079567193985,
0.1619505137205124,
-0.447879821062088,
-0.24690860509872437,
-0.6127932071685791,
0.1901881992816925,
0.5377421379089355,
-0.33068734407424927,
-0.2717673182487488,... | |
Post: <http://ryandaigle.com/articles/2008/8/20/named-scope-it-s-not-just-for-conditions-ya-know>
Github Repo: <http://github.com/yfactorial/utility_scopes>
[Updated per comment]
My bad. I didn't read well enough. I don't think there's anything that will let you call on an association named\_scope like that. The clos... | [
0.4325944483280182,
0.11185164749622345,
0.32141661643981934,
-0.04655782878398895,
-0.37118834257125854,
-0.40538427233695984,
0.6466946005821228,
0.31832006573677063,
-0.23443864285945892,
-0.5409365296363831,
-0.32154732942581177,
0.3336317837238312,
-0.22662734985351562,
-0.00845085643... | |
I've written an application in C# that moves jpgs from one set of directories to another set of directories concurrently (one thread per fixed subdirectory). The code looks something like this:
```
string destination = "";
DirectoryInfo dir = new DirectoryInfo("");
DirectoryInfo subDirs = dir.G... | [
0.09891542047262192,
-0.2320273518562317,
0.6777809262275696,
-0.12174888700246811,
0.17909592390060425,
-0.17093561589717865,
-0.07424522936344147,
-0.06639167666435242,
-0.36104291677474976,
-0.5862482786178589,
-0.13812881708145142,
0.2836958169937134,
-0.4482136070728302,
0.32442706823... | |
foreach (FileInfo f in files)
{
f.MoveTo(destination);
}
}
```
However, the performance of the application is horrendous - tons of page faults/sec. The number of files in each subdirectory can get quite large, so I think a big performance penalty comes from a context sw... | [
-0.18592295050621033,
0.11706680804491043,
0.6222752332687378,
-0.10324207693338394,
0.22770704329013824,
-0.04770633578300476,
0.3829340934753418,
-0.09520893543958664,
-0.06597278267145157,
-0.6930923461914062,
-0.3003532290458679,
0.6665509343147278,
-0.15718409419059753,
0.131066367030... | |
where it can't keep all the different file arrays in RAM at the same time, such that it's going to disk nearly every time.
There's a two different solutions that I can think of. The first is rewriting this in C or C++, and the second is to use multiple processes instead of multithreading.
Edit: The files are named b... | [
0.1713986098766327,
-0.13493594527244568,
0.3374822735786438,
0.1409657597541809,
0.45328739285469055,
0.19899211823940277,
-0.12148337811231613,
0.06601220369338989,
-0.6745041012763977,
-0.7093911170959473,
-0.278506338596344,
0.42044714093208313,
-0.13240210711956024,
0.3480940759181976... | |
for threading.
Any suggestions?
**Reconsidered answer**
I've been rethinking my original answer below. I still suspect that using fewer threads would probably be a good idea, but as you're just *moving* files, it shouldn't actually be that IO intensive. It's possible that just *listing* the files is taking a lot of d... | [
0.6719384789466858,
0.043534040451049805,
0.11823774874210358,
-0.010706559754908085,
-0.06104788929224014,
0.0725712701678276,
0.1642216295003891,
0.06825589388608932,
-0.7938845157623291,
-0.7653678059577942,
0.28621506690979004,
0.5625455379486084,
-0.04988979175686836,
0.13075943291187... | |
idea, IMO.)
I suggest the following plan of attack:
* Work out where the bottlenecks actually are. Try fetching the list of files but not doing the moving them. See how hard the disk is hit, and how long it takes.
* Experiment with different numbers of threads, with a queue of directories still to process.
* Keep an ... | [
0.28255313634872437,
-0.031071698293089867,
0.10165993124246597,
0.26410990953445435,
-0.007960970513522625,
0.08988514542579651,
0.15185457468032837,
-0.18596911430358887,
-0.4621369242668152,
-0.5899496674537659,
-0.08139486610889435,
0.7062292695045471,
-0.11636926233768463,
-0.08870337... | |
except you're doing it with the disk instead.
It makes sense to parallelise tasks which use IO if there's *also* a fair amount of computation involved, but if it's already disk bound, asking the disk to work with lots of files at the same time is only going to make things worse.
You may be interested in a benchmark (... | [
0.012592589482665062,
-0.16134005784988403,
0.20924043655395508,
-0.019279971718788147,
-0.07939841598272324,
0.07715211063623428,
0.01168686244636774,
-0.029858456924557686,
-0.5544717907905579,
-0.6315054893493652,
-0.02048182301223278,
0.5860927104949951,
-0.08706042915582657,
-0.318203... | |
I am currently working on a program which sniffs TCP packets being sent and received to and from a particular address. What I am trying to accomplish is replying with custom tailored packets to certain received packets. I've already got the parsing done. I can already generated valid Ethernet, IP, and--for the most par... | [
0.479846328496933,
0.08538424968719482,
0.08340074867010117,
0.0912252739071846,
-0.038673367351293564,
-0.5209903717041016,
0.13327348232269287,
0.10823560506105423,
0.007072380743920803,
-0.7145177125930786,
0.01573774591088295,
0.2952715754508972,
-0.2943750023841858,
-0.048552103340625... | |
a TCP connection is established, each side generates a random number as its initial sequence number. It is a strongly random number: there are security problems if anybody on the internet can guess the sequence number, as they can easily forge packets to inject into the TCP stream.
Thereafter, for every byte transmitt... | [
-0.03391449153423309,
-0.1961487978696823,
0.4356582760810852,
0.1633116453886032,
-0.07732303440570831,
-0.08300567418336868,
-0.2973247766494751,
-0.07663509994745255,
-0.28471219539642334,
-0.10006724298000336,
-0.19574306905269623,
0.10794612020254135,
-0.46252381801605225,
0.504460930... | |
I'm looking for a good IDE for C++ that has most or all of the following properties (well, the first 4 or 5 ones are mandatory):
1. cross-platform (at least Mac, Linux)
2. of course, syntax highlighting and other basic coding editor functionality
* reasonably responsive GUI, not too sluggish on mid-size (say, 100 fi... | [
0.14323265850543976,
0.045393068343400955,
0.3717765212059021,
0.13583607971668243,
-0.004288389813154936,
-0.3348841667175293,
0.1939806491136551,
-0.023318691179156303,
0.060645271092653275,
-0.9519720673561096,
-0.049257420003414154,
0.4530511498451233,
-0.07996886223554611,
-0.12441084... | |
function/class name and it brings you to the declaration),
* can show code parts that (potentially) call my function (I know that's hard to do for C++ so I added the *potentially*)
So far, I've been using [Emacs](http://www.gnu.org/software/emacs/) for everything, but I think advanced features that give me more overv... | [
0.074176125228405,
-0.11100324243307114,
0.19310522079467773,
-0.10154861211776733,
-0.3120768070220947,
0.09984860569238663,
-0.030109893530607224,
-0.017250660806894302,
-0.19438831508159637,
-0.5922884345054626,
-0.17886999249458313,
0.6455138921737671,
-0.2801668047904968,
-0.044967226... | |
my requirements. Has anyone actually used them for daily coding? What are the differences? What are your experiences? [Code::Blocks](http://www.codeblocks.org/) is more lightweight and doesn't do many of the things listed above, right?
Note: I don't need a GUI builder.
**Update:** With the bullet point 10 I mean that... | [
0.3593558669090271,
0.03663288429379463,
0.4258382022380829,
-0.0037210697773844004,
-0.10712264478206635,
-0.14003396034240723,
0.2678450644016266,
-0.36064955592155457,
-0.10103554278612137,
-0.7614352703094482,
-0.05120377615094185,
0.4892423450946808,
-0.13370713591575623,
-0.117152996... | |
lightweight solition thaen Eclipse or NetBeans, but if you like the minimalist approach it's pretty good.
To summarise CB versus your requirements:
1. Yes
2. Yes
3. Yes
4. Yes
5. Yes
6. No - but you can add it easily
7. No
8. No, but similar functionality
9. No
10. Can go from definition to decl and vice versa, but n... | [
0.443058043718338,
0.2749263346195221,
0.0896139070391655,
0.03465668484568596,
-0.36117616295814514,
-0.06351087242364883,
-0.15798000991344452,
-0.29087206721305847,
-0.31168124079704285,
-0.4923382103443146,
0.25639066100120544,
0.383861780166626,
-0.40734854340553284,
-0.14751435816287... | |
I am an OS X user. Often, I need to share architectural, workflow and other data with managers and developers in a visual fashion.
Can anyone recommend me some software and tell me why it's awesome?
I love OmniGraffle for diagrams
<http://www.omnigroup.com/applications/omnigraffle/>
Easy to use, the result really look... | [
0.6218799948692322,
0.2943457067012787,
0.35298070311546326,
0.019323386251926422,
-0.10823796689510345,
-0.22260239720344543,
-0.02706214226782322,
0.38612255454063416,
-0.33761274814605713,
-0.7715864777565002,
0.12217862159013748,
0.24515439569950104,
0.010166797786951065,
0.09312018007... | |
> This is NOT a question on plain old boring customization; I actually want to create an program, you know, with source code, etc...
I'm thinking about programming my own media centre interface, and I figured it'd look better if I coded my own splash screen for when the OS is loading.
*Note:* The media centre interfa... | [
0.6146203279495239,
-0.07406631112098694,
0.42303603887557983,
0.13818083703517914,
-0.3317582607269287,
-0.1454048603773117,
0.21265314519405365,
0.3461063504219055,
-0.2999556064605713,
-0.7455762028694153,
-0.013849550858139992,
0.5156865119934082,
-0.055295590311288834,
0.0517379604279... | |
like some sort of animated progress bar for example? I assume that I won't be able to code any 2D/3D graphics (as that'd require X to be running, right?), so how would I go about generating that?
I'd prefer to do this in C++, but C is also an option.
*Note:* I'm not looking to use any existing "themes" or anything li... | [
0.5349409580230713,
0.04954583942890167,
0.09922763705253601,
0.2904892563819885,
-0.3890632390975952,
-0.24591639637947083,
0.16978730261325836,
0.3128252923488617,
-0.3938431143760681,
-0.714508593082428,
-0.01430290937423706,
0.4600948989391327,
-0.26795387268066406,
-0.0595644637942314... | |
in to the boot screen application that I will make.
I'm not tied to a Linux distro, so this can be for anything, although Debian or a Debian-based distro would be nice.
I like the suggestion about loading the X server early and running a loading screen from there, however is there not a more direct approach? Surely y... | [
0.5782967805862427,
0.01010780781507492,
0.33004674315452576,
0.17633166909217834,
-0.16844739019870758,
-0.47782930731773376,
0.15774957835674286,
0.30431604385375977,
-0.06742051988840103,
-0.7880552411079407,
-0.0831465870141983,
0.7774626016616821,
-0.07850541174411774,
-0.033902894705... | |
suggestions have been looking at the *source code* for applications like splashy and fbsplash. Can anyone better this suggestion?
For the graphical output you can use the [Linux framebuffer](http://en.wikipedia.org/wiki/Linux_framebuffer), for application development you can use gtk which support rendering directly to ... | [
0.5304304361343384,
-0.17529726028442383,
0.18363793194293976,
0.11974620819091797,
-0.6603574752807617,
-0.06308245658874512,
-0.10727964341640472,
-0.024395348504185677,
-0.35655102133750916,
-0.819134533405304,
-0.21798977255821228,
0.2500438392162323,
-0.42467963695526123,
0.2248755842... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.