instruction stringlengths 0 30k ⌀ |
|---|
Do the vi and emacs implementations for Windows behave like their Unix counterparts? |
|windows|emacs|vi| |
If not, what are the significant differences? |
Recommended Source Control Directory Structure? |
|source|control|svn| |
I am going to be using Subversion for source control on a new J2EE web application. What directory structure will you recommend for organizing code, tests and documentation?
|
|svn|version-control| |
If it needs to be cross platfrom, I would suggest looking at Boost [Asio][1].
[1]: http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio.html |
I updated the question to be more clear. I understand why initialization with a literal changes the serialVersionUID but not why dynamic initialization changes it. If you initialzie with a method, the value, of course, may always be different.
Setting the serialVersionUID explicitly is fine in a subsequent version... |
The two reflection-like solutions I know of from my C++ days are:
1) Use RTTI, which will provide a bootstrap for you to build your reflection-like behaviour, if you are able to get all your classes to derive from an 'object' base class. That class could provide some methods like GetMethod, GetBaseClass etc. As for ... |
which ones?
I use `gvim` on Windows and `MacVim` on the mac. Seem similar enough to be the same to me... |
I split var all over the places, the only questionable places for me are internal short types, e.g. I prefer <code>int i = 3;</code> over <code>var i = 3;</code>
|
|exception|ide|debugging|try-catch| |
Setting FormBorderStyle = None will remove the title bar (at both design and
run time) - and also remove your ability to resize the form.
If you need a border you can set:
ControlBox = false
Text = ""
|
Matt, thanks very much, and likewise longneck and jirv.
This post was partly an experiment, testing the quality of stackoverflow discourse. If you guys/gals/alien lifeforms are representative, I'm sold.
And on point, you've clarified my thinking considerably. Mind, I still might not necessarily *implement* your ... |
How do download accelarators work? |
|html|download|accelerator| |
We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of users.... |
How do download accelerators work? |
We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of users.... |
In Oracle, to insert multiple rows into table t with columns col1, col2 and col3 you can use the following syntax:
INSERT ALL
INTO t (col1, col2, col3) VALUES ('val1_1', 'val1_2', 'val1_3')
INTO t (col1, col2, col3) VALUES ('val2_1', 'val2_2', 'val2_3')
INTO t (col1, col2, col3) VALUES ('... |
A recent application I wrote that _had_ to use multithreading (although not unbounded number of threads) was one where I had to communicate in several directions over two protocols, plus monitoring a third resource for changes. Both protocol libraries required a thread to run the respective event loop in, and when thos... |
You can replace img with span and use a background image with each span, depending on a css class:
<p class="..."><span class="pin"></span><span> </span><span class="pin"></span>...
<p class="..."><span class="pin"></span><span> </span><span class="pin"></span>...
<p class="..."><span class="... |
Continuing the <code>Comparator</code> theme, you may also want to take a look at the [Google Collections][1] API. In particular, they have an interface called [Predicate][2], which serves a similar role to <code>Comparator</code>, in that it is a simple interface that can be used by a filtering method, like [Sets.fil... |
Continuing the <code>Comparator</code> theme, you may also want to take a look at the [Google Collections](http://code.google.com/p/google-collections/) API. In particular, they have an interface called [Predicate](http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicate.html), which... |
I've had good success with eAccelerator (speed improvement with no load is noticable) but XCache also seems pretty promising. You may want to run some trials with each though, your application might scale differently on each. |
Go to Java/Editor/Content Assist/Advanced in Preferences, and make sure that the correct proposal kinds are selected. Same kind of thing happened to me when I first moved to 3.4. |
Expression trees are useful when you need to access function logic in order to alter or reapply it in some way.
Linq to SQL is a good example:
//a linq to sql statement
var recs (
from rec in LinqDataContext.Table
where rec.IntField > 5
select rec );
If we didn't have expres... |
I think the answer might depend on the type of web applications you are running. I had to make this decision myself two years ago and couldn't decide between Zend Optimizer and eAccelerator.
In order to make my decision, I used ab (apache bench) to test the server, and tested the three combinations (zend, eaccelerat... |
The main problem with dependency injection is that, while it gives the apparience of a loosely coupled architecture, it really isn't.
What you're really doing is moving that coupling from the compile time to the runtime, but still if class A needs some interface B to work, an instance of a class which implements int... |
Get `df` to show updated information on FreeBSD |
|filesystems|system-administration|freebsd| |
I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running `df`. When I run `du -d0` on the partition it shows the correct value. Is there any way to force this information to be updated? What is causing the ou... |
You could set a short session timeout (eg 5 mins) and then get the page to poll the server periodically, either by using Javascript to fire an XmlHttpRequest every 2 minutes, or by having a hidden iframe which points to a page which refreshes itself every 2 minutes.
Once the browser closes, the session would timeout... |
I don't know C#, but...
In java:
String[] nums = String.split(yourString, "&?foo[]");
The second argument in the <code>String.split()</code> method is a regex telling the method where to split the String. |
Python 3000 will have [Abstract Base Classes][1]. Well worth a read.
[1]: http://www.python.org/dev/peps/pep-3119/ "PEP 3119: Abstract Base Classes" |
I tend to do it with my own collection if I want to shield the access to the actual list. When you are writing business objects, chance is that you need a hook to know if your object is being added/removed, in such sense I think BOCollection is better idea. Of coz if that is not required, List<BO> is more lightweight. ... |
You have to use System.Diagnostics.Process.
Check out: http://www.devx.com/tips/Tip/20044 |
Normally it's done with a named Mutex (use <tt>new Mutex( "your app name", true )</tt> and check the return value), but there's also some support classes in Microsoft.VisualBasic.dll that <a href="http://www.hanselman.com/blog/TheWeeklySourceCode31SingleInstanceWinFormsAndMicrosoftVisualBasicdll.aspx">can do it for you... |
Not a shrink-wrapped library per se, but Luca Bolognese of Microsoft has [a series of blog posts][1] where he builds a C# library for functional programming with types like tuples, records, type unions and so on:
Also Linq is basically a library for functional programming with syntactial support in C#.
[1]: h... |
I cant see why you would want to have the same markup accross different projects, if you do, I dont know an easy way.
However with code, obviously you can write a code file which inherits from
System.Web.UI.MasterPage
Put in whatever logic you want in all your master pages in there. Build it as your aweso... |
At the most of the time I simply go with the List<BusinessObject> way, as it gives me all the functionality I need at the 90% of the time, and when something 'extra' is needed, I inherit from it, and code that extra bit. |
I've used IM at the last three places I have worked. Currently the building that I am in is so large that it takes a couple of minutes just to walk to my managers office. Then there are the days that we work from home (1-2 days a week). Email for some purposes just doesn't cut it and the phone can be too disruptive and... |
You'll get a more comprehenisve overview of Download Accelerators at [wikipedia]( http://en.wikipedia.org/wiki/Download_accelerator ).
Generally their biggest benefit is managing downloads so that it remembers Start/Stop offsets transferred and uses "partial" and 'range' headers to request parts of the file instead... |
Are POD types always aligned? |
|c++|c|visual-c++| |
For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior? |
For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior?
some more info:
a. It is possible to explicitely create a misaligned integer (*bar):
> char foo[5]
>
> int * bar = (int *)(&fo... |
How can I use the JDT in eclipse to import classes? |
|eclipse|eclipse-jdt| |
I want to do the following imports in a class
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org... |
I think you need quotes inside the string too. Try:
@RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a'',''114c61f2-8935-4755-b4e9-4a598a51cc7f'''
You could also consider parsing the @RespondentFilters into a temporary table.
|
You are on the right track. To get the data from the proxy object back into one of your own objects, you have to do left-hand-right-hand code. i.e. copy property values. I'll bet you that there is already a generic method out there that uses reflection.
Some people will use something other than a web service (.ne... |
TestDriven.NET is not running my SetUp methods for MbUnit |
|mbunit|.net|tdd| |
I've created some MbUnit test fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the tests with TestDriven.NET it does not run the SetUp methods at all.
Does ... |
|mbunit|.net|tdd|testdriven.net| |
I've created some MbUnit Test Fixtures that have SetUp methods marked with the SetUp attribute. These methods run before the tests just fine using the MbUnit GUI, the console runner, and the ReSharper MbUnit plugin. However, when I run the tests with TestDriven.NET it does not run the SetUp methods at all.
Does ... |
|.net|visual-studio|tdd|mbunit|vista64|testdriven.net| |
I think it fits best when you are modeling something cohesive with state and associated actions on those states. I guess that's kind of vague, but I'm not sure there is a perfect answer here.
The thing about OOP is that it lets you encapsulate and abstract data and information away, which is a real boon in building... |
I haven't had a problem just using unix-style path separators, even on Windows (though it is good practice to check [File.separatorChar][1]).
The technique of using [ClassLoader.getResource()][2] is best for read-only resources that are going to be loaded from JAR files. Sometimes, [you can programmatically determin... |
Just a note - the width is always influenced by something happening on the client side - PHP can't effect those sorts of things.
Setting a common class on the elements and setting a width in CSS is your cleanest bet. |
Depends on the server, but the simplest solution I know of, using Apache:
**[FakeBasicAuth][1]**
> "When this option is enabled, the Subject Distinguished Name (DN) of the Client X509 Certificate is translated into a HTTP Basic Authorization username. This means that the standard Apache authentication methods c... |
I've been using XCache for more than a year now with no problems at all.
I tried to switch to eAccelerator, but ended up with a bunch of segmentation faults (it's less forgiving of errors). The major benefit to eAccelerator is that it's not just an opcode cache, it's also an optimizer.
You should fully test out y... |
The previous two responses seem pretty reasonable. As for whether the commandline switch will work, it depends how quickly your memory usage hits the limit. If you don't have enough ram and virtual memory available to at least triple the memory available, then you will need to use one of the alternate suggestions given... |
My own rule of thumb:
I never throw Exception, except in unit tests when what you throw is irrelevant and theres no reason to spend any extra time on it.
I create my own custom exception type for errors occuring in my custom business logic. This exception type is used as much as possible for recasting other exce... |
Does df --sync work? |
I have always found that ActiveRecord is good for quick CRUD-based applications where the Model is relatively flat (as in, not a lot of class hierarchies). However, for applications with complex OO hierarchies, a [DataMapper][1] is probably a better solution. While ActiveRecord assumes a 1:1 ratio between your tables a... |
t4 is the codesmith killer for Microsoft!!!!
Go check it out. Microsoft doesn't want to destroy their partners so they don't advertise it, but it is a thing to be reckoned with and ITS FREE and comes installed in Visual Studio 2008.
[www.olegsych.com][1]
[codeplex.com/t4toolbox][2]
[www.t4editor.net][3]
... |
T4 is the CodeSmith killer for Microsoft!!!!
Go check it out. Microsoft doesn't want to destroy their partners so they don't advertise it, but it is a thing to be reckoned with and ITS FREE and comes installed in Visual Studio 2008.
[www.olegsych.com][1]
[codeplex.com/t4toolbox][2]
[www.t4editor.net][3]
... |
Queso GLC is great for this, I've used it to render Chinese and Cyrillic characters in 3D.
http://quesoglc.sourceforge.net/
The Unicode text sample it comes with should get you started.
|
You need single quotes around each GUID in the list
@RespondentFilters = '''8ec94bed-fed6-4627-8d45-21619331d82a'', ''114c61f2-8935-4755-b4e9-4a598a51cc7f'''
|
This is a problem with the usual "postback" way of ASP.NET. If you need to reload a page without this warning, this page must come from a GET, not a POST. You could do a Response.Redirect("...") yourself. But this will destroy the use of viewstate. |
The <code>Comparator</code> option is not bad, especially if you use anonymous classes (so as not to create redundant classes in the project), but eventually when you look at the flow of comparisons, it's pretty much just like looping over the entire collection yourself, specifying exactly the conditions for matching i... |
I think you should just do a quick connection-speed test. Just download some specific sized files, time how long it takes, and you'll know the speed. I agree with the other guy, don't ask them what type of connection they have, what's more important is the speed. Perhaps next year they come out with 100mbit dialup...do... |
asp.net mvc fixes this issue, not an ie7 only problem but a security feature of most browsers. No fix that I know of except you could just update the content in the main form with js rather than reloading the whole page |
I do not believe that there is a way to do that. Instead, why not direct the parent window to a page without a reload.
javascript:window.opener.location='your url'
|
Counter inside xsl:for-each loop |
|xml|xslt|loops| |
In MySQL 5.0 (and MySQL 5.1 with statement based binary logging), only the calling query is logged, so in your case, the INSERT would be logged.
On the slave, the INSERT will be executed and then the trigger will be re-run on the slave. So the trigger needs to exist on the slave, and assuming it does, then it wil... |
Most common bitwise operations |
|c|c++|c#|bit-manipulation|bitwise| |
For the life of me, i can't remember how to set, delete, toggle or test a bit in a bitfield. Either i'm unsure or i mix them up because i rarely need these. So a "bit-cheat-sheet" would be nice to have.
For example:
flags = flags | bit4; // set bit 4
Can you give examples of all the other common operatio... |
Most common C# bitwise operations |
|c#|bit-manipulation|bitwise|flags|enums| |
For the life of me, i can't remember how to set, delete, toggle or test a bit in a bitfield. Either i'm unsure or i mix them up because i rarely need these. So a "bit-cheat-sheet" would be nice to have.
For example:
flags = flags | FlagsEnum.Bit4; // set bit 4
or
if ((flags == FlagsEnum.Bit4)) == ... |
|c#|bit-manipulation|enums|flags|bitwise| |
For the life of me, i can't remember how to set, delete, toggle or test a bit in a bitfield. Either i'm unsure or i mix them up because i rarely need these. So a "bit-cheat-sheet" would be nice to have.
For example:
flags = flags | FlagsEnum.Bit4; // set bit 4
or
if ((flags == FlagsEnum.Bit4)) == ... |
You should look into separating your GUI from your model and implementation.
You could make cManager a singleton if there is only ever meant to be one cManager ever, app-wide.
|
Convert character to ASCII code in Javascript |
|javascript| |
How can I convert a character to its ASCII code using Javascript?
For example, to get 10 from "\n". |
Assuming you're dealing with numbers this pattern should match:
/=(\d+)&?/
|
Yes, that is something that has disappeared in later versions of Rails. There is no need to specify it. |
This had to do with dependency injection. I don't recall the details.
By now it's just a glorified `require`, which you don't need because rails auto-requires files for missing constants. |
Java serialization with static initialization |
|java|serialization| |
In Java, static and transient fields are not serialized. However, I found out that initialization of static fields causes the generated serialVersionUID to be changed. For example, `static int MYINT = 3;` causes the serialVersionUID to change. In this example, it makes sense because different versions of the class woul... |
In Java, static and transient fields are not serialized. However, I found out that initialization of static fields causes the generated serialVersionUID to be changed. For example, `static int MYINT = 3;` causes the serialVersionUID to change. In this example, it makes sense because different versions of the class woul... |
In Java, static and transient fields are not serialized. However, I found out that initialization of static fields causes the generated serialVersionUID to be changed. For example, `static int MYINT = 3;` causes the serialVersionUID to change. In this example, it makes sense because different versions of the class woul... |