text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
public override int GetHashCode() {
return this.GetHashCodeFromFields(field1, field2, field3);
}
```
Do you see any problems with this code?
That looks like a solid way to do it.
My only suggestion is that if you're really concerned about performance with it, you may want to add generic versions for seve... | [
0.1473110467195511,
0.1350136399269104,
0.0698152408003807,
-0.020803622901439667,
0.11820680648088455,
-0.20057412981987,
0.5168458223342896,
-0.3070002794265747,
-0.18985626101493835,
-0.32944414019584656,
-0.1629127711057663,
0.507104754447937,
-0.5390223264694214,
0.08621686697006226,
... | |
values, etc. The call syntax will be exactly the same, but you'll run slightly more optimized code for that case. Of course, I'd run some perf tests over this before you decide whether it's worth the maintenance trade-off.
Something like this:
```
public static int GetHashCodeFromFields<T1,T2,T3,T4>(this object obj, ... | [
-0.13821423053741455,
0.15998084843158722,
0.3123321831226349,
-0.2231919914484024,
0.3067423105239868,
0.2206713855266571,
0.3338688015937805,
-0.31244412064552307,
-0.07464700937271118,
-0.3217456638813019,
-0.19004438817501068,
0.48813962936401367,
-0.31933480501174927,
0.07425398379564... | |
if(obj3 != null)
hashCode *= _fieldPrimeNumber + obj3.GetHashCode();
if(obj4 != null)
hashCode *= _fieldPrimeNumber + obj4.GetHashCode();
return hashCode;
}
``` | [
-0.3691367506980896,
0.25038862228393555,
0.29288217425346375,
-0.4984966516494751,
0.3125700354576111,
-0.0222617220133543,
0.5306618213653564,
-0.28039976954460144,
-0.2032853215932846,
-0.29418298602104187,
-0.6493940949440002,
0.40905457735061646,
-0.536477267742157,
0.1031933501362800... | |
Can anybody please explain the following line about the designated initializers:
> The initializer list can omit elements that are declared anywhere in the aggregate, rather than only at the end.
Try this [link](http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/... | [
-0.11115873605012894,
0.09632959216833115,
0.020642051473259926,
-0.199818417429924,
-0.17645208537578583,
0.08605451136827469,
0.18678073585033417,
-0.1867062747478485,
-0.3140281140804291,
-0.4626336395740509,
-0.30782049894332886,
0.20464447140693665,
-0.37070420384407043,
0.04079606011... | |
which do not support C99 fully (or support an earlier version of the standard). | [
0.5317815542221069,
0.1750161349773407,
0.23589134216308594,
0.09473927319049835,
-0.023497462272644043,
-0.25884562730789185,
0.2975076138973236,
0.13402409851551056,
-0.18530549108982086,
0.10231724381446838,
-0.848673939704895,
0.2524358928203583,
-0.20780302584171295,
-0.26344102621078... | |
I'm about to deploy a Django application on a nginx web server, and want to make sure I'm building the system correctly.
It seems to be common wisdom that if you are deploying Django on an apache server, then you should still put an nginx server in front of the application to serve static files, at which nginx is more... | [
0.29045870900154114,
0.26764237880706787,
0.22326089441776276,
-0.13053642213344574,
-0.2776060402393341,
-0.3295784294605255,
0.029992517083883286,
0.1546257883310318,
-0.3748752176761627,
-0.5649414658546448,
0.14846985042095184,
0.5684259533882141,
-0.4419868588447571,
0.112101316452026... | |
serving dynamic content, to handle static content as well as redirection to the dynamic content?
Specifically, will there be different configuration parameters for the static and dynamic content that would make me want to keep the servers separate, or can I host it all in a single nginx installation, with some of the ... | [
0.414370596408844,
-0.1335911601781845,
0.31163400411605835,
-0.07095644623041153,
-0.11205439269542694,
-0.33306464552879333,
0.08306686580181122,
0.22204047441482544,
-0.43763595819473267,
-0.44175437092781067,
-0.11848455667495728,
0.40716415643692017,
-0.512907087802887,
0.202590316534... | |
trouble setting this up using only 1 instance of nginx.
One of the great things about this is that you can set it up this way initially and then change your mind later by switching the location block to pass through to a backend server without any of that being visible to the outside world.
So go ahead and do it on o... | [
0.1656731814146042,
-0.2115413397550583,
-0.03711337968707085,
0.17237694561481476,
-0.06387710571289062,
-0.3147747218608856,
0.34858906269073486,
0.32749560475349426,
-0.44809967279434204,
-0.8235750794410706,
0.3746798038482666,
0.2262728363275528,
-0.3436291515827179,
0.059047386050224... | |
Suppose you're a system administrator who uses PowerShell to manage a lot of things on his/her system(s).
You've probably written a lot of functions which do things you regularly need to check. However, if you have to move around a lot, use different machines a lot and so on, you'd have to re-enter all your functions ... | [
0.24637557566165924,
0.3242524564266205,
0.11841494590044022,
0.21823737025260925,
0.27857524156570435,
-0.10831607133150101,
0.0581495463848114,
0.14793258905410767,
-0.5816258192062378,
-0.5745648145675659,
-0.000021491725419764407,
0.21629364788532257,
0.003213530173525214,
0.2031183838... | |
want to be certain it's foolproof. The function itself is stored in `allFunctions.ps1`, which is why I have it excluded in the code.
The basic idea is that you have one folder in which you store all your ps1 files which each include a function. In PowerShell, you go to that directory and then you enter:
```
. .\allFu... | [
0.06297269463539124,
-0.14125101268291473,
0.4562632143497467,
0.13211913406848907,
0.3871921896934509,
0.0780731588602066,
0.06292297691106796,
-0.13574723899364471,
-0.05384669452905655,
-0.6917539238929749,
-0.3353074789047241,
0.44132116436958313,
-0.2634434998035431,
-0.03278467804193... | |
excluded.
Then I split the long string based on the space, which is the common separator here. And then I run through it with a Foreach-loop, each time initializing the function into PowerShell.
Suppose you have over 100 functions and you never know which ones you'll need and which you won't? Why not enter them all i... | [
0.3839441239833832,
-0.11784607172012329,
0.2486698478460312,
0.035484638065099716,
0.17572300136089325,
0.002416336676105857,
0.24375252425670624,
-0.29991427063941956,
-0.2810631990432739,
-0.7092911601066589,
-0.13658350706100464,
0.38403311371803284,
-0.37058764696121216,
-0.0043230550... | |
for more info about where to find your profile script.
PS defaults your profile to your "My Documents" folder. Mine is on a network drive, so anywhere I login, PowerShell points to the same profile folder. | [
0.684137761592865,
-0.06726866215467453,
0.22308388352394104,
0.2868190109729767,
0.07104091346263885,
-0.06640640646219254,
0.3587336242198944,
0.5733817219734192,
-0.1048806756734848,
-1.3319231271743774,
0.14596688747406006,
0.344032347202301,
0.1658504158258438,
0.21004825830459595,
... | |
I'm beginning a project with a client to build a web application and I'm a little stuck on which solution to go with.
I've used Joomla for many clients in the past, but this client has specific requests that I KNOW I'm going to have to build myself.
The problem I'm facing is that I work full time under the .NET spec... | [
0.5364541411399841,
0.3362342119216919,
-0.028561046347022057,
-0.10055716335773468,
-0.12404076009988785,
0.02547878958284855,
0.04420574754476547,
0.13324932754039764,
-0.20415864884853363,
-0.6638721227645874,
0.1575000137090683,
0.4263809621334076,
0.17809927463531494,
0.08010397851467... | |
what OS projects are out there that have a similar community following as Joomla/Mambo/Drupal, along with a plug in architecture that is somewhat akin to Joomla as well?**
I don't really have the time to build out a full blown CMS system in ASP.NET, but if something already exists that can give me X% (25%, 50%, someth... | [
0.23922190070152283,
0.2551184892654419,
0.2631559371948242,
0.09819244593381882,
-0.19663287699222565,
0.06183135509490967,
0.2421777844429016,
0.3306298851966858,
-0.21687471866607666,
-0.6859295964241028,
0.0632249042391777,
0.4898589849472046,
-0.06275617331266403,
-0.17898724973201752... | |
struggled with) [DotNetNuke](http://www.dotnetnuke.com/). | [
0.009194633923470974,
-0.37628427147865295,
0.5137457251548767,
-0.025674443691968918,
0.007359102368354797,
-0.05974685028195381,
0.37669721245765686,
0.196213960647583,
-0.41625845432281494,
-0.515975832939148,
-0.16944356262683868,
0.2689592242240906,
-0.3686140179634094,
0.322284579277... | |
Which is the better approach to developing web services; contract first or contract last?
What are the advantages and disadvantages of each?
Which do you have experience with?
**EDIT**
This question is about the implementation of a web service (read: SOAP)
The question is whether the implementation classes should ... | [
0.6885280609130859,
-0.18571345508098602,
0.0996430516242981,
-0.002161437878385186,
-0.07124102860689163,
0.1809428185224533,
-0.09349566698074341,
-0.3988373279571533,
0.1178516373038292,
-0.7619137763977051,
-0.11518868803977966,
0.6086389422416687,
0.008479923009872437,
-0.239239618182... | |
and what is expected. This becomes especially important when you start trying to convert java types -> xml types. You're also able to reuse schemas across different web service. | [
0.26806700229644775,
-0.08967441320419312,
-0.08120744675397873,
0.2746560275554657,
-0.17535728216171265,
-0.2770111560821533,
-0.04615047574043274,
-0.2334776520729065,
-0.24682509899139404,
-0.8359041213989258,
-0.24692173302173615,
0.4078434109687805,
-0.1181747168302536,
-0.2498719394... | |
I feel the term rather pejorative. Hence, I am flabbergasted by the two sentences in Wikipedia:
> Imperative programming is known for
> employing side effects to make
> programs function. Functional
> programming in turn is known for its
> minimization of side effects. [[1]](http://en.wikipedia.org/wiki/Side_effe... | [
0.3730939030647278,
0.3680567443370819,
-0.06210945546627045,
-0.1019396111369133,
-0.31859198212623596,
-0.22030360996723175,
0.36535218358039856,
-0.014210272580385208,
0.03740782290697098,
-0.4252392649650574,
0.09666541963815689,
0.5129335522651672,
-0.06439647078514099,
0.325511693954... | |
article is now only moderately bad. In the part that bears on your question, I wrote as follows:
> In computer science, a function or expression is said to have a **side effect** if, in addition to producing a value, it also modifies some state or has an *observable* interaction with calling functions or the outside w... | [
0.3357785642147064,
0.3541249930858612,
0.46467477083206177,
-0.04861696437001228,
-0.08034531027078629,
-0.49686020612716675,
0.22684010863304138,
-0.011922698467969894,
0.001782174687832594,
-0.10236144065856934,
-0.17684070765972137,
0.367089182138443,
-0.3233105540275574,
0.40562430024... | |
behavior depends on past history; that is, the order of evaluation matters. Because understanding an effectful program requires thinking about all possible histories, side effects often make a program harder to understand.
>
>
> Side effects are essential to enable a program to interact with the outside world (people... | [
0.018041642382740974,
0.0862906202673912,
-0.032137706875801086,
0.215938001871109,
-0.04951505735516548,
-0.0774315744638443,
0.7133777737617493,
-0.004559781402349472,
0.03265850991010666,
-0.4657886028289795,
-0.06746918708086014,
0.6701836585998535,
-0.395529180765152,
0.07844764739274... | |
but it is customary for programmers to avoid them. The functional language Haskell restricts side effects with a static type system; only a function that produces a result of IO type can have side effects. | [
0.1862233579158783,
0.2845618426799774,
-0.0653514713048935,
-0.19884181022644043,
-0.13954398036003113,
-0.20074276626110077,
0.24485638737678528,
0.020788444206118584,
0.07318253070116043,
-0.2000284343957901,
-0.21492542326450348,
0.5332247614860535,
-0.6434687376022339,
-0.023146716877... | |
Eclipse CDT provides two indexers for C/C++ code (Preferences > C/C++ > Indexer). Does anybody know what the exact difference is between these two?
The help file isn't exactly enlightening:
> "CDT supports the contribution of
> additional indexers, with 2 indexers
> being provided with the default CDT
> release:
>... | [
0.07947953045368195,
-0.21904142200946808,
0.29232072830200195,
0.1561172604560852,
-0.5075238347053528,
-0.45589590072631836,
-0.253442645072937,
-0.06693102419376373,
-0.043557215481996536,
-0.7766401171684265,
-0.21435195207595825,
0.7899227142333984,
-0.34898364543914795,
-0.7553825378... | |
information."
What does it mean to be more *accurate*: does it index more things, and if so which ones?
Here is an excerpt from the CDT page describing their parsing and indexing([CDT/designs/Overview of Parsing](http://wiki.eclipse.org/CDT/designs/Overview_of_Parsing)). It gives a pretty good description of what the ... | [
0.12663745880126953,
0.05360701307654381,
0.4736533761024475,
0.638985276222229,
-0.19016683101654053,
-0.21656908094882965,
-0.26955801248550415,
-0.3278093934059143,
-0.2470913678407669,
-0.8226134181022644,
-0.20279541611671448,
0.468411922454834,
-0.18634802103042603,
-0.18075560033321... | |
(Persisted Document Object Model) in
> order to be able to provide features
> that respond quickly to user requests.
>
>
> Building the index involves parsing
> all the code in a project, resolving
> all the bindings and writing those
> bindings to the index. The index is
> then incrementally updated every time... | [
-0.10375695675611496,
-0.3479400873184204,
0.8370872735977173,
0.3117233216762543,
-0.09096010774374008,
-0.4407345652580261,
-0.09164883941411972,
-0.14293481409549713,
-0.2972833514213562,
-0.5378647446632385,
-0.21445320546627045,
0.5618573427200317,
-0.3226003348827362,
0.0341124758124... | |
time consuming
> process. The difference between the
> fast and full indexers is that the
> fast indexer will skip header files
> that have already been parsed once,
> while the full indexer will always
> re-parse a header file every time it
> is included. However it is important
> to understand that the full i... | [
-0.15174730122089386,
-0.22321109473705292,
0.24530920386314392,
0.37413880228996277,
-0.10716380178928375,
-0.27999985218048096,
0.12743285298347473,
-0.1296713948249817,
-0.35100340843200684,
-0.8206433653831482,
-0.06556826829910278,
0.5563290119171143,
-0.3402600884437561,
0.0104429675... | |
use macros
> in conjunction with preprocessor
> conditionals (#ifdefs) to partially
> include a header file. Sometimes such
> a header file is included more than
> once in a project, if the macros that
> the header depends on are different
> each time the header is included then
> different parts of the header ... | [
0.2077873796224594,
-0.2607157230377197,
0.0679912343621254,
0.15136446058750153,
-0.002967522479593754,
-0.21955469250679016,
-0.011453001759946346,
-0.23074033856391907,
-0.12352452427148819,
-0.9845661520957947,
-0.11440856754779816,
0.38056546449661255,
-0.48282596468925476,
-0.1763900... | |
has already encountered, but it
> will not re-index them. Therefore
> source files that include a header may
> be parsed more accurately, but the
> header itself will only be indexed the
> one time. The full indexer is much
> slower than the fast indexer because
> of the extra parsing it does, but it
> is only ... | [
-0.1698225885629654,
-0.1660076379776001,
0.5128164291381836,
0.2103157341480255,
-0.15350376069545746,
-0.48573172092437744,
-0.05134362727403641,
-0.2677242159843445,
-0.15094484388828278,
-0.9212294816970825,
-0.3448742926120758,
0.46634647250175476,
-0.4719080924987793,
-0.058799311518... | |
is stored
> on disk as a flat binary file. The
> indexer will only index headers that
> are included by source files, so if
> there is a .h file in the project that
> is not being included by any .c or
> .cpp file, then normally it won’t get
> indexed. However there is a preference
> setting for indexing all fi... | [
0.09840010106563568,
-0.08332845568656921,
0.37411653995513916,
0.48715537786483765,
0.11186479032039642,
-0.22578918933868408,
-0.1786002665758133,
0.06715188920497894,
-0.14461015164852142,
-0.8169001936912537,
-0.31870758533477783,
0.19219841063022614,
-0.09422111511230469,
0.2302999347... | |
I have created an NSScrollView in interface builder that has a variable number of semi-unique NSViews that can be programmatically added and removed from it. When I add subViews to the documentView, they appear in the lower-left hand corner instead of the upper-left hand corner. I see that you can check the isFlipped b... | [
0.020399948582053185,
0.008306682109832764,
0.5993742942810059,
0.17292192578315735,
-0.26753661036491394,
-0.17887292802333832,
0.05244160071015358,
0.1307281106710434,
-0.36765778064727783,
-0.7111315727233887,
0.06840261816978455,
0.4227949380874634,
-0.18729007244110107,
0.189121618866... | |
system.
>
>
> Declaration
> -----------
>
>
>
> ```
> var isFlipped: Bool { get }
>
> ```
>
> Discussion
> ----------
>
>
> The default value of this property is `false`, which results in a non-flipped coordinate system.
>
>
> [...]
>
>
> If you want your view to use a flipped coordinate system, override t... | [
-0.1496271938085556,
0.005858255550265312,
0.8852236866950989,
0.06118345260620117,
0.20491690933704376,
0.037397705018520355,
0.15928880870342255,
-0.0175315011292696,
-0.29846346378326416,
-0.6946394443511963,
-0.30155935883522034,
0.5018357634544373,
-0.40880680084228516,
0.087972268462... | |
I have a product designed to be a desktop product using MS Access file as a DB.
Now, some users need to install it in a few PCs (let's say 2 or 3) and SHARE the database.
I thought to place the MS Access file in a shared folder and access it from the PC, but... the JET Engine is designed for multiple user access?
An... | [
0.5628089308738708,
0.38596051931381226,
0.20499511063098907,
0.43565768003463745,
-0.024923261255025864,
-0.2152062952518463,
0.05984673649072647,
0.018213307484984398,
0.1932930201292038,
-0.4619271457195282,
0.2668580114841461,
0.48705124855041504,
-0.4769294261932373,
0.106662295758724... | |
don't know where to start. I just spent 4 points in reputation voting down the answers with misleading and wrong information in them.
1. the Jet database engine (which is all that's involved here, as the OP clarified with an edit) is by default multi-user -- it was built from the ground up to be that way.
2. sharing a... | [
0.6528939604759216,
0.1365032196044922,
0.34104305505752563,
0.46849313378334045,
0.2208259403705597,
-0.47843265533447266,
0.08215627074241638,
-0.056292515248060226,
0.11226934939622879,
-0.40135547518730164,
0.12740623950958252,
0.497820109128952,
-0.3107603192329407,
-0.087153658270835... | |
your local PC's instance of the Jet database engine once per second (with default settings), and because Jet can't recover from a dropped connection (which is quite common in a wireless environment).
3. the situation where Access falls down is when a front-end Access application MDB is shared (which is not the case for... | [
-0.18572765588760376,
-0.00968420971184969,
0.37150144577026367,
0.3577420115470886,
0.09410466253757477,
-0.3862210214138031,
0.2519628405570984,
0.0918305516242981,
-0.22983847558498383,
-0.876201331615448,
-0.11231162399053574,
0.5319539308547974,
-0.3665076792240143,
0.1973911523818969... | |
one record in one of the system tables), it's very prone to corruption if multiple users open it. In my estimation, sharing an Access front end (or an unsplit MDB with the tables and forms/reports/etc. all in one MDB) is the source for 99.99% of corruptions of Access/Jet files.
My basic answer to the OP's question is ... | [
0.1089855283498764,
0.4530608355998993,
0.15861953794956207,
0.47954902052879333,
0.2834358215332031,
-0.07978124916553497,
0.05351685360074043,
0.07160938531160355,
-0.306253045797348,
-0.5441873669624329,
0.1780186891555786,
0.6033572554588318,
-0.13530686497688293,
0.25065532326698303,
... | |
that is more robust at higher user populations. | [
0.10827358812093735,
0.12164338678121567,
0.3011726438999176,
0.06645597517490387,
0.13005298376083374,
0.05014495551586151,
-0.04177410528063774,
0.011891636997461319,
-0.028705740347504616,
-0.6416231989860535,
-0.27666527032852173,
0.49039244651794434,
0.11333571374416351,
-0.0578893274... | |
The javascript jQuery code below works, except I would like to add 2 features to the button's state.
1. When a user clicks one of the buttons, the other button that was not clicked gets a new class (look).
2. Both button's state should change to unclickable.
```
[div id="1" class="__button_image"] [/div]
[div id="2... | [
-0.34740978479385376,
-0.27695971727371216,
0.6620768904685974,
-0.4290872812271118,
0.11960858851671219,
0.1299595683813095,
0.13768911361694336,
-0.28788483142852783,
-0.031167076900601387,
-0.7025874853134155,
-0.3390456736087799,
0.795973539352417,
-0.2722037434577942,
-0.1187601387500... | |
{
$(this).removeClass("__button_image_hover");
});
$("div.__button_image").click(function () {
/** change button look to 'clicked' */
$(this).addClass("__button_image_clicked");
/** get the id of the current button */
b_id = $(this).attr('id');
/** unbind both vote buttons for *no* interacti... | [
-0.008053537458181381,
-0.4349856674671173,
0.659214198589325,
-0.3423508107662201,
0.21092413365840912,
0.39148956537246704,
0.10525774955749512,
-0.4588111340999603,
-0.29497238993644714,
-0.557100772857666,
-0.06914668530225754,
0.8425663709640503,
-0.5365143418312073,
-0.05729949474334... | |
* not clicked.
*/
$('div.__button_image').each(function() {
button_id = $(this).attr('id');
if(button_id!=b_id) {
$('#'+button_id).removeClass("__button_image");
$('#'+button_id).addClass("__button_image_gray");
}
});
jQuery.get('/do/request?id='+b_id);
$(this).parent().cs... | [
-0.15750326216220856,
-0.3417637348175049,
0.5218220353126526,
-0.15595097839832306,
0.1114371046423912,
0.2211519032716751,
0.210550919175148,
-0.04171369597315788,
-0.15621231496334076,
-0.6728800535202026,
-0.4506452679634094,
0.5622395873069763,
-0.4080126881599426,
0.10915530472993851... | |
In Mathematica
```
a = FactorInteger[44420069694]
```
assigns
```
{{2, 1}, {3, 1}, {7, 1}, {11, 2}, {13, 1}, {23, 2}, {31, 1}, {41, 1}}
```
to a. Now instead of the factors with their exponents I would like each of those lists expanded. The above factorization would then become
```
{2, 3, 7, 11, 11, 13, 23, 23, ... | [
-0.37341564893722534,
-0.08182454854249954,
0.4810325801372528,
0.05168052762746811,
-0.16968590021133423,
0.1830330640077591,
0.18160150945186615,
-0.20131462812423706,
-0.38328132033348083,
-0.31822678446769714,
-0.12601129710674286,
0.574860692024231,
-0.3569376468658447,
-0.02531348355... | |
41}`
even shorter:
`Join @@ ConstantArray @@@ a`
---
A speed comparison of methods posted
------------------------------------
Using the these functions (in the order they were posted):
```
zvrba = Flatten[Map[Table[#[[1]], {#[[2]]}] &, #]] &;
dreeves = Sequence @@ Table[#1, {#2}] & @@@ # &;
gdelfino = Flatten[# ... | [
0.05328373983502388,
-0.10894744098186493,
0.7873982787132263,
0.02636684849858284,
-0.19889840483665466,
0.49287042021751404,
0.05305856838822365,
-0.5493694543838501,
-0.4774887263774872,
-0.5554690957069397,
-0.26765310764312744,
0.7492494583129883,
-0.12841066718101501,
0.0832645893096... | |
description here](https://i.stack.imgur.com/7kQsD.gif)
Note that these charts are logarithmic. Lower is better. | [
-0.2545187771320343,
-0.0411703884601593,
0.4529989957809448,
0.234141543507576,
0.025752225890755653,
-0.056811992079019547,
0.22754745185375214,
-0.18494942784309387,
-0.5434218645095825,
-0.5801821351051331,
-0.10247886925935745,
0.06953495740890503,
0.02065422013401985,
0.2381850481033... | |
How would I move items in a BindingList in C#? Say, move last added item to the front, or swap with previous item?
A BindingList has an Items property that implements IList<>
So you can Use `Insert()` and `RemoveAt()` | [
0.22236257791519165,
-0.09142516553401947,
0.22741280496120453,
-0.08805837482213974,
-0.08543587476015091,
-0.09509075433015823,
-0.2536635398864746,
-0.4969973862171173,
0.059710532426834106,
-0.4610148072242737,
-0.20977625250816345,
0.32628366351127625,
-0.5334764719009399,
0.013688688... | |
Suppose that we have a System.Decimal number.
For illustration, let's take one whose ToString() representation is as follows:
```
d.ToString() = "123.4500"
```
The following can be said about this Decimal. For our purposes here, scale is defined as the number of digits to the right of the decimal point. Effective s... | [
-0.15857352316379547,
-0.2179490625858307,
0.27979278564453125,
0.0689430832862854,
-0.11857001483440399,
0.07042405009269714,
-0.04286560043692589,
-0.5518771409988403,
-0.20982253551483154,
-0.323072224855423,
0.2519102394580841,
0.20163750648498535,
0.14900724589824677,
0.12715108692646... | |
I compute all four of these parameters efficiently and without converting to a String and examining the String? The solution probably requires Decimal.GetBits.
Some more examples:
```
Examples Precision Scale EffectivePrecision EffectiveScale
0 1 (?) 0 1 (?) 0
0.0 2 (?) 1 ... | [
0.24889583885669708,
0.058517880737781525,
0.23467384278774261,
-0.043845538049936295,
-0.03238902986049652,
-0.0016201820690184832,
0.34119749069213867,
-0.7014337182044983,
-0.05415952205657959,
-0.3655586540699005,
0.1471230834722519,
0.8068768978118896,
-0.05645158141851425,
-0.1446536... | |
0
12.45 4 2 4 2
12.4500 6 4 4 2
770 3 0 | [
0.4843982756137848,
0.3989371657371521,
0.36264297366142273,
-0.16664838790893555,
-0.12134916335344315,
0.27718329429626465,
0.39452847838401794,
-0.24770011007785797,
0.22058218717575073,
-0.5301276445388794,
0.002979505341500044,
0.2741696536540985,
0.05633387342095375,
0.58357107639312... | |
3 0
```
(?) Alternatively interpreting these precisions as zero would be fine.
Yes, you'd need to use `Decimal.GetBits`. Unfortunately, you then have to work with a 96-bit integer, and there are no simple integer type in .NET which copes with 96 bits. On the other hand, it's possible that you could ... | [
0.2926575541496277,
0.10901247709989548,
-0.044983018189668655,
-0.21094907820224762,
-0.18265235424041748,
0.044192180037498474,
0.28711920976638794,
-0.1934804767370224,
-0.04376242682337761,
-0.20201317965984344,
0.06156744435429573,
0.36849725246429443,
-0.29230761528015137,
0.21398557... | |
{
ShowInfo(123.4500m);
ShowInfo(0m);
ShowInfo(0.0m);
ShowInfo(12.45m);
ShowInfo(12.4500m);
ShowInfo(770m);
}
static void ShowInfo(decimal dec)
{
// We want the integer parts as uint
// C# doesn't permit int[] to uint[] conversion, | [
0.11875657737255096,
-0.1246802806854248,
0.5121362805366516,
-0.03326195478439331,
0.02463231049478054,
0.1292216181755066,
-0.1878354847431183,
-0.07722608745098114,
-0.09411372244358063,
-0.17608702182769775,
-0.2532322406768799,
0.33148738741874695,
-0.17616970837116241,
0.210009083151... | |
// but .NET does. This is somewhat evil...
uint[] bits = (uint[])(object)decimal.GetBits(dec);
decimal mantissa =
(bits[2] * 4294967296m * 4294967296m) +
(bits[1] * 4294967296m) +
bits[0];
uint scale = (bits[3] >> 16) & 31;
// Precision: | [
0.015074320137500763,
-0.09530825912952423,
0.4420280158519745,
0.15103964507579803,
0.05998285487294197,
0.11564257740974426,
0.4470214545726776,
-0.2716718912124634,
-0.3750050663948059,
-0.47268858551979065,
-0.23571518063545227,
0.5063312649726868,
0.08762359619140625,
0.00230280961841... | |
number of times we can divide
// by 10 before we get to 0
uint precision = 0;
if (dec != 0m)
{
for (decimal tmp = mantissa; tmp >= 1; tmp /= 10)
{ | [
0.20690475404262543,
-0.1472562998533249,
0.4626513123512268,
-0.07886889576911926,
0.29219114780426025,
0.4921663701534271,
0.33685266971588135,
-0.35836392641067505,
-0.47829723358154297,
-0.4081951081752777,
0.031069347634911537,
0.4968094527721405,
-0.030540775507688522,
-0.02732723765... | |
precision++;
}
}
else
{
// Handle zero differently. It's odd.
precision = scale + 1;
}
uint trailingZeros = 0; | [
0.07837896794080734,
-0.5741208791732788,
0.3804037272930145,
-0.125061497092247,
-0.21144938468933105,
0.12481581419706345,
0.04133268818259239,
-0.2832223176956177,
-0.06665889918804169,
-0.08938458561897278,
0.2685635983943939,
0.2624562382698059,
-0.2373596578836441,
0.3201677203178406... | |
for (decimal tmp = mantissa;
tmp % 10m == 0 && trailingZeros < scale;
tmp /= 10)
{
trailingZeros++;
}
Console.WriteLine("Example: {0}", dec);
Console.WriteLine("Precision: {0}", precision); | [
-0.23423254489898682,
-0.24769675731658936,
0.7124478816986084,
-0.26658448576927185,
0.19132064282894135,
0.4768925905227661,
0.14840982854366302,
-0.44158437848091125,
-0.004916822072118521,
-0.3322807848453522,
-0.05963054299354553,
0.31147855520248413,
-0.040563613176345825,
0.02109011... | |
Console.WriteLine("Scale: {0}", scale);
Console.WriteLine("EffectivePrecision: {0}",
precision - trailingZeros);
Console.WriteLine("EffectiveScale: {0}", scale - trailingZeros);
Console.WriteLine();
}
}
``` | [
-0.36445438861846924,
-0.32051604986190796,
0.753722071647644,
-0.1443144828081131,
0.2209118902683258,
0.04571482166647911,
0.22703896462917328,
-0.21309074759483337,
0.14723990857601166,
-0.7619099617004395,
-0.15448430180549622,
0.5460429191589355,
-0.18357433378696442,
0.08031616359949... | |
I'm currently playing about with some XNA stuff learning to program AI. Anyway, here's my situation: Class A has a function which takes a reference to an instance of class B, does some stuff to to it, and returns it. Class B contains an instance of Class A, and then calls the function from it.
Example in code:
```
Cl... | [
0.36493295431137085,
-0.04527899995446205,
-0.14675955474376678,
-0.3251371681690216,
0.04163278639316559,
-0.0584319569170475,
0.5827929973602295,
-0.18267321586608887,
-0.2270393669605255,
-0.4189571738243103,
-0.22483594715595245,
0.3902526795864105,
-0.8131700158119202,
0.3706013858318... | |
this = B.Do(ref this);
}
}
Class B
{
public A Do(ref A classA)
{
//Manipulate
return classA;
}
}
```
I've tried passing a memberwise clone .. but that didn't work, obviously, because "this" is read-only. I've no idea with this. I'm really stuck. Does anybody have any ideas? I'd ideall... | [
0.3909006416797638,
0.20744377374649048,
-0.050552573055028915,
-0.3529832363128662,
0.1180865690112114,
-0.09741988778114319,
0.29628029465675354,
-0.15797574818134308,
-0.24086706340312958,
-0.37064817547798157,
0.16561922430992126,
0.3334961235523224,
-0.7072997093200684,
0.476217120885... | |
public void Do(A classA)
{
//Manipulate
}
}
```
should manipulate the object classA references. Then in A,
```
Class A
{
B classB;
public A()
{
classB = new B();
}
public void Act()
{
B.Do(this);
}
}
```
Note: "This does have the side effect that the r... | [
0.1875705122947693,
-0.16313937306404114,
0.15931694209575653,
-0.3660859763622284,
0.06838225573301315,
-0.2498146891593933,
0.3701656460762024,
-0.4389922618865967,
-0.1835629642009735,
-0.38428351283073425,
-0.4549473524093628,
0.4649071991443634,
-0.6961998343467712,
0.1566390544176101... | |
to null (it will only set the local variable to null)" - [JulianR](https://stackoverflow.com/users/61632/julianr) | [
0.16877037286758423,
-0.06823649257421494,
0.41490378975868225,
-0.11551042646169662,
0.17561377584934235,
-0.27256548404693604,
0.3485674560070038,
-0.13034148514270782,
-0.2713671326637268,
0.21317213773727417,
-0.27821213006973267,
0.5293142795562744,
-0.424166202545166,
0.2500576972961... | |
I am working on some Python socket code that's using the [`socket.fromfd()`](http://docs.python.org/library/socket.html#socket.fromfd) function.
However, this method is not available on all platforms, so I am writing some fallback code in the case that the method is not defined.
**What's the best way to determine if ... | [
0.3756467401981354,
-0.014590118080377579,
0.29045212268829346,
-0.1833827644586563,
-0.009821238927543163,
-0.2659696936607361,
0.11010206490755081,
-0.2755211293697357,
-0.02945965901017189,
-0.5203280448913574,
-0.21393564343452454,
0.6658183932304382,
-0.3469219505786896,
0.10795751214... | |
sock = socket.fromfd(...)
else:
sock = socket.socket(...)
```
Thoughts?
**EDIT** As [Paolo](https://stackoverflow.com/questions/763971/determine-if-a-function-is-available-in-a-python-module/763975#763975) pointed out, this question is [nearly a duplicate](https://stackoverflow.com/questions/610883) of a questio... | [
-0.19809721410274506,
-0.10045202821493149,
0.3588283658027649,
-0.16364797949790955,
-0.1930096596479416,
-0.11002323776483536,
0.2875548303127289,
-0.15421101450920105,
-0.24709464609622955,
-0.5272117853164673,
-0.16506899893283844,
0.32136523723602295,
-0.3702942132949829,
0.0422214306... | |
want to cut out the middle man you should go with marcog's answer.
**EDIT**: I also just realized this question is actually a [duplicate](https://stackoverflow.com/questions/610883/how-to-know-if-an-object-has-an-attribute-in-python/610893). One of the answers there discusses the merits of the two options you have: ca... | [
-0.07200291007757187,
-0.26307201385498047,
-0.06176284700632095,
0.26006942987442017,
-0.09197215735912323,
0.3122878670692444,
0.06746017932891846,
-0.08525530993938446,
-0.19619746506214142,
-0.4932287931442261,
-0.2027745544910431,
0.3222726881504059,
-0.1652754694223404,
-0.3390507400... | |
I did some havoc on my computer, when I played with the commands suggested by vezult [[1].](https://stackoverflow.com/questions/625656/favourite-command-line-trick/627870#627870) I expected the one-liner to ask file-names to be removed. However, it immediately removed my files in a folder:
```
> find ./ -type f | whil... | [
0.22824548184871674,
0.18898841738700867,
0.03667495772242546,
-0.10221432149410248,
0.04698331654071808,
-0.11473600566387177,
0.3591001033782959,
-0.1762402206659317,
-0.20500026643276215,
-0.45042404532432556,
-0.14498792588710785,
0.641546368598938,
-0.2983132004737854,
0.1695683747529... | |
you use the read command?
The answer to that is - when you want to read successive lines from some file (quite possibly the standard output of some previous sequence of commands in a pipeline), possibly splitting the lines into several separate variables. The splitting is done using the current value of '`$IFS`', whic... | [
0.39319145679473877,
-0.13336052000522614,
0.3265290856361389,
0.022361995652318,
0.16382740437984467,
0.05157345533370972,
0.07856191694736481,
-0.21909832954406738,
-0.012930302880704403,
-0.5720421075820923,
-0.28325802087783813,
0.6975849866867065,
-0.21118226647377014,
0.0913965851068... | |
last variable. If there's only one variable, the whole line goes into that variable.
There are many uses. This is one of the simpler scripts I have that uses the split option:
```
#!/bin/ksh
#
# @(#)$Id: mkdbs.sh,v 1.4 2008/10/12 02:41:42 jleffler Exp $
#
# Create basic set of databases
MKDUAL=$HOME/bin/mkdual.s... | [
0.028025221079587936,
-0.07734464108943939,
0.32621821761131287,
-0.1094411313533783,
0.07752201706171036,
-0.06798022985458374,
0.34055835008621216,
-0.43327292799949646,
-0.15118086338043213,
-0.46577155590057373,
-0.2134987711906433,
0.38887932896614075,
-0.4355587363243103,
0.293825119... | |
$bw -e "grant resource to public" -f $MKDUAL -f $ELEMENTS $cw
done
```
The `cat` command with a here-document has its output sent to a pipe, so the output goes into the `while read dbs logging` loop. The first word goes into `$dbs` and is the name of the (Informix) database I want to create. The remainder of the line... | [
0.6488664746284485,
0.020134447142481804,
0.45180168747901917,
-0.12220394611358643,
0.22094137966632843,
-0.1739932894706726,
0.17607513070106506,
-0.19782067835330963,
0.2272835671901703,
-0.44220513105392456,
-0.1644878089427948,
0.39248472452163696,
-0.3770788609981537,
0.3314864635467... | |
name; it's been around since about 1990) to create a database and populate it with some standard tables and data - a simulation of the Oracle '`dual`' table, and a set of tables related to the 'table of elements'.
Other scripts that use the `read` command are bigger (by far), but generally read lines containing one or... | [
0.03180360794067383,
0.08973242342472076,
0.387042373418808,
-0.05878471955657005,
-0.24829743802547455,
-0.003984817303717136,
0.1464458405971527,
0.18818865716457367,
-0.1970527619123459,
-0.5717356204986572,
0.019014161080121994,
0.32124239206314087,
-0.37108275294303894,
0.461300939321... | |
read x || exit
jlss: read x || exit
jlss: while read file type link owner group perms
jlss: read x || exit
jlss: while read file type link owner group perms
kb: while read size name
mkbod: while read directory
mkbod:while read dist comp
mkdbs:while read dbs logging
mkmsd:while read msdfile ma... | [
-0.16612261533737183,
0.44412821531295776,
0.35315680503845215,
-0.1405332088470459,
-0.16125117242336273,
0.13368231058120728,
0.5270488262176514,
-0.1210048571228981,
-0.03443886339664459,
-0.6165613532066345,
-0.39485621452331543,
0.28465667366981506,
-0.4264320135116577,
0.454660385847... | |
is my command line prompt; I ran this in my 'bin' directory. '`wgrep`' is a variant of grep that only matches entire words (to avoid words like 'already'). This gives some indication of how I've used it.
The '`read x || exit`' lines are for an interactive script that reads a response from standard input, but exits if ... | [
0.06818060576915741,
-0.24061904847621918,
0.4572581648826599,
0.030281158164143562,
-0.11391440033912659,
0.04953712597489357,
0.34553349018096924,
0.2876243591308594,
0.1534503847360611,
-0.537353515625,
-0.47702670097351074,
0.2570537328720093,
-0.05711997672915459,
-0.00169012765400111... | |
I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Require... | [
0.6191114783287048,
0.3106688857078552,
-0.2683238685131073,
-0.09169866889715195,
-0.2178502380847931,
0.24590462446212769,
0.4483157694339752,
-0.3887529671192169,
0.06255407631397247,
-0.5381054878234863,
0.02118825353682041,
0.2853624224662781,
-0.2575323283672333,
0.22719164192676544,... | |
confused. In the later case, a restart sometimes helps. Then a manual build from all packages in order.
If it really can't be found, check if all package (bpl and dcp) and dcu files are available. You need both. | [
0.14250323176383972,
-0.25165703892707825,
0.032413266599178314,
0.43223845958709717,
0.16245721280574799,
-0.32182830572128296,
0.3858076333999634,
0.09896405786275864,
-0.3489087224006653,
-0.5484490394592285,
-0.20370973646640778,
0.5361179709434509,
-0.1854732781648636,
0.3108872473239... | |
I've tried to find an answer to do this online but apparently it can't be done (I mean at the app level, not database). I have a need to clear out my dataset completely and reset the primary key at the same time. Any ideas?
Alternatively, one hack i can use is to reinitialize the dataset but that doesn't seem possible... | [
0.1874803751707077,
0.06694221496582031,
0.2072513997554779,
0.24335044622421265,
-0.06291022896766663,
-0.16360577940940857,
0.4808863401412964,
-0.033461976796388626,
-0.18225941061973572,
-1.0907933712005615,
-0.06733983010053635,
0.4285736083984375,
-0.44808459281921387,
0.337179094552... | |
MyDataSet();
sharedDS.Table1.Reset();
sharedDS.Merge(referenceDS);
```
}
My original problem is solved but now I get an System.ArgumentException for Column1 does not belong to Table1 where I can see the columns in the DataSet Viewer as well as see the populated rows. Also note that I can manually re-crea... | [
-0.08947386592626572,
0.15630602836608887,
0.2424193024635315,
0.21295815706253052,
0.039914146065711975,
0.2253655344247818,
0.5060534477233887,
-0.01059147622436285,
-0.2672850489616394,
-0.7373519539833069,
0.06892193108797073,
0.7446248531341553,
-0.27020853757858276,
-0.01673060469329... | |
help! | [
-0.05387968197464943,
0.24643917381763458,
0.30373844504356384,
0.09972532838582993,
-0.09025831520557404,
-0.048442624509334564,
0.5725916624069214,
0.11352712661027908,
-0.28229260444641113,
-0.3584964871406555,
-0.1902773231267929,
-0.05915037542581558,
-0.14503291249275208,
0.063085965... | |
How do I access data from html in asp.net in the .cs (code behind) file?
In .aspx page I have:
```
<tr>
<td>Username:</td><td><input id="username" type="text" /></td>
</tr>
<tr>
<td>Password:</td><td><input id="password" type="password" /></td> | [
0.013391091488301754,
0.047208335250616074,
0.6590186357498169,
0.0006282470421865582,
-0.12401200830936432,
0.15639783442020416,
0.15709060430526733,
-0.39193594455718994,
-0.1513008177280426,
-0.9329534769058228,
0.006042046472430229,
0.10778934508562088,
0.16630998253822327,
-0.09058575... | |
</tr>
<tr>
```
I know I can convert this to something like:
```
<tr>
<td>Username:</td><td><asp:TextBox ID="username" TextMode="SingleLine" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Password:</td><td><asp:TextBox ID="password" TextMode="Password" runat=server></asp:... | [
-0.06763077527284622,
-0.11529186367988586,
0.46682479977607727,
0.2082967907190323,
-0.18798071146011353,
0.00873546302318573,
-0.07403279095888138,
-0.5906484127044678,
-0.15006023645401,
-0.6563539505004883,
0.007932553999125957,
0.46488770842552185,
-0.2397891879081726,
-0.009953220374... | |
as well as an id and you will be able to get the values from [Request.Form](http://msdn.microsoft.com/en-us/library/ms525985.aspx). Inputs without names are not sent back with the form post.
```
<input id="username" name="username" type="text" />
<input id="password" name="password" type="password" />
var username = ... | [
-0.07796866446733475,
0.16870373487472534,
0.6115044951438904,
0.18751884996891022,
0.12447380274534225,
0.15304435789585114,
-0.020379768684506416,
-0.31726205348968506,
-0.2799498438835144,
-0.5062891840934753,
-0.37737593054771423,
0.41448062658309937,
-0.03390756621956825,
0.0971669033... | |
I'm working on a small web form that requires the user to input (among other things), the scheduled backup time of whatever server they're adding to the system. The problem is, I'm struggling to find out the best way to take the user input and build a DateTime object (which is what the database requires).
I only reall... | [
0.6874793767929077,
0.1602535843849182,
0.3371257781982422,
0.03444422036409378,
0.361129492521286,
0.21291370689868927,
0.07055255770683289,
0.15080441534519196,
-0.17116186022758484,
-0.4882471561431885,
0.37408313155174255,
0.3691982328891754,
-0.15412943065166473,
0.07001683861017227,
... | |
time of day, etc.
I've been looking at the Calender asp control, which would work for the day of the week selection, but I can't seem to find any support of time of day.
Thanks.
I don't think you want to use a DateTime for a recurring event such as a backup. A DateTime is useful for storing a particular date and time... | [
0.36984214186668396,
-0.3441844880580902,
0.5920056104660034,
0.36474093794822693,
0.16843776404857635,
0.12211347371339798,
0.10748571902513504,
0.14199362695217133,
-0.4819893538951874,
-0.43265825510025024,
0.10199993848800659,
0.39298582077026367,
0.04464709758758545,
0.337687164545059... | |
I'm working on a mod\_wsgi script.. at the beginning is:
```
sys.path.extend(map(os.path.abspath, ['/media/server/www/webroot/']))
```
But I've noticed, that every time I update the script the sys.path var keeps growing with duplicates of this extension:
```
['/usr/lib64/python25.zip'
'/usr/lib64/python2.5'
'/usr/l... | [
0.1543852835893631,
0.017649207264184952,
0.6649675965309143,
-0.21345564723014832,
0.07113099098205566,
-0.2539355456829071,
0.5792236924171448,
-0.3897051215171814,
-0.4344273805618286,
-0.5777117013931274,
-0.05369921773672104,
0.8819952011108398,
-0.6722742915153503,
-0.215451166033744... | |
Are there any Java code generation persistence frameworks?
Something that is "database first" rather than object model first?
I know this is probably heresy in the Java world, I'd just like to know if any frameworks like this exist.
I'm more of a .NET guy these days. So on the .NET-side tools like .NET Tiers or CSLA c... | [
0.6554431915283203,
-0.006576775573194027,
-0.007735072635114193,
0.23395204544067383,
-0.24235035479068756,
-0.09466741979122162,
0.1815553903579712,
0.28218355774879456,
-0.23488189280033112,
-0.6297447085380554,
0.24057170748710632,
0.6203274130821228,
-0.08411826938390732,
0.1385027915... | |
Windows Explorer in Windows 7, and maybe Vista too (can't rememmber), does not have a title in the window. but does have a title (some text) in the taskbar.
Is this possible to reproduce in C# (wpf or winforms)? either through the framework or introp.
I want to have a window that says "Options" in the taskbar but the... | [
0.09210500866174698,
-0.07195490598678589,
0.4128177762031555,
-0.13528461754322052,
0.14850777387619019,
-0.17690525949001312,
0.40315306186676025,
0.1986665576696396,
-0.32821109890937805,
-0.8608443140983582,
-0.23449447751045227,
0.8234314322471619,
-0.22482600808143616,
0.044411085546... | |
I'm looking for a site or book or any other source of tiny programming tasks one can implement in preferred language. Would be great if examples are present too. And would be superb if there're people who may review my code. May be there's a wiki of such tasks. I've tried to google, but found nothing that suits my need... | [
0.44955354928970337,
0.2580147981643677,
-0.36060506105422974,
0.5006566643714905,
0.2147836834192276,
0.23049108684062958,
0.20795725286006927,
0.34592294692993164,
-0.6647077202796936,
-0.6144078373908997,
-0.08106107264757156,
0.18467853963375092,
0.08349305391311646,
-0.224206179380416... | |
I have a NSTextField and I want to set its content if I klick on a button and than set the cursor on this textfield at the end of the text so if someone klicks the button he could just begin to type.
Until now I use [NSTextField selectText] it selects this textfield but it selects the whole text so if someone just beg... | [
0.0030376228969544172,
0.12147832661867142,
0.663578450679779,
-0.20022092759609222,
-0.12276256084442139,
-0.11002975702285767,
0.43212568759918213,
-0.21089252829551697,
0.07476990669965744,
-0.5701580047607422,
-0.13840772211551666,
0.6815120577812195,
-0.22828973829746246,
-0.029799820... | |
in RubyCocoa it is:
```
def select_input_field
@input.selectText self
range = OSX::NSRange.new(@input.stringValue.length, 0)
@input.currentEditor.setSelectedRange range
end
``` | [
-0.34371963143348694,
-0.22748751938343048,
0.4738102853298187,
-0.4545268416404724,
-0.07830725610256195,
-0.003200581530109048,
0.12543733417987823,
-0.23479041457176208,
0.020531222224235535,
-0.40131500363349915,
-0.08242092281579971,
0.20279289782047272,
-0.3457539975643158,
0.0688850... | |
A mysql database table has a column whose datatype is time ( <http://dev.mysql.com/doc/refman/5.0/en/time.html> ). When the table data is accessed, Python returns the value of this column as a datetime.timedelta object. How do I extract the time out of this? (I didn't really understand what timedelta is for from the py... | [
0.0168767049908638,
-0.06452398002147675,
0.34095999598503113,
-0.09862269461154938,
-0.0514662005007267,
0.2475670576095581,
0.18323400616645813,
-0.031542785465717316,
-0.2553353011608124,
-0.4857136309146881,
0.23623032867908478,
0.04178043454885483,
-0.25034230947494507,
0.253125816583... | |
the value as a `datetime.timedelta`. It probably should return a `datetime.time`. Anyway, it looks like it's returning the elapsed time since midnight (assuming the column in the table is 6:00 PM). In order to convert to a `datetime.time`, you can do the following::
```
value = datetime.timedelta(0, 64800)
(datetime.d... | [
0.36811956763267517,
-0.4353196322917938,
0.5665130019187927,
-0.037630803883075714,
0.23953711986541748,
0.12919385731220245,
-0.0078122057020664215,
-0.20326963067054749,
-0.22483783960342407,
-0.2648391127586365,
0.1405138075351715,
0.5041707158088684,
-0.08963799476623535,
0.2337990701... | |
`datetime.timedelta`, you'll get a `datetime.datetime`. That's how the code above works. | [
0.5786310434341431,
-0.4302475154399872,
0.48754653334617615,
0.04261520504951477,
0.37424737215042114,
-0.30207234621047974,
-0.15536558628082275,
0.35215523838996887,
-0.15048633515834808,
-0.5036247968673706,
-0.07269440591335297,
0.49210721254348755,
-0.13503144681453705,
0.08831470459... | |
I have a `TEXT` column in a MySQL DB. The app is like a blog and the col contains the body of the "posts." I will be doing a lot of complex boolean searches on this column.
The MySQL docs say you need to set the index length for TEXT columns with a max length of 767 bytes for InnoDB tables.
Should I just set it to th... | [
0.4313404858112335,
0.3121504783630371,
0.4875825047492981,
-0.017579149454832077,
-0.31108561158180237,
-0.14787378907203674,
0.2230788767337799,
0.028918758034706116,
0.05475565046072006,
-0.5852697491645813,
0.2775307893753052,
0.39038893580436707,
-0.17712010443210602,
0.11835150420665... | |
things that it cannot. A conventional index is not a full-text index and can't be used to find words, or any substring match other than a prefix. Database indexes are used to find an exact value, or a range of values only - they can't perform arbitrary matching.
Assuming you were going to use an index for something it... | [
0.1122266873717308,
-0.03067322075366974,
0.18295645713806152,
0.24221359193325043,
0.03665826469659805,
0.01629059761762619,
0.47631147503852844,
0.06790919601917267,
-0.2997400760650635,
-0.5777305960655212,
-0.15684252977371216,
0.33617740869522095,
-0.15637020766735077,
0.4210462868213... | |
example if your table has many rows with the same prefix, the index needs to be longer than that similar prefix to avoid putting them into the same index entry - meaning that they all need to be searched. | [
-0.06526471674442291,
0.17242255806922913,
0.04342759773135185,
0.13682620227336884,
-0.0741567313671112,
-0.1398080587387085,
-0.08485853672027588,
-0.0868760198354721,
-0.6477546095848083,
-0.8385368585586548,
-0.043815068900585175,
-0.11680032312870026,
-0.2093227207660675,
0.1009373292... | |
I created a java project and then tried to import Java source code from two different projects. I've been working on it for a few hours, deleting and re-creating the project dozens of times to try to reconcile all of the messed up references between these two projects - which other people say are supposed to work toget... | [
0.5658026337623596,
0.29062119126319885,
0.307953417301178,
-0.225203737616539,
-0.009436676278710365,
-0.11139946430921555,
-0.1678006798028946,
-0.16720829904079437,
-0.19031569361686707,
-0.6531720757484436,
0.23983031511306763,
0.6238447427749634,
-0.3211905062198639,
0.044029489159584... | |
the red marks indicating messed up references.
What's the right way to import Java source into Eclipse to avoid messing up references?
Surely not everyone goes about it the way I am doing it - or else no one would get anything done in Eclipse. My assumption here is that I am completely clueless about Eclipse and just... | [
0.6444522142410278,
0.24749024212360382,
-0.31369930505752563,
0.1513400822877884,
-0.41325855255126953,
-0.1728844791650772,
0.07928057760000229,
-0.054746635258197784,
-0.2366635650396347,
-0.5261732339859009,
0.4680553078651428,
0.5015144944190979,
-0.16000179946422577,
0.24576921761035... | |
If you still want one project, you can create a new source folder for each one instead of trying to move then into a single source folder. An eclipse project can have multiple source folders. Ideally, once you got it working, you'd also want to check in the eclipse project (.project file, .settings, etc) into svn also ... | [
0.73167484998703,
-0.13606280088424683,
0.036565739661455154,
0.26111021637916565,
-0.27586689591407776,
-0.31144240498542786,
-0.0005421878886409104,
-0.08417704701423645,
-0.3465118408203125,
-0.6761044859886169,
-0.0851127877831459,
0.4911786615848541,
-0.15392789244651794,
-0.036789838... | |
This code is pretty simple, is it correct? I don't know if I should be retaining the delegate passed in via the init method.
```
@interface SomeClass : NSObject {
SomeClassDelegate *someClassDelegate;
}
-(id)initWithDelegate:(SomeClassDelegate *)delegate;
@end
@implementation SomeClass
-(id)initWithDelegate:(Some... | [
0.20743314921855927,
-0.055266037583351135,
0.530876100063324,
-0.17391981184482574,
0.17332686483860016,
-0.40786463022232056,
0.37587636709213257,
-0.35541510581970215,
-0.43359431624412537,
-0.4372623562812805,
0.03378244489431381,
0.5990927815437317,
0.06323937326669693,
0.145781517028... | |
to know the proper way to deal with delegates.
```
// self's retain count is 1
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:req delegate:self];
// the retain count is now 2, did the init of URLConnection retain self?
```
No, in general, you are not supposed to retain the delegate. Since the ... | [
0.16846899688243866,
0.21317003667354584,
0.5722748041152954,
0.1054466962814331,
0.01419734861701727,
-0.2989572584629059,
0.20881405472755432,
-0.3098253309726715,
-0.4905729293823242,
-0.19940067827701569,
0.06635681539773941,
0.40442603826522827,
-0.002512606093659997,
0.29266789555549... | |
been pointed out by others. | [
0.6948735117912292,
0.5313252806663513,
-0.2684090733528137,
0.21234974265098572,
-0.01635049469769001,
-0.16050615906715393,
-0.16783960163593292,
0.23146095871925354,
-0.18938490748405457,
-0.4627247154712677,
0.18736566603183746,
0.3481113314628601,
-0.06437066197395325,
0.4744458496570... | |
I'm looking to create a binary that takes an html string on stdin, and spits out a well formed xml string representing the DOM. Basically "tidy" but using FireFox.
Any ideas where I should hook into the FF source code?
There are multiple rendering tests included in the source code. Some of them are "close" to what I'm... | [
0.768581748008728,
0.05858936160802841,
0.17663192749023438,
-0.1278388351202011,
-0.071037158370018,
0.19955876469612122,
0.08635856956243515,
-0.0913519412279129,
-0.12068255990743637,
-0.6146765351295471,
0.21077561378479004,
0.6570829153060913,
-0.2559449076652527,
-0.10653223097324371... | |
**Edit:** For those of you looking for an answer to the question as stated the standard limits the number of nested loops at compile time. At runtime this is a different issue as the only limit would be the size of the program segment.
**Solved:** I was looking too early on in the build process. The c file gets furthe... | [
0.4356030523777008,
0.09838758409023285,
0.022616194561123848,
-0.26956892013549805,
-0.20721283555030823,
0.1781274974346161,
0.43566274642944336,
-0.12476083636283875,
-0.2622442841529846,
-0.5966201424598694,
-0.03156595304608345,
0.4725584387779236,
-0.298348993062973,
-0.0986856967210... | |
code is riddled with gotos and it worked up until one of the exception dictionaries reached 23K rules.
The code is basically unreadable but I have managed to make the c code compile after removing what appears to be the 6200th nested loop:
```
for (dictionionary1=seed1;dicitonary1<limit1;dictionary1++)
{
for (di... | [
-0.12203654646873474,
0.42412513494491577,
0.12675398588180542,
-0.0760132372379303,
0.22352716326713562,
0.16211478412151337,
0.6423748731613159,
-0.20330668985843658,
0.23872977495193481,
-0.3874818682670593,
0.1419553905725479,
0.4395391047000885,
-0.21193884313106537,
-0.01317768450826... | |
more removed adding one makes it not compile */
}
}
}
```
Both gcc and xlC are able to handle these but aCC 3.73 (on H11.23 PA RISC) is puking.
```
Compiling /home/ojblass/exception_dictionary_a.c...
Loading the kernel...
Pid 18324 killed due to text modification or page I/O error
/bin/ksh: 28004 Bus ... | [
-0.24729157984256744,
0.17342509329319,
0.38896986842155457,
-0.07823733985424042,
-0.020412441343069077,
0.1362844556570053,
0.2053380161523819,
-0.01636797934770584,
-0.36007606983184814,
-0.7240610718727112,
0.014403115957975388,
0.4513503313064575,
-0.4841226637363434,
0.44044822454452... | |
tried up to 4 GB
maxssiz = 16 MB (x1000000) tried up to 100MB
maxtsiz = 256 MB (x10000000) tried up to 1 GB
```
Any suggestions at compiler settings or a good link for documetation for aCC 3.73? I am drowning in search results.
I have coded a workaround breaking the dictionary into two parts resulting in dictionary... | [
-0.05816158652305603,
0.2585677206516266,
0.4534450173377991,
-0.05944853648543358,
-0.12186302989721298,
0.2072187215089798,
0.4876211881637573,
0.014920049346983433,
-0.3736070692539215,
-0.5317568182945251,
0.03319000452756882,
0.7493917346000671,
-0.02561647817492485,
-0.02806585654616... | |
is well in excess of what C or C++ require (15 for C90, 127 for C99 and 256 for C++).
What I'm curious about is how well that thing runs - if your dictionaries are of any size, the number of loop iterations must be astronomical. Say each dictionary size is 10: (10 ^ 6199) is quite a large number. Even if there are onl... | [
-0.0021367615554481745,
0.10713860392570496,
0.11485812813043594,
0.12735384702682495,
-0.048149265348911285,
0.20105291903018951,
0.4340987801551819,
-0.02007555216550827,
-0.25813889503479004,
-0.5026427507400513,
-0.007752107456326485,
0.3282756805419922,
0.19799023866653442,
-0.3707567... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.