text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
to change later and will pay the time investment of its implementation quickly. It can be consistently applied and easily recognized by maintenance programmers in the future. Overall, it contributes to the good function and lowers cost of maintenance over the life of the product. * "Bad" - This technique may work in th...
[ 0.4544672667980194, -0.0014111256459727883, 0.5889024138450623, 0.2083846777677536, 0.4256940186023712, -0.002809541765600443, 0.24350319802761078, 0.0038518391083925962, -0.019284017384052277, -0.939772367477417, -0.2448500692844391, 0.5602445602416992, -0.005338601768016815, 0.0536916181...
It is subjectively applied and inconsistent and may be a surprise or not easily recognizable by maintenance programmers in the future. Overall, it contributes to the ultimate increasing cost of maintaining and/or operating the product and inhibits or prevents changes to the product. By inhibiting or preventing change, ...
[ 0.3099782466888428, 0.37707358598709106, 0.2523249685764313, 0.12326127290725708, 0.19714383780956268, -0.03789191320538521, 0.0327308252453804, -0.35271674394607544, -0.0532958097755909, -0.17798952758312225, -0.11691538989543915, 0.7260739207267761, -0.19637295603752136, 0.10457687079906...
where, and when would I use this principle?] ### Exceptions [When wouldn't I use this principle, or where might it actually be harmful?] ### Objections [Note any dissenting opinions or objections from the community here] Separation of Concerns Prefer Aggregation to Mixin-style Inheritance -------------------------...
[ 0.4202580749988556, 0.1353185772895813, 0.000942808052059263, 0.07770202308893204, 0.09199200570583344, -0.6269185543060303, 0.20034056901931763, -0.20307332277297974, -0.14380793273448944, -0.1913549154996872, -0.22595691680908203, 0.5174892544746399, -0.4232560992240906, 0.26968222856521...
be used as a direct member Convert this: ``` class Foo : private boost::noncopyable { ... }; ``` To this: ``` class Foo { ... private: boost::noncopyable noncopyable_; }; ``` ### Example (Lockable object): Java introduced the `synchronized` keyword as an idiom to allow any object to be used in a threads...
[ 0.035796869546175, -0.18621359765529633, 0.16545657813549042, -0.008857890963554382, -0.2774314880371094, 0.11766870319843292, 0.058536771684885025, -0.33342355489730835, -0.3643563389778137, -0.12211322039365768, -0.138457253575325, 0.30218616127967834, -0.7945418953895569, 0.314441114664...
mechanism. If inheritance is used for anything besides an Is-A relationship, overall code clarity is reduced. With deeper chains, mixin base classes greatly increase the likelihood of a "Diamond of Death" scenario, wherein a subclass ends up inheriting multiple copies of a mixin class. Applicability ------------- An...
[ 0.2244550883769989, -0.08867523074150085, -0.16995184123516083, 0.1715427041053772, -0.12241770327091217, -0.2616136074066162, 0.5056999325752258, -0.34741929173469543, -0.3309912085533142, -0.41494014859199524, -0.41529422998428345, 0.5535385608673096, -0.4836604595184326, 0.2294787913560...
Can I convert a bitmap to PNG in memory (i.e. without writing to a file) using only the Platform SDK? (i.e. no libpng, etc.). I also want to be able to define a transparent color (not alpha channel) for this image. **The GdiPlus solution seems to be limited to images of width divisible by 4**. Anything else fails dur...
[ 0.5627454519271851, -0.3218876123428345, 0.4375542402267456, 0.26542332768440247, -0.11035054922103882, 0.15344850718975067, 0.02172277681529522, -0.10201454907655716, -0.6182137727737427, -0.8022478818893433, 0.12819622457027435, 0.5155394673347473, -0.24367809295654297, -0.26688659191131...
quad width. The bounty will go to anyone who can solve this width issue (without changing the image dimensions), or can offer an alternative non-GDI+ solution that works. I read and write PNGs using [libpng](http://www.libpng.org/pub/png/libpng.html) and it seems to deal with everthing I throw at it (I've used it in un...
[ 0.295385479927063, -0.18015389144420624, 0.7177189588546753, -0.012077773921191692, -0.62715744972229, -0.04250440374016762, 0.16401126980781555, -0.2983931303024292, -0.374142587184906, -0.4809619188308716, 0.10541097074747086, 0.9604347348213196, -0.039600297808647156, -0.187354743480682...
[PNG IO extension](http://stlab.adobe.com/gil/html/group___p_n_g___i_o.html), but unfortunately that takes `char*` filenames and if you dig into it the `png_writer` and `file_mgr` classes in its implementation it seem pretty tied to `FILE*` (although if you were on Linux a version using fmemopen and in-memory buffers c...
[ -0.08790316432714462, 0.1590258777141571, 0.24940559267997742, -0.13213659822940826, -0.31960901618003845, 0.047147154808044434, -0.08423177897930145, 0.04343322291970253, -0.2808334529399872, -0.4269126057624817, -0.07379864901304245, 0.361952543258667, -0.35448163747787476, -0.0289162565...
How can I change `CSS` from `javascript`. I'm using `jQuery-ui Dialog` and I want to change the style of a `DIV` from javascript. Thanks Check out [the jQuery documentation](http://docs.jquery.com/CSS/css). If you want anything it will be there. Anyhow, if you want to add styles to elements, you need to use the `cs...
[ 0.26655441522598267, -0.06454447656869888, 0.2667863070964813, -0.09891735017299652, -0.08752889931201935, 0.13299153745174408, 0.0758216604590416, -0.1537710279226303, -0.27104637026786804, -0.8937787413597107, -0.1569349467754364, 0.48132145404815674, -0.3658972382545471, -0.166809082031...
you're setting multiple things at once. If you want to check what a property is currently set to, you would use a variant of the 2nd option, just omit the value. ``` var color = $("div#mydiv").css('background-color'); ``` Would make the var `color` be `red` if you already set it above, for example. You can also ad...
[ 0.47026944160461426, -0.18118250370025635, -0.0801328793168068, -0.1502165049314499, 0.18180648982524872, 0.005492092575877905, 0.21021679043769836, -0.2472015768289566, -0.24035699665546417, -0.6345247030258179, -0.2231941670179367, 0.5283595323562622, -0.4851979613304138, 0.2495236545801...
Does anyone have any suggestions as to how I can clean the body of incoming emails? I want to strip out disclaimers, images and maybe any previous email text that may be also be present so that I am left with just the body text content. My guess is it isn't going to be possible in any reliable way, but has anyone tried...
[ 0.8418704867362976, -0.059725984930992126, 0.17799396812915802, 0.19427870213985443, 0.08947794139385223, 0.010331321507692337, 0.28197187185287476, 0.339453786611557, -0.3944481611251831, -0.6655024886131287, 0.02431541308760643, 0.3061063587665558, -0.06448856741189957, -0.13544932007789...
can't really well "sanitize" your emails, but some things you can look for: 1. Line starting with "> " (greater than then whitespace) marks a quote 2. Line with "-- " (two hyphens then whitespace then linefeed) marks the beginning of a signature, see [Signature block on Wikipedia](http://en.wikipedia.org/wiki/Signatur...
[ 0.5397014617919922, 0.05641027167439461, 0.5807932615280151, 0.13367252051830292, 0.09672870486974716, -0.44057491421699524, 0.6399257779121399, -0.14115849137306213, 0.05526512488722801, -0.609325647354126, -0.009351332671940327, -0.05992046743631363, -0.29473865032196045, 0.1392693966627...
Hey, i am currently working on a django app for my studies, and came to the point of l18n. Localizing the site itself was very easy, but now i have to allow users, to translate the dynamic content of the application. Users can save "products" in the database and give them names and descriptions, but since the whole sit...
[ 0.2514958083629608, 0.23898302018642426, 0.24589359760284424, -0.1762896329164505, -0.14662332832813263, -0.38769638538360596, 0.07103224843740463, 0.333772212266922, -0.1362709403038025, -0.4727882444858551, -0.05738251656293869, 0.2541831433773041, -0.1980842798948288, 0.2600058913230896...
in the datamodel) Thanks, Janosch I would suggest checking out [django-multilingual](http://code.google.com/p/django-multilingual/). It is a third party app that lets you define translation fields on your models. Of course, you still have to type in the actual translations, but they are stored transparently in the da...
[ 0.07572758942842484, 0.21770377457141876, 0.14795678853988647, 0.18965284526348114, -0.040489088743925095, -0.054047808051109314, 0.01851787231862545, 0.2197587639093399, -0.23500216007232666, -0.5728515982627869, -0.05996522307395935, 0.3753518760204315, -0.293144553899765, -0.34254002571...
In general I'd like to understand which templates to use when, when I'm making new iPhone apps. Could anyone offer some guidelines, tips, rules-of-thumb? Also, how much should I agonize over this? If I start off with the wrong one, can I add the missing pieces manually, is it hard? For reference here are the choices ...
[ 0.5070611238479614, 0.1503240168094635, 0.2773990035057068, 0.1863141655921936, 0.07345906645059586, 0.18946728110313416, 0.001010474399663508, -0.00008941183477872983, -0.42605775594711304, -0.7618623375892639, -0.035209912806749344, 0.6485654711723328, -0.4092310070991516, -0.21040561795...
Navigation-Based Application. 2. If you're writing a game (or something that looks like one), then OpenGL. 3. If you're writing something like 'Calendar', then use Tab Bar App. Hope this helps.
[ -0.058594752103090286, -0.16779664158821106, 0.5700296759605408, 0.3106171488761902, -0.2014322429895401, -0.16996292769908905, -0.07012614607810974, 0.3783128261566162, -0.1403258591890335, -1.0395305156707764, -0.21753591299057007, 0.6877101063728333, -0.2909511923789978, -0.376920551061...
I would like to load a specific ConfigurationSection but the way the CLR loads the assemblies is giving me some trouble: My CustomConfigurationSection definition is on a specific assembly which cannot be found by the overall process of assembly loading, because I'm using an external tool which basically loads my assem...
[ 0.5614239573478699, 0.15806955099105835, 0.1755409985780716, 0.03814084455370903, 0.21100221574306488, -0.15211737155914307, 0.022008594125509262, -0.08866865187883377, -0.4056922197341919, -0.4011150896549225, -0.01803094521164894, 0.7046489119529724, -0.086190365254879, 0.291749477386474...
sure as I'm using SysInternals Process Monitor. Can someone provide some workaround or directions? Thanks! If you know the path to your assembly, then you should try ConfigurationManager.OpenExeConfiguration(exePath).
[ 0.38409921526908875, -0.10064920037984848, 0.05336771160364151, 0.30983099341392517, 0.0967034250497818, -0.2578723430633545, 0.4988217353820801, 0.4801703095436096, -0.3341202735900879, -1.067233681678772, -0.1176980584859848, 0.6317980289459229, -0.0822184681892395, 0.25920674204826355, ...
I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it ref...
[ 0.33045026659965515, -0.12219349294900894, 0.3914646804332733, 0.15760721266269684, 0.10718375444412231, 0.09636794775724411, 0.013330758549273014, -0.189108744263649, -0.13903963565826416, -0.8714686036109924, 0.40986961126327515, 0.6412839889526367, -0.11284679919481277, 0.06614211946725...
row of DataTypeTwo by doing ``` new_record = DataTypeTwo.new new_record.save! ```
[ -0.09546452760696411, 0.28488078713417053, 0.41539472341537476, -0.15436123311519623, 0.2753767967224121, -0.072355717420578, 0.023727264255285263, -0.2875446081161499, -0.27402788400650024, -0.7173242568969727, -0.03425922244787216, 0.4377920925617218, -0.5329955816268921, 0.3930365443229...
I am a 10year+, C++ linux/windows developer and I have been asked to estimate the effort to port the windows application to OS X. I haven't developed on OS X before,so I don't know what to expect. It is a C++/Qt application, so I want to ask: what are the de facto tools like editor, IDE, compiler, make tool, etc ? Wh...
[ 0.3728685677051544, 0.36843568086624146, 0.44655492901802063, 0.012656331062316895, -0.13667629659175873, -0.10873401910066605, 0.26986250281333923, -0.1345858871936798, 0.01393552590161562, -0.9230804443359375, -0.22925569117069244, 0.4253135323524475, -0.04354318976402283, 0.179066225886...
free (comes with the install DVD or can be downloaded from apple. The XCode IDE is quite different from that of Visual Studio, and it seems to me as if it were more familiar to Codewarrior. I don't know if there are any tools to convert VS projects to XCode, but there are tools as [CMake](http://www.cmake.org/) where ...
[ 0.8939604759216309, -0.13301904499530792, 0.06602862477302551, 0.21554748713970184, -0.18451955914497375, -0.4696482717990875, 0.24298883974552155, -0.261191725730896, -0.2843303084373474, -0.5601409673690796, -0.2568448483943939, 0.5413443446159363, -0.13353493809700012, -0.19176888465881...
don't define how you are used to work. For example, if you used KDevelop, then it is directly available under MacOSX. Also, some people are more dependent than others on the tools the IDE provide (source navigation, for example). Finally, compiler errors are different in Microsoft compilers and g++ (used both in linux...
[ 0.5349847078323364, 0.17704053223133087, 0.15996335446834564, 0.2595314383506775, -0.14737434685230255, -0.17966236174106598, 0.1489579975605011, 0.08353903144598007, 0.032227396965026855, -0.7139723300933838, -0.2058604657649994, 0.6292405128479004, -0.2660684585571289, -0.043714586645364...
how do I bind a `std::ostream` to either `std::cout` or to an `std::ofstream` object, depending on a certain program condition? Although this invalid for many reasons, I would like to achieve something that is semantically equivalent to the following: ``` std::ostream out = condition ? &std::cout : std::ofstream(filen...
[ 0.025586623698472977, -0.06475792825222015, 0.5728798508644104, -0.0851200520992279, 0.05781031399965286, -0.36755573749542236, 0.32760047912597656, -0.242590993642807, 0.027436504140496254, -0.4900829792022705, -0.23969429731369019, 0.6486095190048218, -0.3985467851161957, 0.0161300506442...
//1 if (argc > 1) fp = new std::ofstream(argv[1]); //2 else fp = &std::cout //3 *fp <<
[ 0.07581308484077454, -0.13024963438510895, 0.7427288293838501, -0.4797622263431549, -0.010853009298443794, 0.12712368369102478, 0.12979505956172943, -0.5081369876861572, 0.04291132092475891, -0.39512866735458374, -0.03930682688951492, 0.5745788812637329, -0.5045724511146545, -0.23466664552...
"Hello world!" << std::endl; //4 if (fp!=&std::cout) delete fp; } ``` Does anyone know a better, exception-safe solution? ``` std::streambuf * buf; std::ofstream of; if(!condition) { of.open("file.txt"); buf = of.rdbuf(); } else { buf = std::cout.rdbuf(); } std::ostream o...
[ -0.29724541306495667, 0.2040044665336609, 0.7062303423881531, -0.4731895625591278, 0.43265673518180847, 0.2999128997325897, 0.4806016981601715, 0.1695614457130432, 0.03757783770561218, -0.8717216849327087, -0.3860095739364624, 0.511668860912323, -0.6551453471183777, 0.3408155143260956, 0...
just want that everything going to `std::cout` goes into a file, you can aswell do ``` std::ofstream file("file.txt"); std::streambuf * old = std::cout.rdbuf(file.rdbuf()); // do here output to std::cout std::cout.rdbuf(old); // restore ``` This second method has the drawback that it's not exception safe. You possib...
[ 0.09128498286008835, -0.04561619833111763, 0.7601659297943115, -0.2291579693555832, 0.7079765200614929, -0.14465758204460144, 0.3853997588157654, -0.12289727479219437, -0.2949070930480957, -0.7267298102378845, -0.4668017327785492, 0.9788228869438171, -0.5546407103538513, 0.0854680985212326...
of.open("file.txt", std::ios_base::out); std::ofstream of("file.txt"); { // or: opiped raii(&of, std::cout); opiped raii(of.rdbuf(), std::cout); std::cout << "going into file" << std::endl; } std::cout << "going on screen" << std::endl; } ``` Now, whatever happens, std::cout is...
[ 0.04808073490858078, -0.01926451362669468, 0.799068033695221, -0.2791166603565216, 0.480352520942688, -0.014643697068095207, 0.33506885170936584, 0.006445425562560558, -0.019236767664551735, -1.0605037212371826, -0.5464547276496887, 0.6413596272468567, -0.3790012001991272, 0.13826243579387...
I am trying to do some very simple form validation checking for null or '' (empty) using a conditional, but when I submit my form with ALL BLANK FIELDS, it does the latter section of my code. And when I fill out all of my fields it does that other part. So when they are blank, tell the user, which is the first section...
[ 0.5325033068656921, 0.2441188544034958, 0.07909529656171799, -0.19272774457931519, 0.006853331811726093, 0.07299017906188965, 0.41349703073501587, -0.0816972404718399, -0.0018368761520832777, -0.4775698184967041, -0.18081115186214447, 0.5137776732444763, -0.03696935996413231, -0.0920213684...
((username <> null) or (username <> "")) or ((password <> null) or (password <> ""))) then 'response.redirect("account_created.asp") response.write("You have not filled in all fields.") else Set objConn = ConnectDB() query = "INSERT INTO [user] (username,[password],f_name,l_name) VALUES ('"& usern...
[ -0.277622252702713, 0.0896892249584198, 0.9368294477462769, -0.2929726243019104, 0.006510118953883648, 0.3031894564628601, 0.27950355410575867, -0.31613031029701233, -0.27468031644821167, -0.6396335363388062, -0.40762725472450256, 0.5920092463493347, -0.5296628475189209, 0.1406527310609817...
*Javascript: The Good Parts* is a great book. Often I find myself reading passages like the following from the perspective of a language designer: > `undefined` and `NaN` are not constants. They are global variables, and you can change their values. This should not be possible, and yet it is. Don't do it. Takeaways: ...
[ 0.2150842249393463, 0.15909655392169952, -0.23629312217235565, 0.02267305925488472, -0.3755321800708771, -0.11595306545495987, 0.6078704595565796, 0.035228431224823, -0.07385101169347763, -0.46305498480796814, -0.052460044622421265, 0.6339851021766663, -0.13301624357700348, -0.111754871904...
of a particular language. **If you were trying to design the "perfect" OO language, what books would you read for guidance?** The web site 'lambda the ultimate' is very much about programming languages, and they occasionally have some good resources, although they tend to be more interested in academic kinds of things...
[ 0.23263868689537048, -0.008554124273359776, -0.03705009073019028, 0.037731099873781204, -0.4465525448322296, 0.0667227953672409, 0.2605852782726288, 0.1597905457019806, -0.25022998452186584, -0.509164035320282, -0.3126736581325531, 0.410620778799057, -0.10151264071464539, -0.60093498229980...
What's the best way to animate a background image sliding to the left, and looping it? Say I've got a progress bar with a background I want to animate when it's active (like in Gnome or OS X). I've been playing with the `$(...).animate()` function and trying to modify the relevant CSS property, but I keep hitting a br...
[ 0.37386396527290344, -0.15972082316875458, 0.22841551899909973, 0.049682267010211945, 0.042895909398794174, 0.16961638629436493, -0.011481414549052715, 0.4346333146095276, -0.2696053385734558, -0.7202469706535339, 0.2933900058269501, 0.27701589465141296, -0.19882355630397797, -0.1356661021...
it helps anyone else, here's the function I came up with: ``` function animateBar(self) { // Setup var bar = self.element.find('.ui-progress-bar'); bar.css('background-position', '0px 0px'); bar.animate({ backgroundPosition: '-20px 0px' }, 1000, 'linear', function() { animateBar(s...
[ -0.15522606670856476, -0.06640619039535522, 0.5249207019805908, -0.08770857006311417, 0.16861885786056519, 0.26259681582450867, 0.46939441561698914, -0.24873541295528412, -0.09459241479635239, -0.7031477093696594, -0.13268831372261047, 0.47083091735839844, -0.16188664734363556, -0.37698385...
I browsed around here on Stackoverflow and found this topic : <https://stackoverflow.com/questions/279/aspnet-visual-studio-and-subversion-how-to-integrate> However that didn't help me in my case, or i might just be a little stupid. So to my problem! Installed VisualSVN on a Server far far away and while this works ...
[ 0.4636095464229584, 0.03436180204153061, 0.3845779597759247, 0.039354730397462845, -0.3191308379173279, -0.14336960017681122, 0.4148857593536377, 0.07999898493289948, -0.325406551361084, -0.7706865668296814, 0.25142306089401245, 0.42240995168685913, -0.09463723003864288, 0.2323237806558609...
not? The project is of course on my computer + the repo. and the repo-server and iis-server is the same machine, so i'd like to map those together, but i know that SVN uses some berkly-db-stuff on files.. Suggestions? It's possible. The Berkeley DB is used at the repository side, but it doesn't really affect the clien...
[ 0.5856913328170776, -0.1713062971830368, 0.17390385270118713, 0.11869166791439056, -0.3511204421520233, -0.08289376646280289, 0.2754935920238495, 0.08900119364261627, -0.4987891912460327, -0.6419045925140381, 0.018136577680706978, 0.3810989260673523, -0.23473894596099854, 0.283176273107528...
site.
[ 0.18043164908885956, -0.11191385984420776, 0.04223785176873207, 0.04898296296596527, 0.32459914684295654, -0.30802708864212036, 0.3630734384059906, -0.006437759380787611, -0.17394094169139862, -0.9450380206108093, -0.26347389817237854, -0.056687548756599426, -0.02322421967983246, 0.6752172...
Is there a cross-platform way to list the processes running on one's computer through a python script? For Unix based system "ps -ef" works, but I am new to Python and don't know a way to write something that would work across any platform. Thanks! Python itself doesn't offer any such functionality. On PyPI, there is ...
[ 0.16595138609409332, -0.42374372482299805, 0.06942089647054672, 0.403535932302475, -0.033482056111097336, 0.2787560522556305, -0.14390829205513, 0.17167848348617554, -0.666181743144989, -0.6110527515411377, 0.05747908726334572, 0.48353955149650574, -0.4508171081542969, -0.3008613586425781,...
I'm trying to split a string up into words and punctuation, adding the punctuation to the list produced by the split. For instance: ``` >>> c = "help, me" >>> print c.split() ['help,', 'me'] ``` What I really want the list to look like is: ``` ['help', ',', 'me'] ``` So, I want the string split at whitespace wit...
[ 0.22802338004112244, 0.11352235823869705, -0.12796248495578766, -0.38358649611473083, -0.24079371988773346, 0.3777659237384796, 0.1104867234826088, -0.06797415763139725, -0.02699357084929943, -0.5201467871665955, -0.36828258633613586, 0.5087143778800964, -0.41218888759613037, -0.0833707600...
outputCharacter = character ... separatedPunctuation += outputCharacter >>> print separatedPunctuation help , me >>> print separatedPunctuation.split() ['help', ',', 'me'] ``` This produces the result I want, but is painfully slow on large files. Is there a way to do this more efficiently? This is more or less t...
[ 0.04241035133600235, -0.0566350556910038, 0.08686040341854095, -0.08428632467985153, -0.1308395117521286, 0.24412661790847778, 0.1251049041748047, -0.4512535631656647, -0.11345219612121582, -0.22703534364700317, -0.30261632800102234, 0.4152297377586365, -0.44087040424346924, 0.029936159029...
you don't want that. * This will not work with (single) quotes in the string. * Put any additional punctuation marks you want to use in the right half of the regular expression. * Anything not explicitely mentioned in the re is silently dropped.
[ 0.49897685647010803, 0.23676905035972595, 0.3334534764289856, -0.22471900284290314, -0.3239333927631378, 0.04207826033234596, 0.4494788944721222, 0.0224082563072443, -0.0919172465801239, -0.4850099980831146, -0.5113255381584167, 0.4553469717502594, -0.2314906120300293, 0.24369440972805023,...
I think the answer to this question is so obivous that noone has bothered writing about this, but its late and I really can't get my head around this. I've been reading into IoC containers (Windsor in this case) and I'm missing how you talk to the container from the various parts of your code. I get DI, I've been doi...
[ 0.5430617332458496, 0.3756958544254303, -0.26097407937049866, 0.3291611969470978, -0.10290644317865372, -0.022821389138698578, 0.04617360234260559, -0.09848817437887192, -0.06952419131994247, -0.6965406537055969, 0.2954504191875458, 0.4445459544658661, 0.05939650908112526, 0.06335323303937...
container every time you need a service from it? Do I create a single global insance which I pass around? Surely not! I know I should call this: ``` WindsorContainer container = new WindsorContainer(new XmlInterpreter()); ``` (for example) when I want to load my XML config, but then what do I do with container? Do...
[ -0.014362799003720284, 0.17651468515396118, 0.5193155407905579, 0.03098028339445591, 0.02237600088119507, -0.22591286897659302, 0.04817148298025131, 0.2106054127216339, -0.3441897928714752, -0.6377121210098267, 0.015383101999759674, 0.36433202028274536, -0.2808477282524109, 0.4207636117935...
with using some IoC awsomeness Thanks, Andrew 99% of the cases it's one container instance per app. Normally you initialize it in Application\_Start (for a web app), [like this](https://github.com/castleproject/Castle.MonoRail-READONLY/blob/45ac205867396b1b7ad287a872e5b20afd0af837/src/TempWeb/Global.asax.cs). After ...
[ 0.2736648917198181, -0.11114241927862167, 0.011306672357022762, 0.44243714213371277, 0.10874523222446442, -0.37295669317245483, 0.18115384876728058, -0.4341786503791809, -0.19971519708633423, -0.6243171095848083, -0.14125677943229675, 0.2877514064311981, -0.14009317755699158, -0.0111691504...
hardly ever need to call or even reference the container in your classes, which is the recommended usage. Other frameworks don't let you get in the creation process easily (like Webforms) so you have to resort to hacks like [this one](http://ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Fo...
[ 0.1401064246892929, -0.12155658006668091, 0.37758126854896545, -0.06687041372060776, -0.10972856730222702, -0.4181903302669525, 0.42503345012664795, -0.08859115839004517, -0.5507113337516785, -0.5236814022064209, -0.33903181552886963, 0.421176940202713, -0.2625647783279419, 0.1953902989625...
clears your doubts.
[ 0.3162141442298889, 0.4795737564563751, -0.08760470896959305, 0.180983766913414, 0.4732803404331207, -0.31138965487480164, 0.43698787689208984, 0.7119114398956299, 0.22107315063476562, -0.632804274559021, -0.2734980881214142, 0.1770608276128769, -0.07355431467294693, -0.2996685206890106, ...
I know java and would normally put in getter/setter methods. I am interested in doing it in C# with the following code, but it throws a StackOverflow exception. What am I doing wrong? Calling Code ``` c.firstName = "a"; ``` Property Code ``` public String firstName; { get { return firstName; }...
[ 0.17230145633220673, 0.24366432428359985, -0.04932737722992897, -0.2853432595729828, -0.017144879326224327, -0.49808159470558167, 0.35673975944519043, -0.3274546265602112, -0.12032806873321533, -0.5598065257072449, 0.019776007160544395, 0.5629910826683044, -0.267825722694397, 0.00569248897...
continues *ad infinitum* until you blow the stack. You need a private backing field to hold the value, e.g. ``` private string firstName; public string FirstName { get { return this.firstName; } set { this.firstName = value; } } ``` Alternatively, if you're using C# 3.0, you...
[ 0.4795616865158081, -0.07196652144193649, 0.46397876739501953, -0.18793408572673798, 0.45803871750831604, -0.20241063833236694, 0.291594535112381, -0.16880296170711517, -0.3402267098426819, -0.03497994691133499, -0.4177786409854889, 0.6979147791862488, -0.17262478172779083, 0.1784038990736...
I've taken over a mixed PHP4/PHP5 project which has been handed down from developer to developer, with each one making things worse. Before I spend too much time on it I'd like to develop a base-standard, with consistent formatting at a minimum. Can anyone recommend a utility (Linux or Mac OS X preferably) that will r...
[ 0.6382514834403992, 0.2917165458202362, -0.08151369541883469, 0.02823198214173317, -0.329709529876709, -0.0642862319946289, 0.277930349111557, 0.0046111540868878365, -0.16846370697021484, -0.5883556008338928, 0.2045702487230301, 0.5370082855224609, -0.040890492498874664, -0.199531286954879...
can do that with [Netbeans](http://netbeans.org) or with [Eclipse PDT](http://www.eclipse.org/pdt/), both excellent PHP editors. There's a Format Code option in each, which will reformat a selected file according to your code style preferences. There may be an option to format code in bulk as well. I do recommend that...
[ 0.4164709746837616, -0.13888108730316162, 0.08903507888317108, 0.24328456819057465, -0.23519840836524963, -0.2965857684612274, 0.1327945739030838, -0.0318850539624691, -0.21568843722343445, -0.8163525462150574, -0.21450264751911163, 0.6414065361022949, -0.24383597075939178, -0.196197107434...
Here is an interesting piece of code that my fellow team members were just having a slightly heated discussion about... ``` Dim fred As Integer If True Then fred = 5 : fred = 3 : fred = 6 Else fred = 4 : fred = 2 : fred = 1 ``` After executing the above code snippet, what is the value of *fred*? Try not to che...
[ 0.4188339412212372, 0.12514235079288483, 0.11440044641494751, -0.050768230110406876, 0.20377199351787567, -0.15429963171482086, 0.2703621983528137, -0.006534229032695293, -0.16122615337371826, -0.40230467915534973, 0.3301105797290802, 0.551051676273346, -0.1748669147491455, 0.2367077171802...
proffer a result for *fred*. **UPDATE**: I would not normally write code like this and this snippet only serves as an example. As it so happens, this question originated from a discussion involving the creation of a coding standards document for our team. I'm assuming you mean VB.Net. According to the grammar in the ...
[ 0.2902590036392212, -0.031855445355176926, 0.7361250519752502, -0.1575912982225418, -0.3476777970790863, -0.03258437290787697, 0.20301911234855652, -0.5397977232933044, -0.059336286038160324, -0.1903911679983139, -0.14247439801692963, 0.5097574591636658, -0.2772463858127594, 0.229247838258...
| Statements : [ Statement ] ``` **Edit:** I would like to note that debugging the code is not "cheating". I used to work on the VB compiler team at Microsoft. There were times where the spec was ambiguous, or didn't match what we had actually shipped. In several of those cases the solution (what we did to fix ...
[ 0.8228057026863098, 0.3904705047607422, -0.15426337718963623, 0.21740864217281342, -0.31870418787002563, -0.47684985399246216, 0.42440080642700195, 0.044468529522418976, -0.035385530441999435, -0.11016659438610077, -0.021450942382216454, 0.5226256847381592, -0.376098096370697, 0.2121691256...
a big part of figuring out what it does...
[ 0.4284186363220215, 0.3448365032672882, -0.15705591440200806, 0.07155108451843262, 0.15840502083301544, -0.27399373054504395, 0.3183455765247345, 0.09921900182962418, 0.14155708253383636, -0.6538823843002319, 0.1871124804019928, 0.23808738589286804, 0.4063850939273834, -0.0705128014087677,...
This is a total newbie question, so thanks in advance. I'm trying to get my head around the difference between divs and spans, and when and how to use them. Say for instance, I want to have an image left justified, and I want the text to flow around the image on the right, while maintaining justification. If the text ...
[ 0.7439650893211365, -0.0032123918645083904, 0.3894268572330475, 0.13393113017082214, -0.18246817588806152, -0.03403620049357414, 0.057092949748039246, -0.3586390018463135, -0.1991056203842163, -0.4500749707221985, 0.22840963304042816, 0.5745667815208435, -0.14739678800106049, -0.2045518904...
mark up? Huge Thanks!!! A SPAN tag is not intended to be a container for other tags. This is especially useful when combined with classes. Use divs for defining sections of a page, and spans to enclose and style text or classes of text. <http://www.learnwebdesignonline.com/htmlcourse/span-div.htm> shows a good exam...
[ 0.5555041432380676, 0.12088575959205627, 0.44758161902427673, 0.20056790113449097, -0.29846492409706116, -0.16150207817554474, -0.009080876596271992, -0.4290514290332794, -0.3239940106868744, -0.6822386980056763, -0.024955030530691147, 0.16613256931304932, -0.04085925593972206, -0.22493788...
I'm using the following code within a VB 6.0 application to allow give the application a system tray icon: ``` Option Explicit 'user defined type required by Shell_NotifyIcon API call Public Type NOTIFYICONDATA cbSize As Long hwnd As Long uId As Long uFlags As Long uCallBackMessage As Long hIcon As ...
[ 0.119648277759552, -0.013822417706251144, 0.5969652533531189, 0.06356236338615417, 0.14211446046829224, 0.05130835622549057, 0.23586510121822357, -0.43165919184684753, -0.07936156541109085, -0.5334663391113281, -0.19053514301776886, 0.7081198692321777, -0.38127264380455017, 0.1343007236719...
Const WM_LBUTTONDOWN = &H201 'Button down Public Const WM_LBUTTONUP = &H202 'Button up Public Const WM_LBUTTONDBLCLK = &H203 'Double-click Public Const WM_RBUTTONDOWN = &H204 'Button down Public Const WM_RBUTTONUP = &H205 'Button up Public Const WM_RBUTTONDBLCLK = &H206 'Double-click Public Dec...
[ -0.2397182285785675, 0.13251963257789612, 0.548790454864502, -0.08088075369596481, 0.24923910200595856, 0.016020162031054497, 0.3342020809650421, -0.2658119201660156, -0.1321365386247635, -0.5878375172615051, -0.22920367121696472, 0.7472708821296692, -0.3993627429008484, 0.165019229054451,...
the Window's X to close it. I accomplish this with the following code in the form's QueryUnload event: ``` Me.WindowState = vbMinimized Me.Hide ``` In the form's Unload event I do the following: ``` Shell_NotifyIcon NIM_DELETE, nid ``` The PROBLEM is that when I shut down the operating system and Windows sends th...
[ -0.10304686427116394, 0.32790398597717285, 0.8509630560874939, -0.25311681628227234, -0.10514768958091736, -0.12918050587177277, 0.5461499691009521, 0.09089196473360062, -0.17325876653194427, -0.6374625563621521, -0.5287811756134033, 0.894832193851471, -0.37273988127708435, 0.4249443113803...
Integer, UnloadMode As Integer) Select Case UnloadMode Case 1, 2, 3 'If the program is being terminated by Code, Windows shutting down, or Task Manager Cancel = False 'Allow the program termination Unload Me Case Else Cancel = True 'Else disallow the termination ...
[ 0.0019845524802803993, -0.10659544914960861, 0.4273581802845001, -0.24443675577640533, 0.07597042620182037, 0.1458163857460022, 0.26853159070014954, -0.20519720017910004, 0.048280201852321625, -0.14199866354465485, -0.49249497056007385, 0.7115108966827393, -0.29791489243507385, 0.275984793...
2 (Windows Shutting Down), I go ahead and let the program terminate. Let me know if this helps! JFV
[ 0.1937289535999298, -0.062058839946985245, 0.3687313199043274, -0.11586134880781174, -0.09547514468431473, -0.44971975684165955, 0.6163671016693115, -0.07239346206188202, 0.045345645397901535, -0.4188106656074524, -0.29811039566993713, 0.7466312646865845, -0.21688109636306763, 0.0114382170...
I've factored out common attributes from two classes into an abstract base class, however I have another model that needs to reference either one of those classes. It's not possible to reference an ABC as it doesn't actually have a database table. The following example should illustrate my problem: ``` class Answer(m...
[ 0.0031062227208167315, 0.05039253458380699, 0.171981081366539, -0.19738632440567017, 0.13269276916980743, 0.23577982187271118, 0.05890263244509697, -0.419686883687973, -0.1277630776166916, -0.49107763171195984, 0.08898761868476868, 0.5772659182548523, -0.32491981983184814, 0.22125543653964...
resident = models.ForeignKey("Resident") def __unicode__(self): return u"%s - %s - %s" %(self.ovramt.ssa.name, self.resident, self.question) class Answer_B(Answer): def __unicode__(self): return u"%s - %s" %(self.ovramt.ssa.name, self.question) class Answer_Risk(models.Model): answ...
[ -0.5482754707336426, 0.12747763097286224, 0.12163614481687546, -0.11684967577457428, 0.17631547152996063, 0.32200226187705994, 0.0625590831041336, -0.6682994365692139, -0.2575415074825287, -0.4661928415298462, -0.1841469258069992, 0.44785404205322266, -0.0392937995493412, 0.261786371469497...
attributes later. The problem would STILL exist if I had Answer\_B be the superclass - and have Answer\_A subclass or compose it. A 'Risk' is the same whether it's Answer\_A or Answer\_B. I also have other models that need to reference an 'Answer' regardless of it's sub-type. How can this be done? How can you referenc...
[ 0.035060979425907135, -0.1462726593017578, 0.10451890528202057, 0.16517099738121033, -0.05938008427619934, -0.14080430567264557, 0.42134153842926025, -0.321627140045166, -0.22055168449878693, -0.47064661979675293, 0.2655082941055298, 0.5849202871322632, -0.2583962082862854, 0.0842155367136...
that considered very bad practice? A [generic relation](https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#generic-relations) seems to be the solution. But it will complicate things even further. It seems to me; your model structure is already more complex than necessary. I would simply merge all three `A...
[ 0.23784762620925903, 0.11245192587375641, 0.13992023468017578, -0.08890282362699509, -0.08996430039405823, -0.3231736123561859, 0.24898694455623627, -0.33194711804389954, -0.45490097999572754, -0.28297755122184753, -0.017598986625671387, 0.5469753742218018, -0.4836435616016388, 0.223411917...
implementations: * Using a [one-to-one relationship](http://docs.djangoproject.com/en/dev/topics/db/models/#one-to-one-relationships) * Demoting risk as a field (or any number of fields) inside `Answer` class. My main concern is neither database structure nor performance (although these changes should improve perform...
[ 0.20823326706886292, 0.19003267586231232, -0.10762377083301544, -0.08111658692359924, 0.1029081717133522, -0.35321253538131714, 0.1306607723236084, -0.514803946018219, 0.0874284878373146, -0.4530540704727173, -0.010488307103514671, 0.4667399227619171, -0.481268048286438, -0.245506793260574...
This should be straight forward for a guru. I don't have any code really written out, just a couple of controllers and a custom UIView. All connected through nibs. The app loads without crashing, yet I can't see my NSLog() hit from my custom UIView. My application delegate has default template code which calls for a c...
[ 0.01035083457827568, -0.06042233482003212, 0.29930150508880615, 0.26790520548820496, -0.29555198550224304, 0.020143939182162285, 0.19080610573291779, 0.11347205191850662, -0.30574265122413635, -0.9546915292739868, 0.12376002967357635, 0.6005993485450745, -0.049226418137550354, 0.4742300212...
is going to hit, and it's not showing up at all. ``` - (void)loadView { NSLog(@"calling loadView"); } - (id)initWithFrame:(CGRect)frame { NSLog(@"Calling initWithFrame:"); return self; } ``` Strange. I'm not sure why even after proper IB connections that my NSLog will not show up. Only anything put into drawRe...
[ 0.09790364652872086, -0.006674179807305336, 0.5143144130706787, -0.17452774941921234, -0.1444719433784485, -0.14883944392204285, 0.41661059856414795, -0.051154974848032, -0.03471105918288231, -0.940661609172821, 0.04193263500928879, 0.6719874739646912, -0.22355075180530548, 0.2909165918827...
initialization as well, if you anticipate programmatically creating your TabView instead of hooking up in the IB. Just refactor your initialization to another method and call it from both implementations.) Also in your initialization code above you must always call the super class's initialization. There is a boiler p...
[ 0.030974945053458214, -0.42872855067253113, 0.42689448595046997, -0.12986865639686584, -0.27532151341438293, 0.11251628398895264, -0.024798600003123283, -0.1202298104763031, -0.0014638417633250356, -0.8792776465415955, -0.18281923234462738, 0.4532983899116516, -0.22204190492630005, 0.10920...
yourself programmatically using your controller, you do not need to override `loadView`. Instead you should override `viewDidLoad`, which is called after the view is loaded, to do additional initialization.
[ 0.1474664807319641, -0.2504383325576782, 0.12176413089036942, 0.19757288694381714, 0.005601838696748018, -0.16886255145072937, 0.16034989058971405, -0.08716513216495514, -0.08675290644168854, -0.5285489559173584, -0.1996280550956726, 0.8061940670013428, -0.0648360326886177, -0.051915202289...
I would like to ensure that I only subscribe once in a particular class for an event on an instance. For example I would like to be able to do the following: ``` if (*not already subscribed*) { member.Event += new MemeberClass.Delegate(handler); } ``` How would I go about implementing such a guard? If you are t...
[ 0.24405021965503693, -0.18736547231674194, 0.20757512748241425, -0.08428370952606201, 0.00886907335370779, -0.2126850187778473, 0.1885307878255844, -0.2945364713668823, -0.21111230552196503, -0.6870664954185486, -0.17014499008655548, 0.749713122844696, -0.21071526408195496, 0.1299001723527...
null) { _myEvent += value; } } remove { _myEvent -= value; } } ``` That would ensure that only one subscriber can subscribe to the event on this instance of the class that provides the event. **EDIT** please see comments about why the above code is a bad idea and not thread saf...
[ 0.2915346026420593, 0.0924363061785698, 0.40026652812957764, -0.12182588875293732, 0.04538503289222717, -0.30143770575523376, 0.5378066897392273, 0.1250268816947937, -0.2032569944858551, -0.5802836418151855, -0.20663906633853912, 0.46801257133483887, -0.5550535917282104, 0.4579543173313141...
subscribers) then the client code is going to need to handle that. So replace > *not already subscribed* with a bool member of the client class that gets set when you subscribe for the event the first time. **Edit (after accepted):** Based on the comment from @Glen T (the submitter of the question) the code for the...
[ 0.4060400724411011, -0.39555850625038147, 0.884207546710968, 0.20975130796432495, -0.20140191912651062, -0.12348610907793045, 0.07304134964942932, -0.4742395281791687, -0.4993548095226288, -0.4295453727245331, -0.008947331458330154, 0.33423131704330444, -0.2545028626918793, 0.0854102447628...
of @Rune's comment - it is not a good idea to change the behavior of subscribing to an event in a non-obvious way. **EDIT 31/7/2009:** Please see comments from @Sam Saffron. As I already stated and Sam agrees the first method presented here is not a sensible way to modify the behavior of the event subscription. The co...
[ 0.007618058007210493, -0.1290985643863678, 0.04073069989681244, 0.1653796285390854, -0.34411677718162537, -0.24969343841075897, 0.4066038429737091, 0.15628144145011902, -0.5394149422645569, -0.3142400085926056, 0.26116129755973816, 0.14305658638477325, -0.206835076212883, 0.177758559584617...
to subscribe and they may both end up subscribing. A lock could be used to improve this. If you are planning to change the way event subscription works then I advise that you [read about how to make the subscription add/remove properties thread safe](https://stackoverflow.com/questions/1037811/c-thread-safe-events).
[ 0.3745286762714386, -0.23572032153606415, 0.5225998759269714, 0.1298535168170929, -0.09310805052518845, -0.5758630633354187, 0.14435291290283203, -0.16827261447906494, -0.49951112270355225, -0.3021025061607361, -0.17389743030071259, 0.5279738306999207, -0.1592864990234375, 0.20749521255493...
I know of Rational Rose and we have got Rational Rose 6. But I am looking for some other tools which are more usable, which do not complain that they are not running in Windows 98/2000 (when installed and run in WinXP) and has got better features as compared to Rational Rose 6. [This](http://www.sparxsystems.com.au/pr...
[ 0.481415718793869, -0.12739945948123932, 0.29717710614204407, 0.0643659383058548, -0.19424885511398315, 0.12782053649425507, 0.26360470056533813, -0.19910593330860138, 0.242484912276268, -0.5635095238685608, 0.03669416904449463, 0.8037970662117004, -0.19158466160297394, 0.01982382312417030...
I'm writing a windows C# application which I wish to use data grid views, but unable to find a good tutorial on to take complete control of the datagrid eg: add columns, add data etc. I like some of the tips provided [here](http://www.dotnetperls.com/datagridview)
[ 0.5611533522605896, -0.33321166038513184, 0.6129599213600159, 0.000001163645265478408, 0.002745050238445401, -0.07762665301561356, 0.19491758942604065, 0.3631574213504791, -0.34422555565834045, -0.8834437727928162, 0.3393191993236542, 0.6961339712142944, -0.14300331473350525, -0.1185827255...
I'm interested in how much up front validation people do in the Python they write. Here are a few examples of simple functions: ``` def factorial(num): """Computes the factorial of num.""" def isPalindrome(inputStr): """Tests to see if inputStr is the same backwards and forwards.""" def sum(nums): """Sa...
[ 0.2330968677997589, 0.1894930899143219, 0.07096382230520248, 0.0282707791775465, -0.3420168459415436, 0.10991699993610382, 0.03773755580186844, -0.30355754494667053, -0.18802495300769806, -0.2890901267528534, 0.12172366678714752, 0.43951618671417236, -0.14431755244731903, -0.19522491097450...
example)? Do you just start your calculation and figure it will throw an exception at some point if bad data was passed in ("asd" to factorial, for example)? When the passed in value is supposed to be a container do you check not only the container but all the values inside it? What about situations like factorial, w...
[ 0.3300986588001251, -0.131063774228096, 0.010781332850456238, 0.1192309781908989, -0.19241362810134888, -0.2044789046049118, 0.14988233149051666, -0.34111279249191284, -0.41889309883117676, -0.42108431458473206, -0.12625546753406525, 0.27306845784187317, -0.4681439697742462, -0.18332409858...
and if they break, they will throw the correct exception anyway. By enforcing your own checks, you may invalidate otherwise working input.
[ 0.4765191078186035, 0.28393837809562683, -0.05118543282151222, 0.25999781489372253, 0.24357502162456512, -0.30535194277763367, 0.2282143384218216, -0.1615516096353531, -0.24780157208442688, -0.5173851847648621, -0.15829098224639893, 0.4906507730484009, -0.19119010865688324, -0.084578767418...
How can I build a numpy array out of a generator object? Let me illustrate the problem: ``` >>> import numpy >>> def gimme(): ... for x in xrange(10): ... yield x ... >>> gimme() <generator object at 0x28a1758> >>> list(gimme()) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> numpy.array(xrange(10)) array([0, 1, 2, 3, 4, 5,...
[ 0.09263955801725388, 0.05162256583571434, 0.15038804709911346, -0.1920420080423355, -0.13202643394470215, 0.23329131305217743, 0.2652876079082489, -0.617658257484436, -0.027366967871785164, -0.615609884262085, -0.16434884071350098, 0.5153512358665466, -0.40332239866256714, 0.19951330125331...
generator itself. The behaviour I desire is that from `numpy.array(list(gimme()))`, but I don't want to pay the memory overhead of having the intermediate list and the final array in memory at the same time. Is there a more space-efficient way? Numpy arrays require their length to be set explicitly at creation time, un...
[ 0.3746168613433838, -0.3492661416530609, -0.06143110617995262, -0.05207871273159981, -0.38703587651252747, 0.026162078604102135, 0.08916352689266205, -0.40828949213027954, -0.26988545060157776, -0.5075419545173645, 0.10528482496738434, 0.5706968903541565, -0.4198058247566223, -0.0724719390...
impossible to take a generator object and turn it into an array unless you either: 1. can predict how many elements it will yield when run: ``` my_array = numpy.empty(predict_length()) for i, el in enumerate(gimme()): my_array[i] = el ``` 2. are willing to store its elements in an intermediate list : ``` my_array =...
[ -0.15509581565856934, -0.040382493287324905, 0.11564311385154724, -0.04487834870815277, -0.039159536361694336, 0.09524530917406082, 0.29942095279693604, -0.391446590423584, -0.18070094287395477, -0.5616279244422913, -0.054326318204402924, 0.7136078476905823, -0.4899185001850128, -0.0552410...
inefficient, and **3** is time inefficient (you have to go through the generator twice).
[ 0.2835286259651184, 0.1633312702178955, 0.21619336307048798, -0.06696980446577072, 0.029835352674126625, 0.1618170142173767, 0.3220142722129822, -0.43859413266181946, -0.2339749038219452, -0.5556434392929077, 0.040842507034540176, 0.4718494415283203, -0.178633451461792, 0.27714771032333374...
In another [posting: Does Linq-To-Sql support composable queries](https://stackoverflow.com/questions/89193/does-linq-to-sql-support-composable-queries) there was discussion on how to compose/concat where clauses dynamically. This appears to be done with an "AND" (i.e. the first where clause and the second where clause...
[ 0.14817067980766296, 0.19395017623901367, 0.4101105332374573, -0.00908418744802475, -0.13441936671733856, 0.05997088924050331, 0.16049593687057495, -0.22171875834465027, -0.21427886188030243, -0.07916106283664703, -0.40557441115379333, 0.3135136663913727, -0.20080453157424927, -0.242852941...
where p.firstName equals "Daniel" select p ``` This gives people with a first name of "Daniel" and that are under 18. I'm looking for the syntax to join these to find people who have a first name of "Daniel" or are under 18. Note: I am using ADO.net Data Services so I do not have .Contains() availa...
[ 0.3962285816669464, 0.3946487605571747, 0.26552098989486694, 0.05862318351864815, 0.08458611369132996, 0.024962272495031357, -0.06574595719575882, -0.29604995250701904, -0.0446186326444149, -0.5551971793174744, -0.46631526947021484, -0.2014700025320053, -0.27790793776512146, 0.240618586540...
am looking for functionality-wise. I did run into two possible issues with it: 1. It looks like it would make multiple database hits if I was to do a third condition (union seems to take an IEnumerable as its parameter) - I was hoping to build up multiple AND and OR statements in code and then execute one request. 2. ...
[ 0.5636172890663147, 0.03402664512395859, 0.32348597049713135, 0.041175730526447296, 0.2303784340620041, -0.09454546868801117, 0.3509896993637085, -0.29493552446365356, -0.12523940205574036, -0.6084213852882385, -0.04006597027182579, 0.047983769327402115, -0.4214322566986084, 0.473836749792...
select p; ``` or have you just given a simple example? In which case you can use: ``` var under18 = from p in Person where p.age < 18 select p; var daniels = from p in Person where p.firstName == "Daniel"
[ 0.24710144102573395, 0.06019416078925133, 0.19020822644233704, -0.16435128450393677, 0.12832863628864288, 0.323716938495636, -0.042759910225868225, -0.41774532198905945, -0.2015531361103058, -0.16706416010856628, -0.6038683652877808, 0.21296261250972748, -0.24133692681789398, -0.0094376131...
select p; var combined = under18.Union(daniels); ``` LinqToSql may be intelligent enough to convert that to an OR but I'm not so sure.
[ 0.10062813013792038, 0.0051116966642439365, 0.20493844151496887, -0.319110631942749, 0.11095723509788513, 0.1305522322654724, 0.1741766780614853, -0.33790862560272217, 0.025597648695111275, -0.2657465636730194, -0.15311507880687714, 0.4262276291847229, -0.21625784039497375, 0.1447370797395...
We are invoking Asp.Net ajax web service from the client side. So the JavaScript functions have calls like: // The function to alter the server side state object and set the selected node for the case tree. ``` function JSMethod(caseId, url) { Sample.XYZ.Method(param1, param2, OnMethodReturn); } function OnM...
[ 0.16281157732009888, 0.00026543097919784486, 0.4023628532886505, 0.12480586767196655, -0.046914003789424896, 0.23638781905174255, 0.4437578618526459, -0.5273069739341736, -0.25731950998306274, -0.5394142270088196, -0.2883460521697998, 0.3255063593387604, -0.23890991508960724, 0.03195531666...
{ if (SessionExpired()) { return sessionExpiredMessage; } . . .
[ -0.14209619164466858, -0.2605404555797577, 0.34394413232803345, -0.18926279246807098, 0.22975820302963257, -0.11942076683044434, 0.5131312608718872, -0.011394964531064034, -0.1406560093164444, -0.3143322765827179, -0.1292538195848465, 0.6055318117141724, -0.21555420756340027, 0.39274561405...
} } ``` The website is setup to use form based authentication. Now if the session has expired and then the JavaScript function "JSMethod" is invoked, then the following error is obtained: Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'Method' failed with the following error: Sy...
[ 0.0005509203765541315, 0.34522977471351624, 0.42224058508872986, -0.19971342384815216, 0.17800214886665344, -0.39096692204475403, 0.7113609313964844, -0.10808618366718292, 0.036174047738313675, -0.37003663182258606, -0.1797252744436264, 0.6639650464057922, -0.14221787452697754, 0.082188293...
{ // In debug mode, if no error was registered, display some trace information var error; if (result && errorObj) {
[ -0.07188471406698227, 0.01984672248363495, -0.025735612958669662, -0.1943139135837555, 0.41731661558151245, -0.0203307643532753, 0.7027187347412109, 0.0015558802988380194, 0.0901569128036499, -0.23702210187911987, -0.2019651234149933, 0.5623574256896973, -0.2797259986400604, 0.010501183569...
// If we got a result, we're likely dealing with an error in the method itself error = result.get_exceptionType() + "-- " + result.get_message(); }
[ 0.1641472429037094, -0.14719174802303314, 0.15865792334079742, -0.03554106876254082, 0.2816544473171234, -0.19511468708515167, 0.5146796703338623, -0.291642427444458, -0.16099430620670319, -0.1635843813419342, -0.19320756196975708, 0.47200897336006165, -0.3062366247177124, -0.0077699357643...
else { // Otherwise, it's probably a 'top-level' error, in which case we dump the // whole response in the trace error = response.get_responseData();
[ 0.14059503376483917, -0.4406668543815613, 0.11232653260231018, -0.1898026317358017, 0.4491446614265442, -0.12372669577598572, 0.36871618032455444, -0.2901175618171692, -0.0470225065946579, -0.28306636214256287, -0.2003767490386963, 0.6116689443588257, -0.42744141817092896, -0.0862377732992...
} // DevDiv 89485: throw, not alert() throw Sys.Net.WebServiceProxy._createFailedError(methodName, String.format(Sys.Res.webServiceFailed, methodName, error)); } ``` So the problem is that the exception is raised even before "Method" is invoked, the exception occurs during the ...
[ 0.09879615157842636, 0.1071685254573822, 0.11116137355566025, -0.0547645278275013, 0.1608104556798935, -0.22734695672988892, 0.385762095451355, -0.18259866535663605, -0.12437232583761215, -0.5117356181144714, -0.18961814045906067, 0.5410280227661133, -0.32111024856567383, 0.164706364274024...
the WebMethod call, but not an error handler method. You need to create one and pass it into as you do the callback method. Then you can handle your failed WebMethod calls in there.
[ 0.0452347993850708, -0.13062240183353424, -0.08376031368970871, 0.3407435119152069, -0.014789016917347908, -0.2111036330461502, 0.11488684266805649, -0.14890678226947784, -0.06664480268955231, -0.3844008445739746, -0.05142153427004814, 0.6384533047676086, -0.3975888788700104, 0.05931220948...
What are all the common undefined behaviours that a C++ programmer should know about? Say, like: ``` a[i] = i++; ``` ### Pointer * Dereferencing a `NULL` pointer * Dereferencing a pointer returned by a "new" allocation of size zero * Using pointers to objects whose lifetime has ended (for instance, stack allocated ...
[ 0.08921986818313599, 0.07059527188539505, 0.2019880712032318, -0.27925610542297363, 0.01039074081927538, -0.2620888650417328, 0.24156872928142548, -0.3239135146141052, -0.32060179114341736, -0.2857402265071869, -0.23738911747932434, 0.27504250407218933, -0.3618250787258148, 0.3203693032264...
buffers](https://stackoverflow.com/a/11211519/241536). ### Buffer overflows * Reading or writing to an object or array at an offset that is negative, or beyond the size of that object (stack/heap overflow) ### Integer Overflows * Signed integer overflow * Evaluating an expression that is not mathematically defined ...
[ -0.0067705572582781315, 0.22392809391021729, 0.3911180794239044, -0.09078378230333328, 0.030319632962346077, 0.3069784641265869, -0.01656874641776085, -0.22894670069217682, -0.4886170029640198, -0.4506846070289612, -0.16169287264347076, 0.05826747417449951, -0.5463094115257263, 0.206518471...
directly or via static\_cast) * Using an automatic variable before it has been definitely assigned (e.g., `int i; i++; cout << i;`) * Using the value of any object of type other than `volatile` or `sig_atomic_t` at the receipt of a signal * Attempting to modify a string literal or any other const object during its life...
[ 0.43852972984313965, -0.22734931111335754, 0.3063204288482666, 0.023102182894945145, 0.03606177493929863, 0.05939864367246628, 0.23258520662784576, -0.1504645198583603, 0.023908670991659164, -0.4988682270050049, -0.2835938632488251, 0.4467112123966217, -0.3863309323787689, 0.15564396977424...