instruction stringlengths 0 30k ⌀ |
|---|
Start here - I actually think it's among the best Software Dev books that I've read.
[Expert Spring MVC And Web Flow][1]
Learn the new Annotation-based configuration for MVC classes. This is part of Spring 2.5. Using Annotation-based classes is going to make writing Unit tests a heck of a lot easier. Also being a... |
You should be able to take a backup, clear the lines that are having problems then when you re-open it the designer will fix the code.
The key is that you want to let the designer re-generate, then just validate that all needed lines are there.
That usually works for me, but you just have to be sure to remove al... |
You could store the events as repeating, and if a particular instance was edited, create a new event with the same event ID. Then when looking up the event, search for all events with the same event ID to get all the information. I'm not sure if you rolled your own event library, or if you're using an existing one so i... |
Programming, at least in the declarative sense, comes down to combinations of sequence, alternation, and repetition. One might consider recipe authors as programmers, and therefore very early ones. Think about a recipe: it contains sequence (slice this, then chop that, then heat so and so...), alternation (if you wan... |
Does anybody know how to correctly install ANTLR to work with .Net? |
|antlr| |
The full ANTLR jar is meant to have some embedded Visual Studio solution within it but I can't find it. Hoping someone out there has already overcome this issue. |
Can ANTLR output C# using StringTemplate or any text I want it to like Yacc/Bison or does it only output to java? From the examples I've looked at it appears to be a very java centric tool. |
I would use a 'link' concept for all future recurring events. They are dynamically displayed in the calendar and link back to a single reference object. When events have taken place the link is broken and the event becomes a standalone instance. If you attempt to edit a recurring event then prompt to change all future ... |
Seam examples are quite good - they are stand-alone projects, that you may deploy out of the box. |
How do you switch on a string in XQuery? |
|xml|xquery|switch-statement|case| |
I have an external variable coming in as a string and I would like to do a switch/case on it. How do I do that in xquery? |
From SQL Server 2000 or 2005 you can have it generate scripts for your objects, but I am not sure how well they will transfer to other RDBMS. |
I think I tried to do this a while ago and kind of gave up (I guess you could figure out what int value the OracleTypes.REF_CURSOR is and then use that int value, but that's a hack). If you got the patience you could define a record (or object) type and define the the cursor as a cursor with type since that can be cast... |
In JSF 1.2 you can specify onclick events.
Also, other libraries such as [MyFaces][1] or [IceFaces][2] implement the "onclick" handler.
What you'd need to do then is simply:
<h:commandLink action="#{bean.action}" onclick="if(confirm('Are you sure?')) return false;" />
Note: you can't just do `return con... |
I always create a separate Acme.Stuff.Test project that is compiled separately.
The converse argument is: Why do you want to take the tests out? Why not deliver the test? If you deliver the tests along with a test runner you have some level of acceptance test and self test delivered with the product.
I've heard ... |
read [this][1] by herb sutter. It's exactly what you are asking
[1]: http://www.gotw.ca/gotw/071.htm |
The logger must be static; this would make it non-serializable.
There's no reason to make logger non-static, unless you have a strong reason to do it so. |
I'm fairly certain this problem is caused by the NTFS code in the Win32 subsystem. If you use an Ext2 Installable File System (IFS), you should get case sensitivity on that drive. |
You should use the Server.HtmlEncode method to protect your site from dangerous input.
[More info here][1]
[1]: http://www.asp.net/learn/whitepapers/request-validation/ |
Try making the Logger static instead. Than you don't have to care about serialization because it is handled by the class loader. |
Well (AFAIK) the best way to do this would be to try and compare the messages before they get fragmented for transmission (i.e before the network layer). How you would do this I am not quite sure, but there should be a way.
No idea on the probability that you would be looking at though. |
EDIT: Sorry, my original idea was ridiculous.
You got me interested so I googled a little bit and found [this](http://monkey.org/~jose/software/flowgrep/). If you wanted to write your own tool you would probably have to inspect each payload, the easiest way would probably be some sort of hash/checksum to check for ... |
Tools... Options... Projects and Solutions.... MSBuild project build output verbosity - set to "Detailed", and the build time will appear in the output window |
producing 2 or more short sounds when a web page loads. |
|html|audio| |
I have 6 sound files (1.wav 2.wav etc..) of which 3 different ones have to be heard each time the web page opens. The numbers are selected randomly.
I have tried multiple "embeds" but only the last sound selected gets produced.
I have also tried javascript routines that fiddle the bgsound attribute, however, I was no... |
If your application is web-based you can write tests using tools like [WatiN][1] or [Selenium][2].
If your application is Windows .NET based, you could try [White][3].
[1]: http://watin.sourceforge.net/
[2]: http://selenium.openqa.org/
[3]: http://www.codeplex.com/white |
If you are not worried about conventions and just want to get the job done use realloc. I do this sort of thing for lists all of the time, it goes something like this:
T** list = 0;
unsigned int length = 0;
T* AddItem(T Item)
{
list = realloc(list, sizeof(T)*(length+1));
if(!list) return 0;
list[length] =... |
I agree it is tough. The only thing that keeps me going is to keep in mind the feeling I would have after seeing it complete / shipped / in the hands of customers. |
Depending on where in the spectrum of MVC (that's an overused term) you sit, testing the view could be a mechanical process of ensuring that the correct model methods are called in response to the correct inputs to the view to testing some client side validation to who knows.
A lot of the patterns that have been e... |
replace-char in Emacs Lisp ? |
|emacs-lisp|emacs| |
[I cannot find a question tagged emacs-lisp, so let's start, it will be the first on StackOverflow.]
Emacs Lisp has replace-string but I cannot find a replace-char. If I want to replace "typographic" curly quotes (Emacs code for this character is hexa 53979) with regular ASCII quotes, I write:
(replace-string... |
What is the best grep tool for Windows? |
|windows|grep| |
Any recommendations on [grep](http://en.wikipedia.org/wiki/Grep) tools for Windows? Ideally one that could leverage 64-bit OS.
I'm aware of [cygwin](http://www.cygwin.com/), of course, and have also found [PowerGREP](http://www.powergrep.com/), but I'm wondering if there are any hidden gems out there. |
|windows|grep|subjective|polls| |
What are good grep tool for Windows? |
|windows|grep| |
Any recommendations on [grep](http://en.wikipedia.org/wiki/Grep) tools for Windows? Ideally ones that could leverage 64-bit OS.
I'm aware of [cygwin](http://www.cygwin.com/), of course, and have also found [PowerGREP](http://www.powergrep.com/), but I'm wondering if there are any hidden gems out there. |
:help usr_12.txt
That'll bring up a section in the help system that discusses "Clever Tricks". If those don't get you excited I don't know what will! |
Another pointer for learning OO:
Most OO tutorials will focus on inheritance (e.g. class X extends class Y). I think this is a bad idea. Inheritance is useful, but it can also cause problems. More importantly, inheritance isn't the point of OO. The point is abstraction; hiding the implementation details so you can w... |
[Open Flash Chart II](http://pullmonkey.com/projects/open_flash_chart2/) is a free option that gives very nice output. It does, as you'd expect, require Flash.
[Fusion Charts](http://www.fusioncharts.com/) is even nicer, but is $499. In researching this, I found [a cut-down free version](http://www.fusioncharts.com/... |
It seems more like an issue with SQL reserved words. This is a [good list][1]
[1]: http://developer.mimer.com/validator/sql-reserved-words.tml "SQL Reserved Words" |
This doesn't answer your question, but it may solve your problem. I believe doing something like this should work:
public class MyClass
{
[Embed(source="images/image1.png")] private static var Image1Class:Class;
[Embed(source="images/image2.png")] private static var Image2Class:Class;
... |
Google charts is very nice, but it's not a rails only solution. You simple use the programming language of your choice to dynamically produce urls that contain the data and google returns you back a nice image with your chart.
[http://code.google.com/apis/chart/][1]
[1]: http://code.google.com/apis/chart/ |
- No instant messaging apps running in the background. Trust me, you will survive.
- No email notifications. Instead, dash in and out once every hour or two. Email was never meant to be an instantaneous communication channel - that's what the phone is for.
As a programmer, it takes a good 15-20 minutes to pick... |
I found an answer to my question. I can call
CodeCompiler.ValidateIdentifiers(class1);
where class1 is a CodeObject to validate all identifiers in that CodeDom tree and below. So I can call this right after I create my CodeTypeDeclaration class1 to validate just the class name, or I can build up my CodeDom an... |
You would want to create an event on the control that is subscribed to in the parent. See [OdeToCode][1] for an example.
Here is the article for longevity sake:
Some user controls are entirely self contained, for example, a user control displaying current stock quotes does not need to interact with any other cont... |
I found this page: http://www.codeguru.com/java/articles/199.shtml when I needed to do that.
I don't know if you want the letters 'standing' on each other or all rotated on their side. |
Does a caching-nameserver usually cache the negative DNS response SERVFAIL |
|dns| |
Does a caching-nameserver usually cache the negative DNS response SERVFAIL? |
|dns| |
Does a caching-nameserver usually cache the negative DNS response SERVFAIL?
EDIT:
To clarify the question, I can see the caching nameserver caching negative responses NXDOMAIN, NODATA. But it does not do this for SERVFAIL responses. Is this intentional? |
One thing is that I try to stick to instant messaging when I Communicate with people. In general people will find it natural to communicate back with me via the instant messenger. At least, that's how the culture of my organization works.
The IM is preferable because you can choose to answer it when you're ready - ... |
I always try to avoid as much data repetition as possible. If not all people need to login, you can have a generic `people` table with the information that applies to both people and users (eg. firstname, lastname, etc).
Then for people that login, you can have a `users` table that has a 1~1 relationship with `peopl... |
I wand to construct an MSI which, in its installation process, will deploy itself along with its contained Files/Components, to the TargetDir.
So MyApp.msi contains MyApp.exe and MyAppBootstrapperEmpty.exe (with no resources) in its File Table.
The user launches a MyAppBootstrapperPackaged.exe (containing MyApp.m... |
I found a [web page][1] containing some information about the different optimization levels. One thing a remember hearing somewhere is that optimization might actually break your program and that can be an issue. But I'm not sure how much of a an issue that is any longer. Perhaps todays compilers are smart enough to ha... |
If I remember correctly you are actually dealing with an instance of the web server, not the dll. I don't remember the work around though, but that is the explanation for why that doesn't work. Hopefully someone else can build off of this. |
Okay I tested it with the following code:
string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml><value>受</value></xml>";
XmlWriterSettings settings = new XmlWriterSettings { Encoding = Encoding.Default };
MemoryStream ms = new MemoryStream();
using (XmlWriter writer = XmlTextWrite... |
I don't have a ready made solution, but one thing you could look at are [signals][1] (not sure whether you can safely throw C++ exceptions from them, but it should help for debugging anyway.)
You could install a signal handler for, I think, SIGFPE, and use that for your debugging purposes.
[1]: http://en.wiki... |
If you're willing to consider C#, take a good look at XNA. For hobby projects, assuming what you want is to actually get a game up and running instead of tinkering with complex API code, I cannot recommend it highly enough. It is increasingly mature, well-documented, and, compared to D3D/OpenGL, very quick and easy t... |
I've used unsafe-blocks to manipulate Bitmap-data. Raw pointer-access is significantly faster than SetPixel/GetPixel.
unsafe
{
BitmapData bmData = bm.LockBits(...)
byte *bits = (byte*)pixels.ToPointer();
// Do stuff with bits
}
"fixed" and "unsafe" is typically used when ... |
Store the events as repeating and dynamically display them, however allow the recurring event to contain a list of specific events that could override the default information on a specific day.
When you query the recurring event it can check for a specific override for that day.
If a user makes changes, then you ... |
The ANTLR IDE has option by which you can switch between Java and C# code generation.
Better, consult this article (the Specifying Code Generation section):
http://www.antlr2.org/doc/csharp-runtime.html |
If you're using an older version Rails, Honza's query is close, but you need to add parentheses for the strings that get placed in the IN condition:
Person.find(:all, :conditions => ["created_at > ? AND name IN (?)", date, names])
Using IN can be a mixed bag: it's fastest for integers and slowest for a list o... |
You might need to listen for [selection change](http://java.sun.com/javase/6/docs/api/javax/swing/JList.html#addListSelectionListener(javax.swing.event.ListSelectionListener), and then ensure that the new selection is visible. |
I figured it out!!
This is the code:
import javax.swing.JFrame;
import java.awt.Container;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.JScrollPane;
import java.awt.Dimension;
public class ScrollList extends JFrame {
final int... |
Okay I tested it with the following code:
string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml><value>受</value></xml>";
XmlWriterSettings settings = new XmlWriterSettings { Encoding = Encoding.Default };
MemoryStream ms = new MemoryStream();
using (XmlWriter writer = XmlTextWrite... |
The modulo operator is % (percent sign). To test for evenness or generally do modulo for a power of 2, you can also use & (the and operator) like isEven = !( a & 1 ). |
Typically the POJOs are tested in some context. If you want to perform some logic THAT has to be tested properly (ideally before starting that logic implementation). As for the getters and setters; to test them is usually not necessary as the coverage is obtained by testing the logic:-) Try to check some coverage repor... |
How would I store a date that can be partial (i.e. just the year, maybe the month too) and output it later with the same specifity? |
|ruby-on-rails|database-design|datetime| |
I want to let users specify a date that may or may not include a day and month (but will have at least the year.) The problem is when it is stored as a datetime in the DB; the missing day/month will be saved as default values and I'll lose the original format and meaning of the date.
My idea was to store the real fo... |
If you're trying to connect from one (Leopard) Mac to another, you can use the built-in Screen Sharing functionality; turn the server on from the Sharing System Preferences pane, and either use the network browser (on a LAN) or just open a vnc:// URL.
If you're trying to manage a bunch of Macs, try Apple's [Remote D... |
class Foo
{
inline int SomeFunc() { return 42; }
int AnotherFunc() { return 42; }
};
It is correct that both ways are guaranteed to compile the same. However, it is preferable to do neither of these ways. According to [the C++ FAQ][1] you should declare it normally inside the class defi... |
What is the equivalent of Oracle's REF CURSOR in Postgresql when using JDBC? |
|java|oracle-database|postgresql|plsql|jdbc| |
**In Oracle I can declare a reference cursor...**
TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;
**...and use it to pass a cursor as the return value...**
FUNCTION end_spool
RETURN t_spool
AS
v_spool t_spool;
BEGIN
COMMIT;
OPEN v_spo... |
the gcc option *-fnon-call-exceptions* might be of some use to you. Couldn't find any documentation on it though so your mileage may vary. |
Checkout Data Structures and Algorithms with Object-Oriented Design Patterns in C++
By Bruno Preiss
[http://www.brpreiss.com/][1]
[1]: http://www.brpreiss.com/ |
What do you mean by
> "but it will not act as a real fully functional interface (if the original interface is inactive, then the derived one is also inactive"
?
I can make a new interface, base it on an already existing one, then disable the existing one and the new one still works. Making a second interface ... |
C# - Excluding unit tests from the release version of your project |
|unit-testing|c#|.net|assembly|reference| |
How do you usually go about **separating your codebase and associated unit tests**? I know people who create a separate project for unit tests, which I personally find confusing and difficult to maintain. On the other hand, if you mix up code and its tests in a single project, you end up with binaries related to your u... |
|c#|.net|unit-testing|reference|assemblies| |
Yes, class variables are globally scoped. Have a look in the RTL source for details of how threadvars are implemented. Under Win32 each thread can have a block of memory allocated automatically to it on thread creation. This extra data area is what is used to contain your threadvars. |
**Use regex and now you have two problems.** I would split the thing on dots ("."), then make sure that each part is either a wildcard or set of digits (regex is perfect now). If the thing is valid, you just return correct chunk of the split. |
I would use Flash if i'm trying to add sound into a webpage, you can embed a flash document with no width or height so it will be invisible but still play noise. |
yiwP
yiw: Yank inner word (the word under the cursor). This command also moves the cursor to the beginning of the word.
P: Paste before the cursor. |
yiwP
yiw: Yank inner word (the word under the cursor). This command also moves the cursor to the beginning of the word.
P: Paste before the cursor.
You can then map the e.g.: < ALT > - D to this command:
:nmap < ALT >-D yiwP |
I've got a good idea: **DON'T**!
I hate web sites that play sounds without my telling them to. I use a multi-tabbed browser, and a multi-tasking operating system, and you don't have control of my computer, so don't assume you can play a sound without interfering with other things I'm doing. |
Another easy way to do this is to use the `*` command.
In regular mode, when over a word, type
*:s//\0\0<Enter>
`*` makes the search pattern the current word (e.g. \<abc\\>).
`:s//` does a substitution using the current search pattern, and `\0` in the replacement
section is the matched string.
... |
I'm not aware of assigning `$#ARRAY` being deprecated; `perldoc perldata` from 5.10.0 certainly says nothing about it. It is the fastest way to truncate an array.
If you want something a little more readable, use `splice`:
splice @ARRAY, 43;
(Note `43` instead of `42` - `$#ARRAY` gets you the last index of... |
How do I set the size of emacs' window? |
|emacs|elisp| |
I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my <tt>.emacs</tt> so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my... |