text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
I have an Event table that specifies a date range with `start_date` and `end_date` fields. I have another date range, specified in code, that defines the current week as 'week\_start' and 'week\_end'. I'd like to query all Events for the week. The cases seem to be: * Event begins and ends within the week * Event begi...
[ 0.2214980274438858, -0.02114134095609188, 0.48640844225883484, -0.07071131467819214, -0.0234645027667284, 0.22812336683273315, 0.17994467914104462, 0.15442809462547302, -0.5087772607803345, -0.4320870041847229, -0.008032814599573612, 0.10187627375125885, -0.032657891511917114, 0.5156458020...
with a query that can handle all these cases. So far I've only been able to get cases that handle the week overlaps, or events that are fully internal; Essentially, too many records, or none at all. ``` (event.start BETWEEN week.start AND week.end) OR (week.start BETWEEN event.start AND event.end) ``` In simple words...
[ 0.032210394740104675, -0.02793317288160324, 0.4079633951187134, 0.02006431668996811, -0.12268233299255371, -0.058668043464422226, 0.25264209508895874, -0.01631082594394684, -0.6600133776664734, -0.5035354495048523, -0.17604248225688934, 0.4193735122680664, -0.06861604750156403, 0.479389190...
event starts during the week.** > Event begins before the week and also ends after the week **The week starts during the event.** Note that `BETWEEN` in expressions above is used just for the sake of brevity. Strict expression looks like this: ``` (event.start >= week.start AND event.start < week.end) OR (week.sta...
[ -0.06106843426823616, -0.2636796832084656, 0.6730455160140991, -0.2739774286746979, -0.3437584340572357, -0.12698668241500854, 0.31561097502708435, 0.0019454597495496273, -0.6308364868164062, -0.5010175704956055, -0.21197161078453064, 0.47295162081718445, 0.05366731807589531, 0.57462513446...
is more efficient and index friendly. See these articles in my blog for performance comparisons: * [**Overlapping ranges: SQL Server**](http://explainextended.com/2009/06/30/overlapping-ranges-sql-server/) * [**Overlapping ranges: MySQL**](http://explainextended.com/2009/07/01/overlapping-ranges-mysql/) * [**Overlapp...
[ -0.2948918342590332, 0.060576971620321274, 0.16646026074886322, 0.10178884863853455, -0.033213887363672256, -0.23719137907028198, -0.0872374102473259, -0.29760825634002686, -0.05275199934840202, -0.5869695544242859, 0.11318749189376831, 0.5525067448616028, -0.04425373673439026, -0.06059614...
When you just want to do a try-except without handling the exception, how do you do it in Python? Is the following the right way to do it? ``` try: shutil.rmtree(path) except: pass ``` ``` try: doSomething() except Exception: pass ``` or ``` try: doSomething() except: pass ``` The diff...
[ 0.22405345737934113, -0.020409777760505676, 0.1312466263771057, -0.16244038939476013, 0.07599497586488724, -0.38723933696746826, 0.6069352626800537, -0.23579369485378265, -0.06607530266046524, -0.5050071477890015, -0.24272751808166504, 0.6347523927688599, -0.34776413440704346, -0.609088718...
programming practice?](https://stackoverflow.com/questions/21553327/why-is-except-pass-a-bad-programming-practice)
[ 0.5291081666946411, 0.1883833259344101, -0.03482940420508385, -0.22917763888835907, -0.04988764226436615, -0.45350971817970276, 0.7174435257911682, -0.05891117826104164, -0.15476654469966888, -0.14470358192920685, -0.0057015554048120975, 0.5818655490875244, -0.21136611700057983, -0.0801817...
I've used this [ObjectPool](http://www.c-sharpcorner.com/uploadfile/rmcochran/genericidenetiymapobjectpool01262008090822am/genericidenetiymapobjectpool.aspx?login=true&user=kfinke) class as the basis of my Identity Map. However, I need to bring back the list of all objects of a type. Matthew has : ``` public IEnum...
[ 0.06853529065847397, 0.09277992695569992, 0.5572890043258667, -0.2645293176174164, 0.08698967099189758, 0.014248915947973728, 0.47476354241371155, -0.3972064256668091, -0.23392313718795776, -0.49489811062812805, -0.018669063225388527, 0.37000226974487305, -0.4010624885559082, 0.35413593053...
pool.AddItem<Animal>(dog.ID, dog); pool.AddItem<Vegetable>(carrot.Identifier, carrot); pool.AddItem<Vegetable>(greenbean.Identifier, greenbean); pool.AddItem<Mineral>(carbon.UniqueID, carbon); Console.WriteLine("Dog is in the pool -- this statement is " + pool.ContainsKey<Animal>(dog.ID...
[ 0.06579715758562088, -0.07445448637008667, 0.14215980470180511, -0.0580049529671669, 0.4798249900341034, 0.2604897916316986, -0.36389800906181335, -0.23646599054336548, -0.2402389943599701, -0.4495854079723358, -0.19265177845954895, 0.4132046401500702, -0.30950936675071716, 0.2161236703395...
the cast to IEnumerable. I've tried a few things, for example: ``` IDictionary<int, T> dic = (IDictionary<int, T>) m_pool[myType]; ICollection<T> values = (ICollection<T>)dic.Values; ``` However, I always end up with a casting error. What am I missing? Well, that `GetItems` method is *never* going...
[ 0.5657899379730225, 0.1477576047182083, 0.3946687579154968, -0.10872594267129898, 0.021885156631469727, -0.07397046685218811, 0.2285318821668625, -0.22547855973243713, 0.28295081853866577, -0.558181881904602, -0.018581463024020195, 0.7433435320854187, -0.2283352166414261, 0.246696382761001...
= typeof(T); IDictionary<int, object> dictionary; if (!m_pool.TryGetValue(myType, out dictionary)) { return new T[0]; } return dictionary.Values.Cast<T>(); } ``` That's if you're using .NET 3.5 (you'll need `using System.Linq` as well, to get the `Cast` extension method). Let me know if...
[ 0.4790908694267273, -0.31691494584083557, 0.407521516084671, -0.30858081579208374, 0.31579580903053284, 0.07674351334571838, 0.10942841321229935, -0.31721729040145874, 0.0399620346724987, -0.5503942370414734, -0.10784001648426056, 0.5696661472320557, -0.33551836013793945, -0.05380247905850...
I would like to implement the following. When the user rotates the iPhone, I want to instantiate a new UIViewController (automatically upon rotation, not clicking a button or performing a similar action) and show to the user a view handled by this new UIViewController in landscape orientation. How to do this properly ?...
[ 0.008831833489239216, -0.13734327256679535, 0.929965078830719, 0.13018569350242615, -0.009020390920341015, 0.016955848783254623, 0.051403604447841644, -0.05922377482056618, -0.13896656036376953, -0.6624462008476257, 0.006556715816259384, 0.7126852869987488, -0.17204010486602783, -0.1211507...
would be greatly appreciated. Thank you in advance. I've implemented this exact type of behavior on an app and the key is to make sure that any parent controllers implement shouldAutorotateToInterfaceOrientation and that your current view controller also implements it. In my case I am using a tab controller which inte...
[ 0.03951758146286011, -0.21024620532989502, 0.8814459443092346, -0.06825584918260574, -0.04552975296974182, 0.1412961184978485, 0.3025876581668854, -0.09470517933368683, 0.16546960175037384, -0.8685171008110046, -0.19861748814582825, 0.831747829914093, -0.38232213258743286, 0.03991537913680...
load a new view controller you should respond to: ``` - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { if((fromInterfaceOrientation == UIInterfaceOrientationPortrait) || (fromInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)) { // Load the vi...
[ -0.12286826223134995, -0.3520154654979706, 1.1165012121200562, -0.23058971762657166, -0.19734598696231842, -0.23372182250022888, 0.11331960558891296, -0.34632912278175354, -0.2311677634716034, -0.589691162109375, -0.25366270542144775, 0.9530059695243835, -0.20734678208827972, 0.25676396489...
when the orientation changes back to portrait and dismissing itself from the view stack. Hope that helps a little. Paul
[ 0.22868596017360687, -0.007839569821953773, 0.3704846203327179, -0.10615647584199905, 0.16735753417015076, 0.24345730245113373, 0.1978399157524109, 0.2522188723087311, -0.4943670630455017, -0.7361253499984741, 0.1488501876592636, 0.25936049222946167, 0.39565375447273254, 0.0399893335998058...
I am using asp.net MVC framework. On my page i have a dropdwonbox and when an option is clicked i want to go to another page. But i can't find how/where to set the autopostback property to true. This is the code i'm using: Aspx: ``` <%= Html.DropDownList("qchap", new SelectList( (IEnumerable)ViewData["qchap"], "Id", ...
[ -0.018355712294578552, -0.08231668174266815, 0.8265436291694641, -0.09742316603660583, -0.09596235305070877, 0.01253935880959034, 0.49479568004608154, -0.34093615412712097, -0.26165106892585754, -0.7106555700302124, -0.19713206589221954, 0.6164674162864685, -0.3077506721019745, 0.024100448...
SelectList( (IEnumerable)ViewData["qchap"], "Id", "Title" ), new { onchange = "this.form.submit();" }) %> ```
[ 0.15461431443691254, -0.1771257519721985, 0.6960620880126953, -0.05641716718673706, 0.20417699217796326, -0.024048028513789177, 0.14697116613388062, -0.5063951015472412, -0.025288524106144905, -0.6642659306526184, -0.35970908403396606, 0.525198757648468, -0.28006473183631897, 0.24635805189...
Here is the problem: 1. Create a TestProject in your Visual Studio solution. 2. Open the .testrunconfig file and under the 'deployment' menu item, select the 'Enable Deployment' checkbox. 3. Now click on 'Add Directory...' button and add a folder which has some files in it. 4. Run the test project (use a du...
[ 0.8710842132568359, 0.12434383481740952, -0.03376631811261177, 0.19126614928245544, -0.01699579507112503, -0.3720608949661255, 0.45803314447402954, -0.23914143443107605, -0.18916495144367218, -0.5221520066261292, 0.10048411786556244, 0.8150029182434082, -0.26668643951416016, -0.09298010915...
how to get the folder copied instead of just the files underneath ? Thanks. Use the `[DeploymentItem]` attribute on the test classes that use it. You can specify a directory: ``` [TestClass] [DeploymentItem("blahblah\\myDirectory", "myDirectory")] public class MyTest { } ``` Note: * DeploymentItem is very slow wh...
[ 0.38972899317741394, -0.07162046432495117, 0.05877792090177536, 0.10817454755306244, 0.050018422305583954, -0.4482927918434143, 0.39723828434944153, -0.1128343716263771, -0.38383036851882935, -1.0058497190475464, -0.007316883187741041, 0.6913642287254333, -0.1765381097793579, -0.1816639900...
The source directory is relative to the solution location. This is hardly documented.
[ -0.26991671323776245, 0.44620054960250854, 0.22514060139656067, -0.016164913773536682, 0.26616930961608887, 0.016118504106998444, 0.26992523670196533, 0.2386513501405716, 0.06335673481225967, -0.6945101618766785, -0.33985427021980286, 0.07068949192762375, -0.023133309558033943, 0.475354552...
MySQL seems to have an 8 hour time out on its connections. I'm running multiple WARs in Tomcat utilizing Hibernate for ORM. After 8 hours (i.e. overnight), I get broken pipes when it picks up an idle connection. I've already traced through the code and made doubly sure I commit or rollback all transactions. Here is m...
[ -0.07072721421718597, 0.2111339271068573, 0.6105122566223145, -0.16682305932044983, -0.13466869294643402, 0.071684829890728, 0.4724878966808319, -0.2206123024225235, -0.26333343982696533, -0.8610537648200989, -0.18795253336429596, 0.5100942850112915, -0.059358250349760056, 0.18632349371910...
<property name="hibernate.current_session_context_class">thread</property> <!--property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property--> <property name="c3p0.min_size">3</property> <property name="c3p0.max_size">5</property> <property name="c3p0.time...
[ 0.04984903335571289, 0.28985026478767395, 0.36741504073143005, -0.08666723221540451, 0.12289871275424957, 0.20036719739437103, 0.288578063249588, -0.4061186611652374, -0.12315776944160461, -0.7015471458435059, -0.14336201548576355, 0.35423147678375244, 0.11427431553602219, 0.38358280062675...
the Broken Pipe issue after 8 hours of running. While there are multiple posts index via Google, none arrive at a satisfactory answer. So it turns out I was missing a key line that enabled c3p0 (the c3p0 parameters I was tweaking were having no effect because Hibernate was using it's built in connection pool -- which i...
[ 0.32818475365638733, 0.10563036799430847, 0.6953530311584473, -0.12409776449203491, 0.12483596801757812, -0.07300051301717758, 0.7611860036849976, -0.5556883811950684, 0.13402600586414337, -0.5377604365348816, -0.20768189430236816, 0.36574217677116394, -0.17594097554683685, 0.3487483859062...
rather unfortunate that both Hibernate and c3p0 have abysmal documentation in this regard.
[ 0.30280789732933044, 0.0820920318365097, -0.33102092146873474, -0.1451370269060135, -0.19346123933792114, -0.08214639872312546, 0.458662748336792, 0.10686956346035004, 0.00336158717982471, -0.3082938492298126, -0.04645518958568573, 0.1323777735233307, 0.17428797483444214, 0.197298392653465...
I have a question very similar to [this one](https://stackoverflow.com/questions/203195/how-to-detect-vc-2008-redistributable) but the answer does not work for me. Software I am maintaining the setup for depends on VC++ 2008 (SP1, precisely), thus I need to find a solution to install VCRedist if not yet installed. I u...
[ 0.0567484088242054, 0.12174398452043533, 0.617112934589386, 0.06689446419477463, 0.09992166608572006, -0.1353018879890442, 0.2851804792881012, -0.22874300181865692, -0.38944050669670105, -0.7864052653312683, -0.000961483980063349, 0.6479759812355042, -0.26002246141433716, 0.259224683046340...
versions. Furthermore, I reckon that this would not detect Visual Studios and thus unnecessarily install the VCRedist Package when it's already on a developers machine. I do not want to bug anybody with this, certainly not somebody who has already a DevStudio installed. Now another answer says I should look in the Win...
[ 0.22348342835903168, 0.09492865949869156, 0.7061067223548889, -0.11320845782756805, -0.2336956262588501, -0.3487985134124756, 0.24692335724830627, 0.16379880905151367, -0.6212934255599976, -0.5906205773353577, -0.36925625801086426, 0.6348153948783875, -0.1935240477323532, 0.296811878681182...
there is nothing provided by Microsoft for this scenario, but searching the interwebs for already far too long now brings me back to good ol' SO :) You could take the recommended approach for installing directx: always run the redistributable. Since it's required and you're already shipping it there's no harm in runnin...
[ 0.5184381008148193, -0.03550427034497261, 0.3015703856945038, 0.2695923447608948, -0.018112489953637123, -0.29601991176605225, 0.19436334073543549, 0.49796605110168457, -0.14131265878677368, -0.591484010219574, -0.08044125139713287, 0.587033748626709, -0.2119486778974533, 0.226434871554374...
I have overriden the DefaultControllerFactory by using CustomControllerFactory which is actually using StructureMAp ObjectFactory to construct the Controller Instance using IOC. But some how it can not find the Controller instances and failing over it. Note. I already set the DEfaultControllerFactory in Global.asax too...
[ 0.013827045448124409, -0.13079045712947845, 0.30851107835769653, 0.0751185193657875, -0.11962807178497314, -0.2679945230484009, 0.4696285128593445, 0.04356226697564125, -0.28467804193496704, -0.8707424998283386, 0.00045319812488742173, 0.49962541460990906, -0.3657788932323456, 0.4766167700...
{ if (controllerType != null) { return (IController)ObjectFactory.GetInstance(controllerType); } return null; } } ``` StructureMap configuration document: ``` public class DependencyRegistry : Registry { protected override void configure() { Scan(x => ...
[ 0.19787561893463135, -0.5365575551986694, 0.6793980002403259, 0.15228822827339172, 0.3026302456855774, -0.3160211443901062, 0.04441725090146065, -0.3319029211997986, -0.24566936492919922, -0.6988075971603394, -0.29158201813697815, 0.6915298104286194, -0.5383728742599487, 0.5218027830123901...
x.Assembly("MyApp.Web"); x.Assembly("MyApp.Model"); x.Assembly("MyApp.DataAccess"); x.With<DefaultConventionScanner>();
[ -0.043392375111579895, -0.032521411776542664, 0.5567918419837952, -0.1789686679840088, 0.19106802344322205, 0.1372663676738739, 0.31185007095336914, -0.2766495943069458, -0.09009850025177002, -0.605029821395874, -0.5398160815238953, 0.45471933484077454, -0.6728391051292419, 0.1746825873851...
}); base.configure(); } } ``` Function, which configures StructureMap, using default conventions: ``` public void RegisterDependencies() { ObjectFactory.Initialize(InitializeStructureMap); } private void InitializeStructureMap(IInitializationExpression x) { x.AddRegistr...
[ -0.29361453652381897, -0.3232032358646393, 0.4917932450771332, 0.24167940020561218, 0.18766562640666962, -0.04402128607034683, 0.03819940984249115, -0.39828282594680786, -0.3185553252696991, -0.7400340437889099, -0.29737481474876404, 0.45712944865226746, -0.6052179336547852, 0.428182780742...
to call RegisterDependencies() function... I hope this helps.
[ 0.09283462911844254, 0.18005169928073883, 0.21220161020755768, 0.15877260267734528, 0.24231721460819244, -0.27244943380355835, 0.21160076558589935, 0.031641993671655655, -0.30814218521118164, -0.4218935966491699, 0.02999943122267723, 0.5288114547729492, 0.013722441159188747, -0.02781578339...
Hy all, I believe that the following piece of code is generating memory leak? ``` /* External function to dynamically allocate a vector */ template <class T> T *dvector(int n){ T *v; v = (T *)malloc(n*sizeof(T)); return v; } /* Function that calls DVE...
[ 0.18041342496871948, -0.29553481936454773, 0.24798835813999176, -0.029820051044225693, 0.1242830827832222, -0.006228388287127018, 0.016264820471405983, -0.498044490814209, -0.20630215108394623, -0.5451188087463379, -0.3367632329463959, 0.6860548257827759, -0.4958825707435608, 0.27267593145...
computation, frees it */ void DiscontinuousGalerkin_Domain::computeFaceInviscidFluxes(){ int e,f,n,p; double *Left_Conserved; Left_Conserved = dvector<double>(NumberOfProperties); //do stuff with Left_Conserved // free(Left_Conserved); ...
[ -0.2904471755027771, -0.40808185935020447, 0.5293217301368713, 0.23560582101345062, 0.35231128334999084, 0.149438738822937, -0.16019560396671295, -0.5664622783660889, -0.48522257804870605, -0.26601308584213257, -0.33726978302001953, 0.1444127857685089, -0.32151687145233154, 0.4027722477912...
} ``` I thought that, by passing the pointer to DVECTOR, it would allocate it and return the correct address, so that *free(Left\_Conserved)* would successfully deallocate. However, it does not seem to be the case. **NOTE:** I have also tested with *new/delete* replacing *malloc/free* without success either. I have...
[ 0.051033586263656616, -0.0038022948428988457, 0.08486653119325638, -0.145798921585083, -0.09697812050580978, -0.11763842403888702, -0.1748557984828949, -0.04520652815699577, -0.011798863299190998, -0.7417184114456177, -0.01673002913594246, 0.6433312296867371, -0.40132129192352295, 0.219364...
arrays for me. What's the catch here to avoid the memory leak? **EDIT** I have been using the DVECTOR function to allocate user-defined types as well, so that is potentially a problem, I guess, since I don't have constructors being called. Even though in the piece of code before I free the Left\_Conserved vector, I ...
[ 0.05856575816869736, -0.14274315536022186, 0.1329384744167328, -0.028120148926973343, -0.40563374757766724, 0.10419204831123352, 0.10564374178647995, -0.09426189959049225, -0.3808118999004364, -0.7428756952285767, 0.16786380112171173, 0.7076330780982971, -0.3064447045326233, -0.10575950890...
that's easily fixed with NEW, but what would be the better way for a matrix? It has just occurred me that I pass the pointer as an argument to other functions. Now, BOOST seems not to be enjoying it that much and compilation exits with errors. So, I stand still with the need for a pointer to a vector or a matrix, tha...
[ 0.03534984216094017, 0.2046826034784317, 0.3460637331008911, 0.15972881019115448, -0.13782162964344025, 0.1940835863351822, -0.26311948895454407, -0.10324409604072571, -0.22519747912883759, -0.6175891757011414, 0.16311097145080566, 0.535443902015686, -0.25480055809020996, 0.165099412202835...
the loop and new stuff for allocating the matrix everywhere in the code!) Here is what I'd like to do: ``` template <class T> T **dmatrix(int m, int n){ T **A; A = (T **)malloc(m*sizeof(T *)); A[0] = (T *)malloc(m*n*sizeof(T)); for(int i=1;i<m;i++){
[ 0.29401877522468567, -0.13440252840518951, 0.25494351983070374, -0.302211731672287, 0.19451646506786346, 0.014417032711207867, 0.19542856514453888, -0.5898924469947815, -0.09434375166893005, -0.5430777072906494, -0.1623930037021637, 0.5833108425140381, -0.4553411602973938, -0.0019721121061...
A[i] = A[i-1]+n; } return A; } void Element::setElement(int Ptot, int Qtot){ double **MassMatrix; MassMatrix = dmatrix<myT>(Ptot,Qtot); FillInTheMatrix(MassMatrix); return;
[ 0.17357231676578522, -0.522433876991272, 0.19343328475952148, -0.29870009422302246, 0.38182538747787476, 0.5888447761535645, 0.14960822463035583, -0.3805902898311615, 0.01847306452691555, -0.41178297996520996, -0.22955088317394257, 0.22004307806491852, -0.6632274389266968, 0.12837108969688...
} ``` So, some important concepts discussed here helped me to solve the memory leaking out in my code. There were two main bugs: * The allocation with *malloc* of my user-defined types was buggy. However, when I changed it to *new*, leaking got even worse, and that's because one my user-defined types had a constructo...
[ 0.1611376404762268, 0.42741599678993225, -0.08177455514669418, -0.03966919332742691, -0.036240410059690475, 0.04814709722995758, 0.1466357707977295, 0.033933039754629135, -0.3408035635948181, -0.6641233563423157, 0.13179577887058258, 0.7693028450012207, -0.374214768409729, 0.24065527319908...
memory leaks. * The other leaking was related to a buggy memory-deallocation command, which I was able to isolate with Valgrind (and a bit a patience to get its output correctly). So, here's the bug (and, please, don't call me a moron!): ``` if (something){ //do stuff return; //and here it is!!! =P...
[ 0.38409072160720825, -0.02577657625079155, 0.07783057540655136, 0.031402382999658585, 0.13047106564044952, -0.2083338499069214, 0.21524947881698608, 0.07670127600431442, -0.46395212411880493, -0.37651121616363525, -0.17846736311912537, 0.6407100558280945, -0.4741549491882324, 0.36073350906...
to me if a can pass them as parameter to other functions. So, I still must be careful with *delete[]*. Anyway, memory leaking is gone (by now...) =D
[ 0.08677861839532852, 0.012098279781639576, 0.3676418364048004, -0.08238976448774338, -0.0052827405743300915, -0.020381217822432518, 0.4103320240974426, 0.017360180616378784, -0.18998834490776062, -0.6267234086990356, -0.0587238110601902, 0.5801048278808594, 0.24002429842948914, 0.450596481...
Let's say there is a list of `List<UInt32>` Thus, : ``` 12|12 23|33 33|22 11|22 ``` I need to remove 0th and 2nd element (`List<UInt32>`). However, when I try to `foreach` this list and first remove 0th, the List collapses its elements and 1st becomes 0th now.. so I don't want to delete the wrong element, because m...
[ -0.4098866581916809, 0.20886236429214478, 0.2377522885799408, -0.2999305725097656, -0.12215541303157806, 0.07839872688055038, 0.31709060072898865, -0.38955867290496826, -0.20165199041366577, -0.5963039994239807, -0.4057804346084595, 0.3589211106300354, -0.29603010416030884, 0.2385202795267...
I am getting the following error: ``` mysql_connect(): Too many connections ``` It has completely shut down my site, which has been running seamlessly for several years. Note: I have shared hosting with GoDaddy. How do I fix this? ALSO: is there a way to close all connections and restart when on a shared hosting...
[ 0.41435104608535767, 0.3069212734699249, 0.26566410064697266, -0.022177154198288918, -0.08162815123796463, -0.2688901722431183, 0.6109150052070618, 0.36958935856819153, -0.40771812200546265, -0.6159412860870361, -0.018096495419740677, 0.47436287999153137, -0.24152134358882904, 0.7537267208...
DoS attack (Denial of Service). Unfortunately there is nothing we can do about this. DoS attacks can only be fought at the server or router level, and this is the responsibility of your host. Instead of doing this they have decided to take the easy way out and suspend your account. > > > If you cannot get them to tak...
[ 0.5250665545463562, 0.14382696151733398, 0.20257772505283356, 0.13314642012119293, 0.07674345374107361, -0.4862741529941559, 0.52011638879776, 0.024594679474830627, -0.3018384873867035, -0.6325977444648743, -0.18743614852428436, 0.5625801086425781, -0.27467796206474304, 0.32136502861976624...
to connect again, and exit only when `10` attempts fail. It's not a solution, it's a workaround. This of course will delay your page loading, but it's better than an ugly `too many connections` message. You also can come with a some kind of a method which tells bots and browsers apart. Like, set a salted `SHA1` coo...
[ -0.05144447460770607, -0.1408289074897766, 0.30115798115730286, 0.2810312807559967, -0.16656477749347687, -0.1547027826309204, 0.4538109004497528, 0.023684313520789146, -0.314553439617157, -0.86236971616745, -0.12621508538722992, 0.2648010551929474, -0.39087072014808655, 0.1931179761886596...
As the title says, how can generate (and display) images on the fly for simple charting, resizing etc? Thanks Use `System.Drawing` namespace. Add a reference to `System.Drawing` assembly. Create a new `Bitmap` class. Call `CreateGraphics` on it. Use the returned `Graphics` object to do your drawing. Set the `Response...
[ 0.5737149715423584, -0.057098690420389175, 0.7109633684158325, 0.3759487569332123, -0.3328614830970764, -0.07073766738176346, 0.03265412896871567, -0.12004191428422928, -0.12736862897872925, -0.7606847882270813, -0.059726912528276443, 0.6470671892166138, -0.0667518824338913, -0.10677649825...
I've been following a tutorial "McGugan - Beginning Game Development with Python and Pygame (Apress, 2007)" and in the code at around chapter five involving object movement I keep getting invalid syntax alerts on '-' being used in the code. It isn't up to date but I would've thought a subtract wouldn't be changed in an...
[ -0.23655739426612854, -0.22813411056995392, 0.5055204033851624, -0.28935861587524414, -0.3882777690887451, 0.2753499746322632, 0.09125585108995438, -0.43248698115348816, -0.5198014974594116, -0.7679251432418823, -0.025400986894965172, 0.5522224307060242, -0.3149428367614746, -0.06837759912...
Vector2() while True: for event in pygame.event.get(): if event.type == QUIT: exit() if event.type == MOUSEBUTTONDOWN: destination = Vector2(*event.pos) – Vector2(*sprite.get_size())/2. heading = Vector2.from_points(position, destination) heading.normalize() scree...
[ -0.4492228031158447, -0.804484486579895, 0.5753997564315796, -0.17026668787002563, -0.07010972499847412, 0.16464582085609436, 0.038692012429237366, -0.1461336761713028, -0.5913913249969482, -0.571873664855957, 0.061089493334293365, 0.38601765036582947, -0.574858546257019, -0.32586154341697...
* speed position += heading * distance_moved pygame.display.update() ``` am I doing something wrong or is it just simply outdated? Any help is much needed. In this line: ``` destination = Vector2(*event.pos) – Vector2(*sprite.get_size())/2. ``` You somehow typed the character "`–`" (EN DASH) instead of "`...
[ -0.23543834686279297, -0.3426525890827179, 0.6622397303581238, 0.3136580288410187, 0.05315772444009781, 0.12576758861541748, 0.30628955364227295, -0.08312676846981049, -0.36700230836868286, -0.6572051644325256, 0.18442805111408234, 0.6319509744644165, -0.022058669477701187, -0.099281139671...
I have a gridview that shows (50)rows of data per page. I have the Total showing for the Amount that is shown due to a previous request by the user. Now they want to have the total for the Entire result, regardless of what page they are on. How do I do that? I did the following for my Complete Total Count: After the ...
[ 0.056570444256067276, 0.0034343607258051634, 0.6037793159484863, -0.16315753757953644, -0.12564660608768463, 0.1279822736978531, 0.29255637526512146, -0.5963165163993835, -0.2881262004375458, -0.8463802933692932, 0.1419004499912262, 0.5958204865455627, -0.3437069058418274, 0.28445833921432...
is the sum of the specific Decimal Column[3]? Even though I display 50 results, I need the Total for the ENTIRE column. Something like: ``` Total = dsPoint.Tables["DataTable1"].Compute("SUM(columnName)", String.Empty); ``` You provide the `columnName` :)
[ -0.10522808134555817, -0.027357954531908035, 0.3864954710006714, -0.13550421595573425, -0.18777747452259064, 0.1426926553249359, 0.025997282937169075, -0.535467803478241, -0.08151472359895706, -0.3025786876678467, -0.019127951934933662, 0.39177799224853516, -0.08197753876447678, -0.1306493...
Existing Server = BIND version 9.1.3 new Server = BIND version 9.3.4 How can i move all zones records to new server? I tried moving them by coping the files and changing configuration file on new to match and zones did not resolve, no resolution. Is there an smooth way to just transfer all zones to this new server?...
[ 0.2379135936498642, -0.19223929941654205, 0.8001886010169983, 0.33744585514068604, 0.13570082187652588, -0.3750116527080536, 0.2425536960363388, -0.18560902774333954, -0.547886848449707, -0.8107235431671143, -0.11443111300468445, 0.416296124458313, -0.484322726726532, 0.1552688628435135, ...
zone". 2. The files you get out will be in a different order to the records in the originals, with any comments etc missing. If you normally hand-craft your zone files this would be pretty annoying. Please expand on "it didn't work" so that we can establish why not.
[ 0.7715901732444763, -0.17598892748355865, 0.3642568290233612, 0.3529875874519348, 0.2575037479400635, -0.519318163394928, 0.019563568755984306, 0.09141849726438522, -0.1992410123348236, -0.4322763681411743, -0.01539722178131342, 0.14131854474544525, -0.2850022315979004, 0.12766088545322418...
I have a web service that returns an array of bytes and my intention is to convert said array to a .wav in the client (a handheld such as Blackberry). However I really have no idea of how to do that, I tried just making an FileOutputStream but of course that wouldn't play. So I am once again without knowing what to do....
[ 0.6983765959739685, 0.053309500217437744, 0.7772663831710815, -0.2240591049194336, -0.19476023316383362, -0.22497734427452087, -0.07811074703931808, 0.08053333312273026, -0.4413563013076782, -0.8766269087791443, 0.1052648276090622, 0.28450655937194824, 0.2199261486530304, 0.131901055574417...
suppose you could also use something like <http://java.sun.com/j2se/1.5.0/docs/api/javax/sound/sampled/spi/AudioFileWriter.html>
[ 0.501992404460907, -0.3543146252632141, 0.1873088926076889, 0.05100405588746071, 0.1928476095199585, -0.2110193520784378, -0.15535424649715424, -0.2847459316253662, -0.07345865666866302, -0.36172327399253845, 0.22314214706420898, 0.5956348180770874, -0.09199228882789612, -0.143506005406379...
I have a base class that has an abstract getType() method. I want subclasses to be able to implement this method and provide the actual class to use. In code, something like the following: ``` public abstract class A { public static interface Tile; protected abstract Class<Tile> getTileClass(); } public cl...
[ 0.5942478179931641, -0.011652716435492039, 0.1592930555343628, -0.29699090123176575, -0.030452214181423187, 0.044655609875917435, 0.20737886428833008, -0.29405564069747925, 0.04102840647101402, -0.8297001719474792, -0.042016010731458664, 0.5403926968574524, -0.4006351828575134, 0.139605149...
return MyTile; // ERROR HERE } } ``` The problem here is that I get "MyTile cannot be resolved" in the line marked. So I'm trying to return this instead: > return new MyTile().getClass() but now Eclipse tells me: > Type mismatch: cannot convert from > Class`<`capture#1-of ? extends B.MyTile`>` > t...
[ -0.07010548561811447, 0.16216221451759338, 0.2785426080226898, -0.15848521888256073, -0.2022739052772522, 0.03278281167149544, 0.26086145639419556, -0.07836433500051498, 0.0962858647108078, -0.9919951558113098, 0.2181282788515091, 0.6039054989814758, -0.26838669180870056, 0.238721415400505...
with the following code that seems to compile: ``` public abstract class A { public static abstract class Tile; protected abstract Class<? extends Tile> getTileClass(); } public class B extends A { public static class MyTile exends A.Tile { } @Override protected abstract Class<? extends A.Tile> ...
[ 0.30942752957344055, -0.055455390363931656, 0.3700307011604309, -0.3744727373123169, 0.056321900337934494, 0.009924688376486301, 0.16423368453979492, -0.5309639573097229, -0.13852977752685547, -0.6419403553009033, -0.3496108651161194, 0.5123767852783203, -0.4319990873336792, 0.214325040578...
"Cannot be resolved" } } ``` So I basically seem to have three questions: 1) Is it possible to get this to work with A.Tile being an interface? 2) When using a base class, is `Class<? extends X>` really the correct way to go? 3) And how can I return my nested B.MyTile class reference from inside the method? Ha...
[ -0.3301961123943329, -0.1562669724225998, 0.26652342081069946, 0.043755464255809784, 0.06856989860534668, -0.18278177082538605, 0.16348148882389069, -0.3536471426486969, 0.05938288941979408, -0.6974741220474243, -0.031054019927978516, 0.6476492285728455, -0.41610419750213623, 0.27024027705...
MyTile without instanciating it, with MyTile.class. Try this instead: ``` public abstract class A { public static interface Tile; protected abstract Class<? extends Tile> getTileClass(); } public class B extends A { public static class MyTile implements A.Tile { } @Override protected Class<MyTi...
[ 0.301167756319046, -0.1239829882979393, 0.34369853138923645, -0.298593670129776, -0.07693011313676834, 0.05591968074440956, 0.14186838269233704, -0.40247830748558044, 0.049191296100616455, -0.7064388990402222, -0.09615443646907806, 0.46686840057373047, -0.45937415957450867, 0.2369685918092...
public static interface Tile; protected abstract Class<? extends T> getTileClass(); } public class B extends A { public static class MyTile implements A.Tile { } @Override protected Class<MyTile> getTileClass() { return MyTile.class; } } ```
[ 0.29633867740631104, -0.1579054743051529, 0.29996809363365173, -0.25316914916038513, -0.02478140778839588, 0.14205487072467804, 0.15968695282936096, -0.3247346580028534, 0.06200219690799713, -0.7472778558731079, -0.33631426095962524, 0.4573862850666046, -0.5274261236190796, 0.1162401288747...
Let's say I have a booking database consisting of **users**: ``` user_id fname lname ``` and their **tickets** ``` ticket_id user_id flight_no ``` and associated **flights** ``` flight_no airline departure_time arrival_time ``` *What would I need to change to move this Google AppEngine?* I understand AppEngin...
[ 0.12925125658512115, 0.2600517272949219, 0.5536977052688599, 0.04302617534995079, 0.28633126616477966, -0.05728934705257416, -0.12523913383483887, -0.2033599317073822, -0.3786163926124573, -0.9735580682754517, -0.05451006442308426, 0.5537564754486084, -0.34514641761779785, 0.33132782578468...
found the problematic ones, try to rewrite them with BigTable's constraints in mind. For example, if you often need to find the number of tickets for a list of flights, you won't just be able to do: ``` SELECT flight_no, COUNT(*) FROM flights JOIN tickets ON tickets.flight_no = flights.flight_no GROUP BY...
[ -0.1447097212076187, -0.04941596835851669, 0.07669777423143387, 0.6771223545074463, 0.30060017108917236, -0.3810192048549652, -0.26480966806411743, -0.06343872845172882, -0.52724689245224, -0.8636600971221924, 0.048505913466215134, 0.3710305392742157, -0.44742560386657715, 0.25393617153167...
when you don't really *need* a scalable design.
[ 0.30770882964134216, -0.21357451379299164, -0.08998458087444305, 0.15632306039333344, 0.08788570761680603, 0.027025796473026276, 0.19368219375610352, 0.1576695293188095, -0.383566290140152, -0.8304023146629333, -0.30201011896133423, 0.2608811557292938, -0.006373619195073843, -0.14840830862...
Background ---------- I have two objects which have bidirectional association between them in a C# project I am working on. I need to be able to check for value equality (vs reference equality) for a number of reasons (e.g to use them in collections) and so I am implementing IEquatable and the related functions. Assu...
[ -0.05878376215696335, 0.016211384907364845, 0.03538312017917633, 0.08830036967992783, -0.03756997734308243, 0.22194713354110718, 0.09771602600812912, 0.05820365622639656, -0.13819028437137604, -0.5847328901290894, 0.25873473286628723, 0.7796862721443176, -0.3949109613895416, -0.60692006349...
class) from IEquatable and receive the proper behavior (such as in System.Collections.Generic). Problem ------- When implementing IEquatable to provide checking for value equality on types with bidirectional association, infinite recursion occurs resulting in a stack overflow. **NOTE:** Similarly, using all of the f...
[ -0.1865958720445633, -0.22296686470508575, 0.12340285629034042, 0.08307622373104095, -0.23530744016170502, -0.2649311125278473, 0.3437727093696594, -0.18518972396850586, 0.19596080482006073, -0.6268545389175415, -0.206883504986763, 0.6298985481262207, -0.42788368463516235, 0.12198260426521...
EqualityWithBiDirectionalAssociation { public class Person : IEquatable<Person> { private string _firstName; private string _lastName; private Address _address; public Person(string firstName, string lastName, Address address) { FirstName = firstName; ...
[ -0.28281521797180176, -0.12125416845083237, 0.16985958814620972, -0.1553296446800232, -0.13372690975666046, 0.21617156267166138, 0.42727112770080566, -0.3443674147129059, 0.4715453088283539, -0.6393940448760986, -0.09063123166561127, 0.7520766258239746, -0.23273898661136627, -0.09255485236...
Address = address; } public virtual Address Address { get { return _address; } set { _address = value; } } public virtual string FirstName {
[ -0.33541619777679443, -0.5023773312568665, 0.1064758449792862, -0.02186841145157814, 0.07766947150230408, -0.022890666499733925, 0.12233476340770721, 0.12468253821134567, 0.11509319394826889, -0.939883828163147, -0.4312637448310852, 0.4723219573497772, -0.267263263463974, 0.369620263576507...
get { return _firstName; } set { _firstName = value; } } public virtual string LastName { get { return _lastName; } set { _lastName = value; } }
[ -0.5748193860054016, -0.5774592161178589, 0.29081296920776367, 0.008810417726635933, 0.28414276242256165, 0.06628866493701935, 0.13959838449954987, 0.19910874962806702, 0.12214857339859009, -0.5092982649803162, -0.44105952978134155, 0.6362446546554565, -0.13251161575317383, 0.0158144515007...
public override bool Equals(object obj) { // Use 'as' rather than a cast to get a null rather an exception // if the object isn't convertible Person person = obj as Person; return this.Equals(person); }
[ -0.39197155833244324, -0.0710236132144928, 0.057247936725616455, -0.1423472762107849, -0.1902766078710556, -0.06069454923272133, 0.6499819755554199, -0.243307426571846, 0.03409238159656525, -0.16812218725681305, -0.4112434685230255, 0.26158908009529114, -0.6412219405174255, 0.0542140081524...
public override int GetHashCode() { string composite = FirstName + LastName; return composite.GetHashCode(); } #region IEquatable<Person> Members public virtual bool Equals(Person other) { // Per MSDN documentation, x.Equals(null) should retu...
[ -0.2075543850660324, -0.26514381170272827, 0.47727423906326294, -0.039549242705106735, 0.2258136123418808, 0.08029672503471375, 0.30820509791374207, -0.1796703338623047, -0.32262641191482544, -0.5973283052444458, -0.12281551957130432, 0.08868125081062317, -0.2614551782608032, 0.33459725975...
false if ((object)other == null) { return false; } return (this.Address.Equals(other.Address) && this.FirstName.Equals(other.FirstName)
[ -0.11593764275312424, 0.06375210732221603, 0.25045472383499146, -0.1443004012107849, 0.2100183665752411, -0.18791563808918, 0.5588058233261108, -0.5307871699333191, 0.07206934690475464, -0.473222553730011, -0.08258502185344696, 0.36375313997268677, -0.43175897002220154, 0.15671588480472565...
&& this.LastName.Equals(other.LastName)); } #endregion } public class Address : IEquatable<Address> { private string _streetName; private string _city; private string _state; private Person _resident; public Address(string city, string state, strin...
[ -0.02342912182211876, -0.27442073822021484, 0.7746185064315796, -0.1998646855354309, 0.2892184257507324, -0.14073918759822845, 0.29684966802597046, -0.007855571806430817, 0.18449504673480988, -0.9030065536499023, -0.6143566966056824, 0.3876402974128723, -0.4511011242866516, 0.2685286700725...
City = city; State = state; StreetName = streetName; _resident = null; } public virtual string City { get { return _city; }
[ -0.022540656849741936, -0.3457813560962677, 0.19215117394924164, 0.07095236331224442, -0.18465480208396912, -0.11091185361146927, 0.47876617312431335, 0.159877210855484, -0.14556877315044403, -0.7348579168319702, -0.5674977898597717, 0.3184957206249237, -0.5772290229797363, 0.5992461442947...
set { _city = value; } } public virtual Person Resident { get { return _resident; } set { _resident = value; } } public virtual string State
[ -0.007268630433827639, -0.4337528944015503, 0.0604415163397789, 0.1114049106836319, 0.1888057440519333, -0.0654389038681984, 0.47541162371635437, 0.17576514184474945, -0.09365548938512802, -0.7470080256462097, -0.49319934844970703, 0.20719686150550842, -0.5060388445854187, 0.48211881518363...
{ get { return _state; } set { _state = value; } } public virtual string StreetName { get { return _streetName; } set { _streetName = value; }
[ -0.04900975525379181, -0.3705156445503235, 0.26317596435546875, -0.05081893131136894, 0.11803633719682693, 0.2068682610988617, 0.2859024405479431, 0.1453331857919693, 0.16912074387073517, -0.7785724401473999, -0.3143501877784729, 0.6927963495254517, -0.23834672570228577, 0.1902285665273666...
} public override bool Equals(object obj) { // Use 'as' rather than a cast to get a null rather an exception // if the object isn't convertible Address address = obj as Address; return this.Equals(address);
[ -0.23724645376205444, 0.04412170127034187, 0.26468223333358765, -0.19903439283370972, 0.0070893545635044575, -0.2245693951845169, 0.6022705435752869, -0.24673672020435333, 0.2505192160606384, -0.28542032837867737, -0.43378034234046936, 0.31914612650871277, -0.6231011748313904, 0.1658413708...
} public override int GetHashCode() { string composite = StreetName + City + State; return composite.GetHashCode(); } #region IEquatable<Address> Members public virtual bool Equals(Address other) {
[ -0.06947706639766693, -0.18217308819293976, 0.48440197110176086, -0.12994134426116943, 0.14481766521930695, 0.2075154334306717, 0.2844674289226532, -0.2161896526813507, -0.3086577355861664, -0.7467116117477417, -0.14287163317203522, -0.01548021100461483, -0.3501777648925781, 0.406238943338...
// Per MSDN documentation, x.Equals(null) should return false if ((object)other == null) { return false; } return (this.City.Equals(other.City) && this.State.Equals(other.State)
[ 0.15680834650993347, -0.18752223253250122, 0.5983125567436218, 0.15336154401302338, 0.2556653320789337, -0.15735527873039246, 0.48938706517219543, -0.3781419098377228, -0.13443730771541595, -0.7113291621208191, -0.08561080694198608, 0.18229545652866364, -0.5186833143234253, 0.1313806623220...
&& this.StreetName.Equals(other.StreetName) && this.Resident.Equals(other.Resident)); } #endregion } public class Program { static void Main(string[] args) { Address address1 = new Address("seattle", "washington", "Awesome St");
[ 0.28898122906684875, -0.11602724343538284, 0.6851486563682556, -0.38101568818092346, 0.19470195472240448, -0.10398268699645996, 0.49254733324050903, 0.2923046350479126, 0.1449526846408844, -0.6932194828987122, -0.4190981686115265, 0.27752965688705444, -0.5815327763557434, 0.361053854227066...
Address address2 = new Address("seattle", "washington", "Awesome St"); Person person1 = new Person("John", "Doe", address1); address1.Resident = person1; address2.Resident = person1; if (address1.Equals(address2)) // <-- Generates a stack overflow! {
[ -0.23149824142456055, -0.04904532805085182, 0.5053980946540833, -0.05360095575451851, 0.2928544878959656, 0.24938683211803436, 0.44453415274620056, -0.30898305773735046, -0.22471946477890015, -0.6425514221191406, -0.3850913941860199, 0.14655110239982605, -0.23680491745471954, 0.14622980356...
Console.WriteLine("The two addresses are equal"); } Person person2 = new Person("John", "Doe", address2); address2.Resident = person2; if (address1.Equals(address2)) // <-- Generates a stack overflow! {
[ -0.6132056713104248, -0.0881296917796135, 0.4225224554538727, -0.10424972325563431, 0.5659574270248413, 0.25946152210235596, 0.14263339340686798, -0.34107768535614014, -0.03840772807598114, -0.6168551445007324, -0.12850666046142578, 0.322742223739624, -0.09694778919219971, 0.16705513000488...
Console.WriteLine("The two addresses are equal"); } Console.Read(); } } } ``` If redesigning the class structure to remove the bidirectional association is possible and reduces the number of problems associated with the implementation, then this is preferred solution. If this rede...
[ -0.35094523429870605, -0.14370398223400116, 0.4545007348060608, 0.016045672819018364, -0.026347089558839798, -0.05511242896318436, 0.08389418572187424, -0.0637640580534935, 0.23745980858802795, -0.77842116355896, 0.00031930202385410666, 0.49857762455940247, -0.43697497248649597, 0.02608685...
of the classes involved in the bidirectional association. As Mehrdad stated, this shouldn't be too big of a deal since the requirements explicitly ask for this coupling, so you are not introducing one by doing this. --- Code ---- Here is an implementation of this that keeps the specialized methods checking only thei...
[ -0.13042236864566803, -0.18639147281646729, -0.011248650960624218, 0.18480360507965088, -0.25199073553085327, -0.07465703040361404, 0.05197799205780029, -0.4758729338645935, 0.11169402301311493, -0.5014272928237915, -0.025029249489307404, 0.6799603700637817, -0.3740816116333008, 0.15187400...
_lastName; private Address _address; public Person(string firstName, string lastName, Address address) { FirstName = firstName; LastName = lastName; Address = address; } public virtual Address Address
[ -0.7296603918075562, -0.3515717685222626, 0.17910732328891754, 0.029577823355793953, 0.3816871643066406, 0.3463273048400879, 0.2316340059041977, 0.3905123174190521, -0.04434046894311905, -0.77732253074646, -0.6430121660232544, 0.49589818716049194, -0.044682860374450684, 0.3958304524421692,...
{ get { return _address; } set { _address = value; } } public virtual string FirstName { get { return _firstName; } set { _firstName = value; }
[ -0.45942071080207825, -0.5114029049873352, 0.1794508844614029, 0.038352593779563904, 0.15585118532180786, 0.03528556600213051, 0.08252665400505066, 0.18000805377960205, 0.19205912947654724, -0.6529663801193237, -0.49534010887145996, 0.5314734578132629, -0.25252237915992737, 0.0802305191755...
} public virtual string LastName { get { return _lastName; } set { _lastName = value; } } public override bool Equals(object obj) { // Use 'as' rather than a
[ -0.25295644998550415, -0.17183619737625122, 0.3639349043369293, -0.2805004417896271, 0.06366803497076035, -0.1480373740196228, 0.5531563758850098, -0.022916359826922417, -0.05946289002895355, -0.42244499921798706, -0.47857826948165894, 0.46914660930633545, -0.2546374499797821, 0.1929230690...
cast to get a null rather an exception // if the object isn't convertible Person person = obj as Person; return this.Equals(person); } public override int GetHashCode() { string composite = FirstName + LastName;
[ -0.21640650928020477, -0.22520259022712708, -0.012864906340837479, -0.28823891282081604, 0.05386670306324959, 0.1824837625026703, 0.4612826704978943, -0.46346572041511536, -0.006250662729144096, -0.15801289677619934, -0.2530463933944702, 0.10555774718523026, -0.4762445092201233, 0.11414676...
return composite.GetHashCode(); } internal virtual bool EqualsIgnoringAddress(Person other) { // Per MSDN documentation, x.Equals(null) should return false if ((object)other == null) {
[ -0.15629695355892181, -0.14069758355617523, 0.4163661301136017, -0.15370364487171173, 0.18794727325439453, 0.399631142616272, 0.5499522686004639, -0.09660544991493225, -0.24572551250457764, -0.344137579202652, 0.15844973921775818, 0.4597184956073761, -0.41896602511405945, 0.123449578881263...
return false; } return ( this.FirstName.Equals(other.FirstName) && this.LastName.Equals(other.LastName)); } #region IEquatable<Person> Members public virtual bool Equals(Person other) { // Per MSDN documentation, x.Equals(null)
[ -0.372925728559494, -0.239149808883667, 0.47201359272003174, -0.09034503996372223, 0.19278499484062195, -0.14619754254817963, 0.39359280467033386, 0.055826254189014435, -0.21013803780078888, -0.7240455746650696, -0.17658297717571259, 0.2457326501607895, -0.23038941621780396, 0.379910707473...
should return false if ((object)other == null) { return false; } return (this.Address.EqualsIgnoringPerson(other.Address) // Don't have Address check it's person && this.FirstName.Equals(other.FirstName)
[ -0.37481313943862915, -0.2520475387573242, 0.3910521864891052, -0.08660268783569336, 0.19297076761722565, -0.03094709850847721, 0.49469971656799316, -0.3202640414237976, 0.09909578412771225, -0.7023558020591736, 0.13685111701488495, 0.2911125123500824, -0.2595011591911316, -0.0072778137400...
&& this.LastName.Equals(other.LastName)); } #endregion } public class Address : IEquatable<Address> { private string _streetName; private string _city; private string _state; private Person _resident; public Address(string city, string state, strin...
[ -0.013894439674913883, -0.25835099816322327, 0.7607734799385071, -0.190023273229599, 0.3268185555934906, -0.14376255869865417, 0.3068101406097412, 0.00263890135101974, 0.1380019336938858, -0.9029313921928406, -0.598591685295105, 0.3697125017642975, -0.4533845782279968, 0.2794759273529053, ...
streetName) { City = city; State = state; StreetName = streetName; _resident = null; } public virtual string City {
[ -0.024723462760448456, -0.24686934053897858, 0.09887479990720749, -0.08514847606420517, -0.0035414258018136024, 0.038771845400333405, 0.5172462463378906, 0.09805898368358612, 0.004762836266309023, -0.791066586971283, -0.503400981426239, 0.3663490116596222, -0.5419273972511292, 0.6084265708...
get { return _city; } set { _city = value; } } public virtual Person Resident { get { return _resident; } set { _resident = value; } }
[ -0.3606637716293335, -0.49396657943725586, 0.30363738536834717, 0.30468401312828064, 0.1444273740053177, -0.003249924862757325, 0.2823374569416046, 0.42165297269821167, -0.145961731672287, -0.6871238350868225, -0.6485036611557007, 0.38820385932922363, -0.3570535480976105, 0.191424876451492...
public virtual string State { get { return _state; } set { _state = value; } } public virtual string StreetName { get { return _streetName; } set
[ 0.09071044623851776, -0.32274526357650757, 0.10846855491399765, 0.06542730331420898, 0.1676626056432724, 0.19517658650875092, 0.27187007665634155, 0.140798881649971, 0.16309554874897003, -0.9428646564483643, -0.2650945782661438, 0.616119384765625, -0.2698970139026642, 0.28891614079475403, ...
{ _streetName = value; } } public override bool Equals(object obj) { // Use 'as' rather than a cast to get a null rather an exception // if the object isn't convertible Address address = obj as Address;
[ -0.11361964046955109, 0.1527078002691269, 0.3858758509159088, -0.3204037547111511, -0.1010429784655571, -0.16733518242835999, 0.538368284702301, -0.2936198115348816, 0.13664360344409943, -0.49583905935287476, -0.30865681171417236, 0.3497476875782013, -0.5430623888969421, 0.1572462022304535...
return this.Equals(address); } public override int GetHashCode() { string composite = StreetName + City + State; return composite.GetHashCode(); } internal virtual bool EqualsIgnoringPerson(Address other) {
[ -0.11177556216716766, -0.21616166830062866, 0.548940896987915, -0.2168090045452118, 0.1457335650920868, 0.38956013321876526, 0.29796695709228516, -0.21618640422821045, -0.1269819289445877, -0.6206984519958496, -0.025455417111516, 0.2394615262746811, -0.5050809979438782, 0.15876264870166779...
// Per MSDN documentation, x.Equals(null) should return false if ((object)other == null) { return false; } return (this.City.Equals(other.City) && this.State.Equals(other.State)
[ 0.15680834650993347, -0.18752223253250122, 0.5983125567436218, 0.15336154401302338, 0.2556653320789337, -0.15735527873039246, 0.48938706517219543, -0.3781419098377228, -0.13443730771541595, -0.7113291621208191, -0.08561080694198608, 0.18229545652866364, -0.5186833143234253, 0.1313806623220...
&& this.StreetName.Equals(other.StreetName)); } #region IEquatable<Address> Members public virtual bool Equals(Address other) { // Per MSDN documentation, x.Equals(null) should return false if ((object)other == null) {
[ -0.14540940523147583, -0.14989572763442993, 0.6232565641403198, -0.13648106157779694, 0.10735523700714111, -0.15621541440486908, 0.48180916905403137, -0.13144062459468842, -0.10395696759223938, -0.6821832060813904, -0.05862700939178467, 0.3350680470466614, -0.37814003229141235, 0.354452908...
return false; } return (this.City.Equals(other.City) && this.State.Equals(other.State) && this.StreetName.Equals(other.StreetName) && this.Resident.EqualsIgnoringAddress(other.Resident)); }
[ -0.11909838765859604, -0.03229669854044914, 0.2591678202152252, -0.1658121794462204, 0.24503761529922485, 0.032065898180007935, 0.6133589148521423, -0.3135283291339874, 0.09978450834751129, -0.6358599662780762, -0.1255512535572052, 0.2764369249343872, -0.4259438216686249, 0.155968397855758...