instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>My team is considering building our next web app using the ASP.NET MVC framework. I am slightly hesitant, as are some others, because it is still only in beta. I really want to dive in because it seems to be a great way of providing clear separation of concerns and improving testability. </p> <p>Should I take th...
<p>It's a pretty simple decision tree, really.</p> <p>Choose ASP.NET MVC if you...</p> <ul> <li>Care deeply about URLs</li> <li>Care deeply about your HTML</li> <li>Want true separation of concerns</li> <li>Want testability through and through</li> <li>Want flexibility of view engines (ASPX, NVelocity, NHaml, etc)</l...
<p>If you don't have to put your app in production soon, yes write it in MVC. Here, we have a team working with MVC and planning to put it on prodution at jan/2009.</p>
30,689
<p>I would like to know what are your practices when you test your classes.</p> <p>For example, I like to use inheritance, with my fixtures. Given two classes BaseClass, SubClass, I make two other classes BaseClassFixture and SubClassFixture (SubClassFixture is a sub class of BaseClassFixture). So I'm sure that I don'...
<p>My most important rule is that each test should be atomic and should run in no particular order.</p> <p>For unit tests, they should strictly obey seperation of concerns. For integration tests, I pay extra attention to make sure they follow the most important rule.</p> <p>Also, tests should follow the DRY rule as m...
<p>My most important rule is that each test should be atomic and should run in no particular order.</p> <p>For unit tests, they should strictly obey seperation of concerns. For integration tests, I pay extra attention to make sure they follow the most important rule.</p> <p>Also, tests should follow the DRY rule as m...
24,753
<p>Given 2 rgb colors and a rectangular area, I'd like to generate a basic linear gradient between the colors. I've done a quick search and the only thing I've been able to find is <a href="http://jtauber.com/blog/2008/05/18/creating_gradients_programmatically_in_python/" rel="noreferrer">this blog entry</a>, but the e...
<p>you want an interpolation between the first and the second colour. Interpolating colours is easy by calculating the same interpolation for each of its components (R, G, B). There are many ways to interpolate. The easiest is to use linear interpolation: just take percentage <em>p</em> of the first colour and percenta...
<p>I've been using <a href="http://blog.logeek.fr/2008/10/21/generating-gradients-for-your-css-using-rmagick" rel="nofollow noreferrer">RMagick for that</a>. If you need to go further the simple gradient, ImageMagick and one of its wrappers (like RMagick or <a href="http://sourceforge.net/projects/jmagick/" rel="nofoll...
4,712
<p>I'm looking for a way to <strong>monitor certain Windows services</strong> (on Windows Server 2003) and <strong>restart if necessar</strong>y. The services are on different servers and include mainly SQL Server services (e.g. SQL Server Agent), but also some proprietary services.</p> <p>Email alerts sent out if a s...
<p>A "might be enough" version of this is built into Windows. Look into the "Recovery" tab of the service properties, as available via <code>services.msc</code>.</p> <p>You can act on a service fail with:</p> <ul> <li>"Restart the Service"</li> <li>"Run a Progam"</li> <li>"Restart the Computer"</li> </ul> <p>"Run a ...
<p>+1 for making sure that services are monitored on the local machine.</p> <p>Something like <a href="http://www.servicehawk.com" rel="nofollow noreferrer">Service Hawk</a> can monitor your services and restart them if they should stop and sends you an email alert. You could also consider scheduling periodic restart...
37,743
<p><strong>Background:</strong> we have an application that generates reports from HTML (that may or may not have inline scripting). The HTML source is normally stored as a blob in the database.</p> <p>There is now the need to hard-code a particular report into the application (i.e. so that it is not database dependen...
<p>You could read each line of the file and append it as you go. Alternatively, you could use a StringBuilder class. You would need to either write this class or copy it from somewhere <a href="http://www.vbaccelerator.com/home/Vb/Code/Techniques/StringBuilder/article.asp" rel="nofollow noreferrer">like this</a>. Do...
<p>If that's the way you have to go then think of using the html string as a template with placeholders like @@var1@@ in the string which you can then replace with the actual dynamic values rather than trying to generate the final output inline, should be much easier to debug issues.</p>
35,384
<p>I'm creating a (Java) class to represent an object in a musical score that has a specific onset time, and possibly a duration as well. I need a good name for this class. Is something like "Timed" or "TimedObject" appropriate? I've tried to come up with something that ends in "-able" (like Runnable) but I can't th...
<p>This sounds like <strong>events</strong> in <a href="http://jedi.ks.uiuc.edu/~johns/links/music/midifile.html" rel="noreferrer">MIDI files</a>.</p>
<p>What is the main service (or services) your object is supposed to propose to the rest of your system ?</p> <p>I believe its name should represents the <strong><a href="https://stackoverflow.com/questions/216150#216218">abstraction</a></strong> you want to make by designing it in the first place.</p> <p>So far, we ...
37,939
<p>I'm not quite sure how this happened, but somehow a completely empty hierarchy of directories has ended up in my repository:</p> <pre><code>com/ com/companyname/ com/companyname/blah/ com/sun/ com/sun/java/ com/sun/java/jax_rpc_ri/ </code></pre> <p>I think what happened was that these directories did have files in...
<p>AFAIK the CVS protocol does not allow to remove directories. You should go to the server console and remove them from the real physical repository.</p> <hr> <p><a href="http://www.network-theory.co.uk/docs/cvsmanual/Removingdirectories.html" rel="noreferrer">http://www.network-theory.co.uk/docs/cvsmanual/Removingd...
<p>cvs tends to work on a two phase approach regarding directories that's why there is a -P option for many cvs commands to "Prune empty directories".</p> <p>When this has happened, e.g. want to rename a directory I've just added, I delete the directory, delete the entry for the directory in the CVS/Entries file, it'l...
25,111
<p>We need a 3D printer, that can print with plastic suitable for medical applications. We have about $5000 for the printer. What printers can we choose? I am not a specialist in 3D printing, so please answer in detail. </p> <p>We need to print breathing tubes with cuffs. The tubes should be flexible, but rigid enough...
<p>I am not an expert but I think you will find that because 3D printers use a layer by layer construction method, and the boundary between the layers creates grooves along the surface or leaves a rough texture on the surface. That the textured surface left by 3D printer construction would trap microbes and make 3D pri...
<p>Find another medical facility that is doing it, and ask what equipment and filament they use. They may also have a source for medical related models.</p> <p>I would expect medical stuff to be regulated by the FDA, so there are probably limitations on what you can get.</p>
731
<p>Can someone point me in the right direction? I wish to distribute a WCF peer to peer cloud over the internet. So far I've seen examples of how it works on the same subnet. I wish to push it a little further.</p>
<p>I believe you'll need to look into using <a href="http://www.microsoft.com/technet/network/ipv6/teredo.mspx" rel="nofollow noreferrer">IPV6 Teredo Tunneling</a> for crossing NAT and firewalls, so maybe check out this on <a href="http://msdn.microsoft.com/en-us/library/ms731948.aspx" rel="nofollow noreferrer">WCF tra...
<p>I will look into Live Mesh, it may be the solution to my problem.</p>
18,361
<p>The scenario: we have a web system that automatically generates office 2003 excel files "on the fly" (using the 2003 XML file format, not the binary format.) These files do get kept on the web server for various things.</p> <p>Now, we're in a situation where the client would really like us to take the xls files ge...
<p>I don't know what the Excel files consist of, but would it be possible to at least start out with a simpler format that Excel can read? IE, start with a CSV file, join them together and then convert that into the Excel format.</p> <p>It seems to me that it would be easier to convert to the Excel format as late as p...
<p>so your user would like to append the latest file generated every time? or just glue" them together when they make a request?</p> <p>EDIT: </p> <p>what kind of data is in the excel file? can it be temporarily converted to a simpler format such as csv?</p> <p>even if you cant, you could create a new file and as yo...
44,038
<p>I have an Open Source app and I have it working on Windows, Linux and Macintosh ( it's in C++ and built with gcc ). I've only tested it on a few different flavors of Linux so I don't know if it compiles and runs on all different Linux versions. Is there a place where I can upload my code and have it tested across a ...
<p>There are a few options but there don't appear to be many (any?) free services like this, which isn't surprising considering the amount of effort and resources it requires. Sourceforge used to operate a compile farm like what you describe but it shut down a year or so ago. You might look into some of the following. ...
<p>If you are planning to go commercial with your open source product you might consider our Parabuild. It allows you to <strong><a href="http://www.viewtier.com/products/parabuild/feature_details.htm#parallel_builds" rel="nofollow noreferrer">run a set of builds on multiple platforms and machines in parallel</a></stro...
19,432
<p>I'm looking for good patterns for implementing a paged table of results in ASP.NET MVC with sorting, filtering, and paging provided via AJAX. It seems to me that I should have my controller actions provide only the data and not mark up to maintain the separation of concerns -- so the Ajax callback would provide new...
<p>Here are a few options to checkout:</p> <ul> <li><a href="http://www.codeproject.com/KB/aspnet/MVCFlexigrid.aspx" rel="nofollow noreferrer">jQuery Flexigrid</a></li> <li><a href="http://developer.yahoo.com/yui/datatable/" rel="nofollow noreferrer">Yahoo DataTable</a></li> <li><a href="http://extjs.com/deploy/dev/ex...
<p>I really like <a href="http://tablesorter.com/docs/" rel="nofollow noreferrer">tablesorter</a></p> <p>It's more light-weight and a bit easier to manage...</p>
36,334
<p>I was asked to recall a message I sent out to remove some personal info from it and replace it with a generic made up person as an example. </p> <p>Does message recall really work?</p> <p>It's my opinion because you get told a message has been recalled it just causes you to want to find out what was in the origina...
<p>In most cases, it's too late, it just let's me know there was an email you didn't want me to read.</p>
<p>If the recipient is offline and message is not delivered to his PST by the Exchange server, then RECALL works and you get the message accordingly.</p> <p>Thanks &amp; Regards, Ajay</p>
28,041
<p>I've been profiling some queries in an application I'm working on, and I came across a query that was retrieving more rows than necessary, the result set being trimmed down in the application code.</p> <p>Changing a LEFT JOIN to an INNER JOIN trimmed the result set to just what was needed, and presumably would also...
<p>If you think that the implementation of LEFT JOIN is INNER JOIN + more work, then this result is confusing. What if the implementation of INNER JOIN is (LEFT JOIN + filtering)? Ah, it is clear now.</p> <p>In the query plans, the only difference is this: <em>users... extra: using where</em> . This means filtering...
<p>LEFT JOIN is returning more rows than INNER JOIN because these 2 are different.<br /> If LEFT JOIN does not find related entry in the table it is looking for, it will return NULLs for the table.<br /> But if INNER JOIN does not find related entry, it will not return the <strong>whole</strong> row at all.</p> <p>But...
22,510
<p>Presently, we've got several main projects each in their own repository. We will have to version-control up to a dozen additional projects. VisualSVN recommends to create 1 respository for our company and then vc all projects inside that. </p> <blockquote> <p>It's a good practice to create one repository for the ...
<p>You can check the paths of the commited files to determine which project they belongs to. Just remember that a commit can modify several files at once, and each file could theoretically belong to a different project.</p>
<p>You can check the paths of the commited files to determine which project they belongs to. Just remember that a commit can modify several files at once, and each file could theoretically belong to a different project.</p>
9,685
<p>In normal WebForms scenario, any root-relative URLs (e.g. ~/folder/file.txt) <strong>inside</strong> CSS files such as:</p> <pre><code>.form { background-image: url(~/Content/Images/form_bg.gif); } </code></pre> <p>will automatically get resolved during runtime if I specify</p> <pre><code>&lt;head runat="server"&...
<p>I would not bother with the auto-root-finding <code>~</code> character. I understand that you want the same solution to work where the root directory differs between deployments, but within the CSS document you shouldn't have any problems using relative paths. The paths in the CSS document (to the image URL in your ...
<p>You could use an <a href="http://www.helicontech.com/isapi_rewrite/" rel="nofollow noreferrer">URL Rewriter</a> to fix the URL as the request comes in, though I am not so sure it is so much elegant as a hack in this case.</p>
29,759
<p>I have a Perl script that I'm attempting to set up using Perl Threads (use threads). When I run simple tests everything works, but when I do my actual script (which has the threads running multiple SQL<em>Plus sessions), each SQL</em>Plus session runs in order (i.e., thread 1's sqlplus runs steps 1-5, then thread 2...
<p>A few possible explanations:</p> <ol> <li><p>Are you running this script on a multi-core processor or multi-processor machine? If you only have one CPU only one thread can use it at any time.</p></li> <li><p>Are there transactions or locks involved with steps 1-6 that would prevent it from being done concurrently?...
<p>Check your database settings. You may find that it is set up in a conservative manner. That would cause even minor reads to block all access to that information.</p> <p>You may also need to call <code>threads::yield</code>.</p>
11,176
<p>What is the proper way to split up SQL statements to send to an Oracle ADO.NET client? For instance, lets say you have the following code in a text file and want to execute these statements:</p> <pre><code>CREATE TABLE foo (bar VARCHAR2(100)); INSERT INTO foo (bar) VALUES('one'); INSERT INTO foo (bar) VALUES('two'...
<p>Without the DDL, you could create an anonymous PL/SQL block by surrounding the statements with BEGIN and END:</p> <pre><code>BEGIN INSERT INTO foo (bar) VALUES('one'); INSERT INTO foo (bar) VALUES('two'); END; </code></pre> <p>To perform DDL (like CREATE TABLE) you would need to use dynamic PL/SQL:</p> <pre><...
<p>To expand on Tony's answer, you can use an Anonymous block to do this, you will just have to make sure the string is working as you expect. This is a DOWN AND DIRTY example, pretty much splitting on the ; and creating the block. </p> <pre><code>using System; using System.Data; using System.Text; using System.Refl...
39,809
<p>Recently I've been having trouble printing properly on my Creality Ender-3 printer. I ran a pretty long print (approx. 15 hours) that turned out really well. I then started printing an attachment for the original print and saw that it was printing layers that were extremely thin. </p> <p>I first scraped off the ex...
<p>You need to level you bed. Thin prints happen when the extruder is too low and is printing too close to the bed.</p> <p><a href="https://i.stack.imgur.com/ybFIO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ybFIO.png" alt="Example of printing levels"></a></p> <p>Download the following test co...
<p>If your first layer is more thin than you expect it to be, the bed is too close to the nozzle. Note that you need to check the level an bed-to-nozzle distance once every few prints. Also, the first layer shouldn't be a too thin layer, the Cura default for a 0.4&nbsp;mm nozzle is about 0.28&nbsp;mm. Personally, I alw...
1,594
<p>My problem is that I have used a 3D printing machine from the University and found out that the cover for the car was not smooth even after using sanding paper and painting it.</p> <p>What material would work best to print the cover of the Cyber truck. I want it to be light and smooth.</p> <p>I have to print it f...
<p>I have 3D printed models which were then sanded using progressively finer grades of sandpaper, terminating with wet sanding using micromesh to 12000 grit. The result was smooth and shining without any coating applied.</p> <p>If your original results were not acceptable, the process may have been flawed and should b...
<h2>Choice of Material</h2> <p>PLA is an obvious choice, but it has drawbacks compared with ABS.</p> <ol> <li>PLA is more brittle than ABS.</li> <li>PLA softens at a lower temperature than ABS. </li> <li>PLA is not treatable with acetone for vapor smoothing.</li> <li>PLA can not be glued with (most) solvent-based...
1,596
<p>How do you access the items collection of a combo box in a specific row in a DataGridView?</p> <p>I'm populating the combo as follows:</p> <pre><code> Dim VATCombo As New DataGridViewComboBoxColumn With VATCombo .HeaderText = "VAT Rate" .Name = .HeaderText ...
<p>The problem with the basic combobox in EditGridView is that all rows share the same combobox, so you cannot change it.</p> <p>You to create a new class (ComboEditingControl) inherited from the ComboBox and implementing IDataGridViewEditingControl:</p> <p>(e.g. customdropdown.vb:)</p> <pre><code>Imports System.Col...
<p>Could you not directly cast the control within the cell using the row index to access the current row?</p>
29,493
<p>All of the various postings, when speaking of Setup projects in vs2005, simply say "the properties are there" and/or "In Studio, I just click on the project name in the Explorer and I get the property window typical to other projects, and it's right there." BUT I DON'T!! I get a very limited list of properties (Ou...
<p>Highlight your project and hit F4. That's the properties pane. Right click and select Properties for the project properties dialog.</p>
<p>The F4 key is mapped to display the Setup Properties pane if the keyboard is set up as C#. If your default keyboard layout is C++, F4 does nothing. </p>
31,663
<p>Every now and then in a high volume .NET application, you might see this exception when you try to execute a query:</p> <blockquote> <p>System.Data.SqlClient.SqlException: A transport-level error has occurred when sending the request to the server.</p> </blockquote> <p>According to my research, this is someth...
<p>I posted <a href="https://stackoverflow.com/questions/154897/what-do-you-do-if-you-cannot-resolve-a-bug#155077">an answer on another question</a> on another topic that might have some use here. That answer involved SMB connections, not SQL. However it was identical in that it involved a low-level transport error.<...
<p>You should also check hardware connectivity to the database.</p> <p>Perhaps this thread will be helpful: <a href="http://channel9.msdn.com/forums/TechOff/234271-Conenction-forcibly-closed-SQL-2005/" rel="nofollow noreferrer">http://channel9.msdn.com/forums/TechOff/234271-Conenction-forcibly-closed-SQL-2005/</a></p>...
3,731
<p>One of the companies required from its prospective employee to give the number of lines of code written in the life time in a certain programming language like Java, or C#. Since, most of us have a number of years of experience in different projects in multiple languages and we hardly keep record of this, what would...
<p>This seems like one of those questions like 'How many ping-pong balls could you fit in a Boeing 747?' In that case, the questioner wants to see you demonstrate your problem solving skills more than know how many lines of code you've actually written. I would be careful not to respond with any criticism of the questi...
<p>Even if I agree with the majority in saying that this is not a really good metric, if it's a serious compmany, as you say, they may have their reasons to ask this.. This is what I would probably do: </p> <p>Take one of your existing project, get the number of lines and divide it by the time it took you to code it. ...
34,890
<p>Is there an easy way within C# to check to see if a DateTime instance has been assigned a value or not?</p>
<p>The only way of having a variable which hasn't been assigned a value in C# is for it to be a local variable - in which case at compile-time you can tell that it isn't definitely assigned by trying to read from it :)</p> <p>I suspect you really want <code>Nullable&lt;DateTime&gt;</code> (or <code>DateTime?</code> wi...
<p>I generally prefer, where possible, to use the default value of value types to determine whether they've been set. This obviously isn't possible all the time, especially with ints - but for DateTimes, I think reserving the MinValue to signify that it hasn't been changed is fair enough. The benefit of this over nul...
39,241
<p>If you are working in PHP (or I guess any programming language) and using subversion as your source control, is there a way to take your project (for example):</p> <blockquote> <p>C:\Projects\test\.svn<br> C:\Projects\test\docs\<br> C:\Projects\test\faq.php<br> C:\Projects\test\guestbook.php<br> C:\Projec...
<p>If you use TortoiseSVN, you can use the export feature to automatically strip out all of the .svn files. I think other svn things have the same feature.</p> <p>Right click the root project folder, then select <code>TortoiseSVN &gt; Export</code>, and tell it where you want the <code>.svn</code> free directory.</p>
<p>Ok, so my final solution is this:</p> <p>Use the export command to export to a folder called "export" in the same directory as a file called "deploy.bat", then I run the deploy script (v1 stands for version 1, which is what version I am currently on in this project) This script utilizes 7-Zip, which I have placed o...
2,771
<p>I need to create simple reusable javascript object publishing several methods and parameterized constructor. After reading through several "OOP in JavaScript" guides I'm sitting here with an empty head. How on the Earth can I do this?</p> <p>Here my last non-working code:</p> <pre><code>SomeClass = function(id) { ...
<p>This is my usual approach:</p> <pre><code>MyClass = function(x, y, z) { // This is the constructor. When you use it with "new MyClass()," // then "this" refers to the new object being constructed. So you can // assign member variables to it. this.x = x; ... }; MyClass.prototype = { doSomething: f...
<p>From <a href="http://learn.jquery.com/code-organization/concepts/#the-module-pattern" rel="nofollow noreferrer">http://learn.jquery.com/code-organization/concepts/#the-module-pattern</a>:</p> <pre><code>// The module pattern var feature = (function() { // private variables and functions var privateThing = ...
42,728
<p>Let's say I write a DLL in C++, and declare a global object of a class with a non-trivial destructor. Will the destructor be called when the DLL is unloaded?</p>
<p>In a Windows C++ DLL, all global objects (including static members of classes) will be constructed just before the calling of the DllMain with DLL_PROCESS_ATTACH, and they will be destroyed just after the call of the DllMain with DLL_PROCESS_DETACH.</p> <p>Now, you must consider three problems:</p> <p>0 - Of course,...
<p>When DllMain with fdwReason = DLL_PROCESS_DETACH parameter is called it means the DLL is unloaded by the application. This is the time before the destructor of global/static objects gets called.</p>
10,130
<p>I have an inherited project that uses a build script (not make) to build and link the project with various libraries.</p> <p>When it performs a build I would like to parse the build output to determine what and where the actual static libraries being linked into the final executable are and where are they coming fr...
<p>You might try using the <code>nm</code> tool. Given the right options, it will look at a binary (archive or linked image) and tell you what objects were linked into it.</p> <p>Actually, here's a one-liner I use at work:</p> <pre><code>#!/bin/sh nm -Ag $* | sed 's/^.*\/\(.*\.a\):/\1/' | sort -k 3 | grep -v ' U ' ...
<p>Static libraries, that makes life more difficult in this regard. In case of dynamic libraries you could just have used ldd on the resulting executable and be done with it. The best bet would be some kind of configuration file. Alternatively you could try to look for -l arguments to gcc/ld. Those are used to specify ...
7,003
<p>How do I load a Python module given its full path?</p> <p>Note that the file can be anywhere in the filesystem where the user has access rights.</p> <hr /> <p><sub><strong>See also:</strong> <a href="https://stackoverflow.com/questions/301134">How to import a module given its name as string?</a></sub></p>
<p>For Python 3.5+ use (<a href="https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly" rel="noreferrer">docs</a>):</p> <pre><code>import importlib.util import sys spec = importlib.util.spec_from_file_location(&quot;module.name&quot;, &quot;/path/to/file.py&quot;) foo = importlib.util.module...
<p>The best way, I think, is from the official documentation (<a href="https://docs.python.org/3.2/library/imp.html#examples" rel="nofollow">29.1. imp — Access the import internals</a>):</p> <pre><code>import imp import sys def __import__(name, globals=None, locals=None, fromlist=None): # Fast path: see if the mo...
9,318
<p>I've been trying to follow the information from:</p> <p><a href="http://www.datasprings.com/Resources/ArticlesInformation/Sharepoint2007CustomWebParts/tabid/775/Default.aspx" rel="nofollow noreferrer">Long URL clipped to stop breaking the page</a></p> <p>and</p> <p><a href="http://msdn.microsoft.com/en-us/library...
<p>I believe the minimum you need to have a WP show up in the "New" Part of the webPart Catalog, you need the dll in the "bin" folder (bin in the web dir, not the 12 hive :)) or in the GAC and a safe control entry. I would verify the Safe control entry:<br> Assembly = name of dll<br> NameSpace = well... The NameSpace ...
<p>Wow, you have me stumped ... I would try deploying some other 3rd party "free" web parts manually and see if you can get those to show up. This site has a few: <a href="http://www.sharepointblogs.com/mkruger/archive/2007/06/26/free-sharepoint-web-parts-3rd-party.aspx" rel="nofollow noreferrer">http://www.sharepoint...
29,894
<p><strong>Introduction</strong></p> <p>In my current organisation, we have many desktop and web applications all feeding into each other at some point. When looking after older applications or creating new applications, it's proving very difficult to try and remember which system rely on other systems in order to wor...
<p>I would say to clearly state that on your architecture design document. There are some good tools for this like <a href="http://www.sparxsystems.com.au/" rel="noreferrer">Enterprise Architect</a>. This tool allows you to create diagrams using the UML standard for describing these dependencies in a clear and visual w...
<p>System dependency mapping is one thing. True environmental settings, uid's, passwords, impersonation settings, database names, and other data which change from development to qa to uat to production is the real challenge.</p> <p>Who stores/remembers them all?</p> <p>The developer knows not which production server(...
18,523
<p>Improving Web Development Using Virtualization</p>
<p><a href="https://web.archive.org/web/20090207084158/http://aspnet.4guysfromrolla.com:80/articles/102908-1.aspx" rel="nofollow noreferrer">https://web.archive.org/web/20090207084158/http://aspnet.4guysfromrolla.com:80/articles/102908-1.aspx</a></p>
<p>Virtualization is, in essence, creating multiple miniature (virtual) PCs inside of your primary PC. One of the great benefits of this is that it allows you to isolate and test an application or set of applications in an environment that is free of other things to interfere. It used to be that in order to get a new m...
45,375
<h3>Background</h3> <p>Normal rails eager-loading of collections works like this:</p> <pre><code>Person.find(:all, :include=&gt;:companies) </code></pre> <p>This generates some sql which does</p> <pre><code>LEFT OUTER JOIN companies ON people.company_id = companies.id </code></pre> <h3>Question</h3> <p>However, I...
<p>Can you not add the join conditions using ActiveRecord?</p> <p>For example, I have a quite complex query using several dependent records and it works fine by combining conditions and include directives</p> <pre><code>Contractors.find( :all, :include =&gt; {:council_areas =&gt; :suburbs}, :conditions =&gt; [...
<p>Can you elaborate a bit more on exactly what you are trying to accomplish with this query?</p> <p>Also take a look at at the :joins option for find. It allows you to specify how you want the tables joined. <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001298/" rel="nofollow noreferrer" title="...
15,819
<p>While opening any MS Access database, a security warning appears saying that the file can be harmful to the computer. However, is there a way to remove this message. Or should it remain a necessary evil</p>
<p>You can probably sign your program. I don't know for sure. Read <a href="http://www.howto-outlook.com/howto/selfcert.htm" rel="nofollow noreferrer">this article</a> and see if the same principle applies.</p>
<p>Here's my notes from a similar, internal issue with Access 2003 a few years back:</p> <blockquote> <p>Okay, so here's (evidently) the deal.</p> <p><ul><li>The network server was not in the Trusted Zone. Starting, IIRC, with SP2, this causes a Open/Save/Warning box when opening a file. By default, UNC paths a...
27,975
<p>I have a solution that is missing a lot of code coverage. I need to refactor this code to decouple to begin to create unit tests. What is the best strategy? I am first thinking that I should push to decouple business logic from data access from businessobjects to first get some organization and then drill down fr...
<p>Check out <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="noreferrer" rel="nofollow noreferrer">Working Effectively with Legacy Code</a>.</p>
<p>These are generic guidelines I find useful for unit testing:</p> <p>1) Identify Boundary Objects (Win/WebForms, CustomControls etc).</p> <p>2) Identify Control Objects (Business layer objects)</p> <p>3) Write Unit tests only for control objects public methods invoked by boundary objects. This way you'll be sure y...
40,952
<p>What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have changed over time. For instance, right now r...
<p>In the past I have used triggers to construct db update/insert/delete logging. </p> <p>You could insert a record each time one of the above actions is done on a specific table into a logging table that keeps track of the action, what db user did it, timestamp, table it was performed on, and previous value. </p> <p...
<p>The only problem with using Triggers is that it adds to performance overhead of any insert/update/delete. For higher scalability and performance, you would like to keep the database transaction to a minimum. Auditing via triggers increase the time required to do the transaction and depending on the volume may cause ...
4,363
<p>I'm looking to implement a function that retrieves a single frame from an input video, so I can use it as a thumbnail.</p> <p>Something along these lines should work: </p> <pre><code>// filename examples: "test.avi", "test.dvr-ms" // position is from 0 to 100 percent (0.0 to 1.0) // returns a bitmap byte[] GetVide...
<p>I ended up rolling my own stand alone class (with the single method I described), the source can be <a href="https://gist.github.com/2823028" rel="noreferrer">viewed here</a>. <a href="http://www.mediabrowser.tv" rel="noreferrer">Media browser is</a> GPL but I am happy for the code I wrote for that file to be Public...
<p>There are some libraries at <a href="http://www.mitov.com" rel="nofollow noreferrer">www.mitov.com</a> that may help. It's a generic wrapper for Directshow functionality, and I think one of the demos shows how to take a frame from a video file.</p>
18,782
<p>What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database?</p> <p>Ideally, this script could be run multiple times, as new tables were added to the database. SQL Server Management Studio generates ...
<p>I'm sure there is an easier way, but you could loop through the sysobjects table in the database and grant permissions to any user table objects that exist. You could then run that multiple times whenever new tables are added.</p>
<p>We use something similar where I work. Looping through every Tables, Views, Stored Procedures of the system. </p> <pre><code>CREATE PROCEDURE dbo.SP_GrantFullAccess @username varchar(300) AS DECLARE @on varchar(300) DECLARE @count int SET @count = 0 PRINT 'Granting access to user ' + @username + ' on the fo...
6,654
<p>I have a flex app that uploads files to a server. The server requires authentication to be able to upload. In IE the upload works fine. However in FF and Safari, it does not upload. I have seen people all over with this same problem but no answers. Don't fail me now stackoverflowers. </p>
<p>I found this question while trying to find the answer myself. The solution was rather simple.</p> <p>Based on the <a href="http://bugs.adobe.com/jira/browse/FP-201" rel="nofollow noreferrer">flash player bug</a> that others have linked, and the comments on that page, I decided to append session identifiers to my up...
<p>Looks like this is quite old, but I recently ran into this problem, too. My fix (which is far from optimal) under a Flex + authenticated rails setup was to turn off the session based authentication on the upload script.</p> <p>Since I really <strong>did</strong> want at least basic authentication, I stored the user...
45,725
<p>How would one go about spotting URIs in a block of text?</p> <p>The idea is to turn such runs of texts into links. This is pretty simple to do if one only considered the http(s) and ftp(s) schemes; however, I am guessing the general problem (considering tel, mailto and other URI schemes) is much more complicated (i...
<p>Regexs may prove a good starting point for this, though URIs and URLs are notoriously difficult to match with a single pattern. </p> <p>To illustrate, the simplest of patterns looks fairly complicated (in Perl 5 notation):</p> <p><code>\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*(?:(?:\/[^\s/]*))*</code></p> <p>This would matc...
<p>The following perl regexp should pull do the trick. Does c# have perl regexps?</p> <pre><code>/\w+:\/\/[\w][\w\.\/]*/ </code></pre>
10,811
<p>Is there a simple and lightweight program to search over a text file and replace a string with regex?</p>
<p>For searching: <a href="http://www.opengroup.org/onlinepubs/009695399/utilities/grep.html" rel="nofollow noreferrer">grep</a> - simple and fast. Included with Linux, <a href="http://gnuwin32.sourceforge.net/packages/grep.htm" rel="nofollow noreferrer">here</a>'s a Windows version, not sure about Mac.</p> <p>For rep...
<p>Use emacs or xemacs. It has a perfect regexp replacement function. You can even use constructions like /1 (or /2 or /3) to get a matched expression back in your replacement that was identified with ( ) around them. To prevent a vi-emacs clash: vi will also have similar constructions. I'm not sure of any modern edito...
22,516
<p>I have an ASP.NET 2.0 (C#) webpage with a link that pulls a blob from a MS SQL database and ouputs it in the appropriat file format, i.e., Word, WordPerfect, PDF.</p> <p>My users would like to print these files with one click. Right now they have to click the link to open the file, then click the "Print" button wit...
<p>Do you want to print to a Printer attached to the Server, or attached to the client?</p> <p>If you want to print on the Client, you won't have much chance. For HTML Content, maybe some JavaScript or Flash could trigger the Print Dialog (not sure), but if it's a File that has to be opened in a third party applicatio...
<p>The closest I've gotten to this is using Javascript: </p> <pre><code>&lt;body onload="window.print()"&gt; ... &lt;/body&gt; </code></pre> <p>which will pop-up the print dialog when the page loads (see <a href="https://stackoverflow.com/questions/242182/how-can-i-pop-up-a-print-dialog-box-using-javascript">this pos...
35,244
<p>I'm used to python, so this is a bit confusing to me. I'm trying to take in input, line-by-line, until a user inputs a certain number. The numbers will be stored in an array to apply some statistical maths to them. Currently, I have a main class, the stats classes, and an "reading" class.</p> <p>Two Questions:</p> ...
<p>What you need in your loop condition is:</p> <pre><code>while ( input.get( input.size()-1 ) != end_signal ); </code></pre> <p>What you're doing is decrementing the counter variable.</p> <p>Also you should declare the <code>ArrayList</code> like so:</p> <pre><code>ArrayList&lt;Double&gt; list = new ArrayList&lt;D...
<p>**</p> <pre><code>public static java.util.ArrayList readRange(double end_signal) { //read in the range and stop at end_signal ArrayList input = new ArrayList(); Scanner kbd = new Scanner(System. in ); int count = 0; do { input.add(Double.valueOf(kbd.next())); System.out.print...
14,167
<p>Many people use Mock Objects when they are writing unit tests. What is a <strong>Mock Object</strong>? Why would I ever need one? Do I need a Mock Object Framework?</p>
<p>Object Mocking is used to keep dependencies out of your unit test. Sometimes you'll have a test like "SelectPerson" which will select a person from the database and return a Person object. </p> <p>To do this, you would normally need a dependency on the database, however with object mocking you can simulate the inte...
<p>2 recommended mocking frameworks for .net Unit testing are Typemock Isolator and Rhino Mock.</p> <p>In the following link you can see an explanation from Typemock as to why you need a <a href="http://www.typemock.com/Docs/writing_unit_tests_with_isolator.html" rel="nofollow noreferrer">mocking framework</a> for Uni...
2,633
<p>Is Lucene.Net suitable as the search engine for frequently changing content? </p> <p>Or more specificically, can anybody give a subjective opinion on how quickly lucene.net indexes can be updated. Any other approaches to searching frequently changing content would be great.</p> <p>We’re developing a forum. Forum p...
<p>Out forums (<a href="http://episteme.arstechnica.com" rel="nofollow noreferrer">http://episteme.arstechnica.com</a>) use Lucene as the search backend, so it's doable. Posts aren't indexed quite as quickly as you'd like, but we could solve that by beefing up the indexing hardware and using a smarter caching strategy...
<p>Lucene.Net is extremely fast, however there are many things that can slow down queries when used wrong. I strongly recommend reading the <a href="http://www.manning.com/hatcher2/" rel="nofollow noreferrer">Lucene in Action</a> book by Erik Hatcher and Otis Gospodnetić. It contains a very good chapter about performan...
34,281
<p>Greetings!</p> <p>I am trying to check directory write-permissions from within a Windows MFC/ATL program using C++. My first guess is to use the C-standard _access function, e.g.:</p> <pre><code>if (_access("C:\mydir", 2) == -1) // Directory is not writable. </code></pre> <p>But apparently on Windows 2000 and ...
<p>You can call CreateFile with GENERIC_WRITE access to check this. <a href="http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx</a></p> <p>It's not a C++ library but it still counts as elegant because it directly does wha...
<p>Use sec api. You can ask on Adv. Win32 api newsgroup : news://194.177.96.26/comp.os.ms-windows.programmer.win32 where it has often been discussed (C/C++ code)</p>
24,119
<p>Is it good, bad, or indifferent to run SQL Server on your webserver? </p> <p>I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.</p>
<p>For small sites, it doesn't make a bit of a difference. As the load grows, though, this scales really badly, and quicker than you think:</p> <ul> <li>Database servers are built on the premise they "own" the server. They trade memory for speed and they easily use all available RAM for internal caching.</li> <li>Once...
<p>I've seen this issue over and over again. The right answer is to put SQL Server on one machine and IIS (web server) on the other. Your money will go into the SQL Server machine because the right drive system and RAM must be purchased to support a efficient server but the web server can be a much scaled down &amp; le...
13,863
<p>We'll soon be embarking on the development of a new mobile application. This particular app will be used for heavy searching of text based fields. Any suggestions from the group at large for what sort of database engine is best suited to allowing these types of searches on a mobile platform?</p> <p>Specifics includ...
<p>Just recently I had the same issue. Here is what I did:</p> <p>I created a class to hold just an id and the text for each object (in my case I called it a sku (item number) and a description). This creates a smaller object that uses less memory since it is only used for searching. I'll still grab the full-blown obj...
<p>You could try Lucene.Net. I'm not sure how well it's suited to mobile devices, but it is billed as a "high-performance, full-featured text search engine library".</p> <p><a href="http://incubator.apache.org/lucene.net/" rel="nofollow noreferrer">http://incubator.apache.org/lucene.net/</a> <a href="http://lucene.apa...
34,864
<p>I have a header node in which four child nodes reside. None have borders, padding nor margins. All four of them have the width:25%; css rule. In Opera it works just fine, in IE the last block flips to the next line sometimes depending on the width of the window.</p> <p>I can solve it by giving one block a width of ...
<p><a href="http://ejohn.org/blog/sub-pixel-problems-in-css/" rel="noreferrer">http://ejohn.org/blog/sub-pixel-problems-in-css/</a></p> <p>This is a well-known issue in the CSS world, unfortunately. Likely the issue is that the 100% pixel-equivalent these fit into is an odd number, so there is a rounding error when ca...
<p>You might want to just load a different stylesheet depending on the browser. You can do this with some JavaScript in the header.</p>
45,697
<p>Memory (and resource) leaks happen. How do you make sure they don't?</p> <p>What tips &amp; techniques would you suggest to help avoid creating memory leaks in first place?</p> <p>Once you have an application that is leaking how do you track down the source of leaks?</p> <p>(Oh and please avoid the "just use GC" ...
<p>In XCode 4.5, use the built in <a href="http://developer.apple.com/library/mac/#recipes/xcode_help-source_editor/Analyze/Analyze.html" rel="nofollow noreferrer">Static Analyzer</a>.</p> <p>In versions of XCode prior to 3.3, you might have to download the static analyzer. These links show you how:</p> <h2>Use the L...
<p>Obviously you need to understand the basic memory management concepts to begin with. But in terms of chasing down leaks, I highly recommend reading <a href="http://mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/" rel="nofollow">this tutorial on using the Leaks mode in Instruments</a>.</p>
20,743
<p>I'm learning DirectX as part of a hobby project. I've been looking for some good online resources for DirectX9 (using C++, if that distinction matters), but haven't found anything that's a) great for a beginner and b) up to date.</p> <p>Any recommendations?</p>
<p>When I started using DirectX I found this to be the best resource around for basic stuff: <a href="http://www.directxtutorial.com/" rel="nofollow noreferrer">http://www.directxtutorial.com/</a></p> <p>When you start reaching an intermediate level they want you to pay a subscription but all the good basic stuff is f...
<p><a href="http://www.codeproject.com/KB/directx/" rel="nofollow noreferrer">CodeProject.com</a></p>
22,511
<p>I have a .net 2.0 ascx control with a start time and end time textboxes. The data is as follows: </p> <p>txtStart.Text = 09/19/2008 07:00:00</p> <p>txtEnd.Text = 09/19/2008 05:00:00</p> <p>I would like to calculate the total time (hours and minutes) in JavaScript then display it in a textbox on the page. </p>
<p>Once your textbox date formats are known in advance, you can use <a href="http://www.mattkruse.com/javascript/date/" rel="noreferrer">Matt Kruse's Date functions</a> in Javascript to convert the two to a timestamp, subtract and then write to the resulting text box.</p> <p>Equally the <a href="http://jonathanleighto...
<p>Use Math.floor(n / 3600000) instead of getUTCHours() or else you would lose the number of hours greater than 24.</p> <p>For example, if you have 126980000 milliseconds, this should translate to 0035:16:20.00</p> <p>If you use getUTCHours() you get an incorrect string 0011:16:20.00</p> <p>Better instead, use this ...
17,046
<p>We host the .NET runtime as part of a Win32 program, and lately it has begun to consistently break at a specific address, in mscorwks.dll.</p> <p>At the specified address, there is a 0xCC byte, which is a INT 3 instruction, which fires the debugger.</p> <p>Has anyone else seen this?</p> <p>I can't see enough info...
<p>There's a discussion about a similar problem <a href="http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/d2a864b0-339b-49d3-9c15-5b918f4bf711" rel="nofollow noreferrer">here</a>. The most interesting part is this:</p> <blockquote> <p>Mscorwks.dll is just the messenger. It is telling you that it detect...
<p>You should be able to get the symbols for mscorwks - I have a couple of versions here, so MS symserv has definitely served them in the past.</p> <p>That might help understand what's happening a bit more.</p> <p>From the fact that you have trace in USER32.dll, I suspect you already have some symbol stuff configured...
40,465
<p>If a method checks it's input and detects illegal input, what should it do: Raise an exception (or use another error-mechanism) or do nothing/ignoring on the wrong input?</p> <p>In Java the HashTable-class throws an NullPointerException if given null-references as parameter. This is sometimes annoying, but I think ...
<p>Definitely throw an exception. Exceptions are annoying on purpose to force you to <em>do something</em> about them.</p> <p>Think of it this way, if your program does nothing on bad input, how are you supposed to let the user know that nothing happened and why? Also, how long will it take you to debug a program th...
<p><strong>Fail Fast</strong>: Never ignore wrong input. You may hide problem and make them very hard to find. </p> <p>Some push this very far with <a href="http://en.wikipedia.org/wiki/Design_by_contract" rel="nofollow noreferrer">Design by Contract</a> (DBC).</p> <p>Follow the practices that are already used in you...
39,038
<p>I have a generated HTML page with flash content in it. I am trying to reposition the flash content and make it "absolute". I have tried to wrap the object tags with a div tag, but to no avail. Can anyone tell me how to do this? Removing the generated positioning attributes does not work. </p> <p>See relevant code b...
<p>you should place the JS script that actually creates you object inside your div not before it.</p>
<p>@Fuzzy76 &amp; @epeleg.blogspot.com is right</p> <p>@pypmanetjies -> Your code must be like this (shortened):</p> <pre><code> &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;title&gt;* welcome *&lt;/title&gt; &lt;script language="javascript"&gt;AC_FL_RunContent = 0;&...
20,900
<p>Visual Studio 2005 doesn't provide an interface for creating relationships between tables in a SQL Server CE database (I'm using version 3.0) and you can't open a Compact Edition DB using Management Studio as far as I know. Any ideas?</p>
<p>Unfortunately there is currently no designer support (unlike for SQL Server 2005) for building relationships between tables in SQL Server CE. To build relationships you need to use SQL commands such as:</p> <pre><code>ALTER TABLE Orders ADD CONSTRAINT FK_Customer_Order FOREIGN KEY (CustomerId) REFERENCES Customers...
<pre><code>create table employee ( empid int, empname varchar(40), designation varchar(30), hiredate datetime, Bsalary int, depno constraint emp_m foreign key references department(depno) ) </code></pre> <p>We should have an primary key to create foreign key or relationship between two or more table...
6,898
<p>I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page. Like the WYSIWYG editor on most blog engines or forums.</p> <p>I'm trying to think of all potential security holes I need to plug, one of which is a user pasting...
<blockquote> <p>...I'm worried about the possibility of someone being able to paste some script in and run it there and then, without even sending it back to the server for processing. </p> <p>Am I worrying over nothing?</p> </blockquote> <p>Firefox has a plug-in called Greasemonkey that allows users to arbitr...
<p>As Jason said, I would focus more on cleaning the data on the server side. You don't really have any real control on the client side unless you're using Silverlight / Flex and even then you'd need to check the server.</p> <p>That said, Here are some tips from <em>"A List Apart"</em> you may find helpful regarding s...
7,326
<p>Is there an equivalent to Apache's VirtualHost for IIS? We want to be able to run multiple websites from one IP and address them with different DNS names.</p> <p>i.e. I have </p> <pre><code>www.dom1.com www.dom2.com www.dom3.com </code></pre> <p>that all point to <code>123.123.10.1</code>. Apache would just be ...
<p>You want to use <a href="http://www.visualwin.com/host-header/" rel="noreferrer">Host Headers in IIS</a> - that link will lead to a nice how-to page.</p>
<p>As rob_g suggested, if you already have a website running (eg. default website) you can also select 'Edit bindings' on the website and specify a hostname. </p>
38,917
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/476163">NAnt or MSBuild, which one to choose and when?</a> </p> </blockquote> <p>What is the best build tool for <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a>?</p> <p...
<p>We actually use a combination of <a href="http://en.wikipedia.org/wiki/NAnt" rel="noreferrer">NAnt</a> and <a href="http://en.wikipedia.org/wiki/MSBuild" rel="noreferrer">MSBuild</a> with <a href="http://en.wikipedia.org/wiki/CruiseControl" rel="noreferrer">CruiseControl</a>. NAnt is used for script flow control and...
<p>Generally speaking, I get the impression that NAnt offers more flexibility compared to MSBuild, whereas (with my relatively simple needs) I've been fine with the latter so far.</p>
3,726
<p>One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result.</p> <p>Besides getting rid of the developer, how can I solve this problem?</p> <p>EDIT</p> <p>I have talked to him about it number of times and even given hi...
<p>If you systematically perform <strong>code reviews</strong> before allowing a developer to commit the code, well, your problem is mostly solved. But this doesn't seem to be your case, so this is what I recommend:</p> <ul> <li><strong>Talk to the developer.</strong> Discuss the consequences for others in the team. M...
<p>Have you tried talking to them about it? Might not be a bad first step. It might also give you some clues as to what step 2 should be if the problem continues.</p>
16,848
<p>I'm a Java developer looking to learn some C#/ASP.NET. One thing I've never liked about .NET from the get-go was that it didn't have support for MVC. But now it does! So I was wondering if anybody knew where to get started learning C# MVC. </p> <p>Also, do you need the non-free version of developer-studio to do ...
<p>Keep an eye on <a href="http://weblogs.asp.net/Scottgu/" rel="nofollow noreferrer">Scott Guthrie</a>'s and <a href="http://haacked.com/" rel="nofollow noreferrer">Phil Haack</a>'s blogs. They are the primary source of documentation right now.</p> <p>Be wary, as most posts about MVC are about previous versions and ...
<p>If you have one, you can browse the meetings list of the local .Net User Group in your area. If you don't see an MVC topic being presented, ask the leader of the group to schedule one. If he can't honor your request, he should still be able to point you to other resources.</p>
26,107
<p>I'm currently turning an array of pixel values (originally created with a java.awt.image.PixelGrabber object) into an Image object using the following code:</p> <pre><code>public Image getImageFromArray(int[] pixels, int width, int height) { MemoryImageSource mis = new MemoryImageSource(width, height, pixels, 0...
<p>You can create the image without using ImageIO. Just create a BufferedImage using an image type matching the contents of the pixel array.</p> <pre><code>public static Image getImageFromArray(int[] pixels, int width, int height) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_...
<p>As this is one of the highest voted question tagged with ImageIO on SO, I think there's still room for a better solution, even if the question is old. :-)</p> <p>Have a look at the <a href="https://github.com/haraldk/TwelveMonkeys/blob/master/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageFa...
15,159
<p>This obviously requires the source file to be under source control. I would ideally like a tool which works under the IDE (Eclipse, Visual Studio, etc) - but an external tool would be nice, too. Obviously, it is possible manually go through previous versions of the file, and compare the various versions, but I am lo...
<p>That looks like the <a href="http://svnbook.red-bean.com/en/1.0/re02.html" rel="nofollow noreferrer">blame function</a>, supported in <a href="http://stuvel.eu/archive/42/blame-support-in-eclipse" rel="nofollow noreferrer">eclipse with CVS</a>, or with <a href="https://stackoverflow.com/questions/223657/svn-blame-in...
<p>For perforce plugin in Eclipse annotate is not showing up in the context menu. So I need to use: <code>p4 annotate my-file</code> and then using Eclipse browse the history.</p>
47,989
<p>I almost feel embarrassed to ask, but I always struggle with how to organize exception definitions. The three ways I've done this before are:</p> <ul> <li>Use the file-per-class rule. I'm not crazy about this because it clutters up my directory structure and namespaces. I could organize them into subdirectories ...
<p>I tend to place the Exceptions one per file in the same package as the objects which produce them, in individual files. This is the paradigm used by the Java APIs and the .Net libraries, so most people are at least familiar with the organization of the objects at that point.</p> <p>Modern IDE's do a good enough jo...
<p>In C++, I've always defined classes that I will use as exceptions in the same namespace as the classes which throw them, co-locating them in the same header. For general purpose exceptions, that will be shared between classes, I use a single header to group them together, along with other utility functions and class...
15,971
<p>I have had to do this several times, usually when trying to find in what files a variable or a function is used.</p> <p>I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.</p>
<pre><code>grep -r REGEX . </code></pre> <p>Replace <code>.</code> with whatever directory you want to search from.</p>
<p>This is a great way to find the exact expression recursively with one or more file types:</p> <p><code>find . \\( -name '\''*.java'\'' -o -name '\''*.xml'\'' \\) | xargs egrep</code> (internal single quotes)</p> <p>Where </p> <p><code>-name '\''*.&lt;filetype&gt;'\'' -o</code> (again single quotes here)</p> <p>i...
22,504
<p>I'm building custom control for my Silverlight 2 app. It's in one SL class project, and it contains two files: </p> <ul> <li>MyControl class, inherited from Control, with few DepedencyProperties</li> <li>themes/generic.xaml, with visual elements (ControlTemplate), states for VSM and transitions </li> </ul> <p>...
<p>You can edit this with Blend.</p> <ol> <li>Open your controls project in Blend.</li> <li>Open your generic.xaml</li> <li>click the Resources tab</li> <li>Expand generic.xaml</li> <li>Double click the style resource you want to edit.</li> <li>In the Objects and Timeline section, right click the Style and select "Edi...
<p>I recreated whole project, and suddenly can edit my generic.xaml from Resources. But can't add news stated in Blend, for that I must go to xaml. </p>
41,036
<p>"To summarize: if you install VSTO 2005 SE on top of a clean VS 2005 Professional, you won't have the document-level templates. If you want to have them you need to have VS 2005 Team Suite/Team Edition or you need to install the previous version of VSTO: VSTO 2005. So VS 2005 Professional + VSTO 2005 + VSTO 2005 SE ...
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f2909f92-3517-49bc-9e86-c136299956bc/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f2909f92-3517-49bc-9e86-c136299956bc/</a></p> <blockquote> <p>As Richard said earlier in this thread, the "document-level"...
<p>Maybe this one will help <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5D3FECE9-74E0-4E19-AF98-AEDE2DF94F87&amp;displaylang=en&amp;displaylang=en" rel="nofollow noreferrer">Microsoft Visual Studio 2005 Tools for Office 2005 Runtime (VSTO 2005 RTM)</a></p> <blockquote> <p>The VSTO 2005 redistri...
35,248
<p>I'd like the iPhone virtual keyboard to appear pre-set to a particular language (Russian for example) when the user taps a UITextField. Is there a way to do this in Cocoa code?</p>
<p>This is a user defined setting and can not be messed with by the programmer, unfortunately.</p>
<p>Not sure why you'd want to do this -- I don't speak Russian, and I'd be a little alarmed if all of the sudden a Russian keyboard appeared.</p> <p>The user can choose which language they want in their iPhone Settings app. That then determines which keyboard appears when they tap a text field.</p>
42,820
<p>Has anybody else had trouble with getting the .Net Framework source code? Google doesn't have anything to say about this error message, and neither does the CodePlex issue tracker.</p> <p>Here is the command I'm using to get the source code for the modules that make up mscorlib.dll. Am I doing something obviously...
<p>I found the solution, how to query and to set:</p> <pre><code>BOOL b SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &amp;b, 0); if (!b) { b = TRUE; SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, &amp;b, 0); } </code></pre>
<p>Do you mean you want to change this system-wide setting, or that you want to be able to override the behavior only in your program?</p> <p>If it's the latter and you're using the Win32 API, it looks like you might be able to catch the WM_CHANGEUISTATE notification: <a href="http://blogs.msdn.com/oldnewthing/archive...
30,396
<p>For tasks that will take more than a few seconds, a good user interface, in my opinion, should provide a progress bar along with appropriate information on the progress of the operation. (Microsoft kindly provide <a href="http://msdn.microsoft.com/en-us/library/aa511486.aspx" rel="nofollow noreferrer">User Interface...
<p>For logging, you should probably actually have another higher level of error. These are the levels I usually implement (as swiped from DEC back in the 80's).</p> <ol> <li>DEBUG - a very low-prioity message that the developer just put in to help diagnose what's going on in the event something goes awry.</li> <li>INF...
<p>You have here a <a href="https://www.opends.org/wiki/page/StatusPanelUISpecification" rel="nofollow noreferrer">similar Status Panel specifications</a> which can give you some ideas on what could be included into this kind of GUI:</p> <p>In sort, define your goals and scope of this Status Panel before listing the d...
46,396
<p>What would be the best way to check that a <code>std::vector</code> is sorted? Is there something faster than a loop checking that <code>v[i]&lt;=v[i+1]</code>? Is it faster/cleaner with iterators? Or is it actually better to just call <code>sort</code> every time (though the "v is already sorted" case is quite comm...
<blockquote> <p>Is there something faster than a loop checking that v[i]&lt;=v[i+1] ?</p> </blockquote> <p>No.</p> <p>If this is something you wish to check often, you might want to make a wrapper class that keeps a "sorted" flag which starts out False, is set to False whenever an item is added, and add a member ...
<p>In order to check sorted you must check every item. So v[i]&lt;=v[i+1] is the fastest possible check.</p>
32,770
<p>I have an associative array in the form <code>key =&gt; value</code> where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable name of the array and...
<pre><code>$arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]); </code></pre>
<p>Hmm, I'm not test before, but I think this code working</p> <pre><code>function replace_array_key($data) { $mapping = [ 'old_key_1' =&gt; 'new_key_1', 'old_key_2' =&gt; 'new_key_2', ]; $data = json_encode($data); foreach ($mapping as $needed =&gt; $replace) { $data = str_rep...
29,788
<p>When working with cffile in ColdFusion, after an upload of a file to a webserver, the cffile structure is created that is supposed to have a value in it called "oldFileSize". Every time I do an upload and examine that value, it has the new file's size, not the overwritten file's size. Is there some setting somewhe...
<p>If the oldfilesize attribute is not returning correctly, I would use nameconflict=unique to preserve the old file. Then, you can use cfdirectory to check the old filesize, and cffile action="delete" and action="rename" to replace the old file, so that you have essentially overwritten the old file, only manually.</p...
<p>What overwritten file? It seems you are talking about two files when you only refer to one.</p>
19,335
<p>Does anyone know if there is a plug-in for TFS that will print out our sprint backlog items in a format suitable for using on a Scrum Board, rather than us having to write them out by hand?</p>
<p>If I read your question right, perfect tool right here:</p> <p><a href="http://blog.crisp.se/henrikkniberg/2007/12/18/1197973740000.html" rel="nofollow noreferrer">http://blog.crisp.se/henrikkniberg/2007/12/18/1197973740000.html</a></p> <p>An excel template you can use to print your backlog off. All you need to d...
<p>I was searching for a similar tool a while back, and we ended up just putting everything on cards &amp; sticking them to a whiteboard.</p> <p>Much easier view into our progress... however that status doesn't get into TFS unless we update it :)</p>
25,990
<p>I like HtmlControls because there is no HTML magic going on... the asp source looks similar to what the client sees. </p> <p>I can't argue with the utility of GridView, Repeater, CheckBoxLists, etc, so I use them when I need that functionality. </p> <p>Also, it looks weird to have code that mixes and matches:</p> ...
<p>It might be useful to think of HTML controls as an option when you want more control over the mark up that ends up getting emitted by your page. More control in the sense that you want EVERY browser to see exactly the same markup.</p> <p>If you create System.Web.UI.HtmlControls like:</p> <pre><code>&lt;input id='b...
<p>By adding runat="server" you can get access to any HTML controls in server side.. and I believe HTML controls are less weight compared to ASP.NET server controls..</p>
8,241
<p>What is the nest PHP thumbnailer/resizer class that preferably works on most shared hosts?</p> <p>Clarification: I'm looking for a PHP class/wrapper (eg. <a href="http://phpthumb.sourceforge.net/" rel="nofollow noreferrer">phpThumb()</a>, <a href="http://en.wikipedia.org/wiki/Asido" rel="nofollow noreferrer">Asido<...
<p>I have good experiences with both <a href="http://sourceforge.net/projects/phpthumb/" rel="nofollow noreferrer">phpThumb</a> and <a href="http://sourceforge.net/projects/wideimage/" rel="nofollow noreferrer">Wideimage</a>. Wideimage is the more modern PHP5 approach while phpThumb has much more features.</p>
<p>GD is supported on many hosts <a href="http://uk3.php.net/manual/en/book.image.php" rel="nofollow noreferrer">http://uk3.php.net/manual/en/book.image.php</a></p>
9,059
<p>I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my .NET product.</p> <p>I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on startup with errors about the asse...
<p>When I looked into this a year ago, I came to the conclusion that it was not possible. It's worth noting that many Microsoft-supplied MSI files come in separate x86 and x64 flavors -- and presumably, they'd only deliver a single file if that were possible.</p>
<p>I have had some success by using two features to selectively include the two sets of files (in separate components of course, with their individualized file identifiers!). </p> <p>The installation must be marked as x32 to install on both x32 and x64. It will always install to the x32 directories and will largely b...
8,618
<p>I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomp...
<p>Bayesian filters have exactly this purpose. That's the techno you'll find in most tools that identify spam.</p> <p>Example, to detect a language (from <a href="http://sebsauvage.net/python/snyppets/#bayesian" rel="noreferrer">http://sebsauvage.net/python/snyppets/#bayesian</a>) :</p> <pre><code>from reverend.thoma...
<p>If you are trying to detect the documents that are talking about the same topic, you could try collecting the most frequently used words, throw away the <a href="http://en.wikipedia.org/wiki/Stop_words" rel="nofollow noreferrer">stop words</a> . Documents that have a similar distribution of the most frequently used ...
12,706
<p>I'm working on a simple application to start learning my way around WPF. I created a vector graphic in Microsoft Expression Design at 400px by 400px, mainly because I thought it would be easier to create it on a bigger canvas.</p> <p>I've exported the image to a XAML file as a series of objects within a 400px squar...
<p>Copy and paste the XAML inside your tag</p> <p>One option - After you paste it on to Expression blend , right click on the Canvas (Left side Element Tree) and Change Layout to Grid. And give 100*100 to the grid</p> <p>Second Option - Click on "Group Into" option and add ViewBox, and resize ViewBox.</p>
<p>Blend UI can help a LOT with doing these sorts of transforms for WPF/Silverlight apps. The UI is a little confusing. Once you copy and paste the XAML into your or or you can click on that item on the left side of the screen. You will see the specific Item highlight in Yellow. Then you can do all sorts of scale, m...
39,033
<p>I need to convert inline css style attributes to their HTML tag equivelants. The solution I have works but runs VERY slowly using the Microsoft .Net Regex namespace and long documents (~40 pages of html). I've tried several variations but with no useful results. I've done a little wrapping around executing the ex...
<p>I believe the problem is that if it finds a <code>span</code>|<code>font</code> tag, which has no style attribute defined, it will continue looking for it until the end of the document because of the <code>.\*?</code>. I haven't tested it, but changing it to <code>[^&gt;]\*?</code> might improve performance.</p> <p...
<p><s>.NET regular expressions does not support recursive constructs.</s> PCRE does, but that doesn't matter here.</p> <p>Concider</p> <pre><code>&lt;font style="font-weight: bold;"&gt; text1 &lt;font color="blue"&gt; text2 &lt;/font&gt; text3 &lt;/font&gt; </code></pre> <p>It would get converted into</p> <pre><cod...
19,729
<p>In .NET, what's the best way to prevent multiple instances of an app from running at the same time? And if there's no "best" technique, what are some of the caveats to consider with each solution?</p>
<p>Use Mutex. One of the examples above using GetProcessByName has many caveats. Here is a good article on the subject:</p> <p><a href="http://odetocode.com/Blogs/scott/archive/2004/08/20/401.aspx" rel="noreferrer">http://odetocode.com/Blogs/scott/archive/2004/08/20/401.aspx</a></p> <pre><code>[STAThread] static void...
<p>Normally it's done with a named Mutex (use new Mutex( "your app name", true ) and check the return value), but there's also some support classes in Microsoft.VisualBasic.dll that <a href="http://www.hanselman.com/blog/TheWeeklySourceCode31SingleInstanceWinFormsAndMicrosoftVisualBasicdll.aspx" rel="nofollow noreferre...
11,962
<p>I'm pretty happy with <a href="http://whatcodecraves.com/posts/2008/12/13/rails-flash-with-ajax.html" rel="noreferrer">the solution</a> that I came up with. Basically, I have a helper method that reloads the flash inline, and then I have an after_filter that clear out the flash if the request is xhr. Does anyone h...
<p>You can also store the flash messages in the response headers using a after_filter block and display them using javascript:</p> <pre><code>class ApplicationController &lt; ActionController::Base after_filter :flash_to_headers def flash_to_headers return unless request.xhr? response.headers['X-Message'] = flash...
<p>The only improvement I can think of is making the page.reload_flash default (not having to put it on every rjs file, and make it expicit if you don't want to reload the flash, something like page.keep_flash.</p> <p>I wouldn't know where to start but knowing some rails I'm sure it's not that hard.</p>
47,815
<p>What is the equivalent to the C# "!" operator in F#?</p>
<p>According to <a href="https://rads.stackoverflow.com/amzn/click/com/1590597575" rel="noreferrer" rel="nofollow noreferrer">"Foundations of F#"</a>, page 61:</p> <blockquote> <p>F# uses a function called <code>not</code> for Boolean "not" operations.</p> </blockquote>
<p>you can also use "&lt;>"</p>
29,692
<p>I'm updating my code generator and have a choice between implementing a method stub as a Virtual Method in a base class or a partial method in the generated code. Is there any performance difference between the two?</p>
<p>If you <em>implement</em> the partial method, then I would expect there to be no noticeable difference. C# always uses <code>callvirt</code> to invoke instance methods, even if they aren't virtual, so there won't be much change.</p> <p>If you <em>don't</em> implement the partial method, then the call itself is remo...
<p>There may be a minor difference, but it should be negligible unless the method is called repeatedly in a loop.</p> <p>Partial methods are just syntactic sugar that allow the splitting of a class across multiple files.</p> <p>When compiled, they are exactly the same as if all of the methods had been in the one file...
44,026
<p>I know that <code>.NET</code> is <code>JIT</code> compiled to the architecture you are running on just before the app runs, but does the JIT compiler optimize for 64bit architecture at all? </p> <p>Is there anything that needs to be done or considered when programming an app that will run on a <code>64bit system</...
<p>The <a href="http://blogs.msdn.com/davbr/pages/tail-call-jit-conditions.aspx" rel="nofollow noreferrer">64bit JIT is different</a> from the one for 32bit, so I would expect some differences in the output - but I wouldn't switch to 64bit just for that, and I wouldn't expect to gain much speed (if any) in CPU time by ...
<p>Performance bottlenecks will be the same regardless of whether the architecture is 32- or 64-bit. Performance problems tend to be the result of sub-optimal algorithms &mdash; the choice between 32- and 64-bit types won't significantly affect performance.</p> <p>Most importantly, don't try to improve the performance...
3,525
<p>Does <code>YUI</code> have selector methods like jQuery?</p> <p>e.g. get me all div's that are <code>children</code> of <code>&lt;table&gt;</code> that have links in them?</p>
<p>Check the <a href="http://developer.yahoo.com/yui/selector/" rel="noreferrer">YUI Selector Utility</a>, it gives you <a href="http://www.w3.org/TR/css3-selectors/" rel="noreferrer">CSS3</a> selector sintax, it still in beta but works quite well, check this example: <a href="http://developer.yahoo.com/yui/examples/se...
<p>YUI has selector utility since version 2 (http://developer.yahoo.com/yui/selector/), but it doesn't get popular in YUI 2 since most of module codes are written before selector is introduced into YUI2. </p>
30,346
<p>I have a console program written in C# that I am using to send faxes. When I step through the program in Visual Studio it works fine. When I double click on the program in Windows Explorer it works fine. When I setup a Windows scheduled task to run the program it fails with this in the event log.</p> <pre><code>...
<p>I can't explain it - but I have a few ideas.</p> <p>Most of the times, when a program works fine testing it, and doesn't when scheduling it - security is the case. In the context of which user is your program scheduled? Maybe that user isn't granted enough access.</p> <p>Is the resource your programm is trying to ...
<p>Check that you set correct working directory for your task</p>
5,787
<p>What's the best way to programmatically merge a .reg file into the registry? This is for unit testing; the .reg file is a test artifact which will be added then removed at the start and end of testing.</p> <p>Or, if there's a better way to unit test against the registry...</p>
<p>It is possible to remove registry keys using a .reg file, although I'm not sure how well it's documented. Here's how:</p> <pre><code>REGEDIT4 [-HKEY_CURRENT_USER\Software\&lt;otherpath&gt;] </code></pre> <p>The <code>-</code> in front of the key name tells <code>Regedit</code> that you want to remove the key.</p...
<p>One of the most frustrating things about writing unit tests is dealing with dependencies. One of the greatest things about Test-Driven Development is that it produces code that is decoupled from its dependencies. Cool, huh?</p> <p>When I find myself asking questions like this one, I look for ways to decouple the ...
5,551
<p>Stackoverflow is built on MVC and does a bunch of simple but nice things with dates and numbers (answer counts, votes, etc...). I'm assuming this is all done with a couple of static helper classes.</p> <p>My question is should the view call these helper objects or should the controller call these helper objects an...
<p>Depending on who you ask, you'll get different answers. I personally like option #2 as I want the ViewData to be raw data and choose how it is rendered in the View. To me, that's perfectly fine to do that in the view as it's a view concern.</p> <p>However, I know people on my own team that disagree with me, suggest...
<p>I'm all for option 2. I'd say it's a formatting issue, which is, in my opinion, for the view to worry about. </p>
33,042
<p>This is something I'm not much consistent about and always curious about what other people do.</p> <p>How do you access internal properties (private or public)? </p> <p>For example you've got this property :</p> <pre><code>Private _Name As String Public Property Name() As String Get Return _Name ...
<p>Personally I prefer to use the property where possible. This means you still get the validation, and you can easily put breakpoints on the property access. This <em>doesn't</em> work where you're trying to make a change to two properties which validate against each other - for instance, a "min and max" pair, where e...
<p>This is quite interesting, I think most of the people doing what I do </p> <pre><code>Me.Name = "Johnny" </code></pre> <p>or </p> <pre><code>Name = "Johnny" </code></pre> <p>However most of the projects that I've seen using </p> <pre><code>_Name = "Jonny" </code></pre> <p>style. Which I though was a bad idea, ...
46,377
<p>What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex.</p> <h2>Code with Global</h2> <pre><code>$conn = new PDO(...); function getSomething() { global $conn; . . . } </code></pre> <h2...
<p>I know this is old, but Dr8k's answer was <em>almost</em> there.</p> <p>When you are considering writing a piece of code, assume it's going to change. That doesn't mean that you're assuming the kinds of changes it will have hoisted upon it at some point in the future, but rather that some form of change will be mad...
<p>It is quite simple. Never use global OR Singleton.</p>
15,896
<p>I've recently inherited C# console application that is in need of some pruning and clean up. Long story short, the app consists of a single class containing over 110,000 lines of code. Yup, over 110,000 lines in a single class. And, of course, the app is core to our business, running 'round the clock updating dat...
<p>You could try to use <a href="http://www.ndepend.com/" rel="noreferrer">NDepend</a> if you just need to extract some stats about your class. Note that this tool relies on Mono.Cecil internally to inspect assemblies.</p>
<p>Try having the compiler emit assembler files, as in x86 instructions, not .NET assemblies.</p> <p>Why? Because it's much easier to parse assembler code than it is C# code or .NET assemblies.</p> <p>For instance, a function/method declaration looks something like this:</p> <pre><code> .string "w+" .text ...
13,180
<p>Let's say that a class has a <code>public int counter</code> field that is accessed by multiple threads. This <code>int</code> is only incremented or decremented.</p> <p>To increment this field, which approach should be used, and why?</p> <ul> <li><code>lock(this.locker) this.counter++;</code>,</li> <li><code>Inte...
<h3>Worst (won't actually work)</h3> <blockquote> <p>Change the access modifier of <code>counter</code> to <code>public volatile</code></p> </blockquote> <p>As other people have mentioned, this on its own isn't actually safe at all. The point of <code>volatile</code> is that multiple threads running on multiple CPUs ca...
<p>I'm just here to point out the mistake about volatile in Orion Edwards' answer.</p> <p>He said:</p> <blockquote> <p>&quot;If it is volatile, this just ensures the two CPUs see the same data at the same time.&quot;</p> </blockquote> <p>It's wrong. In microsoft' doc about <a href="https://learn.microsoft.com/en-us/dot...
18,683
<p>Most people complain about the filament not sticking on build plate but mine is vice versa. At first it used to be very good. When I removed the magnetic bed the project would come off easily but for a few days it is like I glue it to the bed with epoxy. It is impossible to remove and when I remove the black project...
<p>Had this problem on my second print. The nozzle was too close to the bed. The only way I got it all off was to heat the bed. Then the PLA became a bit softer and came off pretty fast.</p>
<p>This usually happens when your nozzle is too close to bed during the first layer.<br> Quick fix is <strong>redo bed levelling</strong>.<br> Clean your build surface.<br> Watch you first layer <a href="https://i.stack.imgur.com/PAC4o.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PAC4o.jpg" al...
1,670
<p>I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-)</p> <p>If that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json_decode could make a difference in the app's scalability.</p> <p>Does anyone know w...
<p>As the "lighter" format, I'd expect JSON to be slightly less stressful on the server, but I doubt it will be the biggest performance issue you find yourself dealing with as your site grows in popularity. Use whichever format you're more comfortable with. </p> <p>Alternatively, if you know how you'll be structurin...
<p>There's only one way to determine which is going to be easier on your server in your application with your data.</p> <p>Test it!</p> <p>I'd generate some data that looks similar to what you'll be translating and use one of the unit testing frameworks to decode it a few thousand times using each of SimpleXML and js...
26,332
<p>I have a text box and need to validate that it is plain text does not contain html tags.</p> <p>What is the best way to do it in .net</p> <p>Bonus Question: How to do the same with javascript.</p>
<p>You could allow it to be entered, then before doing ANYTHING with the input, you could use the HttpServerUtility.HtmlEncode class that will convert it all, so that when you re-render it (like in a comment), it wont be the original HTML, but rather the encoded rendering of it.</p>
<p>Why not escape/encode any html, you'll get 1001 different ways to detect html with RegEx's but most will be flawed in some way. If escaping is not an option then your best bet might be to put a RegEx tag on the question and into the title to attract some experts.</p>
37,862
<p>This is a slightly.. vain question, but BuildBot's output isn't particularly nice to look at..</p> <p>For example, compared to..</p> <ul> <li><a href="http://phpundercontrol.org/about.html" rel="noreferrer">phpUnderControl</a></li> <li><a href="http://jenkins-ci.org/content/about-jenkins-ci" rel="noreferrer">Jenki...
<p>You might want to check out <a href="http://somethingaboutorange.com/mrl/projects/nose/" rel="noreferrer">Nose</a> and <a href="http://nose.readthedocs.org/en/latest/plugins/xunit.html" rel="noreferrer">the Xunit output plugin</a>. You can have it run your unit tests, and coverage checks with this command:</p> <pr...
<p>We have used bitten quite a bit. It is pretty and integrates well with Trac, but it is a pain in the butt to customize if you have any nonstandard workflow. Also there just aren't as many plugins as there are for the more popular tools. Currently we are evaluating Hudson as a replacement.</p>
27,887
<p>First time working with UpdatePanels in .NET. </p> <p>I have an updatepanel with a trigger pointed to an event on a FormView control. The UpdatePanel holds a ListView with related data from a separate database.</p> <p>When the UpdatePanel refreshes, it needs values from the FormView control so that on the server i...
<p>make a javascript function that will collect the pieces of form data, and then sends that data to an ASHX handler. the ASHX handler will do some work, and can reply with a response.</p> <p>This is an example I made that calls a database to populate a grid using AJAX calls. There are better libraries for doing AJAX ...
<p>Try </p> <ul> <li>...looking in the Request and Response. </li> <li>...setting a breakpoint on the Load() method and query Me or this in the watch or immediate window to see if the values you want are maybe just not where you are expecting them? </li> <li>...Put a (For Each ctl as Control in Me/This.Controls) and i...
11,107
<p>I am currently working on a project that has been in production for over two years. The project makes extensive use of unit testing and scripted UI tests. Initialy unit tests covered the system framework, business rules and state transitions (or workflow). Test scripts are used for black box testing. However, over t...
<p>In more ways than one I have experienced the same kind of pain that you have vis-a-vis unit tests, especially in projects wherein the members are not at all enthusiastic about unit testing and many of them simply ignore or comment-out tests to be able to cheat source control, save time, etc. One former colleague eve...
<p>My assumption is that the maintenance effort for your unit tests increases because the architecture of your application was allowed to fall apart. Since nobody but you really knows what's in your code, you might want to apply the five whys method to decide what your real, essential, root problem is. IME unit tests s...
14,586