instruction
stringlengths
0
30k
I've done projects between 1 - 6 months on my own, and I always tend to double or quadrouple my original estimates.
I would use Load if you expect it to take "file-time" and Get if you expect it to take "simple DB" time. That is, if the call is expensive, use "Load".
Wouldn't that defeat one of the purposes of a concurrent versioning system like SubVersion? Generally, you'll check out a block of files, but the server doesn't know whether anyone is editing those files. Why not allow another user access to those files and deal with the results if a conflict emerges?
Comments on products that I've used: VSS - Haven't used it in a while now (several years), at the time it did the basics of what we wanted but we were running into a variety of issues regularly enough that we actively sought out a better solution. If you've got free access then it wouldn't hurt to get exposure to t...
You will need to use jscript.net as the code behind language, but other pages of your site should be fine to stay as c# if thats what you prefer. As mentioned in previous comment, you will need to be aware of the security aspects and risks - only use eval if you trust the JSON you're parsing!
As a web developer by trade, you might look into the XSLT/XPath family as for certain types of XML processing they can be very powerful tools. Granted, in C# 3.x Linq2Xml exposes some similar functionality inline. XSLT, however, can be a powerful way to separate data from presentation in your apps.
It seems that I have a clue now. I thought KeyValuePair is a reference type, but it is not, it is a struct. And so it uses ValueType.GetHashCode() method. MSDN for it says: "One or more fields of the derived type is used to calculate the return value". If you will take a real reference type as a "tuple-provider" ...
Make sure there is a timeout on the token, say 2-5 minutes, to ensure it is authentic.
Or, alternatively, use mencoder
Visual studio 2005 actually has two The one for [the original release][1] and the one [for SP1][2] [1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en [2]: http://www.microsoft.com/downloads/details.aspx?familyid=200b2fd9-ae1a-4a14-984d-389c36f...
Here is one I did for Delphi. Each 'arg' is a separate param with a value defined elsewhere. The target is called with the params set up before calling it. <target name="build.application"> <exec program="dcc32" basedir="${Delphi.Bin}" workingdir="${Application.Folder}" verbose="true"> <arg...
In short, it's not complicated at all. **GUID** (or UUID) Version 4 (current) **is a random number**, plain and simple. The trick is that **the possible values of this number are so many that the probability of a hit is** for most practical purposes, **zero**.
In short, it's not complicated at all. **GUID** (or UUID) Version 4 (current) **is a** partially **random number**, plain and simple (122 out of 128 bits are random, the rest are used for storing version and revision). The trick is that **the possible values of this number are so many that the probability of a hit is**...
Hm, seems rsync does it, and does not need server/daemon/install I thought it does - just $ rsync src dst.
How do you calculate the axis-aligned bounding box of an ellipse?
|graphics|math|geometry|
If the major axis of the ellipse is vertical or horizontal, it's easy to calculate the bounding box, but what about when the ellipse is rotated? The only way I can think of so far is to calculate all the points around the perimeter and find the max/min x and y values. It seems like there should be a simpler way. ...
If the major axis of the ellipse is vertical or horizontal, it's easy to calculate the bounding box, but what about when the ellipse is rotated? The only way I can think of so far is to calculate all the points around the perimeter and find the max/min x and y values. It seems like there should be a simpler way. ...
Because until the constructor has completed executing, the object is not fully instantiated. Any members referenced by the virtual function may not be initialised. In C++, when you are in a constructor, `this` only refers to the static type of the constructor you are in, and not the actual dynamic type of the object th...
What is the format of the Remap XML file for IKVM?
|ikvm|xml|
In [this article][1] Jeroen explains an example of using an XML file to remap Java Bean getters and setters to .NET Properties. What would the XML file look like if I wanted to, say, remap a Java method called "showDialog()" to "ShowDialog()" in .NET? Has anyone worked with the remapping option before? Any idea wher...
In [this article][1] Jeroen explains an example of using an XML file to remap Java Bean getters and setters to .NET Properties. What would the XML file look like if I wanted to, say, remap a Java method called "showDialog()" to "ShowDialog()" in .NET? Has anyone worked with the remapping option before? Any idea wher...
|xml|ikvm|
In [this article][1] Jeroen explains an example of using an XML file to remap Java Bean getters and setters to .NET Properties. What would the XML file look like if I wanted to, say, remap a Java method called "showDialog()" to "ShowDialog()" in .NET? Has anyone worked with the remapping option before? Any idea wher...
Yes, it's generally bad to call virtual method in the constructor. At this point, the objet may not be fully constructed yet, and the invariants expected by methods may not hold yet.
Highly testable code tends to be structured differently than other code. You describe several tasks that you want an allocator to do: - coalescing free blocks - reusing free blocks on next allocations - returning excess free memory to the system - asserting that the allocation policy (e....
I asked a similar question at [perlmonks.org][1], and BrowserUk gave a really good framework [in his answer][2]. Basically, a convenient way to get lazy evaluation is to spawn threads for the computation, at least as long as you're sure you want the results, Just Not Now. If you want lazy evaluation not to reduce laten...
To add more python modules (espcially 3rd party ones), most people seem to use PYTHONPATH environment variables or they add symlinks or directories in their site-packages directories. Another way, is to use *.pth files. Here's the official python doc's explanation: > "The most convenient way [to modify > python's s...
There is a small penalty per virtual function call compared to a regular call. You are unlikely to observe a difference unless you are doing hundreds of thousands of calls per second, and the price is often worth paying for added code clarity anyway.
Using [mktime][1]: list($day, $month, $year) = explode('-', '22-09-2008'); echo mktime(0, 0, 0, $month, $day, $year); [1]: http://php.net/mktime
If you want to retrieve the currently authenticated user from the SharePoint context, you need to remain within the SharePoint context. This means hosting your custom web application within SharePoint (see [http://msdn.microsoft.com/en-us/library/cc297200.aspx][1]). Then from your custom application reference Microsoft...
I'd say it was best to run them on the same server until it becomes a problem. That way you'll save yourself some money and time upfront. Once the site becomes a success and requires a some architectural changes it should have already paid for itself. Remember to back up :)
The cost of actually calling the function, but not executing it in full? or the cost of actually executing the function? simply setting up a function call is not a costly operation (update the PC?). but obviously the cost of a function executing in full depends on what the function is doing.
I use a small number of tools and techniques, because it is easy to get distracted managing the information management tools, rather than managing the information. 1. Google Reader - The key for me was creating @work and @home labels, for the appropriate location. 2. TiddlyWiki - I keep track of all my notes fo...
Parser error when using ScriptManager
|asp.net|scriptmanager|
I have an ASP.NET page which has a script manager on it. <form id="form1" runat="server"> <div> <asp:ScriptManager EnablePageMethods="true" ID="scriptManager2" runat="server"> </asp:ScriptManager> </div> </form> The page overrides an abstract property to return...
I have an ASP.NET page which has a script manager on it. <form id="form1" runat="server"> <div> <asp:ScriptManager EnablePageMethods="true" ID="scriptManager2" runat="server"> </asp:ScriptManager> </div> </form> The page overrides an abstract property to return...
Consider the following event declaration Public Event SomethingHappened As EventHandler In C#, you can check for event subscribers by using the following syntax: if(SomethingHappened != null) { ... } However, the VB.NET compiler does not support this. It actually creates a hidden...
Stop, stop, stop. This is not how vim's tabs are designed to be used. In fact, they're misnamed. A better name would be "viewport" or "layout", because that's what a tab is -- it's a different layout of windows of ALL of your existing buffers. Trying to beat vim into 1 tab == 1 buffer is an exercise in futility. ...
Of course you have to profile your queries and look at the execution plan. But the two main things that come up over and over again are filter out as much as you can as soon as you can and try to avoid cursors. I saw an application where someone downloaded an entire database table of events to a client and then wen...
To some extent, the two schemes are equivalent: - A distributed VCS can trivially emulate a centralised one if you just always push your changes to some designated upstream repository after every local commit. - A centralised VCS won't usually be able to emulate a distributed one quite as naturally, but you can...
Following on from what it is, invariants are quite useful in writing clean code, since knowing conceptually what invariants should be present *in* your code allows you to easily decide how to organize your code to reach those aims. As mentioned ealier, they're also useful in debugging, as checking to see if the invaria...
The magic of wikipedia: [Invariant (computer science)][1] [1]: http://en.wikipedia.org/wiki/Invariant_(computer_science)
The magic of wikipedia: [Invariant (computer science)][1] > In computer science, a predicate that, > if true, will remain true throughout a > specific sequence of operations, is > called (an) invariant to that > sequence. [1]: http://en.wikipedia.org/wiki/Invariant_(computer_science)
Have a big AIM/Jabber list filled with knowledgeable Perl people you're friends with.
What's the difference between SQL Server Management Studio and the Express version?
|sql|management-studio|management-studio-express|
I'm using Express currently. What extra features do I get with the full version?
##[Fail Fast][1] [1]: http://en.wikipedia.org/wiki/Fail-fast
I know I come after the battle, but I still would like to present my view of those concepts (under a **community owned answer** so I am not here for the karma ;) If you have enough rep', edit this post and make it better). **In general** (tool agnostic view), a branch is the mechanism use for parallel development. ...
I know I come after the battle, but I still would like to present my view of those concepts (under a **community owned answer** so I am not here for the karma ;) If you have enough rep', edit this post and make it better). **In general** (tool agnostic view), a branch is the mechanism use for parallel development. ...
Using abstract base classes in C++ generally mandates the use of a virtual function table, all your interface calls are going to be looked up through that table. The cost is tiny compared to a raw function call, so be sure that you need to be going faster than that before worrying about it.
php's [strtotime()][1] [1]: http://php.net/manual/en/function.strtotime.php gives $timestamp = strtotime('22-09-2008');
The only main difference I know of is that, since you're not using a concrete class, inlining is (much?) harder to do.
The only thing I can think of is that virtual methods are a little bit slower to call than non-virtual methods, because the call has to go through the [virtual method table][1]. However, this is a bad reason to screw up your design. If you need more performance, use a faster server. [1]: http://en.wikipedia.o...
It's no magic or anything... just a pleasant shorthand for anonymous functions. partial(alert, "FOO!") is equivalent to function(){alert("FOO!");} partial(Math.max, 0) corresponds to function(x){return Math.max(0, x);} The calls to partial ([MochiKit][1] terminology. I think some other libraries give functions...
I'd use what Hibernate calls [Table-per-subclass](http://www.hibernate.org/hib_docs/reference/en/html/inheritance.html#inheritance-tablepersubclass), so my DB would wind up with 3 tables for Boxes: `Box`, `ShippingBox`, and `ReturnBox`. The FK in `BoxItem` would point to `Box`.
When you call a virtual function (say through an interface) the program has to do a look up of the function in a table to see which function to call for that object. This gives a small penalty compared to a direct call to the function. Also, when you use a virtual function the compiler cannot inline the function c...
Enforcing a 1:0-1 or 1:1 relationship can be achieved by defining a unique constraint on the foreign key's columns, so only one combination can exist. Normally this would be the primary key of the child table. If the FK is on a primary or unique key of the referenced tables it will constrain them to values present...
about8.blogspot.com, you said > if equals() returns true for two objects, then hashCode() should return the same value. If equals() returns false, then hashCode() should return different values I can not agree with you. If two objects has the same hashcode it DOSEN'T have to mean that their are equal. If A e...
Using php, how to insert text without overwriting to the beginning of a text file.
|php|insert|
I have: <?php $file=fopen(date("Y-m-d").".txt","r+") or exit("Unable to open file!"); if ($_POST["lastname"] <> "") { fwrite($file,$_POST["lastname"]."\n"); } fclose($file); ?> but it overwrites the beginning of the file. How do I make it insert? ...
I'm in the same boat as you (somewhat). I've been developing in C# for 7 years, ever since .NET 1.0. Over the past couple weeks I've been teaching myself Cocoa and Objective-C. Here are my impressions (note for note with yours) - Agreed in that clutter can be a problem. I tend to use Spaces heavily when developi...
We have used [Dimdim][1] in our company. Pretty easy to install on Windows (as they say one-click; it is really one-click). We have used in LAN environment. We didn't have any issues as long as we were using only audio. With video we faced lot of issues, do we didn't use it (but it might be probably us). I think dim...
Oracle Natural Joins and Count(1)
`<a>` elements are inline by default. This means that they don't establish their own block, they are just part of the text. You want them to establish their own block, so you should use `a { display: block; }` with an appropriate context. This also enables you to add padding to the `<a>` elements rather than the `<l...
Gut-based estimates come with experience but you really need to detail out the tasks involved to get something reasonable. If you have a spec or at least some constraints, you can start creating tasks (design users page, design tags page, implement users page, implement tags page, write tags query, ...). Once you...
Never do anything until you ready to use it, in software to? [Toyota principle]
|process-management|
I was out running in the forest when it struck me like lightning. (okej, I was listening to a podcast where they talked about principles Toyota was using.) It totally came to me, we should be thinking in the exactly same way. " - Never do anything until you are ready to use it." I think this is applies to sof...
Never do anything until you ready to use it, in software too? [Toyota principle]
|process-management|principles|
I was out running in the forest when it struck me like lightning. (okej, I was listening to a podcast where they talked about principles Toyota was using.) It totally came to me, we should be thinking in the exactly same way. " - Never do anything until you are ready to use it." I think this is applies to sof...
|process-management|principles|design-patterns|
|process-management|principles|design-patterns|yagni|
|process-management|principles|design-patterns|yagni|
|process-management|principles|design-patterns|processes|
I was listening to a podcast. Where they talked about principles Toyota was using. " - Never do anything until you are ready to use it." I think this tell us to look in other places, to learn what other practices have known for years. Ok, here is the podcast. I think it is interesting http://itc.convers...
I was listening to a podcast. Where they talked about principles Toyota was using. " - Never do anything until you are ready to use it." I think this tell us to look in other places, to learn what other practices have known for years. Ok, here is the podcast. I think it is interesting http://itc.convers...
(^.)+|(([^.]+)[.]([^.]+))+ But this would match x.y.z.a.b.c and from your description, I am not sure if this is sufficiently restrictive. BTW: feel free to modify if I made a silly mistake (I haven't used .NET, but have done plently of regexs)
Selenium supports Chrome pretty much out of the box because it works by injecting javascript in the web page. http://selenium-rc.openqa.org/ Webdriver has an early version of Chrome driver. http://code.google.com/p/webdriver/ Both are open source and works on Windows.
I think the most useful formula is this one. An ellipsis rotated from an angle phi from the origin has as equation: ![alt text][1] ![alt text][2] where (h,k) is the center, a and b the size of the major and minor axis and t varies from -pi to pi. From that, you should be able to derive for which t dx/dt or ...
C#: Is Implicit Arraylist assignment possible?
|c#|arraylist|
I'd like to populate an arraylist by specifying a list of values just like I would an integer array, but am unsure of how to do so without repeated calls to the "add" method. For example, I want to assign { 1, 2, 3, "string1", "string2" } to an arraylist. I know for other arrays you can make the assignment like: ...
This is certainly not the last of this problem, particularly if you are writing for embedded systems, including Pocket PCs, etc. MIPS, ARM, and other architectures support bi-endian architectures which can select their endian-ness on system start-up. If you're writing code that depends on byte ordering, you need to ...
[^.\s]+\.[^.\s]+(\.([^\s.]+?)? has unmatched paren. If corrected to [^.\s]+\.[^.\s]+(\.([^\s.]+?))? is still too liberal. Matches a.b. as well as a.b.c.d. and .a.b If corrected to [^.\s]+\.[^.\s]+(\.([^\s.]+?)?) doesn't match a.b
^([^.\W]+)\.?([^.\W]+)\.?([^.\W]+)$ This should capture as described, group the parts of the id and stop duplicate periods
Here is a [forum thread][1] that provides a C# image resizing code sample. You could use one of the [GD library][2] binders to do resampling in C#. [1]: http://forums.asp.net/t/1038068.aspx [2]: http://www.libgd.org/Binders
I wouldn't recommend LUA, it has a peculiar syntax so takes some time to get used to. Depending on who will be doing the scripting, this may not be a problem, but I would try to use something fairly accessible. I would probably choose python. It normally compiles to bytecode, so you would need to embed the interpr...
If I'm using Spring.NET judiciously (i.e. messaging, ADO.NET helpers, etc.) as you already stated, I would do it programmatically. And then add the new graph to my existing container. This way Spring.NET still manages lifecycle for me.
That would be dangerous as there can be times when the worker process gets recycled or the AppDomain crashes and the Work Item is killed and you may want it to recover what it was doing, it may not be possible. A Windows service may be OK if you can get that work item out into a service. If an HttpContext is requir...
If you can get the compiler to give you an expression tree for this code, then you could modify that expression tree by replacing each statement with a new try-catch block that wraps the original statement. This isn't possible with .NET 3.5 -- if for no other reason than the lack of a "try" statement in System.Linq.Ex...
If you can get the compiler to give you an expression tree for this code, then you could modify that expression tree by replacing each statement with a new try-catch block that wraps the original statement. This isn't as far-fetched as it sounds; for LINQ, C# acquired the ability to capture lambda expressions as expre...
Optimize y = x*x in Galois field arithmetic
|c|cryptography|bit-manipulation|lowlevel|
I have this C-code to do multiplications over GF(8): int32_t GaloisMultiply (int32_t a, int32_t b) { int32_t i; int32_t mask = 0x100; int32_t y = 0; for(i=0;i<8;i++) { if(b & mask) { y ^= a; } mask >>= 1; y <<= 1; ...