challenge

Most efficient code for the first 10000 prime numbers?

I want to print the first 10000 prime numbers. Can anyone give me the most efficient code for this? Clarifications: It does not matter if your code is inefficient for n >10000. The size of the code does not matter. You cannot just hard code the values in any manner. ...

Project Suggestions

I'd like suggestions for a small project to work on this fall. Something I can work on a few hours a week that will keep me entertained and help me learn new things about a particular language, coding style, etc. I like to program in PHP and Java but am very interested in coding something using Python or Perl. Any good ideas?...

Can I specify a class wide group on a TestNG test case?

I have a base class that represents a database test in TestNG, and I want to specify that all classes extending from this class are of a group "db-test", however I have found that this doesn't seem possible. I have tried the @Test annotation: @Test(groups = { "db-test" }) public class DBTestBase { } However, this doesn't work because...

Where can you find fun/educational programming challenges?

I've searched around for different challenge sites, and most of them seem to be geared towards difficulty in problem solving logically, rather than trying to use your language of choice to do something you haven't used it for. Their center is around mathematics rather than function design. Some kind of point system for correctly solvin...

Where do you go to tickle your brain (to get programming challenges)?

Possible Duplicate: Where can you find fun/educational programming challenges? I am sure we all have some place to go to get our brain teased! Sometimes i visit Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Alth...

Challenge Sites

Post sites with good programming, math, or algorithm challenges/problems/puzzles to solve. Things to stretch your mind, creativity, and logical thinking. (One site per answer, please.) ...

What criteria should be used to judge and compare Java applications?

I have to support a Java Programming Challenge for students and we have to come up with some technical criteria to judge their java application. What is the best way to compare and judge an application, based on the code and the documentation? Edit to give more details about the challenge: The students are supposed to develop an applica...

How do you extract macros programmatically from OpenOffice.org Writer document using .NET?

How do you extract the Macro code from an OpenOffice.org Writer document using the .NET API? I got an answer to the "Office 2007" version of this question, but we are evaluating OpenOffice as an alternative -- if anyone has any experience with this, any tips or resources would be appreciated. ...

What are some good programming challenge websites?

I used to be a member of +Ma's Reversing, and later became a member of Caesum's Electrica. Recently I've played Bright Shadows. Are there other good sites for a challenge? Question reopened; not a duplicate. Similar, yes, but slightly different. Related: http://stackoverflow.com/questions/24692/where-can-you-find-funeducational-p...

Performance challenge: NAL Unit Wrapping

From what I've seen in the past, StackOverflow seems to like programming challenges, such as the fast char to string exercise problem which got dozens of responses. This is an optimization challenge: take a very simple function and see if you can come up with a smarter way of doing it. I've had a function that I've wanted to further op...

Dynamicaly populating a combobox with values from a Map based on what's selected in another combobox

Ok, here's one for the Java/JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc. So, the map looks something like this (this is just an e...

Program to analyze a lot of XMLs

I have a lot of XML files and I'd like to generate a report from them. The report should provide information such as: root 100% a*1 90% b*1 80% c*5 40% meaning that all documents have a root element, 90% have one a element in the root, 80% have one b element in the root, 40% have 5 c elements in b. If for example some documents h...

How do I find the install time and date of Windows?

This might sound like a little bit of a crazy question, but how can I find out (hopefully via an API/registry key) the install time and date of Windows? The best I can come up with so far is to look at various files in C:\Windows and try to guess... but that's not exactly a nice solution. ...

How do I know if Windows has just recovered from a BSOD?

From http://support.microsoft.com/kb/317277: If Windows XP restarts because of a serious error, the Windows Error Reporting tool prompts you... How can my app know that "Windows XP has restarted because of a serious error"? ...

How to discover the type of media inserted in a DVD/CD drive? (java)

When I insert a DVD or CD, I want to programmatically know what type of media(DVD or CD) is it. ...

What was the funnest programming challenge you were ever tasked with?

The funnest thing I ever got paid to do was a compete in a competition. I the "Unix Guy" was tasked with using C# and .NET to build a client/server database application. Our resident "Windows Guy" was given the same specification and tasked with building the same application on Linux with Trolltech QT toolkit. I had NO .NET experience an...

Automagic unit tests for upholding Object method contracts in Java?

When developing Java applications, I often override Object methods (usually equals and hashCode). I would like some way to systematically check that I'm adhering to the contract for Object methods for every one of my classes. For example, I want tests that assert that for equal objects, the hash code is also equal. I'm using the JUnit...

Knowing the plaintext, how to discover the encryption scheme used?

I have some char() fields in a DBF table that were left encrypted by a past developer in the project. However, I know the plaintext result of the decryption of several records. How can I determine the function/algorithm/scheme to decrypt the original data? These are some sample fields: For cryptext: b5 01 02 c1 e3 0d 0a plaintext s...

Challenge: elegantly LINQify this procedural code

string[] filesOfType1 = GetFileList1(); string[] filesOfType2 = GetFileList2(); var cookieMap = new Dictionary<string, CookieContainer>(); Action<string, Func<string, KeyValuePair<string, CookieContainer>>> addToMap = (filename, pairGetter) => { KeyValuePair<string, CookieContainer> cookiePair; try { cookiePair = pairGetter(fi...

How do I create a recursive query in MSSQL 2005?

Let's say I have the following table: CustomerID ParentID Name ========== ======== ==== 1 null John 2 1 James 3 2 Jenna 4 3 Jennifer 5 3 Peter 6 5 Alice 7 5 Steve 8 1 Larry I want to retrieve in one query all th...