instruction
stringlengths
0
30k
How to merge from branch to branch and back again (bidirectional merging) in SVN?
|svn|version-control|
Using the svnmerge.py tool it is possible to merge between branches, up and down. It is hard to find the details for doing this. Hopefully, v1.5 will have a neat method for doing this without using svnmerge.py - details requested!
A/B test seems a good start, and randomize the participants. You'll have to remember them so they never see both. You could treat it like a behavioral psychology experiment, do a T-Test etc...
If there is a solution to this problem I seriously doubt it's a part of core C#. Off the top of my head, it would require a database of first, middle and last name frequencies, as well as account for initials, as in your example. This is fairly complex logic that relies on a database of information.
Here are two I haven't seen mentioned: I wish I had read "[Ruminations on C++][1]" by Koenig and Moo much sooner. That was the book that made OO concepts really click for me. And I recommend Michael Abrash's "Zen of Code Optimization" for anyone else planning on starting a programming career in the mid 90s. ...
Sure; just use the <code>bind</code> method to specify the callback after the button has been created. I've just written and tested the example below. You can find a nice tutorial on doing this at http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm from Tkinter import Tk, Button ...
Refactoring and Source Control: How To?
|version-control|tdd|refactoring|
I am completely on board with the ideas behind TDD, Refactoring and Patterns however it does seem like there is a huge gaping whole in these ideas, mainly that they are great for dev teams of 1, but when you start refactoring code that 10 people are working on you start getting merge conflicts all over the place and mo...
The easiest way to check for UTF-8 validity: 1. If only one line allowed: preg_match('/^.*$/Du', $value) 2. If multiple lines allowed: preg_match('/^.*$/sDu', $value) This works for PHP >= 4.3.5 and does not require any non-default PHP modules.
I would suggest that you either take a look at the RESTful_Authentication plug in, which has an implementation of this, or just switch your implementation to use the RESTful Authentication_plugin. There is a good explanation about how to use this plug in at Railscasts: http://railscasts.com/episodes/67-restful-auth...
It really depends on what you mean by "clean implementation". As in any other language, you can use Perl's object system with polymorphism to do this for you. However, since Perl has first class functions, this pattern isn't normally coded explicitly. Leon Timmermans' example of sort { lc($a) cmp lc($b) } @items...
I have to second most of the comments here, Foreign Keys are necessary items to ensure that you have data with integrity. The different options for ON DELETE and ON UPDATE will allow you to get around some of the "down falls" that people mention here regarding their use. I find that in 99% of all my projects I will...
The use of the pragma header in the response is a wives tale. RFC2616 only defines it as a request header [http://www.mnot.net/cache_docs/#PRAGMA][1] [1]: http://www.mnot.net/cache_docs/#PRAGMA
You need to spend quite some time in JConsole or visualvm to get a clear picture on what the plateau memory usage is. Wait until everything is stable and you see the characteristic sawtooth curve of heap memory usage. The peaks should be your 70-80% heap, depending on what garbage collector you use. Most garbage c...
Is there a serializable generic Key/Value pair class in .NET?
|c#|.net|
I'm looking for a key/value pair object that I can include in a web service. I tried using .NET's `System.Collections.Generic.KeyValuePair<>` class, but it does not properly serialize in a web service. In a web service, the Key and Value properties are not serialized, making this class fairly useless, unless someone...
Before and After Suite execution hook in jUnit 4.x
|junit|java|testing|integration-testing|
I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm looking to port back to jUnit. What hooks are available for execution before any tests are run and after all tests have comp...
|java|testing|junit|integration-testing|
I'm trying to preform setup and teardown for a set of integration tests, using jUnit 4.4 to execute the tests. The teardown needs to be run reliably. I'm having other problems with TestNG, so I'm looking to port back to jUnit. What hooks are available for execution before any tests are run and after all tests have comp...
As a session (and its Id) is basically considered of value only for the issueing application, you may rather look for setting an additional cookie. Have a look at Tomcats SingleSignOnValve, providing the extra-Cookie JSESSIONIDSSO (note the ...SSO) for the server path "/" instead of "/applicationName" (as JSESSIONID co...
As a session (and its Id) is basically considered of value only for the issueing application, you may rather look for setting an additional cookie. Have a look at Tomcats SingleSignOnValve, providing the extra-Cookie JSESSIONIDSSO (note the ...SSO) for the server path "/" instead of "/applicationName" (as JSESSIONID co...
I think [this][1] is your answer. Looks like it is baked in to ActieMQ. I tried the examples and they seem to work. [1]: http://activemq.apache.org/ajax.html
I think [this][1] is your answer. Looks like it is baked in to ActieMQ. I tried the examples and they seem to work. [http://activemq.apache.org/ajax.html][1] [1]: http://activemq.apache.org/ajax.html
if you need mroe architectural insight use NDepend. This tool does not stop to amaze me. It can do soo much more than FxCop. It's commercial though, but has a free trial version
I don't have experience with ksh, but I have used both bash and zsh. I prefer zsh over bash because of its support for very powerful file globbing, variable expansion modifiers, and faster tab completion. Here's a quick intro: [http://friedcpu.wordpress.com/2007/07/24/zsh-the-last-shell-youll-ever-need/][1] ...
Which resources should one monitor on a Linux server running a web-server or database
|linux|performance|system-administration|
When running any kind of server under load there are several resources that one would like to monitor to make sure that the server is healthy. This is specifically true when testing the system under load. Some examples for this would be CPU utilization, memory usage, and perhaps disk space. What other resource sho...
in bash, something like: function gemMove() { filename=$1 mv backup/gem/$filename gem/$filename mv backup/doc/$filename doc/$filename mv backup/specification/$filename.spec specification } then you can just call `gemMove("foo")` elsewhere in the script.
gVIM has a really good tutorial (link in the Start menu group). I found working through that helped to get over the initial learning hump; and then switching my Visual Studio to ViEMU helped me hone my VI skills.
In my opinion, the more errors and warnings in development, the better. In a live environment, you want a slightly reduced (but only slightly) set, but you want them logged somewhere that they can't be seen by the user (I prefer syslog) http://php.net/error_reporting E&#95;ALL | E_STRICT for development with...
In my opinion, the more errors and warnings in development, the better. In a live environment, you want a slightly reduced (but only slightly) set, but you want them logged somewhere that they can't be seen by the user (I prefer syslog) http://php.net/error_reporting E&#95;ALL | E_STRICT for development with...
showing the key itself isn't inherently bad because it holds no real meaning, but showing the means to obtain access to an item is bad. for instance say you had an online store that sold stuff from 2 merchants. Merchant A had items (1, 3, 5, 7) and Merchant B has items (2, 4, 5, 8). If I am shopping on Merchan...
Is there a benefit to defining a class inside another class in Python?
|python|oop|
So what i'm talking about here are nested classes. So essentially I have two classes that I'm modeling. I have a DownloadManager class and a DownloadThread class. The obvious OOP concept here is composition. However, composition doesn't necessarily mean nesting, right? So I have code that looks something like this: ...
Why isn't there a viable mod_ruby for Apache yet?
|ruby|apache|rubyonrails|
As popular as Ruby and Rails are, it seems like this problem would already be solved. JRuby and mod_rails are all fine and dandy, but why isn't there an Apache mod for just straight Ruby?
|ruby|ruby-on-rails|apache|
Similar thing to RJS (used in Ruby on Rails) in the Java web app world ?
|java|rubyonrails|
In Ruby on Rails, there's RJS templates that help do AJAX by returning javascript code that will be executed in the client browser. How can I do a similar thing in the Java/J2EE world? Is Google Widget Toolkit similar to RJS? What options do I have?
|java|ruby-on-rails|
Some useful advice on how to manage a situation like this is available here: http://www.codeproject.com/KB/dotnet/Localization.aspx
Try using the [__decspec(dllexport)](http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx) magic pixie dust in your C++ function declaration. This declaration sets up several things that you need to successfully export a function from a DLL. You may also need to use WINAPI or something similar: __declspec(dllex...
You can just create a class library project, add a resource file there, and then refer to that assembly for common resources.
Search and replace a line in a file in Python
|python|
I want to loop over the contents of a text file and do a search and replace on some lines and write the result back to the file. I could first load the whole file in memory and then write it back, but that probably is not the best way to do it. What is the best way to do this, within the following code? f...
How do I find the definitive Name Server for a domain name?
|dns|
And for extra credit. Is it possible to find the origins of conflicting DNS records?
How do I find the authoritative name-server for a domain name?
And for extra credit - Is it possible to find the origins of conflicting DNS records?
Create a new file, copy lines from the old to the new, and do the replacing before you write the lines to the new file.
In order to take control over the properties that you want to be cached you can call 'RefreshCache()' passing the properties that you want to hang around: System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(); // Push the property values from AD back to ...
G'day, You might like to look at [ProFPD][1]. Heavily customisable. Based on Apache module structure. From their web site: > ProFTPD grew out of the desire to have a secure and configurable FTP server, and out of a significant admiration of the Apache web server. We use our adapted version for large scal...
I think it is important to target as many users as you can, have you ever considered shipping your application without any managed code at all? You can convert your managed applications to pure machine code using tools such as [http://www.xenocode.com/][1] or [http://www.remotesoft.com/linker/][2] so you won't need any...
I am not sure what you want to do. If you simply want a progress bar that "sweeps" from side to side like on starting Vista you could use: IsIndetermined = true. If you actually want to go from 0% to 100% you have to either animate over the value as shown in this example on msdn: http://msdn.microsoft.com/en-us/lib...
I would think that a PolicyComparer class should do the evaluation.
Use System.Threading.CurrentThread.Identity with the IsInRole() method to check which groups they are a member of. If you cast the Identity to a WindowsIdentity, it will show your Active Directory groups.
Use System.Threading.Thread.CurrentPrincipal with the IsInRole() method to check which groups they are a member of. You do need to set the principal policy of the AppDomain to WindowsPrincipal first. Use this to get the current user name: private string getWindowsUsername() { App...
For WinForms, use System.Threading.Thread.CurrentPrincipal with the IsInRole() method to check which groups they are a member of. You do need to set the principal policy of the AppDomain to WindowsPrincipal first. Use this to get the current user name: private string getWindowsUsername() { ...
Allow user@example or user@localhost in email validation?
|php|email|web-applications|
I'm working on an email validation check and we need to decided whether to allow user@localhost and user@example (notice no .anything) to be validated as a valid email address. This is for an open source project that has a number of use cases on both the web at large and intranets. [RFC 2822][1] (Internet Message Fo...
I don't care for the schema in the diagram. It's rather ugly. **Schema Abstract** **Table: Visit** The Visit table contains one row for each night stayed in a hotel. Note: Visit contains - ixVisit - ixCusomer - dt - sNote **Table: Customer** - ixCustomer - sFirstName - sLastName **Table: St...
Well, [stackoverflow.com][1] is. [1]: http://stackoverflow.com
When downloading a large file I quite often do: while ls -la <filename>; do sleep 5; done And then just ctrl+c when I'm done (or if `ls` returns non-zero). It's similar to the `watch` program but it uses the shell instead, so it works on platforms without `watch`. Another useful tool is netcat, or `nc`. If...
When downloading a large file I quite often do: while ls -la <filename>; do sleep 5; done And then just ctrl+c when I'm done (or if `ls` returns non-zero). It's similar to the `watch` program but it uses the shell instead, so it works on platforms without `watch`. Another useful tool is netcat, or `nc`. If...
Yes, this one.
Second to Levenshtein distance, what language do you want? I was able to find an implementation in C# on codeproject pretty easily.
Folders in Windows aren't subject to the name.extension rules at all, there's only 1 entry in the registry's file type handling for "folder" types. (If you try to change it you're going to have very, very rough times ahead) The only simple way to get the effect you're after would be to do what OpenOffice, MS Office ...
Stackoverflow uses ASP.Net MVC. Seems to be doing pretty well here from my experience with the site.
I'm not sure I understand the question exactly, but you can do something like the following which reads the table in one pass then uses a derived table to calculate it. SQL Server code: CREATE TABLE #testing ( eventdatetime datetime NOT NULL, state varchar(10) NOT NULL ) INSERT I...
I agree with the previous answers in that they are useful to mantain data consistency. However, there was an [interesting post by Jeff Atwood][1] some weeks ago that discussed the pros and cons of normalized and consistent data. In a few words, a denormalized database can be faster when handling huge amounts of dat...
iText is the best library I know. Originally written in Java, there is a .NET port as well. See http://www.ujihara.jp/iTextdotNET/en/
This is entirely dependent on your application and any hardware limitations you may have. There is no one size fits all. jmap can be used to have a look at what heap you are actually using and is a good starting point for right-sizing the heap.
In log4j you can log the thread name with the "%t" pattern. See [log4j Pattern Layout][1]. [1]: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
In VS2008, when I click on the service reference and select "Configure Service Reference", there is an option to choose how the client de-serializes lists returned from the service. Notably, I can choose between System.Array, System.Collections.ArrayList and System.Collections.Generic.List
mysqldump | mysql yields 'too many open files' error. Why?
|mysql|rhel|
I have a RHEL 5 system with a fresh new hard drive I just dedicated to the MySQL server. To get things started, I used "mysqldump --host otherhost -A | mysql", even though I noticed the manpage never explicitly recommends trying this (mysqldump into a file is a no-go. We're talking 500G of database). This process ...
Find/Replacing using Regular Expressions Find: "\s*$" Replace: ""
I remember all the hype around XSLT when the standard was newly released. All the excitement around being able built an entire HTML UI with a 'simple' transform. Let’s face it, it is hard to use, near impossible to debug, often unbearably slow. The end result is nearly always quirky and less than ideal. I will s...
Refactor Mercilessly or Build One To Throw Away?
|refactoring|throw-away|
> Where a new system concept or new technology is used, one has to build a > system to throw away, for even the best planning is not so omniscient as > to get it right the first time. Hence **plan to throw one away; you will, anyhow.** > > -- Fred Brooks, [_The Mythical Man-Month_][1] [Emphasis mine] Build one ...
Use Oracle's own [SQL Developer][1]. If you are mainly working with Oracle, it does everything you'll need. [1]: http://www.oracle.com/technology/products/database/sql_developer/index.html
How do you restart Rails under Mongrel, without stopping and starting Mongrel
|ruby-on-rails|rubyonrails|mongrel|
Is there a way to restart the Rails app (e.g. when you've changed a plugin/config file) while Mongrel is running. Or alternatively quickly restart Mongrel. Mongrel gives these hints that you can but how do you do it? ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals re...
|ruby-on-rails|mongrel|
You should be able to use any good mocking framework to verify that calls to a collaborating object are done in a specific order. However, you don't generally test that one method makes some calls to other methods on the same class... why would you? Generally, when you're testing a class, you only care about test...