instruction stringlengths 0 30k ⌀ |
|---|
Basically, reassigning Object parameters doesn't affect the argument, e.g.,
private void foo(Object bar) {
bar = null;
}
public static void main(String[] args) {
String baz = "Hah!";
foo(baz);
System.out.println(baz);
}
will print out `"Hah!"` instead of ... |
Don't exactly know how this can be done, but I remember some of my friends had to represent this game's grid with a Quadtree for a assignment. I'm guess it's real good for optimizing the space of the grid since you basically only represent the occupied cells. I don't know about execution speed though. |
It's a two dimensional automaton, so you can probably look up optimization techniques. Your notion seems to be about compressing the number of cells you need to check at each step. Since you only ever need to check cells that are occupied or adjacent to an occupied cell, perhaps you could keep a buffer of all such cell... |
I have a detailed step by step guide, but it requires that you use isapi_rewrite. View it at: [http://biasecurities.com/blog/2008/how-to-enable-pretty-urls-with-asp-net-mvc-and-iis6/][1]
[1]: http://biasecurities.com/blog/2008/how-to-enable-pretty-urls-with-asp-net-mvc-and-iis6/ |
Check out [boost.org][1]. It provides a lot of additional functionality, especially their smart pointer implementations.
[1]: http://boost.org |
The Synthesis Toolkit (STK) is excellent, but it is C++ only:
http://ccrma.stanford.edu/software/stk/
You may be able to extract the wavetable synthesizer code from the STK though. |
During internal development, I'm using milestone numbers (M1, M2, M3...). After release, I'll probably just update dates ("the January 2009 update"). |
Since you're moving from LAMP (a somewhat cool acronym) to WIMP (a less cool one), you may need to mentally affirm yourself. Otherwise, I've had very little trouble with PHP on Windows.
ISAPI rewrite (http://www.isapirewrite.com/) is $99 and has worked very well for me for URL rewriting. |
Why not go with Apache on Windows? |
How to collect customer feedback? |
|customer|feedback|user-experience| |
What's the best way to close the loop and have a desktop app "call home" with customer feedback? Right now our code will login to our SMTP server and send me some email. |
You can avoid having to use strtotime() or getdate() in PHP buy using MySQL's UNIX_TIMESTAMP() function.
SELECT UNIX_TIMESTAMP(timestamp) FROM sometable
The resulting data will be a standard integer Unix timestamp, so you can do a direct comparison to time(). |
There are VBA methods to [zip][1] and [unzip][2] using the windows built in compression as well, which should give some insight as to how the system operates. You may be able to build these methods into a scripting language of your choice.
-Adam Davis
[1]: http://www.rondebruin.nl/windowsxpzip.htm
[2]: http... |
Veritas Backup Exec 11d RALUS Communications Error |
|backup|backupexec|redhat|symantec| |
I'm trying to do a file system backup of a RedHat Enterprise Linux v4 server using Symantec Backup Exec 11d (Rev 7170). The backup server is Windows Server 2003.
I can browse the target server to create a selection list, and when I do a test run it completes successfully.
However, when I run a real backup, the j... |
Symantec Backup Exec 11d RALUS Communications Error |
|backup|redhat|backupexec|symantec| |
You could also have the application send a POST http request directly to a URL on your server. |
Avoid finalizers. There is no guarantee that they will be called in a timely fashion. It could take quite a long time before the Memory Management system (i.e., the garbage collector) decides to collect an object with a finalizer.
Many people use finalizers to do things like close socket connections or delete te... |
I am not (currently) a user of jQuery, but I can tell you that you need to temporarily disconnect your event handler while you repopulate the items or, at the least, set a flag that you then test for and based on its value, handle the change. |
What essential design artifacts do you produce? |
|artifacts| |
In the course of your software development lifecycle, what essential design artifacts do you produce? What makes them essential to your practice?
The project I'm currently on has been in production for 8+ years. This web application has been actively enhanced and maintained over that time. While we have CMMI based p... |
Working code...and whiteboard drawings.
:P
|
Java Delegates? |
|java|delegates| |
Does the Java language have delegate features, similar to how C# has support for delegates? |
Windows Forms Application Performance |
|winforms|performance| |
My app has many controls on its surface, and more are added dynamically at runtime.
Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc).
What are your tips and tricks to improve WinForms app performa... |
Another option is to use plain ol' HTTP PUT:
WebClient webclient = new WebClient();
webclient.Credentials = new NetworkCredential(_userName, _password, _domain);
webclient.UploadFile(remoteFileURL, "PUT", FilePath);
webclient.Dispose();
Where remoteFileURL points to your SharePoint document lib... |
Is JINI at all active anymore? |
|jini| |
Everyone I talk to who knows (knew) about it claims it was the greatest thing since sliced bread. Why did it fail? Or, if it didn't fail, who's using it now? |
|java|jini| |
Short story: [no][1].
[1]: http://java.sun.com/docs/white/delegates.html |
An approach I particularly like is to have different life cycle versions in the depot. That is,for example, have a dev version of the code that is where the developers check in code that is in being worked on; then you could have a beta version, where you could add beta fixes to your code; and then a production version... |
Keep in mind that TCP usually keeps multiple messages on wire. If you want to implement this in UDP you'll have quite a lot of work if you want to do it reliably. Your solution is either going to be less reliable, less fast or an incredible amount of work. There are valid applications of UDP, but if you're asking this ... |
A [good starting point][1], and a [nice stock icon site][2]. Some require payment, but there are lots of free sources out there. However, one of your highest priorities for a commercial application is that it looks good enough to buy - [$30 for a good set is cheap][3] compared to the time it takes you to research and... |
@eed3si9n: I'd even suggest that '1' is a magic number. :-)
A principle that's related to magic numbers is that every fact your code deals with should be declared exactly once. If you use magic numbers in your code (such as the password length example that @marcio gave, you can easily end up duplicating that fact, a... |
Combining and Caching multiple JavaScript files in ASP.net |
|asp.net|javascript| |
Either I had a bad dream recently or I am just too stupid to google, but I remember that someone somewhere wrote that ASP.net has a Function which allows "merging" multiple JavaScript files automatically and only delivering one file to the client, thus reducing the number of HTTP Requests.
Server Side, you still kep... |
Organization of C files |
|c|file-organization|header| |
I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why havi... |
I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why havi... |
|c|header|file-organization| |
How to Maintain Correct Javascript Event After Using cloneNode(true) |
|prototype|javascript|clonenode|dom|events| |
I have a form element that contains multiple lines of inputs. Think of each line as attributes of a new object that I want to create in my web application. And, I want to be able to create multiple new objects in one HTTP POST. I'm using Javascript's built-in cloneNode(true) method to clone each line. The problem is ... |
|javascript|events|dom|prototype|clonenode| |
I have a form element that contains multiple lines of inputs. Think of each line as attributes of a new object that I want to create in my web application. And, I want to be able to create multiple new objects in one HTTP POST. I'm using Javascript's built-in cloneNode(true) method to clone each line. The problem is ... |
We use Visual Studio 2008 to maintain a .NET 1.1 WebForms app using [MSBee] [1]. It required a bit of initial *.csproj/msbuild file hackery, but works very well. Of course, you're limited to .NET 1.1 features (it uses the old 1.1 compilers), so no Generics or LINQ. But if you're wanting just one copy of Visual Studio i... |
Just happened across [this article][1] which point out shortcomings in Redhat/Centos/Fedora implementations of Perl which affect <code>URI</code> profoundly.
> I realized that anyone running perl code with the distribution perl interpretter on Redhat 5.2, Centos 5.2 or Fedora 9 is likely a victim. Yes, even if your ... |
Just happened across [this article][1] which point out shortcomings in Redhat/Centos/Fedora implementations of Perl which affect <code>URI</code> profoundly.
If you are running one of these Linux flavours, you might want to recompile Perl
> I realized that anyone running perl code with the distribution perl int... |
What is the best way to display a status message in WPF? |
|wpf| |
I have several wpf pages with update/delete/add buttons. I want to display to the user messages like "successful delete", etc. How can I best implement this so the message is defined in a single place (similar to an asp.net master page) and I can update this message from anywhere? |
One reason is compatibility - anyone who has done 'check for existence' knows to exclude directories; changing that behaviour may confuse those who rely on that behaviour.
Secondly, the underlying code often does a check on the operating system for existence in a catlog of filesystem entries - to the OS, a directory... |
Interprocess communication for Windows in C# (.NET 2.0) |
|c#|.net|ipc| |
I've never had to do IPC on Windows before. Currently I'm developing a pair of programs, a standard GUI/CLI app and a windows service. The app has to tell the service what to do. So, assuming the communication is local only, what would be the best communication method for these two processes?
Where best is defined a... |
Create a Dictionary<int, int> "dict" and then for each member in the first collection, do dict[member]++;
Then, loop over the second collection in the same way, but for each member do dict[member]--.
At the end, loop over all of the members in the dictionary:
private bool SetEqual (List<int> left, List... |
[Microsoft Rights Management Server (RMS)][1] has a similar problem. It just solves it by encrypting its configuration with a master password. ...A password on a password, if you will.
[1]: http://www.microsoft.com/rms |
Things like this are quite common. It all depends on the agreement between the vendor and leasor. It's not limited to software either. Think about buying music, images etc. I have heard of some agreements where you can't transfer the license at all. You just have to buy a new copy. The thing that has to be rememb... |
Hashtable is synchronized, whereas HashMap isn't. That makes Hashtable slower than Hashmap.
For non-threaded apps, use HashMap since they are otherwise the same in terms of functionality. |
Java passes references to objects by value. |
I'd go lambdas... wayyy nicer
var bars = Foos.Select(f => f.Bar).Distinct().ToArray();
works the same as what @lassevk posted.
I'd also add that you might want to keep from converting to an array until the last minute. |
I'd go lambdas... wayyy nicer
var bars = Foos.Select(f => f.Bar).Distinct().ToArray();
works the same as what @lassevk posted.
I'd also add that you might want to keep from converting to an array until the last minute.
LINQ does some optimizations behind the scenes, queries stay in its query form until... |
Two interesting options I have seen, but yet to use professionally, are the screencapture utility and a MacFuse demo.
The screencapture utility has been around since 10.2, according to the man page, and could be linked to a Cocoa application by use of NSTask.
The MacFuse demo worked by creating a new screenshot e... |
There are table-driven solutions for this that resolve multiple cells in each table lookup. A google query should give you some examples. |
GWT has good support for internationalization. See this [link](http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideInternationalization). The [i18nCreator](http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideI18nCreator)... |
if you're going to use the doctype, experiment with the features. As long as they don't go into a production site, and you test them thoroughly, have at it. |
It doesn't appear to be possible. |
The imported project "C:\Microsoft.CSharp.targets" was not found |
|c#|visual-studio| |
I got this error today when trying to open a Visual Studio 2008 **project** in Visual Studio 2005:
The imported project "C:\Microsoft.CSharp.targets" was not found
So I thought I'd post it here in case anyone else is interested |
Open your csproj file in notepad (or notepad++)
Find the line:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
and change it to
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
I'm fairly positive it's nothing you can do. I've seen this on the front page of digg alot recently. It more than likely has to do with a character being encoded improperly. Not necessarily a factor of the font, just a mistake made somewhere in translation. |
Personally I'd say no. There is no clear benefit to HTML5 and in fact would go as far as to say that the whole thing is botched from the start.
Having specialised tags for header, footers and sidebars is a huge mistake - you've got them already in the form of tags (div) and names (classes/id's). Why do we need the s... |
It appears that for this particular author, the text was edited in some editor that assumed it wasn't UTF8, and then re-wrote it out in UTF8. I'm basing this off the fact that if I tell my browser to interpret the page as different common encodings, none make it display correctly. This tells me that some conversion was... |
It appears that for this particular author, the text was edited in some editor that assumed it wasn't UTF8, and then re-wrote it out in UTF8. I'm basing this off the fact that if I tell my browser to interpret the page as different common encodings, none make it display correctly. This tells me that some conversion was... |
Just happened across [this article][1] which point out shortcomings in Redhat/Centos/Fedora implementations of Perl which affect <code>URI</code> profoundly.
If you are running one of these Linux flavours, you might want to recompile Perl from original source (not RPM source).
> I realized that anyone running p... |
You need to modify the AUTHENTICATION_SERVICES entry in SQLNET.ORA to this:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
As well, you will need to setup the accounts in Oracle to match the Windows accounts. Have a look at http://www.dba-oracle.com/bk_sqlnet_authentication_services.htm for more details. |
for f in template_*.txt; do cp $f foo_${#template_}; done
|
for f in template_*.txt; do cp $f foo_${f#template_}; done
|
<pre>
for f in template_*.txt; do cp $f foo_${f#template_}; done
</pre> |
Use the Benchmark standard library and the various tests available in Rails (unit, functional, integration). Here's an example:
def test_do_something
elapsed_time = Benchmark.realtime do
100.downto(1) do |index|
# do something here
end
end
assert elapsed_time < S... |
Use the Benchmark standard library and the various tests available in Rails (unit, functional, integration). Here's an example:
def test_do_something
elapsed_time = Benchmark.realtime do
100.downto(1) do |index|
# do something here
end
end
assert elapsed_time < S... |
Show all libraries used by executables on linux |
|linux| |
I'd like to know which libraries are used by executables on my system. More specifically, I'd like to rank which libraries are used the most, along with the binaries that use them. How can I do this? |
I would say you are not, i have never seen a practice like that before. |
I would say you are not, i have never seen a practice like that before.
edit : well i must be very lucky, seems that it is common. Very glad i have not run across this before :) |
I've implemented complex undo systems sucessfully using the Memento pattern - very easy, and has the benefit of naturally providing a Redo framework too. A more subtle benefit is that aggregate actions can be contained within a single Undo too.
In a nutshell, you have two stacks of memento objects. One for Undo, the... |
For local only, we have had success using Named Pipes. Avoids the overhead of TCP, and is pretty much (at least for .NET) as efficient as you can get while also having a decent API to work with. |
to learn what libraries a binary uses, use ldd
ldd path/to/the/tool
You'd have to write a little shell script to get to your system-wide breakdown. |