instruction stringlengths 0 30k ⌀ |
|---|
Just right click on the folder in TFS, and select Rename. Once you commit the rename, TFS will make the changes on disk for you. As Kevin pointed out, you will want to make sure that everything is checked in, because TFS will remove the old folder and everything in it, and pull down the renamed folder with the curren... |
I'm in a situation now where I have a stream of XML coming in over the wire and I need to instantiate an Entity object that will populate itself from elements in the stream. It's easier to use reflection to figure out which Entity object can handle which XML element than to write a gigantic, maintenance-nightmare condi... |
If regular javascript syntax highlighting is good enough, you can map that to .j files by adding something like this to your .vimrc file:
augroup objective-j
au! BufRead,BufNewFile *.j set filetype=objective-j
au! Syntax objective-j source /usr/share/vim/vim71/syntax/javascript.vim
aug... |
Great question. I'll refer you to [Josh Bloch in Effective Java][1], who writes (item 16) why to prefer the use of interfaces over abstract classes. By the way, if you haven't got this book, I highly recommend it! Here is a summary of what he says:
1. **Existing classes can be easily retrofitted to implement a new ... |
Several people have already answered the 'what', but here are a couple of quick 'whys' that I can think of:
1) because unit tests should to be fast - testing a component that interacts with the network, a database, or other time-intensive resource does not need to pay the penalty if it is done using mock objects. Th... |
It's acceptable as long as you understand the consequences. The main reason you'd have a BLL is to re-use that logic elsewhere throughout your application.
If you have all that validation logic in the presentation code, you're really making it difficult to re-use elsewhere within your application. |
If you want to set priority when launching a process you could use the builtin start command:
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/WAIT] [/B] [command/program]
Use the low through belownormal option... |
Acceptable? Depends who you ask and what your requirements are. Is this app an internal one-off used by you and a few other people? Maybe this is good enough. If it's meant to be a production ready enterprise application that will grow and be maintained over the years, then you probably want to invest more effort up-fr... |
WCF - High availability |
|c#|.net|wcf|soa| |
Is there anyway to configure a WCF service with a failover endpoint if the primary endpoint dies? Kind of like being able to specify a failover server in a SQL cluster...
Specifically I am using the TCP/IP binding for speed, but on the rare occurrence that the machine is not available I would like to redirect traffi... |
Without trying to sound too vague but I think Windows Network Load Balancing (NLB) should handle this for you. |
I've been obsessing over [TikiWiki][1] lately. Although it has "wiki" in the name, its full name is "TikiWiki CMS/Groupware" and it's an interesting piece of software. It has a real everything **and** the kitchen sink feel. It includes support for wiki, blogs, articles, forums, and files out of the box (and a ton of... |
Curses! Beaten to the punch by a Google search. Unfortunately it's true there is no easy way to create draggable tab panes (or any other components) in Swing. So whilst the example above is complete this one I've just written is a bit simpler. So it will hopefully demonstrate the more advanced techniques involved a b... |
Curses! Beaten to the punch by a Google search. Unfortunately it's true there is no easy way to create draggable tab panes (or any other components) in Swing. So whilst the example above is complete this one I've just written is a bit simpler. So it will hopefully demonstrate the more advanced techniques involved a b... |
How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML? |
|wpf|data-binding|xmldataprovider| |
Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding.
Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.
Has anyone found a way to load a dynamic xml string (for example load it fro... |
Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding.
Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.
Has anyone found a way to load a dynamic xml string (for example load it fro... |
|xml|wpf|data-binding|xpath|xmldataprovider| |
If you have control over the machine where you're doing your work, I highly recommend installing [GnuWin32](http://gnuwin32.sourceforge.net/). Just "Download All" and let the wget program retrieve all the packages. You will then have access to cat, grep, find, gzip, tar, less, and hundreds of others.
GnuWin32 is one... |
In my experience, internationalization requires a little more than translating strings. Many strings when translated, require more space on a dialog. Because of this it's useful to be able to customize the dialogs for each language. Otherwise you have to create dialogs with extra space for the translated strings which ... |
I work for a state agency and we do all our deployments using a product called RepliWeb.
It works good because as dev's we have no control over the webservers. But we can deploy to a deployment area and run the RepliWeb job to do the deployment. Not sure on pricing though... |
You don't use an img tag, but an element with a background-image css attribute and set the background-position on hover. They are called css sprites.
A great article explaining how to use css sprites.
http://www.alistapart.com/articles/sprites/
|
Great question. I'll refer you to [Josh Bloch in Effective Java][1], who writes (item 16) why to prefer the use of interfaces over abstract classes. By the way, if you haven't got this book, I highly recommend it! Here is a summary of what he says:
1. **Existing classes can be easily retrofitted to implement a new ... |
I can list following usage for reflection:
- Late binding
- Security (introspect code for security reasons)
- Code analysis
- Dynamic typing (duck typing is not possible without reflection)
- Metaprogramming
Some real-world usages of reflection from my personal experience:
- Developed plugin sy... |
You could create an interface that matched the column names, and then use the Reflection.Emit API to create a type at runtime that gave access to the data in the fields. |
If your product requires the use of the internet, then you can generate a unique id for the machine and use that to check with a license web service.
If it does not, I think going with a commercial product is the way to go. Yes, they can be hacked, but for the person who is absolutely determined to hack it, it is u... |
Found something that I wanted:
Google's [AJAX Feed API][1] has a load feed and lookup feed function (Docs <a href="http://code.google.com/apis/ajaxfeeds/documentation/reference.html#_intro_fonje">here</a>).
a) [Load feed][2] provides the feed (and feed status) in JSON
b) [Lookup feed][3] provides the RSS feed ... |
I've settled with a combination of both answers:
dict((key, value) for key, value in f.__dict__.iteritems()
if not callable(value) and not key.startswith('__')) |
Are there legitimate uses for JavaScript's "with" statement? |
|javascript|best-practices|language-features| |
[Alan Storm's comments][1] in response to my answer regarding the [`with` statement][2] got me thinking. I've seldom found reason to use this particular language feature, and had never given much thought to how it might cause trouble. Now, i'm curious as to how i might make effective use of `with`, while avoiding its p... |
Spell Checking Service with python using mod_python |
|spell-checking|aspell|mod-python| |
What is the best available method for developing a spell check engine (for example, with aspell_python), that works with apache mod_python ? apache 2.0.59+RHEL4+mod_python+aspell_python seems to crash. Any alternative to using aspell_python ? |
How about a hierarchy of [TestFixture]s classes? Put the common test code in the base test class and inherit it into child test classes.. |
I think the question is phrased incorrectly. C# vs. Java is much less interesting in terms of cross-platform usage than is (a) which platforms you need to support, and (b) considering the core libraries and available third party libraries. The language is almost the least important part of the decision-making process. |
Well the idea is same as that of fryguybob - kinda weird that ObservableCollection is kinda half-done. The event args for this thing do not even use Generics.. making me use an IList (that's so.. yesterday :)
Tested Snippet follows...
using System.Collections.Generic;
using System.Collections.ObjectModel;
... |
So wait, you want to write CSS for Safari using only CSS? I think you answered your own question. Webkit has really good CSS support. If you are looking for webkit only styles, try [here][1].
[1]: http://qooxdoo.org/documentation/general/webkit_css_styles |
foreach access the index or an assocative array |
|php|foreach| |
I have the following code snippet.
$items[A] = "Test";
$items[B] = "Test";
$items[C] = "Test";
$items[D] = "Test";
$index = 0;
foreach($items as $key => $value)
{
echo "$index is a $key containing $value\n";
$index++;
}
Expected output:
0 is a A co... |
foreach access the index or an associative array |
I have the following code snippet.
$items['A'] = "Test";
$items['B'] = "Test";
$items['C'] = "Test";
$items['D'] = "Test";
$index = 0;
foreach($items as $key => $value)
{
echo "$index is a $key containing $value\n";
$index++;
}
Expected output:
0 i... |
Just type perfmon into Start > Run and press enter. When the Performance window is open, click on the + sign to add new counters to the graph. The counters are different aspects of how your PC works and are grouped by similarity into groups called "Performance Object".
For your questions, you can choose the "Process... |
Just type perfmon into Start > Run and press enter. When the Performance window is open, click on the + sign to add new counters to the graph. The counters are different aspects of how your PC works and are grouped by similarity into groups called "Performance Object".
For your questions, you can choose the "Process... |
I use AQTime, it is one of the best profiling tools I've ever used.
It isn't free but you can get a 30 day trial, so if you plan on a optimizing and profiling only one project and 30 days are enough for you then I would recommend using this application. ([http://www.automatedqa.com/downloads/aqtime/index.asp][1])
... |
The main I get from the pdb is line numbers and real method names for stack traces. |
I've seen used most in <code>while</code> loops:
<pre>
string s;
while(read_string(s), s.len() > 5)
{
//do something
}
</pre>
It will do the operation, then do a test based on a side-effect. The other way would be to do it like this:
<pre>
string s;
read_string(s);
while(s.len() > 5)
{
//do someth... |
AFAIK it would be compiled as <code>new A<b>(c) > d</code>. This is the only reasonable way to parse it IMHO. If the parser can't assume under normal circumstances a > end a template argument, that would result it much more ambiguity. If you want it the other way, you should have said <code>new A<(b > c)>(d);</co... |
SpecialCells in VSTO |
|vsto| |
I'm trying to use the SpecialCells method in a VSTO project using c# against the 3.5 framework and Excel2007.
Here's my code:
Excel.Worksheet myWs = (Excel.Worksheet)ModelWb.Worksheets[1];
Range myRange = myWs.get_Range("A7", "A800");
//Range rAccounts = myRange.SpecialCells(XlCellType.x... |
|.net3.5|excel|vsto| |
|vsto| |
Visual Web Developer Express and .NET, et al. |
|asp.net|visual-studio|licensing| |
I'm coming from the open source world, and interested in giving ASP.NET a spin. But I'm having a little trouble separating the tools from the platform itself in regards to the licensing. I've downloaded Visual Web Developer 2008 Express, but not sure how different this is from one of the full-featured Visual Studio lic... |
|asp.net|visual-studio|licensing|legal| |
I voted for mharen's answer, and commented on it as well, but since the comments are hidden by default let me explain it again:
The reason you would want to use the regex validator rather than the custom validator is that the regex validator will also automatically validate the regex client-side using javascript, if... |
Automating DB Object Migrations from Source Control |
This might be a case where [CSLA][1] is applicable. It was designed to provide complex undo support to objects in Windows Forms applications.
[1]: http://www.lhotka.net/ |
I've used both PHPUnit & **[SimpleTest](http://simpletest.org/)** and I found **SimpleTest** to be easier to use. |
I've used both PHPUnit & **[SimpleTest](http://simpletest.org/)** and I found **SimpleTest** to be easier to use.
As far as TDD goes, I haven't had much luck with it in the purest sense. I think that's mainly a time/discipline issue on my part though.
Adding tests after the fact has been somewhat useful but my f... |
I've used both PHPUnit & **[SimpleTest](http://simpletest.org/)** and I found **SimpleTest** to be easier to use.
As far as TDD goes, I haven't had much luck with it in the purest sense. I think that's mainly a time/discipline issue on my part though.
Adding tests after the fact has been somewhat useful but my f... |
Well, for security reasons you should not input any user entered data into queries. If you stick with this rule, I don't see the problem of having select permission. |
The [Yahoo pattern library][1] has a useful wee bit about breadcrumbs too.
[1]: http://developer.yahoo.com/ypatterns/pattern.php?pattern=breadcrumbs |
Take a look at [CLucene][1] - It's a well maintained C++ port of java Lucene. It's currently licenced under LGPL and we use it in our commercial application.
Performance is incredible, however you do have to get your head around some of the strange API conventions.
[1]: http://clucene.wiki.sourceforge.net/ |
I had to do this when write a solver for a peg-jump puzzle game. I made each move a Command object that held enough information that it could be either done or undone. In my case this was as simple as storing the starting position and the direction of each move. I then stored all these objects in a stack so the prog... |
You'll have to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3 (or whatever version you have). I have the VBA SDK and such on my box - so this may not be exactly what office ships with.
Also you have to enable access to the VBA Object Model specifically - see the "Trust Center" in Word o... |
|asp.net-mvc|master-pages| |
I've started to work a bit with master pages for an ASP.net mvc site and I've come across a question. When I link in a stylesheet on the master page it seems to update the path to the sheet correctly. That is in the code I have
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
but look... |
Bluetooth parking |
|bluetooth| |
How do I park a Bluetooth connection? I'm trying to communicate with dozens of Bluetooth devices, and the time to re-establish a connection is unacceptable. I've read that you can park connections, but not found anything that answers how to do this. |
Seems there's a bug in the 0.6 version of the gem (possibly coinciding with change made to finders in Rails 2.1) as detailed in the google group thread about <a href="http://groups.google.com/group/rubycas-server/browse_thread/thread/ba965e423c86682e#">this same issue</a>. You could try installing a <a href="http://co... |
Seems there's a bug in the 0.6 version of the gem (possibly coinciding with change made to finders in Rails 2.1) as detailed in this <a href="http://code.google.com/p/rubycas-server/issues/detail?id=48">bug ticket</a>. In the meantime, you could try <a href="http://code.google.com/p/rubycas-server/source/checkout">ins... |
I posted a [similar question][1] that focused on the multithreading issues of setting a unique instance id. You can review it for details.
[1]: http://stackoverflow.com/questions/41792/instance-constructor-sets-a-static-member-is-it-thread-safe |
GD and GD::Graph are probably your best bets, you can use them to create images that you can then embed into whatever you need. |
how to copy text from emacs to another application |
|emacs|editing|copy-paste| |
when i yank text in emacs, i can't paste it anywhere else. i'm reduced to opening kate to copy the text with ^C. is there a better way? |
How to copy text from Emacs to another application on linux |
When I yank text in Emacs (in its own window on X, in KDE, on Kubuntu), I can't paste it anywhere else. I'm reduced to opening kate to copy the text with ^C. Is there a better way? |
the XNA Live API doesn't give you access to leaderboards ... so your real only option is to store the scores locally. If you want users to see each other's scores ... you could use two different stores. The player's store for his own save data ... and then title storage to store scores.
Of course then, if the 360 ... |
I think you want `SELECT * FROM INFORMATION_SCHEMA.TABLES`
See [http://dev.mysql.com/doc/refman/5.0/en/tables-table.html][1]
[1]: http://dev.mysql.com/doc/refman/5.0/en/tables-table.html |
I think what you want is MySQL's information_schema view(s):
http://dev.mysql.com/doc/refman/5.0/en/tables-table.html |
Your requirement isn't exactly the best, but if you'd like to hack together a define, one option could be:
#define is_numeric_type_signed(typ) ( (((typ)0 - (typ)1)<(typ)0) && (((typ)0 - (typ)1) < (typ)1) )
However, this isn't considered *nice* or portable by any means. |
Anything that is not a "value type", which essentially covers enums, booleans, and built-in numeric types, will be passed "by reference", which is arguably the same as the C/C++ mechanism of passing by reference or pointer. Syntactically and semantically it is essentially identical to C/C++ passing by reference.
No... |
GD is supported on many hosts
http://uk3.php.net/manual/en/book.image.php |
how to implement shortcut key combination of CTRL or SHIFT + <letter> through javascript? |
|keyboard-shortcuts|ergonomics|javascript|asp.net| |
ASP.NET 2.0 web application, how to implement shortcut key combination of CTRL + <letter>, preferably through javascript, to make web application ergonomically better? How to capture multiple-key keyboard events through javascript? |
|javascript|keyboard|keyboard-shortcuts| |
I would store the data in the Application Cache (Cache object). And I wouldn't preload it, I would load it the first time it is requested. What is nice about the Cache is that ASP.NET will manage it including giving you options for expiring the cache entry after file changes, a time period, etc. And since the items ... |
I wrote one in C many years ago for a project at Frigidaire. The internal card would cause all sorts of fun with memory leaks but I eventually found a solution by allocating arrays at the boundary of the communication card. This was over 8 years ago, I'm sure today's cards are much better and/or using native comm to ... |
Well....Java is actually more portable. Mono isn't implemented everywhere, and it lags behind the Microsoft implementation significantly. The Java SDK seems to stay in better sync across platforms (and it works on more platforms).
I'd also say Java has more tool availability across all those platforms, although ... |
Visual Basic.NET has a similar `With` statement. One of the more common ways I use it is to quickly set a number of properties. Instead of:
someObject.Foo = ''
someObject.Bar = ''
someObject.Baz = ''
, I can write:
With someObject
.Foo = ''
.Bar = ''
.Baz = ''
... |
Java actually is as cross-platform as everyone says it is. There's a JVM implementation for just about any mainstream OS out there (even Mac OS X, finally), and they all work really well. And there's tons of open source tools out there that are just as cross platform.
The only catch is that there are certain nati... |