instruction stringlengths 0 30k ⌀ |
|---|
|java|spring| |
I need to pass a UUID instance via http request parameter. Spring needs a custom type converter (from String) to be registered. How do I register one? |
Perforce is proven to be scalable to 5000+ users on a single server at Google, see:
[Life on the Edge: Monitoring and Running a Very Large Perforce Installation][1]
It would seem that many of the largest software companies use Perforce either exclusively or as their main SCM. For example: Adobe, Cisco, SAP, Symante... |
There appears to be 3 states for the breakpoints in Xcode. If you click on them they'll go through the different settings. Dark blue is enabled, grayed out is disabled and I've seen a pail blue sometimes that required me to click on the breakpoint again to get it to go to the dark blue color.
Other than this make su... |
You can't copy the whole table, you need to copy one rows. From http://support.microsoft.com/kb/308909 (sample code if you follow the link)
"How to Copy DataRows Between DataTables
Before you use the ImportRow method, you must ensure that the target table has the identical structure as the source table. This sampl... |
I have the following script. It replaces all instances of @lookFor with @replaceWith in all tables in a database. However it doesn't work with text fields only varchar etc. Could this be easily adapted?
------------------------------------------------------------
-- Name: STRING REPLACER
-- Author: ADUGGLEBY
... |
How to get the correct Content-Length for a POST request. |
|perl|http|google-app-engine| |
I suppose I might be being a bit picky here but it's important to note DI (Dependency Injection) is a programming pattern and is facilitated by (but does not require) an IoC (Inversion of Control) Framework. IoC Frameworks just make DI much easier, but it's not only DI that they do, they provide a host of other benefit... |
ctrl+a is a special key.
ctrl+a d - [d]etach, leave programs (irssi?) in background, go home.
ctrl+a c [c]reate a new window
ctrl+a [0-9] switch between windows by number
screen -r - get back to detached session
That covers 90% of use cases. Do not try to show all the functionality at the single time. |
In trying to find my answer, I found this on [ANTLR][1] - might be of use
[1]: http://www.ibm.com/developerworks/edu/au-dw-au-parsingwithantlr-i.html |
Type 'syso' then press ctrl-space to expand it to System.out.println().
Tres handy. |
If you use Java at all (and thus IDEA), the IDE's [extensions for custom languages][1] might be of use
[1]: http://www.jetbrains.com/idea/plugins/developing_custom_language_plugins.html |
Windows Communication Foundation [supports REST model since .NET 3.5][1].
You can find documentation and code samples on MSDN:
[REST and POX][2]
Some resources to learn REST:
- [REST documentation on xFront.com][3]
- [Architectural Styles and the Design
of Network-based Software
Architectures... |
Windows Communication Foundation [supports REST model since .NET 3.5][1].
You can find documentation and code samples on MSDN:
[REST and POX][2]
Some resources to learn REST:
- [REST documentation on xFront.com][3]
- [Architectural Styles and the Design
of Network-based Software
Architectures... |
Is there a reason you want to *avoid* putting empty `__init__.py` files in version control? If you do this you won't be able to `import` your packages from the source directory wihout first running distutils.
If you really want to, I suppose you can create `__init__.py` in `setup.py`. It has to be *before* running `... |
Since you want a random element, this will also work:
>>> import random
>>> s = set([1,2,3])
>>> random.sample(s, 1)
[2]
The documentation doesn't seem to mention performance of `random.sample`. From a really quick empirical test with a huge list and a huge set, it seems to be constant time for... |
Since you want a random element, this will also work:
>>> import random
>>> s = set([1,2,3])
>>> random.sample(s, 1)
[2]
The documentation doesn't seem to mention performance of `random.sample`. From a really quick empirical test with a huge list and a huge set, it seems to be constant time for... |
I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option.
http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1
There is a version 1.2, already tested and get the same issue. The post looks something like this.
Host: foo.appspot.com
Use... |
I am using a perl script to POST to Google Appengine application. I post a text file containing some XML using the -F option.
http://www.cpan.org/authors/id/E/EL/ELIJAH/bget-1.1
There is a version 1.2, already tested and get the same issue. The post looks something like this.
Host: foo.appspot.com
Use... |
|perl|https|google-app-engine| |
Any way to handle Put and Delete verbs in ASP.Net MVC? |
|asp.net-mvc|http|rest| |
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview 5 preferably. |
|asp.net-mvc|rest|https| |
Design debate: versioned temporal objects |
|time|portfolio-management|risk-management| |
Interfaces have the distinct advantage of being somewhat "hot swappable" for classes. Changing a class from one parent to another will often result in a great deal of work, but Interfaces can often be removed and changed without a great deal of effect on the implementation class. This is especially useful in cases wh... |
What are some gotchas when retargeting .net 2.0 to 3.5? |
|.net| |
I am currently working on a project that is moving from .NET 2.0 to 3.5 across the board.
I am well aware that 3.5 is basically a set of added functionality (libraries, if you will) on top of what 2.0 offers.
Are there any gotchas that I might hit by simply re-targeting the compiler to 3.5? |
I'm going to run some new tests with the settings to passive tomorrow when maintenance is done here, but I'm not sure that's the issue. We are able to get a directory listing if there are files or subdirectories in that directory. It only fails when the directory we're NLST-ing on is empty.
Would the active/passiv... |
The ImageKit framework in Leopard has an [`IKPictureTaker`][1] class that will let you run the standard picture-taking sheet or panel that you seen in iChat and other applications.
If you don't want to use the standard picture-taker panel/sheet interface, you an use the [QTKit Capture][2] functionality to get an ima... |
Nope
3.5 is completely compatible with 2.0, not the other way around of course |
If you absolutely require that the constructor be private you can try something like this:
public abstract class GenericFactory<T> where T : MyAbstractType
{
public static T GetInstance()
{
return (T)Activator.CreateInstance(typeof(T), true);
}
}
Otherwise you... |
`yacc`/`bison` definitely gives you a leg up, since good linting would require parsing the program. Regex (true regex, at least) might cover trivial cases, but it is easy to write code that the regexes don't match but are still bad style. |
Not sure what the issue was but I solved it by going onto the server and deleting the file Attic/newfile.v in the repository and adding it again. |
I use JetBrains IDEA (a Java IDE) to edit and SQL*Plus to execute. The advantages of using a tool with local version control, seemless integration into Source Version Control, advanced find and highlighting, great editing, 'live templates' and so on for me outweighs any advantage of having it 'database aware' (which wi... |
Sometimes it's appropriate to hide the implementation classes from the user -- in these cases it's better to put them in an foo_internal.h than inside the public class definition. That way, readers of your foo.h will not see what you'd prefer they not be troubled with, but you can still write tests against each of the ... |
How do you keep search engines from indexing text ads? |
|search-engine|ads| |
Is there any way to keep search engines from indexing text ads?
These are basically stylized links.
I have thought about generating images with text or using javascript to write them into a DIV.
What is the best and most accepted way?
|
The [Java tutorial says][1]:
> Terminology: Nested classes are
> divided into two categories: static
> and non-static. Nested classes that
> are declared static are simply called
> static nested classes. Non-static
> nested classes are called inner
> classes.
In common parlance, the terms "nested" and "inne... |
The [Java tutorial says][1]:
> Terminology: Nested classes are
> divided into two categories: static
> and non-static. Nested classes that
> are declared static are simply called
> static nested classes. Non-static
> nested classes are called inner
> classes.
In common parlance, the terms "nested" and "inne... |
I'm sure there is a better generics based solution. But still gave it a shot
public abstract class TwoLetterCode {
public readonly string Value;
public static TwoLetterCode TryParse(string tlc) {
if (tlc == null)
{
return null;
}
... |
I'm sure there is a better generics based solution. But still gave it a shot.
EDIT: As the comment says, static methods can't be overridden so one option would be to retain it and use TwoLetterCode objects around and cast them, but, as some other person has already pointed out, that is rather useless.
How about... |
If you have access to the Apache server status page, try using the ?auto flag:
http://yourserver/server-status?auto
The output is a machine-readable version of the status page. I *believe* you are looking for "IdleWorkers". Here's some simple PHP5 code to get you started. In real life you'd probably want to use c... |
The answer is as always it depends.
<code>set</code> and <code>multiset</code> are appropriate for keeping items sorted but are generally optimised for a balanced set of add, remove and fetch. If you have manly lookup operations then a sorted <code>vector</code> may be more appropriate and then use <code>lower_bound... |
The problem here is that you are trying to split your class between two tables, RootPage and Page.
Unfortunately LINQ to SQL only supports single table inheritence so this would not work.
You would need to merge the two table definitions together and make the RootPage-specific fields nullable. |
The problem here is that you are trying to split your class between two tables, RootPage and Page.
Unfortunately LINQ to SQL only supports single table inheritence so this would not work.
You would need to merge the two table definitions together and make the RootPage-specific fields nullable. e.g.
Page... |
The problem here is that you are trying to split your class between two tables, RootPage and Page.
Unfortunately LINQ to SQL only supports single table inheritence so this would not work.
You would need to merge the two table definitions together and make the RootPage-specific fields nullable. e.g.
Page... |
Is the object in question a MovieClip, and does it have a timeline playing?
If so you will need to stop it before removing.
Also keep in mind that storing a reference to the object in any way (although most commonly in an Event listener) will keep it from getting garbage collected. This includes any references to fu... |
In visual studio, go to help | about and look at the version of Visual Studio that you're using to compile your app. |
First of all I would like to note that nohat's answer simply does not work. Try running it, and look at the output in Data::Dumper to verify that.
That said, your question is not well-posed. It looks like you are using sets as arrays. How do you wish to handle duplicates? How do you want to handle complex data s... |
Logging in securely is very subjective. Full 'security' is not easy to achieve (if at all possible...debatable). However, you can come close.
If POST is not an option, maybe you can use a directory security method such as .htaccess or windows authentication depending on what system you're on.
Both of the above... |
(customize-variable (quote tab-stop-list))
or add *tab-stop-list* entry to *custom-set-variables* in *.emacs* file:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only ... |
I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers.
I'm in the middle of designing an app that does something like portfolio management. The design I have so far is
* Problem: a problem that needs to be solved
* ... |
|time|version|architecture| |
|time|version|architecture|rdbms| |
|architecture|time|version|rdbms| |
Design debate: what are good ways to store and manipulate versioned objects? |
|architecture|time|versions|rdbms| |
I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers.
I'm in the middle of designing an app that does something like portfolio management. The design I have so far is
* Problem: a problem that needs to be solved
* ... |
Always have a working release ready. Treat it like the way SQL server implement snapshot isolation. :)
Continue adding new cool stuffs to a separate copy of the project. Once it is stable, overwrite your release folder and that is your new snapshot. Whenever somebody ask for a demo or release, that way you can alwa... |
Always have a working release (snapshot) ready. Treat it like the way SQL server implement snapshot isolation. :)
Continue adding new cool stuffs to a separate copy of the project. Once it is stable, overwrite your release folder and that is your new snapshot. Whenever somebody ask for a demo or release, that way y... |
You can make a wrapper function `void Wrap(T *t)` that just calls `t->Call()` and have `Render` take such a function together with an object. That is:
void Wrap(T *t)
{
t->Call();
}
void Render(void (*f)(T *), T *t)
{
...
f(t);
...
} |
Yeah, gdb is good for lower level debugging.
You can change threads with the _thread_ command.
e.g
(gdb) thr 2
[Switching to thread 2 (process 6159 thread 0x3f1b)]
(gdb) backtrace
....
You could also check out Python specific debuggers like [WinPDB](http://winpdb.org/about/), or [Pydb](... |
Yeah, gdb is good for lower level debugging.
You can change threads with the _thread_ command.
e.g
(gdb) thr 2
[Switching to thread 2 (process 6159 thread 0x3f1b)]
(gdb) backtrace
....
You could also check out Python specific debuggers like [Winpdb](http://winpdb.org/about/), or [pydb](... |
I did so once by defining a global function "Call" which accepts a pointer to your intance as member
void CallRender(myclass *Instance)
{
Instance->Render();
}
So render becomes:
void Render(void (*Call)(myclass*), myclass* Instance)
{
...
Call(Instance);
...
... |
I Python, __init__.py files actually have a meaning ! They mean that the folder they are in is a Python module. As such, they have a real role in your code and should most probably be stored in Version Control.
You could well imagine a folder in your source tree that is NOT a Python module, for example a folder cont... |
I Python, `__init__.py` files actually have a meaning ! They mean that the folder they are in is a Python module. As such, they have a real role in your code and should most probably be stored in Version Control.
You could well imagine a folder in your source tree that is NOT a Python module, for example a folder co... |
The problem here is that you are trying to split your class between two tables, RootPage and Page.
Unfortunately LINQ to SQL only supports single table inheritence so this would not work.
You would need to merge the two table definitions together and make the RootPage-specific fields nullable. e.g.
Page... |
**set a reference to the Scripting.Runtime library** and then use the FileSystemObject:
Dim fso as New FileSystemObject, aFile as File
if (fso.FileExists("PathToFile")) then
aFile = fso.GetFile("PathToFile")
aFile.Delete
End if |
The best way to grab an RSS feed as the requested string would be to use the System.Net.HttpWebRequest class. Once you've set up the HttpWebRequest's parameters (URL, etc.), call the HttpWebRequest.GetResponse() method. From there, you can get a Stream with WebResponse.GetResponseStream(). Then, you can wrap that st... |
Learn Silverlight or WPF first? |
|silverlight|wpf| |
It seems that Silverlight/WPF are the long term future for user interface development with .NET. This is great because as I can see the advantage of reusing XAML skills on both the client and web development sides. But looking at WPF/XAML/Silverlight they seem very large technologies and so where is the best place to g... |
|subjective|wpf|silverlight| |
|wpf|silverlight| |
Pass Silverlight type to Microsoft AJAX and pass parameter validation |
|javascript|silverlight|htmlbridge| |
I'm working on a Silverlight application where I want to take advantage of the Microsoft ASP.NET AJAX Client library. I'm calling the library using the HTML Bridge that is part of Silverlight 2. Silverlight got great support for passing types between JavaScript and Managed Code, but now I've bumped against a problem.
... |
_MSC_VER should be defined to a specific version number. You can either #ifdef on it, or you can use the actual define and do a runtime test. (If for some reason you wanted to run different code based on what compiler it was compiled with? Yeah, probably you were looking for the #ifdef. :)) |
Try these .Net implementations of Lisp:
- [IronScheme][1]
> IronScheme will aim to be a R6RS
> conforming Scheme implementation based
> on the Microsoft DLR.
- [L Sharp .NET][2]
> L Sharp .NET is a powerful Lisp-like
> scripting language for .NET. It uses a
> Lisp dialect similar to Arc but
> tight... |
The Team Build Tray Notification tool what is included in the [TFS 2008 Power Tools][1] is very useful for this.
![Build Notification Tray tool][2]
See [Buck Hodges' blog for screenshots and more information][3].
[1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=00803636-1D16-4DF1-8A3D-EF1AD4F4... |
[Maybe the bottom of this can help you?][1]
> Standard vi interprets the tab key literally, but there are popular vi-derived alternatives that are smarter, like vim. To get vim to interpret tab as an ``indent'' command instead of an insert-a-tab command, do this:
> set softtabstop=2
[1]: http://www.j... |
I'd say it depends on the kind of programming you want to try. If you want to stay on the OOP side, learn [Python](http://python.org/) or [Ruby](http://www.ruby-lang.org/en/), both languages provide an easy way to create bindings to use your C++ code from a script (for efficiency reasons).
If you need another approa... |
If it's merely the routines you want to use you might try LSharp, which lets you have Lisp expressions in .NET:
[http://www.lsharp.org/][1]
The other way around (using .NET from Lisp) would be RDNZL:
[http://www.weitz.de/rdnzl/][2]
[1]: http://www.lsharp.org/
[2]: http://www.weitz.de/rdnzl/ |
By using the `_MSC_VER` macro. |
I was also sick of these limitations in old versions of Subversion. Yet no one else in my company uses branching and merging. Each of them, when trying a new feature, got another checkout, hack-hack-hack and got rid of it if was bad - commit when good. Just sometimes they commited something bad ;)
So I've started us... |
Here's a very simple Prototype example.
All it does is, on window load, an ajax call which sticks some html into a div.
<html>
<head>
<script type="text/javascript" src="scriptaculous/lib/prototype.js"></script>
<script type="text/javascript">
Event.observe(... |
The solution we use is to have only the single configuration file (web.config/app.config), but we add a special section to the file that contains settings for all environments.
There is a **LOCAL, DEV, QA, PRODUCTION** sections each containing the configuration keys relevant to that environment in our config file(s)... |
I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers.
I'm in the middle of designing an app that does something like portfolio management. The design I have so far is
* Problem: a problem that needs to be solved
* ... |
Graph (Chart) Algorithm |
|algorithm|graph|charts| |
Does anyone have a decent algorithm for calculating axis minima and maxima?
When creating a chart for a given set of data items, I'd like to be able to give the algorithm:
- the maximum (y) value in the set
- the minimum (y) value in the set
- the number of tick marks to appear on the axis
- an optional v... |
|algorithm|graph|charts| |
Response.Redirect with POST instead of Get? |
|asp.net|response.redirect| |
We have the requirement to take a form submission and save some data, then redirect the user to a page offsite, but in redirecting, we need to "submit" a form with POST, not GET.
I was hoping there was an easy way to accomplish this, but I'm starting to think there isn't. I think I must now create a simple other pa... |