instruction
stringlengths
0
30k
Given the code bellow, how do I style the radio buttons to be next to the labels and style the label of the selected radio button differently than the other labels? <div class="input radio"> <fieldset> <legend>What color is the sky?</legend> <input type="hidden" name="color" va...
> but have you tried setting the > compatibilty mode for the database to > sql server 2000. I just checked the 2005 database, I selected the database, and clicked Properties->Options, and it says the db is already in 2000 compatibility mode.
This is a pain. What we really need is for Microsoft to allow us to hook into a Post-Solution Build event. You can do this via macros but that's too complicated. I'm assuming this is a C++ project because I don't have this problem with C#. This is my solution, it's not elegant but it works: - Create a new pr...
Here are some 3rd-party diagramming tools: - <http://www.nevron.com/Products.DiagramFor.NET.Overview.aspx> - <http://www.nwoods.com/GO/dotnet.htm> - <http://www.syncfusion.com/products/diagram/web/default.aspx>
var fileName = string.Format("{0}\\fileNameHere", Directory.GetCurrentDirectory()); var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName); var adapter = new OleDbDataAdapter("SELECT * FROM [workSheetNameHere$]", connection...
The Java runtime library supports validation. Last time I checked this was the Apache Xerces parser under the covers. You should probably use a [javax.xml.validation.Validator][1]. import java.io.File; import java.net.URL; import javax.xml.XMLConstants; import javax.xml.parsers.ParserConfigu...
The low cost solution is to switch to using ClickOnce, which you can automate using MSBuild. But if you still need to create a Windows Installer package, you will need to convert your project to WiX (pretty straight foward) and build that with your solution. This will get you started: [Automate Releases With MSBui...
@Mike: While I agree that validity is not needed to make a page render (after all, we have to keep IE6 compatibility in...), creating valid XHTML that IS compatible AND valid is not a problem. The problems start when people are used to HTML 4 and using the depreciated tags and attributes. Just because the Web is ...
[nProf][1] is a free .Net profiler ([ref][2]). [1]: http://nprof.sourceforge.net/Site/Description.html [2]: http://stackoverflow.com/questions/3927/what-are-some-good-net-profilers#3935
[nProf][1] is a good, free tool for .Net Profiling. [1]: http://nprof.sourceforge.net/Site/Description.html
Using IP address isn't really the best idea in my experience. For example; my office has two IP addresses that get used depending on load and we constantly run into issues using IP addresses. Instead, I've opted for storing the sessions in a separate database for the domains on my servers. This way no one on the fi...
Ajaxian actually had a [post on inserting / retrieving html from an iframe](http://ajaxian.com/archives/introducing-html-into-an-iframe-and-getting-it-back) today. You can probably use the js snippet they have posted there. As for handling whether browser / tab, you can attach to the onbeforeunload (<http://msdn.mic...
Ajaxian actually had a [post on inserting / retrieving html from an iframe](http://ajaxian.com/archives/introducing-html-into-an-iframe-and-getting-it-back) today. You can probably use the js snippet they have posted there. As for handling closing of a browser / tab, you can attach to the onbeforeunload (<http://msd...
Keep in mind that the money data type can have up to 4 digits past the decimal. Values with more than two digits might not work as expected for either your original solution or the x100 trick.
I used to use NUnit, but I switched to MbUnit since it has more features. I love RowTest. It lets you parametrize your tests. NUnit does have a litter bit better tool support though. I am using ReSharper to run MbUnit Tests. I've had problems with TestDriven.NET running my SetUp methods for MbUnit.
Expanding on [Nathans][1] post. The following will do the job lot in one batch file. @echo off if %1.==Sub. goto %2 for %%f in (*.in) do call %0 Sub action %%~nf goto end :action echo The file is %3 copy %3.in %3.out ren %3.out monkeys_are_cool.txt ...
Perhaps the most common SVN property, 'svn:ignore' is done through the .gitignore file, rather than metadata. I'm afraid I don't have anything more helpful for the other kinds of metadata.
Database exception handling best practices
|database|architecture|exception|
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: - Validate data prior passing it to DB - Left val...
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: 1. Validate data prior passing it to DB 2. Left v...
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: 1. Validate data prior passing it to DB 2. Left v...
|database|architecture|exception|
|database|exception|architecture|
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: 1. Validate data prior passing it to DB 2. Left v...
I write a SOAP server that receives XML requests, and creates XML responses. (Unfortunately, it's not my project, so it's closed source, but that's another problem). It turned out for me that creating (SOAP) XML documents is fairly simple, if you have a data structure that "fits" the schema. I keep the envelope,...
I've always used the SharpZip Library (found [here][1]) [1]: http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx
I've always used the SharpZip Library (found [here][1]) edit: hyperlink wont work, here's the url: http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx [1]: http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx
I've always used the SharpZip Library <http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx>
Swap unique indexed column values in database.
|sql|database|
I have a database table and one of the fields (not primary key) is having unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hack I know are: 1. Delete both rows and re-insert them 2. Update rows with some other value and swap and then update to actual v...
Automatically update version number
|c#|.net|visual-studio|
I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want. I'm also using a settings file and in earlier attemp...
I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want. I'm also using a settings file and in earlier attemp...
<blockquote><blockquote>Some come with a performance penalty of running the same test twice, which may not always be trivial. The alternative to that is storing and passing round booleans, which gets ugly.</blockquote> The performance penalty is minor. However I agree that running a test twice is not a nice solution...
<blockquote><blockquote>Some come with a performance penalty of running the same test twice, which may not always be trivial. The alternative to that is storing and passing round booleans, which gets ugly.</blockquote> The performance penalty is minor. However I agree that running a test twice is not a nice solution...
<p>I've had a similar problem before when using ODBC linked tables to connect to an Sql Server. The solution was to relink the tables and specify the primary key to the table. If Access doesn't know the primary key it cannot perform inserts or updates.</p> I haven't any experience with ADPs but it could be a similar t...
Maybe this is not the best way, but it works. // Here is your path String p = photosLocation + "whatever.jpg"; // Here is the page address String pa = Page.Request.Url.AbsoluteUri; // Take the page name String pn = Page.Request.Url.LocalPath; // Here is the server ...
|html|css|styles|radio-button|
Given the code bellow, how do I style the radio buttons to be next to the labels and style the label of the selected radio button differently than the other labels? <div class="input radio"> <fieldset> <legend>What color is the sky?</legend> <input type="hidden" name="color" va...
Have you considered using conditional compilation to control what happens during debug/deployment? e.g. DateTime date; #if DEBUG date = new DateTime(2008, 09, 04); #else date = DateTime.Now; #endif Failing that, you want to expose the property so you can manipulate it, this is ...
Have you considered using conditional compilation to control what happens during debug/deployment? e.g. DateTime date; #if DEBUG date = new DateTime(2008, 09, 04); #else date = DateTime.Now; #endif Failing that, you want to expose the property so you can manipulate it, this is ...
Thanks so far. I've successfully tried Andrew Connel's solution: [http://www.andrewconnell.com/blog/articles/UsingCodeBehindFilesInSharePointSites.aspx][1] Wrapping it into a solution is part of that, but the main problem was how to get the code into that, and it's more leaning towards Option 2 without having to ...
Maybe this is not the best way, but it works. // Here is your path String p = photosLocation + "whatever.jpg"; // Here is the page address String pa = Page.Request.Url.AbsoluteUri; // Take the page name String pn = Page.Request.Url.LocalPath; // Here is the server ...
The IInterceptor is the recommended way to modify any data in nhibernate in a non-invasive fashion. It's also useful for decryption / encryption of data without your application code needing to know. Triggers on the database are moving the responsibility of logging (an application concern) in to the DBMS layer whic...
One repository per project. Steven Murawski's comment about CC.NET is an interesting one. I would be interested to hear how it works if you need to specify several source control repositories.
Simply delete the .suo file. It contains the list of open files.
Evidence Base Scheduling Tool
|evidence-based-scheduling|
Are there any free tools that implement evidence based scheduling that [joel talks about][1]? There lies fogbugz of course but I am looking for a simple and free tool that can apply ebs on some tasks that I give estimates (and actual times which are complete) for. [1]: http://www.joelonsoftware.com/items/2007/10...
|fogbugz|evidence-based-scheduling|
Evidence Based Scheduling Tool
Not sure if this is what you are after but you can [search source code on Google][1]. Follow the link for a search on ['function:reduce() lang:python'][2] on Google Code search At first glance the following projects use <code>reduce()</code> <ul> <li>MoinMoin</li> <li>Zope</li> <li>Numeric</li> <li>Scienti...
I would have to say that this is pretty bad practice. Whilst some people might be happy to say that looping through the collection is less efficient to throwing an exception, there is an overhead to throwing an exception. I would also question why you are using a collection to access an item by key when you would be be...
In IE. Select View -> Script Debugger -> Open. That should do it.
I like break my classes down into packages that are related to each other. For example: **Model** For database related calls **View** Classes that deal with what you see **Control** Core functionality classes **Util** Any misc. classes that are used (typically static functions) etc.
TechRepublic has a good walk through - [http://blogs.techrepublic.com.com/programming-and-development/?p=672][1] [1]: http://blogs.techrepublic.com.com/programming-and-development/?p=672
Firebug lite doesn't work too well for me. The Developer Toolbar just isn't good enough. There really is no great solution.
Exceptions should be exceptional. Something like 'The collection is missing because the database has fallen out from underneath it' is exceptional Something like 'the key is not present' is normal behaviour for a dictionary. For your specific example of a winforms Control collection, the `Controls` property ha...
I think the best thing to do here would be one/both of two things: 1. Rethink the design, if its too complex, find a less-complex way. 2. Stop trying to visualise it.. :P Just store the dimensions in question that you need to sum, then do them one at a time. Once you have the base code, then look at improving the e...
These are standard library references. Make sure that all libraries (including the standard library) are using the *same* linkage. E.g. you can't link statically while linking the standard lib dynamically. The same goes for the threading model used. Take special care that you and the 3rd party library use the same link...
SICP is a great book, but it is difficult when you don't know the Lagrange (as I recall). This is probably my bias, but I thought ocaml was pretty easy to get into. You have the option of programming in a few different styles. Along those lines, I'd recommend python as well. Though, ocaml will get you closer to the...
SICP is a great book, but it is difficult when you don't know the Lagrange (as I recall). This is probably my bias, but I thought ocaml was pretty easy to get into. You have the option of programming in a few different styles. Along those lines, I'd recommend python as well. Though, ocaml will get you closer to the...
SICP is a great book, but it is difficult when you don't know the Lagrange (as I recall). This is probably my bias, but I thought ocaml was pretty easy to get into. You have the option of programming in a few different styles until you're completely comfortable. Along those lines, I'd recommend python as well. Thou...
>3) Do not match if in the middle of a string (thanks nohat). You can perhaps write a reg ex to check ".\*Boolean.\*". But what if you have quote(") inside the string? So, you have more work to not exclude (\") pattern. >4) Do not match if in a comment. (// or /\* \*/) For '//', you can have a regex to exclud...
I totally agree with Dallas. Use a case statement - it makes your intent clearer. The synthesis tool will build it as a look-up table (if it's parallel) and will optimise whatever it can. Also, I wouldn't worry so much about keeping your RTL code short. I'd shoot for clarity first. Synthesis tools are cleverer th...
Ayende Rahien [uses][1] a static method that is rather simple... public static class SystemTime { public static Func<DateTime> Now = () => DateTime.Now; } [1]: http://www.ayende.com/Blog/archive/2008/07/07/Dealing-with-time-in-tests.aspx
The brand-new version of ASP.NET ([3.5 SP1][1]) has a nifty feature called [CompositeScript][2]. This allows you to use a [ScriptManager][3] to reference lots of tiny little .js files server-side and have them delivered as a single .js file to the client. Good for the client since it only has to download one file...
To reference something on the stage, you need to give the stage instance a name - not give the symbol in the library a class name. Click on the item on the stage and look at the properties panel. There should be a text entry box just above the entry boxes for the item's dimensions. Enter a name there. Elsewhere i...
Building a custom Linux Live CD
|linux|
Can anyone point me to a good tutorial on creating a bootable Linux CD from scratch? I need help with a fairly specialized problem: my firm sells an expansion card that requires custom firmware. Currently we use an extremely old live CD image of RH7.2 that we update with current firmware. Manufacturing puts the card...
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: 1. Validate data prior passing it to DB 2. Left v...
How do you handle database exceptions in your application? Are you trying to validate data prior passing it to DB or just relying on DB schema validation logic? Do you try to recover from some kind of DB errors (e.g. timeouts)? Here are some approaches: 1. Validate data prior passing it to DB 2. Left v...
class A: def _ _init_ _(self): self.name = 'A' a = A() Creates an attribute on the object instance a of type A and it can therefore be found in: `a.__dict__` class B: name = 'B' b = B() Creates an attribute on the class B and the attribute can be found in `B.__d...
With the "Built in" stuff, you can't, as using 1.0.* or 1.0.0.* will replace the revision and build numbers with a coded date/timestamp, which is usually also a good way. For more info, see the [Assembly Linker][1] Dicumentation in the /v tag. As for automatically incrementing numbers, use the AssemblyInfo Task: ...
Second the Buildbot - Trac integration. You can find more information about the integration on the <a href="http://buildbot.net/trac/wiki/BuildbotAndTrac">Buildbot website</a>. At my previous job, we wrote and used the plugin they mention (tracbb). What the plugin does is rewriting all of the Buildbot urls so you can ...
I think you should go for solution 2. There is no 'swap' function in any SQL variant I know of. If you need to do this regularly, I suggest solution 1, depending on how other parts of the software are using this data. You can have locking issues if you're not careful. But in short: there is no other solution than...
It depends on what kind of application you are building. Create a representative test scenario, and start hammering away. Then you will know the definitive answer. Besides your use case, it also depends on CPU, memory, front-side bus, operating system, cache settings, etcetera. Seriously, just test your own scena...
Encrypting Passwords
Your best researching the most common type of queries that happen on your database and creating indexes based on that research. For example, if there is a table which stores website hits, which is written to very very often but hardly even read from. Then don't index the table in away. If how ever you have a list...
The advice you got is right. Try them all, one by one. There is NO substitute for testing when it comes to performance. Unless you prove it, you haven't done anything.
How do I configure a Vista Ultimate (64bit) account so it can access a SMB share on OSX?
|macos|windows-vista|smb|
I have Windows File sharing enabled on an OS X 10.4 computer. It's accessible via \\rudy\myshare for all the Windows users on the network, except for one guy running Vista Ultimate 64-bit edition. All the other users are running Vista or XP, all 32-bit. All the workgroup information is the same, all login with the ...
It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better. Some people like to write up use cases and if they see a lot of the same noun...
The word on the street is that unless you are a database vendor trying to prove that your database can do it (like, let's say Microsoft boasting about Terraserver storing a bajillion images in SQL Server) it's not a very good idea. When the alternative - storing images on file servers and paths in the database is so mu...
The restful_authentication plugin has a good implementation of this: <http://agilewebdevelopment.com/plugins/restful_authentication>
In my opinion, it is better to make the version number part of the file itself. e.g. myscript.1.2.3.js You can set your webserver to cache this file forever, and just add a new js file when you have a new version.
It's an often-asked question. There's an [ASPN Cookbook][1] entry on it that has served me in the past. And there is an [extensive page of requirements one person would like to see from a module doing this.][2] [1]: http://code.activestate.com/recipes/113799/ [2]: http://wiki.python.org/moin/BitManipulati...
Another option would be to infer the time zone from the user agent's country preference. This is a somewhat crude method (won't work for en-US), but makes a good approximation.
If you happen to be using ([OpenID][1]) for authentication, [Simple Registration Extension][2] would solve the problem for authenticated users (You'll need to convert from tz to numeric). Another option would be to infer the time zone from the user agent's country preference. This is a somewhat crude method (won't w...
If you happen to be using [OpenID][1] for authentication, [Simple Registration Extension][2] would solve the problem for authenticated users (You'll need to convert from tz to numeric). Another option would be to infer the time zone from the user agent's country preference. This is a somewhat crude method (won't wor...
According to the [TortoiseHg FAQ][1] the context menus will work in 64-bit Vista if you use a third-party 32-bit file manager, like [FreeCommander][2] or [TotalCommander][3]. There's no mention of a workaround to get them to work with Windows Explorer though. [1]: http://tortoisehg.wiki.sourceforge.net/FAQ ...
<section name="AppNameConfiguration" type="AppName.SystemBase.AppNameConfiguration, SystemBase"/> The custom section is supposed to have a class that defines how the various configuration data can be managed, (This is in the Type section). Is this class not available for you to examine? MSDN has a decen...
Does git have anything like `svn propset`?
|version-control|git|svn|
Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks or the "propset" features that can, say, update a version number or copyright notice within a file whenever it is committed to the repository. Are git users expected to write external scripts for this sort of functionality (...