fun

Is it possible to find the distance between two routers?

I was thinking about making a fun project that would tell me where I am throughout my house. My idea was to put two routers in different spots of the house at the same height and then send ping requests or something and check the latency, from that it should be able to triangulate where I am in the house. I know this would only really ...

Good/Funny/Useful mnemonic devices?

In order to keep the OSI model straight in my head, I dreamt up the silly mnemonic: P. Diddy Never Takes Shit, Punk Ass! (Physical, Data, Network, Transport, Session, Presentation, Application) Similarly I was first learning Perl, I rearranged (some of) the regex modifiers to: SIXMOP GC (as in 6 of the things you use to clean the floo...

What would programming languages look like if every computable thing could be done in 1 second?

Inspired by this question Suppose we had a magical turing machine with infinite memory, and unlimited CPU power. Use your imagination as to how this might be possible, e.g. it uses some sort of hyperspace continuum to automatically parallelize anything as much as is desired, so that it could calculate the answer to any computable quest...

How do I program using cat?

In this xkcd comic: they mention that real programmers use cat. Well, I was asking myself: how could you program using the cat command? ...

What is a good piece of low cost electronic kit for programming?

Now that systems are so powerful, there doesn't seem to be anything like the fun challenge of trying to get the most out of some 8-bit micro and with less than 64kb memory. Is there something (that isn't an emulator) which can provide a similar experience? ...

What is the best or most interesting use of Extension Methods you've seen?

I'm starting to really love extension methods... I was wondering if anyone her has stumbled upon one that really blew their mind, or just found clever. An example I wrote today: Edited due to other users' comments: public static IEnumerable<int> To(this int fromNumber, int toNumber) { while (fromNumber < toNumber) { yield...

rails session model

How can I treat important session info as if it were a model? I've started toying with it, and some of it works. But I'm not sure what I'm missing? Does anyone know a good place to start or where I can find some good examples? Also, I'm able to use the model to set session variables, but what about getting them from the model as op...

How can I describe a bug as a feature?

I often hear of situations where a bug in a program is passed off as a feature. This seems like a useful skill to have. Please describe a technique for doing this - preferably with specific examples. ...

What games gave you most helpful ideas and concepts for our profession?

We all like to play games from time to time. Playing games is not only a way to spend time, but often is a good source of concepts related to various parts of life and science. Examples: importance of good resource management and parallel execution early in the game in resource-constrained RTS's (e.g. Warcraft); importance of good risk...

The Skyline Problem.

I just came across this little problem on UVA's Online Judge and thought, that it may be a good candidate for a little code-golf. The problem: You are to design a program to assist an architect in drawing the skyline of a city given the locations of the buildings in the city. To make the problem tractable, all buildings are rectangular...

Programming on (not *for*) an Android device

Are there any interpreters available for the Android platform for any language at all? If so, do they work with both physical and on-screen keyboards? ...

Regular expression joke explanation

I love regex. I’ve used them with grep, Perl, Java, C, and a variety of others. I have Jeffery Friedl’s awesome book on them, and I studied their theory in college. But for years I have been haunted by a famous regex joke: Q: What did one regular expression say to the other? A: .* which I first saw on Slashdot, years ago. ...

Do you ever try to explain how fun programming is?

As you all know, there is nothing more fun than writing software. I guess we all remember occasions where we had to force ourselves to get up from behind our monitor to get something to eat or to go to bed. The odd thing is, non-programmers (mere mortals ;-)) often see programming as the most boring thing a man can do for a living. They ...

Algorithm challenge: Generate color scheme from an image

Background So, I'm working on a fresh iteration of a web app. And, we've found that our users are obsessed with being lazy. Really lazy. In fact, the more work we do for them, the more they love the service. A portion of the existing app requires the user to select a color scheme to use. However, we have an image (a screenshot of t...

1x10^49 in decimal - how binary bits is that and how would you convert it to binary?

I've encountered a website that uses a 50-digit decimal integer ID in a URL query string, which seems a little excessive. The smallest 50-digit decimal number is 1.0 x 10^49, otherwise known as: 1000000000 0000000000 0000000000 0000000000 0000000000 How many bits would the binary representation contain? How would you approach conver...

What is your amazing user test eye opener?

Lassooing users and putting them down to monkey around with your application may be the best way to spot deficiencies in your freshly baked program. But it is also where some jaw-dropping things occur. Stuff you really did not expect to happen, made you facepalm for your own stupidity or the users, let us in on the fun! My story is ...

recursion: cut array of integers in two parts of equal sum - in a single pass

Using recursion, find an index that cuts an array in two parts so that both parts have equal sum. Cut means to cut like with a knife. All the cells with index <= to the result must be equal in their sum to the all the cells with index > to the result. No cells can be left off or be part of both sides. The arrays contains arbitrary inte...

Funniest or Strangest Compiler Error?

What is the funniest or strangest error message you have ever seen from a compiler? My personal favorite is one I came across with java: cannot cast boolean to Boolean Any others? ...

Creating a board game simulator (Python?) (Pygame?)

I've decided to start working on programming an old favorite of mine. I've never done a game before and also never done a large project in Python. The game is the old Avalon Hill game Russian Campaign I've been playing with PyGame a little bit and was wondering if there were reasons not to try to do this with PyGame and go after some o...

Online Python interpreter for use *from* the iPhone?

Is there an online Python interpreter or some such that would allow me to try out simple python code from my iPhone? Something like try ruby! (in your browser) for Python, and works with the iPhone? ...