text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
{ _x=snap->_x; _y=snap->_y; _z=snap->_z; } Snapshot (){_x=_y=_z=0;} int GetX(){return _x;}
[ -0.2002682387828827, -0.4029359817504883, 0.3244993984699249, -0.13828793168067932, 0.029983684420585632, 0.22878551483154297, 0.2496083527803421, -0.07307498902082443, -0.15944907069206238, -0.2568338215351105, -0.6033732891082764, 0.7768338322639465, -0.6019981503486633, -0.4122683703899...
int GetY(){return _y;} int GetZ(){return _z;} ~virtual Snapshot(){} protected: int _x,_y,_z; }; class Value:public Snapshot { /*Very heavy class with a lot of components used to calculate _x, _y, _z*/ }; class Manager {
[ -0.21341170370578766, -0.3060740828514099, 0.2587713301181793, 0.16236835718154907, 0.07064217329025269, -0.09169826656579971, 0.18843115866184235, -0.1728566735982895, -0.1666533648967743, -0.34776830673217773, -0.36136385798454285, 0.6886640191078186, -0.34233635663986206, 0.039279066026...
public: void Process( const Snapshot * snap) { } }; ``` How do you feel about this design? What are the alternatives? Thanks **Solutions and issues** * Solution: I would create makeSnapshot function which would return Snapshot object by given Value object. * Issues: + major issue: ...
[ 0.27827125787734985, -0.1090182363986969, 0.3118749260902405, 0.07726742327213287, 0.0851001888513565, 0.17438015341758728, 0.24325193464756012, -0.1832309365272522, -0.23496568202972412, -0.5437772870063782, 0.03409171104431152, 0.5704191327095032, -0.3692038655281067, 0.17315419018268585...
Snapshot, as I don't want to introduce setters. Generally speaking I would use public inheritance, if I want to implement a specific interface, e.g. if my class is to be accessed thrugh a specific contract. Protected inheritance could be used, if you just want to reuse the functionality implemented in the parent. ...
[ 0.19335812330245972, -0.17009317874908447, 0.12869295477867126, 0.32235342264175415, -0.22452127933502197, -0.13899177312850952, -0.0514279268682003, 0.06669119745492935, 0.03018600307404995, -0.561089277267456, 0.04031581059098244, 0.5155044794082642, -0.5743774175643921, 0.09707304835319...
A ASP.NET page's `ViewState` seems to have troubles keeping up with dynamically removed controls and the values in them. Let's take the following code as an example: **ASPX:** ``` <form id="form1" runat="server"> <div> <asp:Panel runat="server" ID="controls" /> </div> </form> ``` **CS:** ``` protected void Pa...
[ -0.384797602891922, -0.49863556027412415, 0.9377433657646179, -0.15684670209884644, -0.20675230026245117, 0.08264376223087311, 0.27451950311660767, -0.447743684053421, -0.531236469745636, -0.8041994571685791, -0.31678155064582825, 0.2455645352602005, -0.4579907953739166, -0.072408258914947...
for (int i = 0; i < int.Parse(ViewState["controls"].ToString()); i++) { controls.Controls.Add(new TextBox()); Button remove = new Button(); remove.Text = "Remove"; remove.Click +=new EventHandler(removeOnClick); controls.Controls.Add(remove); contr...
[ -0.349638968706131, -0.38592779636383057, 0.5936651229858398, -0.4527919292449951, 0.2492908537387848, 0.27792832255363464, 0.30833008885383606, -0.5644188523292542, -0.06758874654769897, -0.48219433426856995, -0.46928343176841736, 0.5601373314857483, -0.5274186134338379, -0.02762709371745...
} } } protected void removeOnClick(object sender, EventArgs e) { Control s = sender as Control; //A hacky way to remove the components around the button and the button itself s.Parent.Controls.Remove(s.Parent.Controls[s.Parent.Controls.IndexOf(s) + 1]); s.Parent.Controls.Remove(s.Parent.Controls[s....
[ -0.3638727068901062, -0.31288206577301025, 0.34004339575767517, -0.24786080420017242, 0.38247182965278625, 0.1303728073835373, 0.49132800102233887, -0.3221636712551117, -0.19781342148780823, -0.4120326042175293, -0.6078439354896545, 0.2027963399887085, -0.5946160554885864, 0.38869705796241...
= (int.Parse(ViewState["controls"].ToString()) + 1).ToString(); controls.Controls.Add(new TextBox()); } ``` Then, let's say you create 4 controls and insert the following values: ``` [ 1 ] [ 2 ] [ 3 ] [ 4 ] ``` We want to delete the second control; after removing the second control the output is: ``` [ 1 ] [ ...
[ 0.004456530790776014, -0.036227814853191376, 0.5750165581703186, -0.06429346650838852, 0.1884509176015854, 0.039938606321811676, -0.02667565830051899, -0.45226672291755676, -0.14295636117458344, -0.6218946576118469, -0.08129440993070602, 0.6139363050460815, -0.4991152286529541, 0.000035560...
Whether controls are loaded by their ID or Index depends on the ViewStateModeById attribute. By default it is false (meaning load by index). However, text boxes are handled differently. Their view state does not contain input value unless they are disabled or invisible. The text property gets overwritten by posted val...
[ -0.09870094060897827, -0.452223002910614, 0.7691130042076111, 0.3530904948711395, -0.18255622684955597, 0.3562363386154175, 0.0016262225108221173, -0.300549179315567, -0.2106814682483673, -0.43105819821357727, 0.023483281955122948, 0.5690003037452698, -0.2803332805633545, 0.049369119107723...
ctrl3 with according values. Now, when you do any postback, these three values get submitted in the form ctrl0=1&ctrl2=3&ctrl3=4. Then, on Page\_Load, you create three controls, this time: ctrl0, ctrl1, ctrl2 with no values. The Framework calls LoadRecursive to load view states and then ProcessPostData to assign inpu...
[ -0.25675052404403687, -0.1934673935174942, 0.7774677276611328, -0.022758329287171364, -0.31381872296333313, 0.177856907248497, 0.21747423708438873, -0.5461812615394592, -0.10515739768743515, -0.49403080344200134, 0.099953293800354, 0.42937541007995605, -0.4980766773223877, 0.06606907397508...
Button b = new Button(); b.Text = "Add"; b.Click += new EventHandler(buttonOnClick); form1.Controls.Add(b); Button postback = new Button(); postback.Text = "Postback"; form1.Controls.Add(postback); } protected void Page_Load(object sender, EventArgs e) { if (ViewState["controls"] != null) ...
[ -0.3660888969898224, -0.5639135241508484, 0.8397006988525391, -0.30775216221809387, 0.0970034971833229, 0.28928568959236145, 0.10100628435611725, -0.5293421149253845, -0.4471409320831299, -0.5653517246246338, -0.44862666726112366, 0.5962534546852112, -0.5642187595367432, 0.0613632313907146...
TextBox textbox = new TextBox(); textbox.ID = string.Format("txt_{0}", ids[i]); textbox.Text = textbox.ID; controls.Controls.Add(textbox); Button remove = new Button(); remove.Text = "Remove"; remove.Click += new EventHandler(removeOnClick);
[ -0.3874824345111847, -0.5243730545043945, 0.4340091049671173, -0.2457548826932907, 0.15365435183048248, 0.13256824016571045, 0.21932174265384674, -0.39338207244873047, -0.2154548615217209, -0.40937715768814087, -0.3510727882385254, 0.452085942029953, -0.6778755784034729, 0.0429106727242469...
remove.ID = ids[i]; controls.Controls.Add(remove); controls.Controls.Add(new LiteralControl("<br />")); } } } protected void removeOnClick(object sender, EventArgs e) { Control btn = sender as Control; List<string> ids = (List<string>)ViewState["controls"]; ids.Remove(...
[ -0.032065168023109436, -0.25722503662109375, 0.36930039525032043, -0.239315465092659, 0.23300035297870636, 0.19760610163211823, 0.2827162742614746, -0.534323513507843, -0.20248916745185852, -0.3215949237346649, -0.45071208477020264, 0.15827062726020813, -0.7122663259506226, 0.4814861714839...
btn.Parent.Controls.Remove(btn); ViewState["controls"] = ids; } protected void buttonOnClick(object sender, EventArgs e) { List<string> ids; if (ViewState["controls"] == null) ids = new List<string>(); else ids = (List<string>)ViewState["controls"]; string id = Guid.NewGuid().ToS...
[ -0.22369715571403503, -0.32876327633857727, 0.4753813147544861, -0.3196033239364624, 0.22249752283096313, 0.3070454001426697, 0.37742382287979126, -0.34433168172836304, -0.19110621511936188, -0.6914191246032715, -0.49483975768089294, 0.5571865439414978, -0.48196902871131897, 0.243031442165...
remove.Click += new EventHandler(removeOnClick); remove.ID = id; controls.Controls.Add(remove); controls.Controls.Add(new LiteralControl("<br />")); ids.Add(id); ViewState["controls"] = ids; } ```
[ -0.005693486891686916, -0.22933760285377502, 0.3273208439350128, -0.24997058510780334, 0.18629154562950134, -0.10175899416208267, 0.24067701399326324, -0.3587130010128021, -0.19910763204097748, -0.49751824140548706, -0.31656721234321594, 0.504884660243988, -0.5964367985725403, 0.1768149882...
I was just dealing with strings, and I find myself annoyed that strings can be nullable. So, I have to have ``` if((teststring??string.Empty)==string.Empty) ``` all over the place. Would string? have been so hard for allowing nullability in the relatively few cases where it is needed (dbs, idiot user inputs, etc.)....
[ 0.09011376649141312, 0.07762111723423004, 0.06757097691297531, 0.04935692623257637, -0.4178219437599182, -0.1867057830095291, 0.3476307690143585, 0.19536837935447693, -0.16672030091285706, -0.6261513829231262, 0.05271497741341591, 0.6096844673156738, -0.3160932958126068, 0.3795846104621887...
type seems entirely reasonable to me. It's a shame that one can't declare a variable/parameter/return type to be *non-nullable* though - e.g. ``` // Never returns null public string! Foo() { } ``` Code contracts in .NET 4.0 will help with this, I believe - but it's a bit late to make it pervasive. A while ago I wr...
[ 0.09286164492368698, 0.17558804154396057, 0.19205984473228455, -0.15090399980545044, -0.33374184370040894, -0.1940799206495285, 0.5336612462997437, 0.09042646735906601, -0.06049782782793045, -0.29682543873786926, -0.10706203430891037, 0.5002791881561279, -0.3497479259967804, 0.396404653787...
sequence. * Various things about the switch statement :) * Some odd overload resolution rules * The "lock" keyword, instead of "using" with a lock tocken. **C# 2:** * Lack of partial methods (came in C# 3) * Lack of generic variance (coming in C# 4) * The `System.Nullable` class (not `Nullable<T>` - that's fine!) * I...
[ 0.0020797643810510635, 0.017046554014086723, 0.18939507007598877, -0.12287602573633194, -0.12144435197114944, -0.016813933849334717, 0.5223040580749512, -0.2929508686065674, -0.3240002691745758, -0.39286208152770996, -0.030519381165504456, 0.3895469605922699, -0.5585787296295166, 0.1066651...
So in my `persistence.xml` I turned on `hibernate.generate_statistics`. ``` <property name="hibernate.generate_statistics">true</property> ``` My question is how do I access them? Where do the statistics go? In your dao service you can go: ``` Session session = this.sessionFactory.getCurrentSession(); SessionStatis...
[ 0.197661891579628, 0.1702711284160614, 0.47222867608070374, 0.08762551099061966, -0.03624778985977173, -0.28148943185806274, 0.32110413908958435, -0.032659564167261124, -0.23364068567752838, -0.6234837770462036, -0.07930950075387955, 0.379155695438385, -0.15159517526626587, 0.1655126512050...
I have done this the other way many times as it makes sense (the page knows about the control as it has been added to the page and can handle the 'child' event) Is it possible to do it the other way? I think not as the control doesn't know what page it is going to be on The reason i ask this is that I have a modal p...
[ 0.48855024576187134, 0.004026409704238176, 0.26931363344192505, -0.010863682255148888, 0.12001291662454605, -0.008245985023677349, 0.238395094871521, 0.042011894285678864, -0.19521617889404297, -0.4723208248615265, 0.16487860679626465, 0.17162907123565674, -0.1754564344882965, 0.4251423776...
but I am not too sure how to tell the control this has happend? In your dao service you can go: ``` Session session = this.sessionFactory.getCurrentSession(); SessionStatistics sessionStats = session.getStatistics(); Statistics stats = this.sessionFactory.getStatistics(); ```
[ -0.05683670565485954, 0.09511144459247589, 0.4289325177669525, 0.10540547966957092, 0.16380594670772552, -0.2135729193687439, 0.40702196955680847, -0.08201846480369568, -0.17146533727645874, -0.5625681281089783, -0.20528419315814972, 0.5594745874404907, -0.13568060100078583, -0.13366560637...
In Java, I use *log4J* that is a logging framework. In Log4j you can do something like this: ``` if (log.isDebug()) { // do some expensive operation that should only be displayed if DEBUG is turned on } ``` Reading some Symfony examples, I am unable to find a way to determine if DEBUG logging is activated in the c...
[ 0.16677452623844147, -0.0938451960682869, 0.10435385257005692, -0.26010388135910034, -0.02394837699830532, -0.45948442816734314, 0.19506579637527466, -0.21909044682979584, -0.2704114317893982, -0.5848529934883118, -0.22161853313446045, 0.679641842842102, -0.5229853987693787, -0.20544247329...
In order to use the uniq command, you have to sort your file first. But in the file I have, the order of the information is important, thus how can I keep the original format of the file but still get rid of duplicate content? Another awk version: ``` awk '!_[$0]++' infile ```
[ 0.14232173562049866, -0.36517348885536194, 0.25388607382774353, 0.07103592902421951, -0.03144774213433266, -0.13957291841506958, 0.12745614349842072, 0.08270207047462463, -0.0026034959591925144, -0.7541790008544922, -0.15194863080978394, 0.6671660542488098, -0.37554022669792175, 0.17353886...
Note: Please don't answer with *just use Adobe AIR*". I am aware of it, and it's not applicable in this situation. I've been reviewing the [Gecko Plugin API reference](https://developer.mozilla.org/en/Gecko_Plugin_API_Reference). I'm assuming I'd have to implement all the required browser-side functionality. My goal ...
[ 0.37445899844169617, 0.30466389656066895, 0.14621475338935852, 0.05279946327209473, -0.3477797508239746, -0.21266531944274902, 0.25442492961883545, 0.0994928777217865, 0.035028163343667984, -0.8135455250740051, -0.15824444591999054, 0.686806857585907, -0.3022575080394745, 0.015037583187222...
alternatives are to extract the necessary bits from WebKit, etc. Yep, check out ScreenweaverHX: <http://haxe.org/com/libs/swhx> <http://code.google.com/p/screenweaver-hx/> HTH
[ 0.29652735590934753, 0.13142411410808563, 0.35051077604293823, 0.20774352550506592, -0.06879179924726486, -0.14088372886180878, 0.08554740995168686, -0.19118233025074005, -0.25941094756126404, -0.7353912591934204, -0.18704695999622345, 0.22239729762077332, -0.10621117800474167, -0.07172966...
I have an application built with .NET 3.5. If a user runs it without having .NET 3.5 installed, I want to have control of what they see and perhaps provide a message that they can understand (with a link to .NET 3.5) versus unhandled exception stack traces. But if they don't actually have .NET 3.5 how can my applicatio...
[ 0.725835919380188, -0.05240988731384277, 0.3129023313522339, 0.0485786609351635, 0.021808462217450142, -0.4077657461166382, 0.13554014265537262, -0.005429203622043133, 0.012926371768116951, -0.6015179753303528, -0.09237129986286163, 0.5637497901916504, -0.1845964789390564, -0.0671830549836...
install them, or at least tell the user where to get them and what to do next
[ 1.017537236213684, 0.1649273931980133, 0.24682414531707764, 0.29126498103141785, 0.3591141402721405, -0.11778774112462997, -0.07223987579345703, -0.006431888323277235, 0.05102754011750221, -0.3625483810901642, -0.3067682683467865, 0.3274821639060974, 0.060009896755218506, -0.29399752616882...
I am new to inter process communication and need some help. I want to be able to send a string from a C++ program to a C# program. My problem is that the resultant string is gibberish. Here is my code: Sending program (C++): ``` void transmitState(char* myStr) { HWND hWnd = ::FindWindow(NULL, _T("myApp v.1.0"));...
[ 0.2960421144962311, 0.27671563625335693, 0.4655545651912689, -0.29589998722076416, 0.09171273559331894, -0.17101740837097168, 0.2853001356124878, 0.028091775253415108, 0.08304642885923386, -0.804564356803894, -0.11921152472496033, 0.6903389692306519, -0.363054096698761, 0.2542743682861328,...
(PVOID) myStr; cds.cbData = strlen(myStr) + 1; ::SendMessage(hWnd, WM_COPYDATA, NULL, (LPARAM)&cds); } } ``` And the receiving program (C#) (I have already overridden the WndProc): ``` private void OnCopyData(ref Message m) { COPYDATASTRUCT cds = new COPYDATASTRUCT(); cds = (COPYDATA...
[ 0.05715364217758179, 0.20232242345809937, 0.762032151222229, -0.37398457527160645, 0.38958054780960083, -0.07399201393127441, 0.25768694281578064, -0.5763336420059204, -0.278987318277359, -0.3168080747127533, -0.6524014472961426, 0.887517511844635, -0.2819047272205353, 0.3274362087249756, ...
ANSI character string (usually one byte per character), char\* in C# is Unicode character string (like WCHAR\* - two bytes per character). You in fact reinterpret\_cast from char\* to WCHAR\*. This won't work. Use MultiByteToWideChar() on C++ side to convert.
[ -0.06397206336259842, 0.04353344440460205, 0.07482614368200302, -0.16798371076583862, -0.22678935527801514, 0.1211775466799736, 0.2367720901966095, -0.13357487320899963, -0.052740029990673065, -0.4904431104660034, 0.11041627079248428, 0.40298017859458923, -0.5522464513778687, 0.02031500265...
I need to store a lookup table as an instance member in one of my classes. The table will be initialized when the object is constructed. Each "row" will have 3 "columns": ``` StringKey (e.g., "car") EnumKey (e.g., LookupKeys.Car) Value (e.g, "Ths is a car.") ``` I want to pick the data structure that will yield the ...
[ -0.13162817060947418, 0.3839021623134613, 0.30106601119041443, 0.19891396164894104, -0.12242422252893448, 0.6304901242256165, -0.1662975400686264, -0.0598854161798954, -0.0708007737994194, -0.5862010717391968, -0.06551247090101242, 0.3511998951435089, -0.12474460154771805, 0.25358247756958...
but I'm wondering what type of performance impact that would have. Am I thinking about this all wrong? You have two hashmaps. * One from StringKey to value. * One from EnumKey to value. You do not have to duplicate all the Value instances, those objects can be shared between the two hashmaps. If it's a LOT of items...
[ -0.03261476382613182, -0.27523738145828247, 0.014574842527508736, 0.3733637034893036, -0.14978542923927307, -0.08256510645151138, 0.1317644566297531, 0.01878868229687214, -0.33466780185699463, -0.9973980784416199, 0.08067791908979416, 0.3170166313648224, -0.2819192409515381, 0.143727704882...
Why are so many people still writing crappy versions of things in standard libraries? Not to go after PHP developers, but guys go read the [PHP SPL](http://ca2.php.net/spl) **Better search techniques.** and **Domain Specific Familiarity** How does a developer check for a function they dont know the name of? Or perhaps...
[ 0.5944965481758118, 0.31655582785606384, 0.03478185832500458, 0.3635459542274475, -0.21319012343883514, -0.4771690368652344, 0.5773106217384338, 0.15319189429283142, -0.4139540195465088, -0.42314738035202026, 0.08892908692359924, 0.3097223937511444, -0.04296048358082771, -0.400021016597747...
reading topics specific to your problem domain. Get away from coding specific resources and spend sometime in the field which you are coding for... wether it be retail, medical, insurance, etc.
[ 0.758548378944397, -0.004899535793811083, -0.03795262426137924, 0.5508665442466736, 0.20994716882705688, -0.41766357421875, 0.10246048122644424, 0.47035646438598633, 0.11527005583047867, -0.8583906888961792, -0.0810554251074791, 0.36316999793052673, 0.12221299111843109, -0.1218722239136695...
I am trying to write a Java applet that will read from a user's serial port. For this I am using the [Java Comm API](http://java.sun.com/products/javacomm/) in conjuction with the [RXTX library](http://www.rxtx.org/). I've successfully managed to read data through a local Java application but I can't seem to do the sam...
[ 0.02473590523004532, 0.3279277980327606, 0.3851512372493744, -0.09553266316652298, -0.15089938044548035, -0.1247972622513771, 0.2958691120147705, -0.005474426317960024, -0.17822806537151337, -0.8089818954467773, 0.27719709277153015, 0.22071164846420288, -0.045203786343336105, 0.25992828607...
and I am wondering if there is a newer solution. Or if you can suggest an alternative, I would love to hear it! Use Java Web Start. You can include the native library as a signed jar and everything should work. 1) put the native librarys in a jar in the ROOT directory 2) sign ALL the jars 3) write a JNLP referencing a...
[ 0.43882516026496887, 0.16847269237041473, 0.04645479470491409, -0.09628071635961533, -0.11857929825782776, -0.4172143340110779, 0.5085961818695068, -0.15933610498905182, -0.08195260167121887, -0.8353621363639832, 0.09889797121286392, 0.5322102308273315, -0.13523773849010468, -0.19317582249...
On our site, we provide to users a simulation based on their private information (given through a form). We would like to allow them to get back on their simulation results later, but without forcing them to create a login/password account. We have thought of sending them an email with a link, from which they could g...
[ 0.41041237115859985, -0.023732325062155724, 0.10981524735689163, 0.29626983404159546, 0.13896316289901733, -0.08064190298318863, 0.15682494640350342, 0.11446535587310791, 0.03096581995487213, -0.5732362866401672, -0.1175997406244278, -0.06168748438358307, 0.05609377101063728, 0.09360089153...
they would receive an email like that: > Hi, > > Get back your results on > <https://www.example.com/load_simulation?token=uZVTLBCWcw33RIhvnbxTKxTxM2rKJ7YJrwyUXhXn> What do you think about it? Is it secure enough? What would you advise me for the token generation? What about passing URL parameters in a https req...
[ 0.3115917146205902, -0.3530498445034027, 0.40174511075019836, 0.3044087290763855, -0.17471212148666382, -0.025409702211618423, 0.2154640108346939, -0.21908804774284363, -0.4661654829978943, -0.5579766035079956, 0.2647427022457123, 0.1348264366388321, 0.05046890676021576, 0.0604927539825439...
your IT people having access to all the tokens. Additionally the URL with the query string would be saved in your user's history, allowing other users of the same machine to access the URL. Finally and what makes this very insecure is, the URL is sent in the Referer header of all requests for any resource, even thir...
[ 0.22814714908599854, -0.00014156133693177253, 0.06813652068376541, 0.5093963742256165, 0.07432974129915237, -0.13869085907936096, 0.03101448528468609, 0.2553282678127289, -0.16375859081745148, -0.5566420555114746, 0.06747910380363464, 0.49203458428382874, -0.01285793911665678, 0.2358354330...
I have found that datagrid columns can be dynamically created and bound in Silverlight. However I can't find a way to bind data to those columns. If I try to bind any type of object with AutoGenerateColumns = true, then the names of each property of the object get added as columns and the object information is display...
[ 0.1744573414325714, 0.03449845686554909, 0.37483152747154236, 0.18813955783843994, -0.1514374315738678, -0.05554867535829544, 0.09908288717269897, -0.26385366916656494, -0.3055835962295532, -0.7509590983390808, 0.11563940346240997, 0.41301828622817993, -0.6228272914886475, 0.48461750149726...
a specific object for each case that i need to display data in the datagird. I do not want to have my column names limited to the names of properties, e.g. names with out spaces. I want to be able to bind a list or a dictionary array to the data grid. I also want to be able to control what data shows up in what colum...
[ 0.03338097035884857, 0.1898215264081955, 0.6964011192321777, 0.16946743428707123, -0.22011001408100128, -0.09351875633001328, 0.2367023229598999, -0.1570901721715927, -0.2731527090072632, -0.7335635423660278, -0.02644956484436989, 0.2544451951980591, -0.2583879232406616, 0.2862647771835327...
URL might get logged in its log files. Depending on how sensitive the data is you might not want your IT people having access to all the tokens. Additionally the URL with the query string would be saved in your user's history, allowing other users of the same machine to access the URL. Finally and what makes this ve...
[ 0.12334635853767395, 0.11152276396751404, 0.2482382357120514, 0.49622267484664917, -0.06106140837073326, -0.2631136476993561, 0.12963783740997314, 0.23216818273067474, -0.255747526884079, -0.5854232907295227, 0.08462566137313843, 0.16351214051246643, -0.1104695126414299, 0.4080530405044555...
opinion this is a bad idea.
[ 0.768934428691864, 0.40238824486732483, 0.15173077583312988, 0.15572886168956757, -0.24343042075634003, -0.031994085758924484, 0.12732911109924316, 0.5757101774215698, 0.1957756131887436, -0.5805057883262634, 0.16042858362197876, 0.5649666786193848, 0.18691202998161316, 0.18512769043445587...
Our pool size is set to 600 connections for our web app to our database. However I just got an email from the client saying they are pushing our training course to 4000+ users telling them that they should get it completed by the 27th of this month. Should I up it to 4000? First, remember having 4000 users doing stuff ...
[ 0.6802560687065125, -0.12831908464431763, 0.6504659652709961, 0.12878622114658356, 0.26247984170913696, 0.05209365487098694, 0.2955469787120819, -0.25928187370300293, -0.6339513659477234, -0.577789843082428, 0.28755253553390503, 0.4364932179450989, 0.28135886788368225, -0.00890349037945270...
needing to up that. It really depends on the type load + architecture + [insert other factors]. The best would be to do some load testing. Also consider getting performance/resource usage information on the current load, and doing some transaction cost based analysis.
[ 0.35509204864501953, 0.11933863908052444, 0.23752304911613464, 0.19073761999607086, -0.09925926476716995, -0.005565039347857237, -0.022748278453946114, -0.5023088455200195, -0.14487917721271515, -0.5146992802619934, 0.21747252345085144, 0.7447267174720764, -0.08591226488351822, -0.34502035...
I have the following challenge, and I haven't found a good answer. I am using a Mocking framework (JMock in this case) to allow unit tests to be isolated from database code. I'm mocking the access to the classes that involve the database logic, and seperately testing the database classes using DBUnit. The problem I'm ...
[ 0.38932695984840393, 0.5721216797828674, -0.31120145320892334, 0.0949387326836586, -0.3866950571537018, -0.1128583550453186, 0.43819528818130493, -0.03894457593560219, -0.15359042584896088, -0.42773470282554626, 0.36454683542251587, 0.3402104675769806, -0.17573867738246918, 0.5518158674240...
access class which does the database interaction, and returns null appropriately. Then I have the business logic class which receives null from the mock and then is tested to act appropriately if the value is null. Now what if in the future that behavior needs to change and returning null is no longer appropriate, say...
[ -0.12630067765712738, 0.12898129224777222, 0.14563310146331787, 0.2817099988460541, 0.039803240448236465, 0.2333935648202896, 0.16791076958179474, -0.16635841131210327, -0.16755840182304382, -0.461602121591568, 0.1853257119655609, 0.8603253364562988, -0.11693721264600754, 0.318892806768417...
logic class would still appear to function, and the bug would only be caught in QA, unless someone remembered the coupling, or properly followed the usages of the method. I fell like I'm missing something, and there has to be a better way to avoid this conceptual duplication, or at least have it under test so that if ...
[ 0.22350233793258667, -0.2039523869752884, -0.1491490751504898, 0.2917288839817047, -0.016191594302654266, 0.03678033873438835, 0.3989570438861847, 0.031412601470947266, -0.0825786218047142, -0.3784434199333191, 0.23795124888420105, 0.39896315336227417, 0.17023326456546783, 0.19299486279487...
mock and actual implementation of the classed that the mock represents. For example, I just had a case where I had a method that was originally created and didn't expect null values, so this was not a test on the real object. Then the user of the class (tested via a mock) was enhanced to pass in a null as a parameter ...
[ 0.41908255219459534, -0.029707377776503563, 0.0079535823315382, 0.264999657869339, -0.3466514050960541, 0.29741618037223816, 0.3292175829410553, -0.24956120550632477, -0.05948255956172943, -0.5093477964401245, 0.1938791424036026, 0.5969010591506958, -0.08842134475708008, 0.0109820012003183...
the design needs to evolve two months later when you tend to forget about the details, how would you test the interaction between these two sets of objects (the one tested via a mock vs the actual implementation)? The underlying problem seems to be one of duplication (that is violating the DRY principle), the expectat...
[ 0.6362009644508362, 0.048745300620794296, -0.15276697278022766, 0.15721853077411652, -0.03722171485424042, 0.1332588791847229, 0.27194204926490784, -0.29111549258232117, 0.009985021315515041, -0.5186147689819336, 0.0065603419207036495, 0.4766373038291931, -0.15074051916599274, -0.021745128...
a class that is tested via DBUnit and interacts with the database during its tests, but it is the same idea). So now, say we need to modify the database behavior so that the results are different. The test using the mock will continue to pass unless 1) someone remembers or 2) it breaks in integration. So the stored pro...
[ 0.23465974628925323, -0.01649077981710434, -0.15356503427028656, 0.3490116596221924, 0.03857191279530525, 0.03620632365345955, 0.5480562448501587, -0.2100478857755661, -0.13981600105762482, -0.48534873127937317, 0.05460451915860176, 0.5602091550827026, -0.40083855390548706, 0.4074821472167...
that that is just the way it is (there is a reason for integration tests after all), but I was feeling that instead I'm missing something. [Edit on starting the bounty] Reading the interact with Aaron gets to the point of the question, but what I'm really looking for is some insight into how to avoid or manage the ap...
[ 0.4387682378292084, 0.12267815321683884, -0.060402899980545044, 0.3822888433933258, -0.2056073397397995, 0.2054930478334427, 0.48622700572013855, -0.028499403968453407, -0.39003804326057434, -0.4153790771961212, 0.531161904335022, 0.30813729763031006, 0.18729592859745026, -0.04112555086612...
scenario correctly. [Edit on awarding the bounty] Thanks to everyone who spent the time answering the question. The winner taught me something new about how to think about passing the data between the two layers, and got to the answer first. Your database abstraction uses null to mean "no results found". Ignoring the...
[ 0.5764826536178589, -0.21130616962909698, -0.0477900393307209, 0.5470627546310425, -0.13725347816944122, 0.02219458296895027, 0.4917738139629364, -0.250471293926239, -0.11230678111314774, -0.5200077891349792, 0.3590114712715149, 0.5495783686637878, -0.05675619840621948, 0.18379993736743927...
between objects, not to how that information is represented. Then if you need to change the way that the database layer represents "no results found" (or whatever information your test relies upon) you only have one place in your tests to change that.
[ 0.37993186712265015, -0.1995406299829483, 0.02232661284506321, 0.6367978453636169, 0.10374696552753448, -0.062287166714668274, 0.17104361951351166, 0.35938355326652527, 0.003060125047340989, -0.8193225264549255, -0.05107801780104637, -0.0497828871011734, -0.14444495737552643, 0.23535718023...
GUIDs get used a lot in creating session keys for web applications. I've always wondered about the safety of this practice. Since the GUID is generated based on information from the machine, and the time, along with a few other factors, how hard is it to guess of likely GUIDs that will come up in the future. Let's say ...
[ 0.5055647492408752, 0.10900023579597473, 0.35283634066581726, 0.5292017459869385, -0.036731790751218796, -0.12314241379499435, 0.054447002708911896, 0.10267358273267746, -0.19246156513690948, -0.7066848278045654, 0.4680112898349762, 0.8549692630767822, -0.14767955243587494, 0.0367588587105...
specific GUID, but just keep on trying GUIDs that might be generated at a specific period of time. .NET Web Applications call Guid.NewGuid() to create a GUID which is in turn ends up calling the [CoCreateGuid()](http://msdn.microsoft.com/en-us/library/ms688568(VS.85).aspx) COM function a couple of frames deeper in the ...
[ -0.1805385798215866, -0.03679889068007469, 0.519011378288269, 0.13985653221607208, -0.20416942238807678, -0.21456317603588104, -0.10388677567243576, -0.05959764122962952, -0.22596979141235352, -0.8466137647628784, -0.19065570831298828, 0.5811495780944824, -0.47320684790611267, 0.3007642626...
certainty, this function returns a > unique value – no other invocation, on > the same or any other system > (networked or not), should return the > same value. And if you check the page on [UuidCreate](http://UuidCreate): > The **UuidCreate** function generates a > **UUID** that cannot be traced to the > ether...
[ 0.23275552690029144, 0.31597477197647095, 0.07008562982082367, 0.2729184925556183, 0.2091243416070938, -0.4158938527107239, 0.2202414572238922, -0.05704765394330025, -0.05675967037677765, -0.23755908012390137, 0.2461676150560379, 0.6667590737342834, 0.01195080392062664, 0.3540979325771332,...
is a bug in Microsoft's implementation.
[ 0.060389354825019836, 0.09034396708011627, -0.09536803513765335, 0.07053903490304947, 0.5419805645942688, -0.34452977776527405, 0.36245307326316833, 0.5465407371520996, 0.3328184187412262, -0.4031861424446106, -0.189801886677742, 0.24653074145317078, -0.2188948690891266, 0.2917773425579071...
I am looking for suggestions for an interface name. The interface is for the primitive CRUD methods that will be defined later in the DAL, however I need to use it in a lower-level API. The interface itself will just have the four members, Create(), Read(), Update(), and Delete(). I am currently thinking something al...
[ 0.22867822647094727, 0.08288893103599548, 0.216286763548851, 0.08610682189464569, -0.26483336091041565, 0.2516290247440338, 0.19038426876068115, 0.0143272178247571, 0.060875266790390015, -0.6916402578353882, 0.13674107193946838, 0.7523142099380493, -0.1663508415222168, 0.11712469905614853,...
Is there a way to do the following in Oracle: ``` SELECT * FROM Tbl1 JOIN Tbl2 USING (col1) AND ON Tbl1.col2 = Tbl2.col3 ``` In standard SQL, you can use either USING or ON but not both. If you could use both, you'd omit the AND from your example. --- PMV commented (more accurately, asked - see also the poste...
[ 0.23290450870990753, 0.22988320887088776, 0.11898830533027649, 0.10589409619569778, -0.08248312771320343, -0.07987943291664124, -0.16509048640727997, -0.19163060188293457, -0.42166027426719666, -0.4677932858467102, 0.2269388884305954, 0.28550204634666443, -0.4432300329208374, 0.06802993267...
joins to ON join? Well, the best way to limit the damage imposed by the sadly misnamed columns is probably (and roughly - I've not debugged the SQL below): ``` SELECT * FROM (SELECT * FROM Tbl1 JOIN Tbl2 USING (col1, col2, col3, col4) JOIN Tbl3 USING (col2, col4, c...
[ -0.04231206700205803, -0.14045120775699615, 0.5371795892715454, 0.055200520902872086, 0.04109075292944908, 0.07682602852582932, 0.21357741951942444, -0.2044772058725357, -0.25037896633148193, -0.39080870151519775, -0.09135429561138153, 0.23043344914913177, -0.8890635371208191, 0.1216979995...
JOIN Tbl4 USING (col2, col8, col3, col23) ) AS SystematicNaming JOIN Tbl5 ON SystematicNaming.Col1 = Tbl5.Col1 AND SystematicNaming.ColA = Tbl5.PoorlyNamedColA AND SystematicNaming.ColB = Tbl5.PoorlyNamedColB ``` This preserves the convenient and
[ 0.017521271482110023, 0.2515266239643097, 0.1365947723388672, -0.03717317804694176, -0.24652893841266632, 0.11273560672998428, 0.2576529085636139, -0.19357697665691376, -0.42605847120285034, -0.2741892635822296, 0.02000124379992485, 0.2185988575220108, -0.4909939467906952, 0.38146254420280...
systematic USING notation for as long as possible, while managing the join with Tbl5 in the way that it has to be managed given the non-uniform column names required to join with Tbl5. I'm not sure that's the best query layout, though I think it is reasonable.
[ 0.16095411777496338, 0.14125686883926392, -0.010823545046150684, 0.035579729825258255, 0.20734865963459015, -0.2871037721633911, 0.3955715596675873, -0.27815529704093933, -0.00803616177290678, -0.682190477848053, 0.17952202260494232, 0.38293397426605225, -0.2911348044872284, -0.03487356379...
Ok, I have a question that I know is very opinionated (based on all the posts I have read), but I need help. Long story short, I have been using the following model for Data access for past few years. Database->Sprocs->XSD(Typed dataset, drag drop sproc in.net)-> In DAL project make functions to call created methods m...
[ 0.21307100355625153, -0.06455343961715698, 0.5237281322479248, 0.10695724189281464, -0.15065382421016693, -0.03747013211250305, -0.2336340844631195, -0.09302026033401489, -0.33138182759284973, -0.5134879946708679, 0.03128885105252266, 0.24636580049991608, -0.14080005884170532, -0.006398735...
not the database, I just map them in C# 4) Code mapping, easy to refactor 5) who doesn’t like everything to be typed and intellisensed Cons: 1) Slow to build 2)Slow to pull data (Table adapter and datasets have bad performance compared to a datareader) 3) Buggy when it comes to null vales. And boy can this krap be...
[ -0.16640983521938324, 0.07718406617641449, 0.25110137462615967, 0.3360964059829712, -0.27465182542800903, -0.18160806596279144, 0.5018202066421509, -0.014951414428651333, -0.1283024549484253, -0.5843051671981812, 0.04459530860185623, 0.3449183702468872, -0.3080701231956482, 0.0291014276444...
all with code with datareaders and untyped. **SO, the question is what is a good database (sprocs likely to Objects) mapper .** My thoughts on the 3 I looked at: 1)Linq to SQL – Well its only SQL and Microsoft pretty much has said it’s a dead technology, so seems pointless. 2) Entity Framework – I probably need mor...
[ 0.10571447014808655, 0.17340680956840515, 0.27125608921051025, 0.3744219243526459, -0.34494367241859436, -0.16317978501319885, 0.16879460215568542, -0.16665498912334442, -0.1977347582578659, -0.6150432825088501, 0.2611483633518219, 0.6191994547843933, -0.24391034245491028, -0.0176774989813...
Also, I have to use sprocs in various areas. Anyone’s suggestions or a really good link to a tutorial on a good ORM would be greatly appreciated. Sorry this question is so long. Thanks, Joe *I assume you're using this question for an interview to see if the applicant can notice a simple solution in a seemingly complex...
[ 0.3406534790992737, 0.250942587852478, 0.16106581687927246, 0.2745954692363739, -0.11166296899318695, -0.17041824758052826, 0.3729279041290283, 0.21173018217086792, -0.3142719268798828, -0.5164687037467957, -0.07804597914218903, 0.2899070978164673, 0.2458454668521881, 0.05963348224759102, ...
clue is the distance formula. It introduces a penalty for changing directions. The first thing an that comes to my mind is minimizing this penalty. To remove the penalty I have to order them in a certain direction, this ordering is the natural sort order. I would remove the penalty for changing directions, it's too mu...
[ 0.028178581967949867, 0.0799613818526268, 0.23289735615253448, 0.1332150101661682, -0.03219134360551834, 0.07437154650688171, 0.021001173183321953, -0.0821748673915863, -0.2222387194633484, -0.46019095182418823, 0.1068979874253273, 0.2781445384025574, -0.26545700430870056, -0.0791096240282...
Given a list of all possible > permutations of n delivery locations, > where each permutation of deliveries > (d1, d2, ..., > dn) has a cost defined by: > > > ![](https://latex.codecogs.com/gif.latex?%5Csum_%7Bi=1%7D%5E%7Bn-1%7D%5Csqrt[]%7B(d_%7Bi%7D-d_%7Bi+1%7D)%5E2%7D) > > > Return permutation P such that the...
[ 0.15929217636585236, -0.15212100744247437, 0.3728328049182892, -0.02071922831237316, 0.19308041036128998, 0.6191331744194031, 0.27663958072662354, -0.26086699962615967, -0.0946042612195015, -0.7979684472084045, -0.49418574571609497, 0.24868710339069366, -0.023346075788140297, 0.23025080561...
I'm trying to build a function that accepts an array in the following manner: ``` int inCommon = findCommon({54,56,2,10}, 4); int findCommon(int nums[], int len){ for(int i=0; i<len; i++) cout<<nums[i]<<endl; return 1; } ``` Note, that's not actually what my function does, but I do loop through the array. I'm...
[ -0.18757104873657227, -0.11256317794322968, 0.2587873637676239, -0.22741782665252686, -0.041785161942243576, -0.041333284229040146, 0.30533528327941895, -0.41372835636138916, -0.026336021721363068, -0.49136894941329956, -0.22965280711650848, 0.3593963086605072, -0.4813840389251709, -0.0463...
nums) { std::initializer_list<int>::iterator it; for (it = nums.begin() ; it != nums.end() ; ++it) { std::cout << *it << std::endl; } return 1; } ``` See [this presentation](http://iap.cse.tamu.edu/IAP_Initializers) from Bjarne Stroustrup, and [this article](http://en.wikipedia.org/wiki/...
[ -0.20210297405719757, 0.054797906428575516, 0.12372470647096634, -0.10154446214437485, -0.16555550694465637, 0.057395000010728836, 0.11952182650566101, -0.4361148476600647, -0.4611634314060211, -0.5596908330917358, -0.358334481716156, 0.2972165644168854, -0.21225106716156006, -0.1207230389...
I'm working on a project that has all its [user controls registered in its web.config file](http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx) (which seems very clean and tidy) So far so good (here comes the problem) however I'm trying to d...
[ 0.3555491864681244, -0.11221247911453247, 0.2856469750404358, 0.22650262713432312, -0.05353743955492973, -0.36831921339035034, 0.2609750032424927, -0.21495172381401062, -0.372586190700531, -0.30313703417778015, 0.28183120489120483, 0.3778887391090393, -0.2906849980354309, -0.00421887729316...
registered in the web.config, which means no cast, which means no event handling! Weirdly you can reference the type if you add the usercontrol to the page at design time! There must be a way round this (without having to register the control on the page, or add a control at design time), what on earth am I missing? ...
[ 0.726965606212616, -0.027421146631240845, 0.34609097242355347, 0.24041283130645752, -0.22648684680461884, -0.5329694747924805, 0.33913522958755493, -0.04276655241847038, -0.4853062331676483, -0.3045410215854645, 0.19134677946567535, 0.07499967515468597, -0.2629377841949463, 0.2054636925458...
no common name space and regardless of config requires the <%@ Register %> directive. If you don't, you get the exact error of missing an assembly reference. I would have to test to be sure...
[ 0.48280763626098633, 0.37725284695625305, -0.03557765856385231, -0.10806421935558319, 0.2699088752269745, -0.20072941482067108, 0.4431539475917816, 0.16138921678066254, -0.01136366743594408, -0.3675990104675293, -0.23048579692840576, 0.17733700573444366, -0.1505843549966812, 0.520151913166...
I've set up a SQLite DB that currently reads and writes `NSString`s perfectly. I also want to store an image in the database and recall it later. I've read up a bit on using `NSData` and encoding the image, but I'm not entirely sure what the syntax is for what I want to do. Any code snippets or examples would be greatl...
[ 0.3818216025829315, 0.006425921339541674, 0.5096989870071411, 0.07933830469846725, -0.2511228919029236, -0.16494667530059814, 0.19342485070228577, -0.09195661544799805, -0.13271403312683105, -1.0252139568328857, 0.13910263776779175, 0.5719070434570312, -0.09197500348091125, 0.1860209256410...
call will eventually be replaced with a call to a remote server. Not sure if this makes a difference as far as performance goes. One option (and generally preferred when working in SQL) is to write the image to a file on the system and store the path (or some other kind of identifier) in the database.
[ 0.4121609926223755, -0.22884799540042877, 0.5269594192504883, 0.2650650143623352, 0.011014517396688461, -0.13979750871658325, 0.059284865856170654, -0.024357054382562637, -0.023328760638833046, -0.6024482250213623, -0.12757626175880432, 0.5911181569099426, -0.3285466134548187, 0.0213756673...
I have a decent sized set of data that needs to be stored in an active record. In order to prepopulate the form fields on the page, I have already written the following code: ``` Device device = new Device(DeviceID); // device is simply the active record txtDeviceName.Text = device.Name; txtNotes.Text = device.Notes;...
[ 0.2373354583978653, 0.1659652590751648, 0.7582743763923645, -0.27689477801322937, 0.348171204328537, -0.1025327742099762, 0.25916969776153564, -0.2872738838195801, -0.3149658739566803, -0.8421570658683777, -0.12596873939037323, 0.7813966870307922, -0.17844149470329285, 0.18003185093402863,...
perform a database insert? For example, after highlighting the above code and running the macro, it would become: ``` device.DeviceName = txtDeviceName.Text; device.Notes = txtNotes.Text; device.Hostname = txtHostName.Text; device.AssetTag = txtAssetTag.Text; device.SerialNumber = txtSerialNumber.Text; // snip again.....
[ 0.11815974861383438, 0.11230134218931198, 0.3688788414001465, -0.3413895070552826, 0.19677209854125977, -0.06692782789468765, 0.11280974000692368, -0.2140835076570511, -0.295682817697525, -0.4691809415817261, -0.08594035357236862, 0.829874575138092, -0.535146176815033, 0.017413858324289322...
EnvDTE80 Imports System.Diagnostics Imports System.Text.RegularExpressions Public Module Helpers Sub SwapAssignment() If (Not IsNothing(DTE.ActiveDocument)) Then Dim selection As TextSelection = CType(DTE.ActiveDocument.Selection, TextSelection) selection.Text = Regex.Replace(select...
[ -0.08317561447620392, -0.6670483350753784, 0.5881248712539673, -0.010917824693024158, 0.014848997816443443, -0.13398826122283936, 0.049864761531353, -0.41717371344566345, -0.2326817512512207, -0.4747796952724457, -0.3380506634712219, 0.7090113162994385, -0.5948885679244995, -0.260651618242...
macros never are.
[ 0.3846195340156555, -0.23221898078918457, 0.18427437543869019, 0.20505501329898834, 0.39139994978904724, 0.27482911944389343, -0.3482425808906555, 0.9379366636276245, -0.1216697171330452, -0.5934818387031555, -0.032997895032167435, 0.7836480736732483, -0.44092482328414917, -0.0641569048166...
I need to do auto-correlation of a set of numbers, which as I understand it is just the correlation of the set with itself. I've tried it using numpy's correlate function, but I don't believe the result, as it almost always gives a vector where the first number is *not* the largest, as it ought to be. So, this quest...
[ 0.532200038433075, -0.37022730708122253, 0.07798083126544952, 0.15716388821601868, -0.25313547253608704, -0.042531706392765045, -0.1264430284500122, -0.191639244556427, -0.07570842653512955, -0.2829827070236206, 0.2616078853607178, 0.4568477272987366, -0.5739484429359436, 0.112360186874866...
results clipped by the specified mode. The [definition of convolution](http://mathworld.wolfram.com/Convolution.html), C(t)=∑ -∞ < i < ∞ aivt+i where -∞ < t < ∞, allows for results from -∞ to ∞, but you obviously can't store an infinitely long array. So it has to be clipped, and that is where the mode comes in. There ...
[ 0.0424688495695591, -0.5577031970024109, 0.6125071048736572, 0.28816625475883484, -0.17003965377807617, 0.12285125255584717, -0.10148495435714722, -0.2566603720188141, -0.21964596211910248, -0.08805776387453079, -0.2544248700141907, 0.6981427073478699, -0.3132514953613281, -0.0403555743396...
when `a` and `v` completely overlap each other. The [documentation](http://docs.scipy.org/doc/numpy/reference/generated/numpy.convolve.html) for `numpy.convolve` gives more detail on the modes. For your second question, I think `numpy.correlate` *is* giving you the autocorrelation, it is just giving you a little more ...
[ 0.4249410331249237, -0.5832159519195557, 0.41675829887390137, -0.018536873161792755, -0.28838369250297546, -0.11631786823272705, -0.048197608441114426, -0.27991122007369995, -0.11067110300064087, -0.4401372969150543, 0.00523926317691803, 0.7206244468688965, -0.3965558409690857, 0.189826235...
at a time difference of 0. It starts at a negative time difference, closes to 0, and then goes positive. That is, you were expecting: autocorrelation(a) = ∑ -∞ < i < ∞ aivt+i where 0 <= t < ∞ But what you got was: autocorrelation(a) = ∑ -∞ < i < ∞ aivt+i where -∞ < t < ∞ What you need to do is take the last ha...
[ -0.1773912012577057, -0.23021046817302704, 0.24055393040180206, -0.3477727770805359, -0.35972321033477783, 0.19742311537265778, -0.15169769525527954, -0.21358898282051086, -0.0327865332365036, -0.025331225246191025, 0.10597272217273712, 0.5840026140213013, -0.6417528986930847, 0.1089309528...
numpy.correlate(x, x, mode='full') return result[result.size/2:] ``` You will, of course, need error checking to make sure that `x` is actually a 1-d array. Also, this explanation probably isn't the most mathematically rigorous. I've been throwing around infinities because the definition of convolution uses them,...
[ 0.28166714310646057, 0.017032016068696976, 0.028822042047977448, -0.08508002758026123, -0.2866451144218445, -0.1589106172323227, -0.08579153567552567, 0.05230038985610008, -0.08541261404752731, -0.35274600982666016, -0.08799310028553009, 0.5379763841629028, -0.17872409522533417, 0.07086668...
I am going back over a recent project sorting out accessibility issues and was making sure all form elements had labels. Putting the label text into a tag caused a problem with some kludgy code I had written before. Basically, if you have a radio button and its label: ``` <label for="zone_r1"><input type="radio" nam...
[ 0.39456743001937866, 0.13449819386005402, 0.56679368019104, -0.07965575903654099, 0.09618870168924332, -0.5227923393249512, 0.0013685764279216528, -0.41423556208610535, -0.23801028728485107, -0.7495346665382385, 0.006607007700949907, 0.61683589220047, -0.3589039146900177, 0.173035368323326...
the kludge and it may not validate with the span in the label, but maybe I am being overly zealous. ``` $('#zone_r1').parent().hide(); ``` works for me
[ 0.6007201671600342, 0.23092994093894958, 0.4259314239025116, -0.09957057982683182, 0.20583947002887726, -0.24768736958503723, 0.4497927725315094, 0.07066909968852997, 0.24795234203338623, -0.3234502673149109, -0.13034014403820038, 0.3018997609615326, -0.04663222283124924, 0.405399411916732...
Is there any way I can check in/out of a local repository, and have those changes sync with the remote repository in the background? Internet connection where we are is weak, and the repository is huge. When I want to browse the repository with TortoiseSVN's Repo Browser, I can wait 30 minutes to load the repository i...
[ 0.3268537223339081, -0.22755251824855804, 0.8588045239448547, -0.004216678906232119, 0.30054399371147156, 0.07785321772098541, 0.21462704241275787, -0.17680233716964722, -0.575319766998291, -0.40829139947891235, 0.14158974587917328, 0.9008041024208069, 0.35805201530456543, 0.07129838317632...
push the changes to the 'real' repository using SVK. I believe this strategy is described in [Using SVK as a repository mirroring system](http://svk.bestpractical.com/view/UsingSVKAsARepositoryMirroringSystem)
[ 0.19254332780838013, -0.23684467375278473, 0.5263030529022217, -0.051136456429958344, -0.05954766646027565, -0.2656700909137726, 0.2845476269721985, -0.26267778873443604, -0.2712024748325348, -0.3750171959400177, -0.052888959646224976, 0.5977575778961182, 0.2613216042518616, -0.03687622770...
I am unit testing a class that calls ``` ContextRegistry.GetContext().GetObject("ISomething") ``` and it's ok if an ISomething isn't defined. So I am trying to test it both ways. Since this definition normally comes from the app.config file and I don't want to edit that file between tests, I'm using [TestFixtureSet...
[ 0.24723179638385773, 0.22891537845134735, 0.2552487552165985, 0.03883052244782448, -0.06524556875228882, 0.1779956817626953, 0.3675782382488251, -0.3923470079898834, 0.018554076552391052, -0.6484625935554504, -0.04568840563297272, 0.5287570953369141, -0.08302487432956696, 0.025824703276157...
as I know, no such feature exists. It would be tricky, anyway. What should be the semantics if the singleton has been wired to other objects already, before it is removed eventually? Re-setting object properties to null might not be possible as you cannot assume that null is allowed for the affected properties. If the ...
[ 0.39401012659072876, -0.19557714462280273, -0.13026677072048187, 0.34804239869117737, 0.07742380350828171, -0.08023904263973236, 0.10705909132957458, -0.15973863005638123, -0.22393549978733063, -0.30766192078590393, -0.08473218232393265, 0.7764132618904114, -0.3218749463558197, 0.288707673...
I remember a discussion I recently had with a fellow developer about the memory footprint of private vs public properties. I stated that private ones have less of a footprint than public ones. He claimed it makes no difference. By the way, we were talking about C#. **Who is right and why?** Apparently there are dif...
[ 0.22723715007305145, 0.2967351973056793, -0.1507641077041626, 0.18725743889808655, -0.3060948848724365, -0.15351895987987518, 0.2703411281108856, 0.06676560640335083, -0.3863477110862732, -0.39232200384140015, -0.004229576792567968, 0.5472071170806885, -0.21300949156284332, 0.2306777983903...
of the method does not change, only the way access to it is enforced (either at compile-time, or at run-time, based on the programming language in question.) **What *will* have an effect on memory footprint are other qualifiers**, such as **`final` in Java, `virtual` in C++, `static`, etc.** These qualifiers may eithe...
[ 0.10969986021518707, -0.018383391201496124, 0.16297468543052673, 0.415096640586853, 0.017262153327465057, -0.05402786657214165, 0.18866778910160065, 0.025595789775252342, -0.1929631233215332, -0.576827347278595, -0.3911474049091339, 0.2022521048784256, -0.12429884821176529, 0.1432573646306...
performance -- and *most definitely* increasing memory footprint.) --- **Of greater importance than memory footprint**, when discussing how a method should be qualified, is what you can do to both (1) have the compiler (or the runtime, as depending on the language) validate some of your assumptions and intentions, an...
[ 0.25680825114250183, 0.09369885921478271, -0.08224040269851685, 0.43458160758018494, -0.10678429156541824, -0.2880803346633911, 0.38915303349494934, -0.43158018589019775, 0.051774490624666214, -0.4804093539714813, -0.2540728449821472, 0.6865621209144592, 0.18571186065673828, -0.22550739347...
other classes (except maybe `friend` classes), need direct access to this method? If so, make it `protected`. * `static`: does the method require access to member variables or to `this`? If not, it should be `static` (e.g. a utility method that depends solely on its arguments) * `const`: does the method alter member va...
[ -0.1553235650062561, -0.25641801953315735, 0.07568879425525665, 0.3381189703941345, -0.06770394742488861, -0.21044950187206268, 0.03427640348672867, 0.16441236436367035, -0.2141697257757187, -0.12862902879714966, -0.2818513512611389, 0.4678002893924713, -0.5056149959564209, 0.3171237111091...
class, if this class' descendants will override it? If not, make it `abstract` (or `pure virtual`) * etc. There are miscellaneous articles, lectures and posts out there regarding best practices for the above, transcending the boundaries of many a programming language: * [access permissions and encapsulation](https://...
[ -0.0007176287472248077, -0.06964278221130371, -0.24518072605133057, 0.08479481935501099, -0.10996917635202408, -0.04520517215132713, 0.16209152340888977, -0.18226701021194458, -0.2674749791622162, -0.41439324617385864, -0.5538233518600464, 0.3881125748157501, -0.11889732629060745, 0.568939...
I have an annoying bug in on a webpage: > date.GetMonth() is not a function So, I suppose that I am doing something wrong. The variable `date` is not an object of type `Date`. **How can I check for a datatype in Javascript?** I tried to add a `if (date)`, but it doesn't work. ``` function getFormatedDate(date) { ...
[ 0.23618660867214203, 0.10115431994199753, 0.36375030875205994, -0.15811733901500702, -0.041084591299295425, -0.31281715631484985, 0.5845328569412231, 0.07962184399366379, -0.14765529334545135, -0.6022361516952515, -0.023868035525083542, 0.4118078351020813, -0.17787006497383118, 0.101973846...
to check the format of the date, but I want to be sure that the parameter passed to the method `getFormatedDate()` is of type `Date`. As an alternative to duck typing via ``` typeof date.getMonth === 'function' ``` you can use the `instanceof` operator, i.e. But it will return true for invalid dates too, e.g. `new D...
[ 0.23877571523189545, -0.027103569358587265, 0.20361578464508057, 0.0439431369304657, 0.0948549434542656, -0.26068001985549927, 0.08758091181516647, -0.27077266573905945, -0.20562970638275146, -0.6027826070785522, 0.07315286248922348, 0.16724403202533722, -0.32229793071746826, 0.49425315856...
I know that VPC does not officially support Linux, but I was wondering if there are any ways to get things similar to the VM additions so that I can get: * 1) A higher screen resoultion than 800x600 * 2) Faster graphics, no jerkey movements * 3) Drag and Drop support Number 3 really isn't that important but it would ...
[ 0.14383074641227722, -0.0802433118224144, 0.7333233952522278, 0.10659004002809525, -0.13291755318641663, -0.11652775853872299, 0.2480505108833313, 0.1539057493209839, -0.39699044823646545, -0.5624580383300781, -0.14897088706493378, 0.5427166223526001, -0.25281861424446106, 0.18003456294536...
frame boundaries. A work-around for this is to check the object's class via ``` Object.prototype.toString.call(date) === '[object Date]' ```
[ 0.24370406568050385, -0.05989224836230278, 0.14203695952892303, 0.0009849376510828733, 0.08052871376276016, -0.2246338129043579, 0.11903640627861023, -0.350095272064209, -0.30307215452194214, -0.3928825557231903, 0.17437498271465302, 0.06331174075603485, -0.13508310914039612, 0.50994026660...