fun

Numeric Representations Without Machine Primitives

Synopsis Post examples in any language of a type that represents integers without making direct use of machine integers. Include mappings to and from the user-defined type. Points for efficiency in space and/or time. Original Question In the comments of a certain rather bold answer to a question about object-oriented programming, I st...

How to learn the Joy of Autotools?

So a couple years back I took some time to grok make, and it's paid off enormously. Writing little makefiles for building my projects and automating tasks is fun and productive. The downside is, of course, that my makefiles are overspecific, especially when it comes to platforms and library locations. So this is the point at which peo...

What is the best songs/musics to make you faster when you coding?

Duplicate: Music to listen to while coding Actually music is very important for me when i am coding. 2 Days ago i discovered this song: www.youtube.com/watch?v=x-64CaD8GXw and during it plays, i feel that i am coding faster. Do you have favorite musics that makes you faster (your ideas, fingers ...) ? PS: Please be positive a...

Short rot13 function

Hi there! I am searching for an short and cool rot13 function in Python ;-) I've written this function: def rot13(s): chars = "abcdefghijklmnopqrstuvwxyz" trans = chars[13:]+chars[:13] rot_char = lambda c: trans[chars.find(c)] if chars.find(c)>-1 else c return ''.join( rot_char(c) for c in s ) Can anyone make it bett...

Code golf: Digital clock

Possible Duplicate: Code Golf: Seven Segments The task: Write the smallest possible program (least number of characters) that takes input in the hh:mm format and outputs this as a digital clock (seven-segment display). Sample input: 19:27 Sample output: _ _ _ | |_| . _| | | _| . |_ | Sample input: 11:...

What's your biggest fear as a programmer?

Please note I am NOT looking for answers like "spiders" well I guess depending on the context that could be an acceptable answer.. But you know what I mean. I am looking for answers like "I cannot keep up with an ever changing field" or "That my data gets hacked" Actual fears that developers have to deal with. ...

What is the biggest mistake you have made as a programmer and what did you learn from it?

We all make mistakes, but some have bigger consequences than others. I'm interested in hearing about the biggest doozies all the smart programmers here have made in the past and how what they learned from it helped them to become a better programmer. Mine: I was developing a website which allowed users to post comments (that were mode...

crash IE and firefox with this simple google search term

Just search eval error Specified cast is not validin google on IE or FireFox and both of them will crash. I am not sure if they are crashing or just closing that window as it doesnt affect other open windows. I tried this with Bing too and the result was same. IE - 8 Firefox - 3.6 Let me know if you get the same results? ...

Have you ever been coerced into using Fear Driven Development

Have you ever, during your career, been forced to use Fear Driven Development, and how did you react to it and handle it ? By Fear Driven Development, I mean a scenario where your boss comes to you and quite literally says "get the project out by [some date in the near future] or you (and possibly the company) are done". I've found tha...

Check if a number is divisible by 3

Not sure if it's a duplicate. But I need to find whether a number is divisible by 3 without using %, / or *. The hint given was to use atoi() function. Any idea how to do it? ...

Amusing Ways to Abuse IE's Rendering

It's really no secret to anyone who has done some web design that Internet Explorer does some funky things with rendering. There's probably lots of examples of weird bugs and workarounds out there, but I'm curious about something slightly different. Instead of bugs that people have to hack around, what bugs have you run into that can act...

How to get a specific sequence like this?

There are 100 numbers: 1,1,2,2,3,3,...,50,50 How can I get a sequence which has 1 number between two 1s, and two numbers between two 2s, three numbers between two 3s,..., and fifty numbers between two 50s using the 100 numbers? Does anyone have a better idea than Bruteforce? Or prove it there's no solution when n = 50. Thanks. ...

Code Challenge - Convert var_dump of array back to array variable

I have never really thought about this until today, but after searching the web I didn't really find anything. Maybe I wasn't wording it right in the search. Given an array (of multiple dimensions or not): $data = array('this' => array('is' => 'the'), 'challenge' => array('for' => array('you'))); When var_dumped: array(2) { ["this"]...

overview and news of/about coding competitions

I just have seen this nice screencast of someone coding for the Ludumdare 48h competition. I seem to miss such contests most of the time and only hear about them when they ended. I would love to attend to some (if it happens that I have time), just for the fun (because I don't know if I would have any chance to actually win). Where wou...

Rotating a section of a two dimensional array.

I've read this SO question on how to rotate a two-dimensional array many times, and I was curious as to how you could expand this situation to work with a section of a two-dimensional array. I've thought about it for a while, and I can't seem to come up with a good equation. Essentially what I'm wanting to do is something like this: ...

What programming tangle is more evil than C++ strings?

I came from Java/C# and am amazed at the sheer ugliness of strings in C++, particularly the variety of C++ types invented to make strings more pleasant that all still seem to be in use somewhere (std::string std::wstring CString null terminated strings, null terminated strings of tchars, ....) and whose interoperability and encodings onl...

Programming lectures teaser

Me and my friend will be running the C++ programming lectures in school from November. (The basics of programming) Obviously programming is still not such an attractive or easy subject that would be popular between young people. So we decided we want to put some teaser posters in school that might help attract people to come and see a...

How many operations would it take to simulate an Atom?

So I got into an argument today with a colleague of mine about how much processing power it would take to simulate a human brain and that it should be possible within the next 15 – 20 years. This argument is based on the assumption that consciousness lies at the atomic level and not at the quantum level or some unknown state below. Base...

Haskell: Deducing function from type

So I was playing around with Haskell today, thinking about autogeneration of function definitions given a type. For example, the definition of the function twoply :: (a -> b, a -> c) -> a -> (b, c) is obvious to me given the type (if I rule out use of undefined :: a). So then I came up with the following: ¢ :: a -> (a ->b) -> b ¢ =...

Solve this PHP puzzle in as few bytes as possible

*EDIT: since some folk's panties are apparently bunching uncomfortably over this, how about just recommending some efficient ways of dealing with similar code? Maybe not specific answers to the problem I posed (my goal anyway, this bit of code golf was merely a means to finding more concise ways of dealing with the basic problems present...