instruction
stringlengths
0
30k
We run into the periodically and it is very frustrating to developers. For some reason reading from the repository seems to be case insensitive but commit cares. I understand the reason why case matters due to Subversion's roots in unix filing systems that are case sensitive, but I really wish you would get the err...
Java Compiler Options to produce .exe files.
|java|windows|compiler-construction|gnu|
What compiler (I'm using gcj 4.x) options should I use to generate an "exe" file for my java application to run in windows?
The best way around this is to educate the developers. After you do an update in TortoiseSVN it shows you a list of affected files. Simply double clicking each file will give you the diff between them. Then you'll be able to see what changed between your version and the latest repository version.
I've always thought that algorithmic questions should be language agnostic. If you want to test the java level of a student, focus on the language: its keywords (from common one like static to more exotic one, like volatile), generics, overloading, boxing/unboxing of variable, standard libraries.
Is there any reason why it has to be on a whiteboard? Personally, I'd rather sit them in front of a keyboard and have them write some code. Our test used to be a simple 100 (IIRC) line Swing text editor. We then broke it a few simple ways, some making the code not compile and some a little more subtle, and gave the ...
Is there any reason why it has to be on a whiteboard? Personally, I'd rather sit them in front of a keyboard and have them write some code. Our test used to be a simple 100 (IIRC) line Swing text editor. We then broke it a few simple ways, some making the code not compile and some a little more subtle, and gave the ...
How do I tokenize a string in C++?
|c++|string|
Java has a convenient split method: String str = "The quick brown fox"; String[] results = str.split(" "); Is there an easy way to do this in C++?
Do note the absence of a WPF `Application` object when hosting in Winforms. This can result in problems if you're taking an existing WPF component and hosting it in Winforms, since resource lookups and the likes will never look in application scope. You can create your own `Application` object if it is a problem.
I've been using BBEdit for years. It's rock-solid, fast, and integrates into my Xcode workflow decently well. (I'm not sure anything integrates into Xcode as well as the built-in editor, but who has time to wait for the built-in editor?) For small team projects which don't use a source control system, or for single ...
Probably not. If you don't understand which bits are 2.0-specific, you're probably going to have to go the trial-and-error route. However, you can probably save yourself quite a bit of work if you go looking for generics beforehand. In my experience, those are the most numerous 1.1-incompatible bits that tend to make i...
You could use a list which would give you the input form. It depends on a) whether people should be able to see each other's submissions and b) who the e-mail should go to. You could set an alert (Actions -> Alert Me) to send an e-mail to a person/people when a new item is added to the list. In Settings -> Lis...
Why are you using an MDI interface? Surely a single window with a TableLayoutPanel or similar providing layout would be more suitable. The only reason you'd want to use a MDI layout is to allow the users to move the windows, which as far as I can tell from your description of the problem isn't desirable anyway?
The above solutions have a couple of common mistakes: http://www.pixelbeat.org/programming/shell_script_mistakes.html 1. for i in `ls ...` is redundant/problematic just do: for i in $1/resources*; do ... 2. [ $i != file1 -a $1 != file2 ] This actually has 2 problems. a. The "$i" is not quoted, hence names wit...
ReadOnly variables must be initialized during object construction, and then cannot be updated afterwards. This won't compile because you can't increment _nextId for that reason. (Shared ReadOnly variables can only be assigned in Shared constructors.) As such, if you remove the ReadOnly modifier on the definition o...
I'd do it like this. Public MustInherit Class Unique Private _UID As Guid = Guid.NewGuid() Public ReadOnly Property UID() As Guid Get Return _UID End Get End Property End Class
Yes, returning multiple values (i.e., a tuple) is definitely pythonic. As others have pointed out, there are plenty of examples in the Python standard library, as well as in well-respected Python projects. Two additional comments: 1. Returning multiple values is sometimes very, very useful. Take, for example, a ...
Ambiguity in Left joins (oracle only?)
|sql|oracle-database|join|
My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); and here it is...
My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix: select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); and here it is...
It's mean that you should put new code in new classes/modules. Existing code should be modified only for bug fixing. New classes can reuse existing code via inheritance. Open/closed principle is intended to mitigate risk when introducing new functionality. Since you don't modify existing code you can be assured that...
It means that you should put new code in new classes/modules. Existing code should be modified only for bug fixing. New classes can reuse existing code via inheritance. Open/closed principle is intended to mitigate risk when introducing new functionality. Since you don't modify existing code you can be assured that ...
What is the difference between the WPF TextBlock element and Label control?
As long as there are no identity columns you can just INSERT Table2 SELECT * FROM Table1 WHERE [Conditions]
Alternative syntax: INSERT tbl (Col1, Col2, ..., Coln) SELECT Col1, Col2, ..., Coln) FROM Tbl2 WHERE ... The select query can (of course) include expressesions, case statements, constants/literals, etc.
"INSERT INTO DestTable SELECT * FROM SourceTable WHERE ..." works in SQL Server.
Is there any disadvantage to returning this instead of void?
|.net|fluent-interface|
Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can't really think of any disadvantages sinc...
Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can't really think of any disadvantages sinc...
Have you tried putting the UI scrollbar onto the stage, binding it to the textfield at design time, and then calling update() during the loaded event? I have had some *interesting* experiences in the past with dynamically creating UIScrollbars at runtime.
There is very little reason for a value type to implement an interface. Since you cannot subclass a value type, you can always refer to it as its concrete type. Unless of course, you have multiple structs all implementing the same interface, it might be marginally useful then, but at that point I'd recommend using a...
There is very little reason for a value type to implement an interface. Since you cannot subclass a value type, you can always refer to it as its concrete type. Unless of course, you have multiple structs all implementing the same interface, it might be marginally useful then, but at that point I'd recommend using a...
You can use [java.lang.Process][1] to do what you want. Once you have created the nested process and have a reference to the Process instance, you can get references to its standard out and err streams. You can periodically monitor those, and call .destroy() if you want to close the process. The whole thing might look ...
You can use [java.lang.Process][1] to do what you want. Once you have created the nested process and have a reference to the Process instance, you can get references to its standard out and err streams. You can periodically monitor those, and call .destroy() if you want to close the process. The whole thing might look ...
Flash is going to be your best solution. Hopefully this will help: http://www.kirupa.com/forum/showthread.php?t=17331
java.lang.Process has a waitFor() method to wait for a process to die, and a destroy() method to kill the subprocess.
I go for a belt and braces appraoch here. I create a 32x32 icon in both the <code>.ico</code> and <code>.png</code> formats called <code>favicon.ico</code> and <code>favicon.png</code>. The name doesn't really matter unless you are dealing with older browsers. 1. Place <code>favicon.ico</code> at your site root to ...
On Windows CE 5 (which is the base for Windows Mobile 6) the storage cards get mounted at the root file system as "Storage Card\", "Storage Card2\", etc. To find out if it's mounted call GetFileAttributes (or the remote version CeGetFileAttributes I believe) passing in the full path ("\Storage Card\"). If it returns...
Added Types in .NET framework 2.0 Service Pack 1
|.net|.net-2.0|
I couldn't find the the newly added types documented anywhere; only the bug fixes are listed. Any ideas...
New Added Types in .NET Framework 2.0 Service Pack 1
Note that GNU Emacs for Windows comes with two executables to start Emacs: "emacs.exe" and "runemacs.exe". The former keeps a DOS-Prompt window in the background, while the latter does not, so when if you choose that distribution and want to create a shortcut, be sure to launch "runemacs.exe". Carl
what about using a *[hashSet][1]*? that way you can do what you want in O(n) where n is the number of items in all the lists combined, and I think that's the fastest way to do it. you just have to iterate over every list and insert the values you find into the hashset When you insert a key that already exists you w...
I found that this article by Microsoft with full VBA worked very well for me. [How to display images from a folder in a form, a report, or a data access page](http://support.microsoft.com/kb/285820/)
> Auron asked: How do you generate a key for the client to encrypt/decrypt the data? Where do you store this key? Well, the key is usually derived from some password the user has chosen. You don't store it, you trust the user to remember it. What you can store is maybe some salt value associated to that user, to inc...
I'm not sure why Idea doesn't use @author tag by default. But you can change this behavior by going to File -> Settings -> File Templates and editing the File Header entry in the "Inculdes" tab.
I'm not sure why Idea doesn't use the @author tag by default. But you can change this behavior by going to File -> Settings -> File Templates and editing the File Header entry in the "Inculdes" tab.
The shared integer shouldn't be read-only. A field marked `readonly` can only ever be assigned once and must be assigned before the constructor exits. As the shared field is private, there is no danger that the field will be changed by anything external anyway.
the security you need depends on your application. for example, if the only time the cc# will be used is when the user is logged in (thin online store type scenario), then you can encrypt the cc# with the a hash of the user's plain-text password, a per-user salt, and a dedicated cc# salt. do not store this value perman...
As you, I'm a java/C# developer trying to learn more Ruby On Rails. I'm taking the free online course [Ruby on Rails Programming with Passion][1], is a good introductory course, check it out. We are using [NetBeans][2] as IDE (win/mac/linux/solaris), if you are used to Eclipse or Visual Studio, there is a good ...
There are technical rules, but here are my two rules of thumb: 1) If you are writing something where, if spoken, you would emphasize a word, < strong > and < em > are appropriate. (E.g., "You have got to be <em>sh*tting</em> me, Pyle!") 2) If you are emphasizing a word for a technical reason, but would not emphas...
Yes I believe Flash or a Java-Applet are the only ways to do that. Since you cannot interact with a microphone you must use some sort of browser-plugin, its the only way to use the microphone. I'm not aware of any other plugin that would provide that features. A quick search on Google did not reveal any further possi...
Download Ruby 1.9 source, and issue `make golf`, then you can do things like this: make golf ./goruby -e 'h' # => Hello, world! ./goruby -e 'p St' # => StandardError ./goruby -e 'p 1.tf' # => 1.0 ./goruby19 -e 'p Fil.exp(".")' "/home/manveru/pkgbuilds/ruby-svn/src/...
Since you're switching to Ubuntu eventually anyways, I highly recommend using erlang-mode for emacs (which comes bundled with the Erlang distribution). It is officially what all the core developers use and what many other developers use because of the many features it offers you. Installing the Erlang distribution i...
|wpf|.net-3.5|
Visually both of the following snippets produce the same UI. So why are there 2 controls.. **Snippet1** <TextBlock>Name:</TextBlock> <TextBox Name="nameTextBox" /> **Snippet2** <Label>Name:</Label> <TextBox Name="nameTextBox" /> (*Well I am gonna answer this myself... thought this is...
Best way to write a conversion function
|coding-style|
Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter? Example 1 - separate parameters: function conver...
The only way to truly protect yourself against this sort of attack is to rigorously filter all of the input that you accept, specifically (although not exclusively) from the public areas of your application. I would recommend that you take a look at Daniel Morris's [PHP Filtering Class][1] (a complete solution) and al...
To insert comments select the beginning characters of the lines using CTRL-v (blockwise-visual, not 'v' character wise-visual or 'V' linewise-visual). Then go to insert-mode using 'I', enter your comment-charater(s) on the first line (for example '#') and finally escape to normal mode using 'Esc'. Voila! To remove t...
To insert comments select the beginning characters of the lines using CTRL-v (blockwise-visual, not 'v' character wise-visual or 'V' linewise-visual). Then go to insert-mode using 'I', enter your comment-character(s) on the first line (for example '#') and finally escape to normal mode using 'Esc'. Voila! To remove ...
Label has an important **focus handling** responsibility.Its purpose is to allow you to place a caption with an access key. It has a **Target** property, which indicates the target of the access key. Like this... <Label Target="{Binding ElementName=nameTextBox}">_Name:</Label> <TextBox x:Name="nameTextBox" ...
Dynamic navigation and web applications
|asp.net|database|web-applications|database-design|
I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming. Examples: (1) a "contact us" form or (2) a report generator How should I represent/reference the programming within the database? Should I have a...
How do I make dynamic content with dynamic navigation?
|asp.net|database|web-applications|database-design|
I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming. Examples: (1) a "contact us" form or (2) a report generator How should I represent/reference the programming within the database? Should I have a...
I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming. Examples: (1) a "contact us" form or (2) a report generator How should I represent/reference the programming within the database? Should I have a...
Jarrett's answer creates a new table. Scott's answer inserts into an existing table with the same structure. You can also insert into a table with different structure: INSERT Table2 (columnX, columnY) SELECT column1, column2 FROM Table1 WHERE [Conditions]
In general, you should favor interfaces over abstract classes. One reason to use an abstract class is if you have common implementation among derived classes. Of course, you should still declare an interface (IPet) and have that abstract class (PetBase) implement that interface. Interfaces allow the maximum amount of f...
To compile the Java program MyJavaProg.java, type: gcj -c -g -O MyJavaProg.java To link it, use the command: gcj --main=MyJavaProg -o MyJavaProg MyJavaProg.o and then linking to create an executable mycxxprog.exe g++ -o mycxxprog.exe mycxxprog.o
How to create Virtual COM ports..
|communication|port|virtual-com-port|
I am trying to implement a software [Null Modem][1]. Any suggestion how to create virtual COM Ports? Looking for tips, strategy, known techniques, etc.. [1]: http://en.wikipedia.org/wiki/Null_modem
I would suggest you should learn to work with the natural Subversion model if at all possible. In practice we find conflicts are rare, and the type of logic conflict you talk about almost non-existent (I can't recall an instance in the last 4 years in our repository). Team members should check-in changes on as smal...
Checking available stack size in C
|c|stack|mingw|
I'm using MinGW with GCC 3.4.5 (mingw-special vista r3). My C application uses a lot of stack so I was wondering is there any way I can tell programatically how much stack is remaining so I can cleanly handle the situation if I find that I'm about to run out. If not what other ways would you work around the probl...
I'm using MinGW with GCC 3.4.5 (mingw-special vista r3). My C application uses a lot of stack so I was wondering is there any way I can tell programatically how much stack is remaining so I can cleanly handle the situation if I find that I'm about to run out. If not what other ways would you work around the probl...
Hmm... I'd define "building" as something like "preparing, packaging and deploying all artifacts of a software system". The compilation to machine code normally is one of many steps in the build. Others might be checking out the latest version of the code from scm-system, getting external dependencies, setting configur...
Check out [truncate table][1] which is a lot faster. [1]: http://msdn.microsoft.com/en-us/library/aa260621(SQL.80).aspx
Yes, well, deleting 5 million rows is probably going to take a long time. The only potentially faster way I can think of would be to drop the table, and re-create it. That only works, of course, if you want to delete ALL data in the table.
Your app sounds small enough that I would create a fresh project/solution in a separate folder for the 1.1 framework, copy over the necessary files, use the "Add Existing Item" option, and then build. All the problems will bubble up to the surface that way. A rather "ugly" approach, but it'll show you everything you...
Linked to, but not explicitly mentioned here, is exactly when `__all__` is used. It is a list of strings defining what symbols in a module will be exported when `from <module> import *` is used on the module. For example, the following code in a `foo.py` explicitly exports the symbols `bar` and `baz`: __all__...
Quality vs. ROI - When is Good Enough, good enough?
|methodology|quality|success|
A non-development example that comes to mind is that if it costs, say, $10,000 to keep a uptime rate of 99%, then it theoretically can cost $100,000 to keep a rate of 99.9%, and possibly $1,000,000 to keep a rate of 99.99%. Somewhat like calculus in approaching 0, as we closely approach 100%, the cost can inc...
I'm asking this from a **development perspective**, however to illustrate, a canoical *non-development* example that comes to mind is that if it costs, say, $10,000 to keep a uptime rate of 99%, then it theoretically can cost $100,000 to keep a rate of 99.9%, and possibly $1,000,000 to keep a rate of 99.99%. So...
Great, I created the console app and indeed, the app is not crazy, CurrentCulture is in spanish, but for THAT User in THAT machine only. If I run the console app as another user it returns english for all cultures. Should I open a new question asking where are user-wise locale settings?
OK so while I was writing the question, I came up with a workaround which will work for now. I put a global JavaScript variable in act as a boolean on whether or not the icon is being hovered over. Then, I attach events to the image's onmouseover and onmouseout events and write functions that will set this value. Fi...
**EDIT:** My "workaround" below is complete overkill, based on my lack of understanding. Go with Shog9's answer above. OK so while I was writing the question, I came up with a workaround which will work for now. I put a global JavaScript variable in act as a boolean on whether or not the icon is being hovered ove...
Go with the first option, but rather than allow literal strings (which are error prone), take constant values or an enumeration if your language supports it, like this: convertTemperature (TempScale.CELSIUS, TempScale.FAHRENHEIT, 22)