instruction
stringlengths
0
30k
In .NET 2.0 you have to code this yourself. It involves researching daylight savings time laws in various regions and building that into your own data structures. The problem is somewhat simplified if you only care about a subset of time zones, for example just in the USA, but if you need all global time zones, you h...
It looks like this has been reported as a [Java bug](http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6442982). It appears to be caused by using annotations from a 3rd party library (like JUnit) and not including the jar with that annotation in the javadoc invocation. If that is the case, just use the -classpat...
Try the [Web Developer Plugin](https://addons.mozilla.org/en-US/firefox/addon/60) for Firefox. Specifically, the **Information -> Display Block Size** and **Outline -> Outline Block Level Elements** options. This will allow to see the borders of your elements, and their size as Firefox sees them.
I'm getting a java.lang.ClassCastException when generating javadocs. Any ideas?
|java|javadoc|ant|
I'm using ant to generate the javadocs, but it gets this exception over and over. Any help would be appreciated. [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com.sun.tools.javadoc.AnnotationDescImpl.annota...
|java|ant|javadoc|
I'm using ant to generate the javadocs, but it gets this exception over and over. Any help would be appreciated. Jdk 1.6.0_06 [javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com.sun.tools.javadoc.Annotatio...
Unless I'm missing something, `','.join(foo)` should do what you're asking for. >>> ','.join(['']) '' >>> ','.join(['s']) 's' >>> ','.join(['a','b','c']) 'a,b,c'
Unless I'm missing something, `','.join(foo)` should do what you're asking for. >>> ','.join(['']) '' >>> ','.join(['s']) 's' >>> ','.join(['a','b','c']) 'a,b,c' (edit: and as jmanning2k points out, ','.join([str(x) for x in foo]) is safer and quite Pythonic, though the...
I'd rather tab indentation not work than breaking tabbing between form items. If you want to indent to put in code in the Markdown box, use Ctrl+K (or ⌘K on a Mac). In terms of actually stopping the action, jQuery (which Stack Overflow uses) will stop an event from bubbling when you return false from an event cal...
I would advise against changing the default behaviour of a key. I do as much as possible without touching a mouse, so if you make my tab key not move to the next field on a form I will be very aggravated. A shortcut key could be useful however, especially with large code blocks and nesting. Shift-TAB is a bad opti...
You don't have to get out of Ruby to do this, can use the Base64 module in Ruby to encode the document like this: irb(main):005:0> require 'base64' => true irb(main):007:0> Base64.encode64("Hello World") => "SGVsbG8gV29ybGQ=\n" irb(main):008:0> Base64.decode64("SGVsbG8gV29ybGQ=\n") ...
MAC addresses in JavaScript
|javascript|
I know that we can get the MAC address of a user via IE (ActiveX objects). Is there a way to do the same thing in all browsers? (Especially since FF is gaining browser share everyday!)
I guess it depends what database you're using, but Red Gate ([www.red-gate.com][1]) make a tool called SQL Data Generator. This can be configured to fill your database with sensible looking test data. You can also tell it to always use the same seed in its random number generator so your 'random' data is the same eve...
The quick and simple answer is No. Javascript is quite a high level language and does not have access to this sort of information.
If this is for an intranet application and all of the clients use DHCP, you can query the DHCP server for the MAC address for a given IP address.
IE 8 is supposed to have better tools, but the IE Developer Toolbar is pretty good: <http://www.microsoft.com/downloads/details.aspx?FamilyId=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en>
You might find [Firebug Lite][1] useful for that. Its bookmarklet should be especially useful when debugging on a user's machine. [1]: http://getfirebug.com/lite.html
Try it using SQL. - [CREATE FULLTEXT CATALOG][1] - [ALTER FULLTEXT CATALOG][2] Here's an example from Microsoft. --Change to accent insensitive USE AdventureWorks; GO ALTER FULLTEXT CATALOG ftCatalog REBUILD WITH ACCENT_SENSITIVITY=OFF; GO -- Check Accentsensitivity ...
Can UDP data be delivered corrupted?
|c++|networking|udp|
Is it possible for UDP data to come to you corrupted? I know it is possible for it to be lost.
GODI installation issue
|linux|ocaml|godi|
I'm trying to install [GODI][1] on linux (Ubuntu). It's a library management tool for the ocaml language. I've actually installed this before --twice, but awhile ago-- with no issues --that I can remember-- but this time I just can't figure out what I'm missing. $ ./bootstrap --prefix <<path>>/godi $ ./boot...
I'm trying to install [GODI][1] on linux (Ubuntu). It's a library management tool for the ocaml language. I've actually installed this before --twice, but awhile ago-- with no issues --that I can remember-- but this time I just can't figure out what I'm missing. $ ./bootstrap --prefix /home/nlucaroni/godi $...
UDP is slightly quicker in my experience, but not by much. The choice shouldn't be made on performance but on the message content and compression techniques. If it's a protocol with message *exchange*, I'd suggest that the very slight performance hit you take with TCP is more than worth it. You're given a connection...
Each TCP connection requires an initial handshake before data is transmitted. Also, the TCP header contains a lot of overhead intended for different signals and message delivery detection. For a message exchange, UDP will probably suffice if a small chance of failure is acceptable. If receipt must be verified, TCP is y...
I'm the lead developer on an enterprise document management system in which some customers store hundreds of gigabytes of documents. Terabytes in the not too distant future. We use the **file system** approach for many of the reasons mentioned on this page plus another: archiving. Many of our customers must conform...
G'day, As a quick answer I would say to come up with a series of categories and have switchable logging levels, e.g. info, warning, error, critical, etc. Then make it easy to set the logging level to tune the level of detail that you need. Typically, set the logging level in a config file and stop and restart the...
I'm afraid there is no way you can do it without PInvoke. To give focus to some window you should call SetForegroundWindow function, see [this][1] article for details. [1]: http://www.codeproject.com/KB/cs/windowhider.aspx
For *persistence.xml*, specifically, you can put a persistence unit in a separate JAR, which you can deploy separately from your web application WAR, or both together in an EAR archive, depending on what your application server supports. For example, the JBoss manual describes this as [Deploy EAR with EJB3 JAR][1]. ...
Embed audio object in infopath
|infopath|moss|sharepoint|
Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled infopath form? If it is, how do you do it?
|infopath|moss|sharepoint|audio|
Can an audio object be embedded in an InfoPath form ?
|sharepoint|audio|moss|infopath|
Is it possible to embed an audio object (mp3, wma, whatever) in a web-enabled InfoPath form ? If it is, how do you do it ?
Comparison of Lat, Long Coordinates
I used the draggable search in Spy++ (installed with VS) to look at the split open button on the file-open dialog of VS. This revealed that it's an ordinary windows button with a style which includes BS_DEFSPLITBUTTON. That's a magic keyword which gets you to some interesting places, including http://www.codepl...
I usually create a repository and use that to save my entity, then retrieve a fresh one. Then I assert that the retrieved is equal to the saved.
What kind of scrpt generation are you talking about now?, generating create scripts from the objects in the database is way faster in SSMS compared to EM. But if you are running an select or something that gives you lots of rows in the grid, it is crazy slow.. like scripts generating inserts statements of all rows in ...
> Don't tell me -- the functions don't > have any naming convention that tells > you which include file has their > implementation... That brings back > memories (shudder)... How did you guess? ;) > I hope you have weighed the upgrade > you are doing against just rewriting > from scratch -- as long as you a...
If you are not doing a merge in SQL 2008 you must change it to: if @@rowcount = 0 and @@error=0 otherwise if the update fails for some reason then it will try and to an insert afterwards because the rowcount on a failed statement is 0
Try this: var distinctFooBars = (from foo in foos select foo.Bar).Distinct().ToArray();
Take a look at HttpWebRequest. You should be able to construct a request to the URL in question using HttpWebRequest.Method = "POST".
Is Java pass by reference?
|java|programming-languages|reference|
I always thought Java was pass by reference, however I've seen a couple of blog posts that claim it's not. I don't think I understand the distinction they're making. Could someone explain it please? e.g. [This blog][1] [1]: http://javadude.com/articles/passbyvalue.htm
Look into using a [numbers table][1]. While it can be hackish, it's the best method I've come by to quickly query missing data, or show all dates, or anything where you want to examine values within a range, regardless of whether all values in that range are used. [1]: http://andre-silva-cardoso.blogspot.com/20...
Based on the info [here][1], I'd recommend going with HashMap. I think the biggest advantage is that Java will prevent you from modifying it while you are iterating over it, unless you do it through the iterator. [1]: http://www.jguru.com/faq/view.jsp?EID=430247
Optimizing Conway's 'Game of Life'
|language-agnostic|performance|algorithm|
To experiment, I've (long ago) implemented Conway's [Game of Life][1] (and I'm aware of [this][2] related question!). My implementation worked by keeping 2 arrays of booleans, representing the 'last state', and the 'state being updated' (the 2 arrays being swapped at each iteration). While this is reasonably fast, I...
Have you tried the WebClient class? An example might look like: WebClient client = new WebClient(); NameValueCollection data = new NameValueCollection(); data["var1"] = "var1"; client.UploadValues("http://somewhere.com/api", "POST", data);
If a process "doesn't come back", I recommend [strace][1] to analyze how a process is interacting with the operating system. In case of <tt>ls</tt>: $strace ls you would have seen that it reads all directory entries ([getdents(2)][2]) before it actually outputs anything. (sorting… as it was already mention...
How do you OCR an tiff file using Tesseract's interface in c#? Currently I only know how to do it using the executable.
Yes it's possible. In the project properties you can target different versions of the .Net Framework going back to .NET 2.0. Upgrading to VS 2008 will upgrade your Solution file and you won't be able to go back to VS 2005 unless you have backed up your solution
You could also use [Outlook Redemption][1], which is supported from managed code; I'm not immediately sure if it has a simple MAPISendDocuments replacement, but Dmitry's helpful if you have questions. As for "crashes and burns", here's another quote from an MS support guy, [here][2] > It's the sort of thing that...
Actually, VB6 implements [RAII](http://en.wikipedia.org/wiki/RAII) just like C++ meaning that locally declared references automatically get set to `Nothing` at the end of a block. Similarly, it *should* automatically reset member class variables after executing `Class_Terminate`. However, there have been several report...
Moving from Visual Studio 2005 to 2008 and .NET 2.0
|c#|visual-studio|.net|
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather large (25 projects in the solution), I'd like to try VS 2008, since its theoretically faster with larger projects. Before doing such thing, i'd like to know if what I've read is true: can I use VS2008 in ".net 2.0" mode? I don't wa...
|c#|.net|visual-studio|.net-3.5|.net-2.0|
I would take a look at Main Concept's Reference SDK: http://www.mainconcept.com/site/developer-products-6/pc-based-sdks-20974/reference-sdk-21221/information-21243.html It is built for transcoding and, since it is a licensed SDK it doesn't have any of the legal issues surrounding ffmpeg/libavcodec.
Yes, the feature that enables this is Visual Studio 2008 is called multi-targeting. See [this link][1] for more information. To use it you simply open the Properties for your Project, and select the Target Framework you want from the drop-down list on that page. [1]: http://weblogs.asp.net/scottgu/archive/2007/0...
JQuery has animation, but I don't know what it is like on a Mac (I don't have a mac). If things are going slow, then you are probably making the animations too complicated. Remember, JavaScript is a slow language, and DOM is not designed for animation, so try to limit yourself with respect to the number of animations a...
Well, for starters you could use CSS Transformations if the application is Safari-specific. Otherwise JQuery got some built in animations and a big community behind it (and thus, a large plugin repository).
How to profile a rails controller action
|ruby|ruby-on-rails|
What is the best way to profile a controller action in Ruby on Rails. Currently I am using the brute-force method of throwing in "puts Time.now" calls between what I think will be a bottleneck. But that feels really, really dirty. There has got to be a better way.
SSIS: Adding a constant column value when doing a CSV to SQL conversion
|sql-server|csv|ssis|
I am reading in CSV file and translating it to a SQl Table. The kicker is that one of the columns in the table is a type ID that needs to be set to a constant (in this case 2). I am not sure how to do this.
If you call volume to the service gets up too high, you should definitely consider getting your own set of postal data. In most cases, that will provide all of the information that you need, and there are plenty of db tools for indexing location data (i.e. PostGIS for PostgreSQL).
Essentially, yes. I was not sure you could do it like that (current version does not do it like that). When using the python install script, however, there is no option (that I can find) to specify where to put directories and files (eg --prefix). I was hoping to match the current layout of python related files so as t...
This is a [Lisp FAQ][1] (slightly adapted): > **\*\*\* How do I make an executable from my programme?** > This depends on your implementation; you will need to consult your vendor's documentation. > - With ECL and GCL, the standard compilation process will produce a native executable. > - With Lisp...
Well, MSBuild is built in, so if you are doing something simple, then yes, it is recommended. But for something like nightly builds, I would suggest [FinalBuilder][1]. See this [question on Build/Configuration Management Tools.][2] [1]: http://finalbuilder.com [2]: http://stackoverflow.com/questions/6...
You can override the path by setting the environmental variable LD_LIBRARY_PATH. However I would suggest changing the system paths as well so you don't have to change the library path for all users. This can be done using crel. crel -l -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/opt/gnu/lib For the i...
I believe you need to add the following to the Makefile: CFLAGS += -I/opt/gnu/include LDFLAGS += -L/opt/gnu/lib -R/opt/gnu/lib The -I argument tell gcc where to find the include files. The -L flag tells ld where to find the libraries while linking. The -R flag writes /opt/gnu/lib into the library search...
I don't know about the SEO aspect of this (because I never can tell the mambo jambo from the real deal). But as Douglas Crockford pointed out in one of his javascript webcasts the browser always stops for parsing the script, at each <script> element. So, if possible, I'd rather deliver the whole document and enhance th...
UDP used a 16 bit checksum. It is not impossible for it to have corruption, but it's pretty unlikely. In any case it is not more susceptible for corruption than TCP.
I use two search engines: [IconFinder][1] and [IconLook][2]. If you can't find what you want, this [blog post][3] has a list of great resources. [1]: http://www.iconfinder.net/index.php?q=file [2]: http://www.iconlook.com/search.icon?q=file&s12=on&s16=on&s22=on&s32=on&s48=on&s64=on&s128=on [3]: http:...
It is worth noting that sometimes you do want non-configurable "hard-coded" numbers in your code. There are a number of [famous ones][1] including 0x5F3759DF which is used in the optimized inverse square root algorithm. In the rare cases where I find the need to use such Magic Numbers, I set them as a const in my c...
The way the FogBugz screenshot setup tool does this is that it appends a 256 byte block at the end of the setup program at the moment it is downloaded. In other words, the download script spits out all the bytes from setup.exe and then an extra 256 with the url for the FogBugz server, plus any padding. Windows igno...
The latest iPhone OS Programming Guide has a full section on this, with sample code. I am sure this is a recent addition, so maybe you missed it. It explains all the conditions you have to comply with; basically... - set the Info.plist properties (this changes the position of the status bar, but not the view) -...
The MSDN Documentation seems to miss one thing though, I had to set the content type manually, but otherwise, it works like a charm :-) MailMessage msg = new MailMessage(username, nu.email, subject, body); msg.BodyEncoding = Encoding.UTF8; msg.SubjectEncoding = Encoding.UTF8; AlternateView htm...
@jmanning2k using a list comprehension has the downside of creating a new temporary list. The better solution would be using itertools.imap which returns an iterator from itertools import imap l = [1, "foo", 4 ,"bar"] ",".join(imap(str, l))
Really you're only doing four calculations, so ***readability seems way more important*** here than efficiency. My approach to make something like this more readable is to 1. Extract common code to a function 2. Put similar calculations together to make the patterns more obvious 3. Get rid of the intermediate...
|sorting|comparison|
I have a list of more than 15 thousand latitude and longitude coordinates. Given any X,Y coordinates, what is the fastest way to find the closest coordinates on the list?
Working, usable and stable. It's well tested since quite a lot of mono's own low-level functionality has to be marshaled through it to the underlying operating system. There are some <a href="http://www.mono-project.com/Interop_with_Native_Libraries">P/Invoke extensions</a> when compared to Microsoft .Net implementa...
For a typical desktop app, I'd store everything on the current session, and maybe store info messages for the past n sessions or up to x in size. I'm assuming that your messages are organized. We use 4 categories; errors, warnings, info, and trace. We're still figuring out what goes at which level. As I'm getting us...
**Ruby** - The [Free Ruby on Rails Training Online Course by Sang Shin][1] Isn't too bad. It also has a decent amount of further reading links on each subject in the course [1]: http://www.javapassion.com/rubyonrails/
1. Go to menu View 2. Click on Design Tasks 3. Select Controls in the 'Design Tasks' Task pane 4. Click on the 'add or remove custom controls' button to install your custom control 5. Click on the Add button and select ActiveX Control 6. Select the Windows Media Player control 7. Select the necessary properties ...
Edit: My apologies, I missed that the question was about Web forms - for which the below does not work. Must learn to read the question fully! 1. Go to menu View 2. Click on Design Tasks 3. Select Controls in the 'Design Tasks' Task pane 4. Click on the 'add or remove custom controls' button to install your cus...