instruction
stringlengths
0
30k
|c#|object|initialization|dataset|
Is there a difference (performance, overhead) between these two ways of initializing an object: MyTypedDataSet aDataSet = new MyTypedDataSet(); ds.Merge(anotherDataSet); and MyTypedDataSet ds = anotherDataSet; Which do you recommend?
Is there a difference (performance, overhead) between these two ways of initializing an object: MyTypedDataSet aDataSet = new MyTypedDataSet(); aDataSet .Merge(anotherDataSet); aDataSet .Merge(yetAnotherDataSet); and MyTypedDataSet aDataSet = anotherDataSet; aDataSet .Merge(yetAnoth...
|c#|dataset|object|initialization|
Formatting works correctly even without having to round: "%.1f" % n
How do I make a UIDatePicker display specific dates?
|iphone|cocoa|cocoa-touch|
My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a UIDatePicker to limit date choices to a certain subset or should I just use a UIPickerView?
You probably want different tools for performance profiling and code coverage. For profiling I prefer Shark on MacOSX. It is free from Apple and very good. If your app is vanilla C you should be able to use, if you can get hold of a Mac. For profiling on Windows you can use LTProf. Cheap, but not great: http://s...
You probably want different tools for performance profiling and code coverage. For profiling I prefer Shark on MacOSX. It is free from Apple and very good. If your app is vanilla C you should be able to use it, if you can get hold of a Mac. For profiling on Windows you can use LTProf. Cheap, but not great: http:...
xsl:copy-of
round() in Python doesn't seem to be rounding properly
|language-agnostic|styles|spartan|
|language-agnostic|styles|spartan|
Sounds like you're overextending regex for this purpose. What I would do is use a regex to match a few date formats and then use a separate function to validate the values of the date fields so extracted.
Regex was not meant to validate number ranges(this number must be from 1 to 5 when the number preceding it happens to be a 2 and the number preceding that happens to be below 6). Just look for the pattern of placement of numbers in regex. If you need to validate is qualities of a date, put it in a date object js/c#/vb...
This is not an appropriate use of regular expressions. You'd be better off using [0-9]{2}/[0-9]{2}/[0-9]{4} and then checking ranges in a higher-level language.
How can I retrieve the page title of a webpage using Python?
|python|html|
How can I retrieve the page title of a webpage (title html tag) using Python?
Are there any languages that implement generics _well_?
|language-agnostic|generics|
I liked the discussion at [Differences in Generics][1], and was wondering whether there were any languages that used this feature particularly well. I really dislike Java's `List<? extends Foo>` for a `List` of things that are Liskov-substitutable for `Foo`. Why can't `List<Foo>` cover that? And honestly, `Compa...
|language-agnostic|generics|
For subversion, there is [Assembla][1] too which comes with [Trac][2] and other useful tools. It's free or you could pay for an account if you need more space or users per project. Kind Regards [1]: http://www.assembla.com/ [2]: http://trac.edgewall.org/
I know this does not answer your question, but why don't you use a date handling routine to check if it's a valid date? Even if you modify the regexp with a negative lookahead assertion like (?!31/0?2) (ie, do not match 31/2 or 31/02) you'll still have the problem of accepting 29 02 on non leap years and about a single...
I found this but can't get it to work. You're supposed to be able (according to [this][1]) to scaffold and then override the actions you want (say list) in your controller, but like I said, it doesn't work for me... class PersonController { def scaffold = true def list = { if(!params.max) params.m...
There are other good reasons for entity objects besides abstraction and loose coupling. One of the things I like most is the strong typing that you can't get with a DataReader or a DataTable. Another reason is that when done well, proper entity classes can make the code more maintanable by using first-class constructs ...
There are other good reasons for entity objects besides abstraction and loose coupling. One of the things I like most is the strong typing that you can't get with a DataReader or a DataTable. Another reason is that when done well, proper entity classes can make the code more maintanable by using first-class constructs ...
Just last week, I used regex find/replace to convert a CSV file to an XML file. Simple enough to do really, just chop up each field (luckily it didn't have any escaped commas) and push it back out with the appropriate tags in place of the commas.
Here is what I'm currently doing in the application's Program.cs file. // Sets the window to be foreground [DllImport("User32")] private static extern int SetForegroundWindow(IntPtr hwnd); // Activate or minimize a window [DllImportAttribute("User32.DLL")] private static extern boo...
Don't forget that you can't trust floating point arithmetic to be 100% accurate. If you're concerned about this, you'll want to look into the <a href="http://us2.php.net/manual/en/intro.bc.php">BCMath Arbitrary Precision Mathematics</a> functions. $x = 22.732423423423432; $x = bcsub(abs($x),floor(abs($x)),...
Some commands i use in my code : - `\todo { paragraph describing what is to be done }` Useful to keep track of todos, a page will be created in final documentation containing your todo list. - `\c <word>` Displays the argument <word> using a typewriter font. Use this to refer to a word of code. I would use it b...
Regex make it easy to replace whole words using word boundaries. (\b\w+\b) So you can replace unwanted words in your file without disturbing words like **Scunthorpe**
Crystal Reports, because it is easy to take the same exact report file and 1 - Post it on the intranet 2 - Embed it in an application 3 - Schedule it to be emailed as an Excel output every so often to whoever needs it Also (as I already suggested), it exports easily to Excel, PDF, and other formats.
@Kogus: Even if i run outside debugger(standalone app. from a command prompt) it still could be preempted by OS and cause a incorrect measurement of the time consumed by my app. Is'nt it? -AD
I use a similar method to ChanChan, but instead of whitespace I put a comment in the web.config to indicate when/why the config was edited.
I use [PrettyCode.Print for .NET][1]. It does everything on your list, and more. (I use it for printing code excerpts for copyright registration paperwork, which is similar to your escrow case.) It is a little slow to open a really big solution, but not unbearably so, and the output quality is excellent. [1]:...
Our build people use Mozilla Tinderbox. It seems to have some hooks for distributed testing. I'm sorry not to know the details but I thought I would at least pass on the pointer to you. It's also nice coz you can find out immediately when a build breaks, and what checkin might have been the culprit. <http://www...
davex.dll is the legacy webdav component for Exchange server, which Entourage uses. Your first step should be investigating why the application pool crashes. My guess is that Entourage can't do anything when the dll isn't present because webdav is not responding to any requests.
Don't use `int`. Files over 2 gigabytes in size are common as dirt these days Don't use `unsigned int`. Files over 4 gigabytes in size are common as some slightly-less-common dirt IIRC the standard library defines `off_t` as an unsigned 64 bit integer, which is what everyone should be using. We can redefine that ...
Don't use `int`. Files over 2 gigabytes in size are common as dirt these days Don't use `unsigned int`. Files over 4 gigabytes in size are common as some slightly-less-common dirt IIRC the standard library defines `off_t` as an unsigned 64 bit integer, which is what everyone should be using. We can redefine that ...
Seconding @[Matt Miller][1] on RSS feeds. There's a useful tool called [WebSVN][2] that offers RSS feeds of every repository and individual branches/tags/folders with full commit messages. It's also a great web interface for quickly looking at file histories and commits/diffs without having to run an update and ope...
I can't imagine drawing icons online. Nowadays icons are usually *drawn* as vectors, and I'm not aware of any online vector packages. In case you decide to draw off-line instead, I use Xara (www.xara.com) to draw all my computer artwork, and I use Gif Movie Gear to create .ico files. The former is a superb vector...
I use a simple program called MyViewPad, which can convert (almost) any old image to a .ico file. It's free and easy to use. This may not be what you are looking for though.
Otto, if you could clarify what it is that you need this for, and we are more likely to have good suggestions. Provide a use-case, and someone will probably have some advice to fit it.
Helpful code snippet from: windows vista \appdata\roaming shortcut problem install ode Snippet public class Utilities { public enum FolderPaths { CSIDL_DESKTOP = 0x0000, // <desktop> CSIDL_INTERNET = 0x0001, // Internet Explore...
Helpful code snippet ode Snippet public class Utilities { public enum FolderPaths { CSIDL_DESKTOP = 0x0000, // <desktop> CSIDL_INTERNET = 0x0001, // Internet Explorer (icon on desktop) CSIDL_PROGRAMS ...
|python|floating-point|
The documentation for the [round()][1] function states that you pass it a number, and the positions past the decimal to round. Thus is *should* do this: n = 5.59 round(n, 1) # 5.6 But, in actuality, good old floating point weirdness creeps in and you get: 5.5999999999999996 For the purposes of ...
The documentation for the [round()][1] function states that you pass it a number, and the positions past the decimal to round. Thus is *should* do this: n = 5.59 round(n, 1) # 5.6 But, in actuality, good old floating point weirdness creeps in and you get: 5.5999999999999996 For the purposes of ...
Of course all these shortcuts are available in the menus but who has time for that when you're in the "zone". I like the code hot swapping.
The context connection uses the user's already established connection to the server. So you inherit things like their database context, connection options, etc. Using localhost will connect to the server using a normal shared memory connection. This can be useful if you don't want to use the user's connection (i.e...
Calling a Web Service from Seam
|java|seam|
A simple question, but could someone provide sample code as to how would someone call a web service from within the JBoss Seam framework, and process the results? I need to be able to integrate with a search platform being provided by a private vendor who is exposing his functionality as a web service. So, I'm just ...
Doesn't the [Criteria API][1] do it for you? It looks almost exactly like what you're asking for. [1]: http://www.hibernate.org/hib_docs/v3/reference/en/html/querycriteria.html
Can you do a partial checkout with svn?
|subversion|
If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do an svn checkout with only those 3 directories under trunk?
|svn|
Can I have TortoiseSVN auto-add files?
|tortoisesvn|subversion|
Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?
|svn|tortoisesvn|
Source Control for Everyone?
|svn|git|subversion|version-control|
I've got a number of non-technical users that all share a set of project files. It would be ideal to have them using version control, but I think that both subversion and git are too technical for non-technical office staff. Is there any distributed source control software that would work well for normal people?
|svn|git|version-control|
How do I export (and then import) a Subversion repo?
|version-control|versioning|subversion|import|export|
I'm just about wrapped up on a project where I was using a commercial SVN provider to store the source code. The web host the customer ultimately picked includes a repository as part of the hosting package, so, now that the project is over, I'd like to relocate the repository to their web host and discontinue the comme...
|svn|version-control|versioning|import|export|
Tables are used for tabular data. If it makes since ot put it in a spreadsheet then use a table. Otherwise there is a better tag for you to be using such as div, span, ul, etc.
There's a text progress bar library for python at <http://pypi.python.org/pypi/progressbar/2.2> that you might find useful: >This library provides a text mode progressbar. This is tipically used to display the progress of a long running operation, providing a visual clue that processing is underway. >The Progre...
Hosting the CLR within SQL Server is meant to give database developers *more flexible options* in how they sought to accomplish tasks. Like others have mentioned, SQL is great for operations and modifications on *sets of data*. Anybody who has done extensive large application development with complex business/domain ru...
Hibernate makes more sense when your application works on <i>object graphs</i>, which are persisted in the RDBMS. Instead, if your application logic works on a 2-D matrix of data, fetching those via direct JDBC works better. Although Hibernate is written on top of JDBC, it has capabilities which might be non-trivial to...
The problem was DBNull, doing: command.Parameters.AddWithValue("@parameter", null); compiles OK.
UnhandledException handler in a .Net Windows Service
|.net|exception|windows-services|
Is it possible to use an UnhandledException Handler in a Windows Service? Normally I would use a custom built Exception Handling Component that does logging, phone home, etc. This component adds a handler to System.AppDomain.CurrentDomain.UnhandledException but as far as I can tell this doesn’t achieve anything win ...
The best way of doing this is a dedicated profiling tool. There are lots out there. I haven't used one for C for a few years, someone else will hopefully be able to give better advice. As you are using Visual Studio 2005 this might be a good place to start: [AQ][1], but I've never used it. [1]: http://www.autom...
I like to use regexps to reformat lists of items like this: int item1 double item2 to public void item1(int item1){ } public void item2(double item2){ } This can be a big time saver.
I've found some benefits to makefiles with large projects, mainly related to unifying the location of the project settings. It's somewhat easier to manage the list of source files, include paths, preprocessor defines and so on, if they're all in a makefile or other build config file. With multiple configurations, add...
1 - Put some debug logging in your code (include timestamps of course), and run it outside of the debugger 2 - Run again *in* the debugger 3 - Repeat many times, to get statistically valid data. 4 - Compare. If there is a significant difference in the average execution time of the standalone vs. the debugge...
1 - Put some debug logging in your code (include timestamps of course), and run it outside of the debugger 2 - Run again *in* the debugger 3 - Repeat many times, to get statistically valid data. 4 - Compare. If there is a significant difference in the average execution time of the standalone vs. the debugge...
These are relatively cheap mechanisms for possibly solving the problem: 1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that. 2. Give valgrind more of a go; it's an excellent tool, and I o...
These are relatively cheap mechanisms for possibly solving the problem: 1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that. 2. Give valgrind more of a go; it's an excellent tool, and I o...
These are relatively cheap mechanisms for possibly solving the problem: 1. Keep an eye on my [heap corruption question][1] - I'm updating with the answers as they shake out. The first was balancing new[] and delete[], but you're already doing that. 2. Give valgrind more of a go; it's an excellent tool, and I onl...
What is a good repository layout for releases and projects in Subversion?
|subversion|
We have the standard Subversion trunk/branches/tags layout. We have several branches for medium- and long-term projects, but none so far for a release. This is approaching fast. Should we: 1. Mix release branches and project branches together? 2. Create a releases folder? If so, is there a better name than rel...
|svn|tags|branch|release|
I'll always use [lxml][1] for such tasks. You could use [beautifulsoup][2] as well. import lxml.html t = lxml.html.parse(url) print t.find(".//title").text [1]: http://codespeak.net/lxml/ [2]: http://www.crummy.com/software/BeautifulSoup/
Subversion or Adobe Version CUE 3 for Photoshop/Illustrator Files
|versioning|
This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversion to handle all of our files my text (code) files and their photoshop/illustrat...
This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversion to handle all of our files my text (code) files and their photoshop/illustrat...
This might seem like a stupid question I admit. But I'm in a small shop me plus two designers. Our backups are getting out of hand because they just copy/paste files if they need to make a change (version). I was all set to try Subversion to handle all of our files my text (code) files and their photoshop/illustrat...
Aku, that is a good resource. I answered a question similar to this one a while back. You can check my [answer here][1]. Even though this was for WPF, you can use the same logic in WinForms. [1]: http://stackoverflow.com/questions/19147/what-is-the-correct-way-to-create-a-single-instance-application#19326