fun

Is there a faster/better way to leettime?

I found leettime via twitter, and it's novel enough for me to want to mess around with it/share it with you guys. To my dismay this version doesn't do seconds. It also seems like there might be a more efficient way to generate the time, what do you think? Leet Time Now, how is this leettime calculated? For a given humanti...

Generate words that fit in Guids (just for fun)

I have some tests that use guids. The guids used don't need to be enormously unique, they just need to be guids. Random guids are boring - so I'm trying to find fun guid words. Right now, I don't have anything better than "00000000-feed-dada-iced-c0ffee000000". Ideally I'd generate a list of verbs, nouns, prepositions. Having only spent...

What are some fun programming competition questions?

When I was in university, I helped organize a programming competition for Computer Science students. I believe we had 4 questions in total and allowed an hour for each one. The best received question was: Sort a series of integers such that the order goes from lowest-highest-lowest. eg. If given 1,2,3,4,5,6,7,8,9,10, the correct sor...

Magic Exception thrower without declaring throws Exception.

I want a method that can throw any Throwable including sub classes of Exception. Ive got something that takes an exception, stashes it in a thread local, then invokes a class.newInstance. That class ctor declares that it throws Exception then takes the threadlocal and throws it. Problem is it does not work for the two declared Exceptions...

Visual Studio Extending Ctrl + K, Ctrl + D

I am a bit lazy when it comes to formatting code in Visual Studio and almost rely solely on the magic of Ctrl + K, Ctrl + D (or F depending on what I’m doing). However I loathe having to use my right mouse button to Remove and Sort my using statements and am constantly forgetting. Assuming that I’m not using Re-Sharper is there any way...

What are some programming problems you initially get WORSE at?

In programming, as many professions, there are mistakes you'll make now that you may not have made as a beginner. For instance, consider pointers: In C++, is there any difference between arrays and pointers? The beginner will say yes, they are two completely different concepts, and treat them as such. The intermediate programmer (...

Ideas for Computer Science related Microteaching

This semester, I will be a TA for an introductory computer science course at my university. As part of TA training, I'll be doing something called Microteaching, which is where I teach for 5-7 minutes in front of a small audience (4-5 people) and I am reviewed on my teaching style. Among being critiqued on my personal things like confide...

How to 'detect' a site technology?

I wonder how do +- easy to 'detect' a site server-side web technology (PHP, ASP, etc..) For some sites is enough to see the links extension(.../logout.php, .../search.aspx, etc). On the others, like by example stackoverflow :) I can't clearly see page extensions. Any "recommendations"? Thanks. ...

I would like to interactively detect when an ActiveX component has been installed, and asynchronously refresh a portion of the page

Hello, I am working on a website, and I would like to refresh a portion of the page after an ActiveX component has been installed. I have a general idea of how to do this with polling, which I am working on getting going : function detectComponentThenSleep(){ try{ // Call what I want ActiveX for, if the method is available,...

What funny automatic-response do you know ?

(I don't know how this kind of fun questions are dealt with in here, but I hope it doesn't get deleted (since it's not a dupe, it IS a question, it is (fairly) programming related) just because it's not professional or really important) I've come across this image and I went to windows prompt and noticed that it didn't work anymore:( i...

Vista / Win 7 SDK bufferoverflowu.lib linking error

Hey All, I downloaded the Windows SDK 7.0A to explore some things I was reading about. I downloaded some samples that work with the SDK but when I try to compile them I get an error. I looked in the Lib directory of the SDK and couldn't find it. I also did a full system search and also did not find it. I have read about this being a spe...

Web pages with examples of really stupid HTML

I stumbled upon this site http://www.fujinonbinos.com/, and almost laughed out loud at the ridiculous use of the <font> tag. Seriously, do a View Source! So, I coudn't resist a post here to enquire if anyone else had any other spectacular examples of web pages with daft/stupid/crazy HTML that we could all visit and mock mercilessly! CW...

What happens if I use "throw;" without an exception to throw?

Here's the setup. I have a C++ program which calls several functions, all of which potentially throw the same exception set, and I want the same behaviour for the exceptions in each function (e.g. print error message & reset all the data to the default for exceptionA; simply print for exceptionB; shut-down cleanly for all other exceptio...

Is there a way of checking for membership from the values of a dictionary? Once confirmed, can we do other things?

I understand that it's quite easy to check if a key is available in a dictionary, but what about certain values? So, what I have here is a dictionary of lists where the key references a set of, for consistency's sake, strings. It would look a bit like this: menu = {'breakfast':['soft-boiled eggs', 'hash brown', 'Earl Grey'], ...

Sticky headers in complex web form (a la iPhone)

I'm designing a complex web form (for trained users, not drive-bys) that has many sections, many of which contain subsections. The form could become quite long, depending on the situation. Usability would be greatly enhanced if (sub)section headers would remain visible until the (sub)section has completely scrolled past. For example, wh...

Determining Opcode Cycle Count for a CPU

Hi everyone, I was wondering where would one go about getting CPU opcode cycle counts for various machines. An example of what I'm talking about can be seen at this link: http://www.obelisk.demon.co.uk/6502/reference.html If you examine the MAME source code, especially under src\emu\cpu, you'll see that most of the CPU models keep a t...

How to elegantly say "something unknown is wrong with this program"?

Medicine has the term idiopathic cardiomyopathy. Cardiomyopathy means something is wrong with your heart, and idiopathic means "we have no idea why yours isn't working." I know we have heisenbugs, bohrbugs, mandelbugs, and so on, but I feel I'm lacking one more buzzword: what's the IT cousin to idiopathic cardiomyopathy? What's an eleg...

How can I design an object to represent all HTML form elements?

Disclaimer: This is a personal project that I'm doing for fun. I'm not looking to use existing libraries since it would take some of the joy out of learning more about wheels. That being said, I'm working on a web spider and I've come to the problem of how to represent HTML form elements with a single object. What I want to do is have ...

Are there any "short tricks" in JavaScript 1.8 that I can use to reduce my golf score?

I have recently picked up golfing as a pastime. I've been trying to golf with JavaScript, and the amount of time I have spent with JavaScript 1.8 is about zero. Are there any nifty shortcuts I might be missing out on in JavaScript between 1.5 and 1.8 that I can rely on to reduce my golf score? ...

Developer Interview question - wrongly asked or am I stupid?

There's a blog post comment on this page: http://www.codinghorror.com/blog/2010/02/the-nonprogramming-programmer.html#comments by Paul Jungwirth which includes a little programming task: "You have the numbers 123456789, in that order. Between each number, you must insert either nothing, a plus sign, or a multiplication sign, so that the...