<$BlogRSDURL$>
I rock, you suck
Donate to my Beer Fund


If you enjoyed/hated my blog/have money to burn/are crazy, why not give me your money?
All you have to do is click on the button above.
No? Well, go on to the posts below, then, you prick.


Wednesday, December 29, 2010
 
Divisible by 6 or 7 but not both

I saw this student posting a problem on her blog and decided to have a go at it in Java. The problem is to print out the numbers below 100 that are divisible by either 6 or 7 but not both. The naive solution is to just loop through all the numbers below 100 and test them using the % operator. However, that might be inefficient if the limit was, say 10000000 instead of 100, so I tried to do it without using the modulus operator. It turns out that there wasn't really that significant a difference below 100000000. Ah well, here's the code anyway.

public class SixSeven{
public static void main(String args[]){
int adder=1;
int six=0;
int seven=0;
int limit=100;
while(six six+=6;
seven = six + adder;
if(six>limit||seven>limit)
break;
if(adder==7){
adder = 1;
continue;
}
System.out.println(six);
adder++;
if(adder==7)
continue;
System.out.println(seven);
}
}
}

Labels: ,

 
Monday, August 24, 2009
 
Physician, heal thyself!

Hmm, I saw this post in the morning. While I am not a fan of the national rag myself, in this instance, mainstream journalism clearly got their facts right. So I wrote this comment on his blog.

"Free software does not equate to open source. One good example of free software that isn’t open source include Google Docs, or pretty much most of the Google Apps. Please editor, check Wikipedia the next time something like this lands on your desk."


Ah, actually, the author could have been using "free software" the way the FSF uses it. While not precisely synonymous with the term "open source" as defined by the OSI, it's pretty close.

Ironically, you could have found this information on the wikipedia article on free software. :)


Even more ironically, it was moderated. One would have thought that someone railing about the lack of journalistic quality in mainstream media would have been less quick to censor on his own blog, but that's by the by. The primary irony here was that he actually committed the sin he accused others of (not checking his facts). Physician, heal thyself!

[Edit]
Oops, my nerd rage was too hasty. Apparently the guy's blog is hooked up with Twitter, which was why some comment originally posted on Twitter appeared on the blog but the comment I posted on the blog did not appear. My bad. Sorry, motochan.

Labels:

 
Tuesday, July 28, 2009
 
I have a dirty, dirty mind

So the Zii has finally been released. I took a look at their OS overview and saw the following picture. Immediately, I thought that it plays pr0n out of the box.


Seriously, though, it seems like a cool piece of technology, so go check it out. Also, please donate US$399 to my Beer Fund so I can get one of those. Come on, people, this is no time to be stingy, KTHXBYE.

Labels: ,

 
Friday, July 24, 2009
 
Can you code?



Heheh, this made me snigger a little.

Labels: ,

 
Saturday, June 27, 2009
 
Eclipse is bloated

Why does an IDE require half a gig of disk space? Does it, like, fry my eggs or something? Does it play videos? Isn't it supposed to just help me edit my code?

Seriously.

Labels: ,

 
Friday, April 24, 2009
 
Innocuous News

Hacker News has recently been renamed to Innocuous News by Paul Graham, because someone complained that he kept getting weird looks from people who thought he was a computer criminal. This is the sort of quaint hacker humour that keeps me going back to it everyday.

Labels: ,

 
Sunday, April 19, 2009
 
Password Generator! For great Justice!

The other day, I was talking with a friend about the hassle of having to come up with and remember passwords for every site that I have an account with. So I thought, hey, why not write a password generator capable of coming up with unique passwords for each site based on my handle and a password so that I would only need to remember one password?

Well, why not?

Labels: , , ,

 
 
Blogger pagination hack update

It works for labels now, bitches, and if you're already using it, you don't even have to alter your blogger template to enable it. Enjoy.

Yeah, it's been requested before, but I didn't really want to make the effort of figuring out how to do it (hey, I do have other stuff to do). Then someone was actually industrious enough to find out how and, since it was a minor modification, I implemented it. You guys have Alexander to thank for this.

Labels: , , ,

 
Friday, January 23, 2009
 
Presenting the RequestProcessorFactoryFactory

Yes, you heard me. --> RequestProcessorFactoryFactory

Remember kids, this is what happens to your brain when you do Java.

Labels: ,

 
Tuesday, December 02, 2008
 
Dear Mr. President

My friend and I were talking about long job titles and how there seems to be a generally inverse relationship between the length of a person's job title and his actual ability. We also observed that if your job title doesn't tell people what you actually do, then you're probably not doing much. Take, for instance, the title Deputy Assistant Vice President. I remarked, upon hearing this title, that it's like Number 2 of Number 2 of Number 2, since that's more or less what the words "deputy", "assistant" and "vice" means. You might as well call the job Vice Vice Vice President.

We then came up with the following.


vice(degree){
 if(degree==0)
  return "president";
 return "vice " + vice(--degree);
}


So in this case "vice(3);" would be the title of the guy above.

I think we can all agree that this is a more efficient method (method, get it? haw haw haw) for expressing such titles.

p.s. I am a software programmer, which means I get paid to think about stuff like that.
p.p.s. Yes, I know an iterative function would be more efficient usually, but recursive functions are just cooler.

Labels: ,

 
Tuesday, November 25, 2008
 
How to write unmaintainable code

I found this article absolutely fascinating and hilarious. Beyond the trappings of manic humour, however, there are some pieces of arcane technical knowledge to be gleaned from there. Take this C snippet, for instance.

int arr[2] = {1,2};
int i = 1;


Now, what is the value of i[arr]? Yes, it seems obvious to me now, but I was a little surprised to find that gcc accepted it.

Labels: ,

 
Friday, September 26, 2008
 
I DIDN'T KNOW!

I wonder if anyone will actually write this virus.

Labels: ,

 
Thursday, September 18, 2008
 
Grow a beard! Run as root!

This is hilarious.

Labels: ,

 
Thursday, September 11, 2008
 
Software freedom and downloading the internets

Be there or be square, bitches.




Here's another example of why my friends hate me. There he is, telling me about some serious work he did, and here I am going Chuck Norris on him.
(09:27:27 SGT) CY aka Big Guy: yesterday i downloaded the whole live folder of **** website..

(09:27:34 SGT) Don AQ®: 黄美珍 has an epic voice.: u power

(09:27:38 SGT) Don AQ®: 黄美珍 has an epic voice.: wtf for?

(09:27:48 SGT) Don AQ®: 黄美珍 has an epic voice.: yesterday i downloaded the internets!

(09:27:57 SGT) CY aka Big Guy: fucking took 3 hours

(09:28:23 SGT) CY aka Big Guy: and there is a lot of rubbish

(09:28:27 SGT) Don AQ®: 黄美珍 has an epic voice.: i have the internets stored on my hard drives bitch!

Labels: ,

 
Monday, September 08, 2008
 
Web OSes and density

My friend showed me this hilarious piece just now. I do so admire a man who speaks his mind.

Labels: ,

 
Saturday, August 30, 2008
 
Teching around

I finally received my Neo Freerunner a couple of days ago, and boy, am I psyched. To be honest, as a phone, it totally sucks. Out of the box, the interface is not terribly intuitive, and the GUI runs pretty slowly. Furthermore, the battery lasts about a day when fully charged. However, it is a developer's toy after all, so one must make allowances.

So I've finally gotten a chance to fiddle with it some, and after poring through the wiki, I decided to try installing Debian on it. Yes, motherfuckers, Debian runs on a phone now. I'm actually doing it now as I type this post, because the installation script is running, and there's basically nothing you can do except wait while it does its work.

Anyway, since this is an entirely new platform to me, it's kinda scary. After all, the phone did cost some SG$600, and I haven't even heard of any hackers in Singapore who are playing around with it. So if I brick my phone, I'm pretty much on my own. I doubt anyone around these parts has a debugging board. With that frame of mind, I was reading through the wiki about flashing the phone, and it seems there are all sorts of problems which can occur. Happily, hackers from around the world have contributed solutions to the wiki. Stuff like "You may encounter... but if you... you should be fine." This is all very optimistic, and it seems to tell you that, hey, you're ok. We've got you covered. My perverse mind immediately wondered why these people were all so resourceful. I keep expecting to scroll down to the bottom of the page and seeing someone finally encounter a problem no one could solve. It would say, "If you do this and this followed by this, the phone shuts down. At this point, you may, if you have a sharp nose, you may detect a slight odour of something burning and... you're fucked."

That would be so darkly hilarious.

Labels: ,

 
Thursday, July 10, 2008
 
Neo FreeRunner

I wonder... how many geeks in Singapore are interested in this? Let's find 9 other buggers and get the 10-pack!

Aw, come on, no one?

Damn.

[Update] Sold out! OMG.

Labels: , ,

 
Tuesday, July 01, 2008
 
Why Google is cooler than Ebay

Hacker cool, that is. Google organizes a programming competition, and Ebay does one too. Before I even get started, note how the Google Code Jam page is written entirely in HTML, CSS and Javascript. All open standards. Then note how the Ebay page (unnecessarily) uses what has been dubbed "the cancer of the web" by some. Even though I wouldn't go that far, (you can always not go to Flash sites) I do think that its use should be minimized. I will not go into the reasons here, but if you're curious, shoot me a comment. Furthermore, clicking on their "Register Now" button brings up a popup which Firefox promptly blocks.

Anyway, the point is this:

The Ebay competition is very obviously the brainchild of suits and not hackers. At the event where they launched the competition, I did not see a single techie there who represented Ebay. Furthermore, although I can no longer recall the exact figures, implementation comprised a mere 20% or so of their judging criteria. To put this in context, minutiae like business plan or some crap like that was worth 30%. I suppose it makes sense if you're trying to attract talented suits, but then why hold a Developer Challenge? Why not hold a Suit's Biz-Off and just give the winner some money so he can hire hackers to implement his business plans?

Google, on the other hand, doesn't give a flying fuck about your business plan. What you have to do instead, is solve algorithmic problems. As swiftly and accurately as possible. That is the attitude that ensures Google always has the brightest engineers.

p.s. A friend of mine who attended the aforementioned event with me said that we should just interrupt the speakers with this:
I propose that we forgo the competition and split the $25K among all those present here (a coupla hundred for each person, more or less). All those in favour, say "yea"...

My friends are funny.

Labels: ,

 
Friday, April 18, 2008
 
Scramble or hacking?

Some time ago, I was arguing with my colleagues about which required more intelligence: writing a program that could cheat at Scramble? Or winning at Scramble? Naturally, I took the stand that writing programs requires way more intelligence than playing some word-finding game. My friend, being a rather contentious guy, told me that I was biased because I am a programmer and that he respected the top scramble players because we couldn't do what they did, blah blah.

I said that all that scramble required was memory and basic pattern recognition coupled with the digital dexterity required to type words fast, while writing programs required a higher level of intelligence and the ability to understand what was required to solve that problem (i.e. problem abstraction). I told him that the skill set required to play scramble wasn't that much different from that required to play minesweeper, and that since I could hit timings of 80+ seconds on minesweeper, I could probably also play scramble well with practice. He didn't buy it, even though he's also a programmer. Well, I've written a program that could cheat at scramble. I've also been playing scramble and I've improved to the point where I can get to the top 10 positions.

To sidetrack a little bit, the main game in scramble has at least 300+ players playing on the same board at any one time, so it is really not that easy to own at the game.

However, I can actually prove my point with a simple observation. Let's take the intelligence quotient required to play well at scramble as X. So if you play well at scramble, all we can conclude is that you have at least an intelligence quotient of X. Now, let's posit that the intelligence quotient required to write a program that cheats at scramble is Y, as yet an unknown quantity. However, we observe that, since the program is able to attain better results than a human player (my program is able to get all the answers on the board within 1 second, while the average good human player plays a 3 minutes game and usually attains sub-perfect results, but let's forget the obvious disparity for now), the program itself has at least an intelligence quotient of X. If an entity with an intelligence quotient of Y is able to create an entity with an intelligence quotient of X, does it not logically follow that the creator is smarter than the creation?

I end this post with a challenge illustrating the above for those programmers who still disagree. You're probably smart enough to write a scramble solver. But are you smart enough to write a program that can write a scramble solver? (QED)

p.s. Note that I'm not saying that people who are good at scramble are less intelligent than me (though they probably are, heh heh). I'm just saying that of the two tasks, writing a scramble solver and solving scramble, writing a scramble solver requires higher intelligence.

p.p.s. If you come to me with a program that prints the source code for a scramble solver, I... would really not know what to say to you.

[Update]
I spoke with the aforementioned colleague again and he pointed out a flaw in my previous reasoning, namely that it takes an entity with a higher level of intelligence to create an entity of a certain level of intelligence. Basically, if one believes, as I do, that humans will someday birth artificial intelligences greater than themselves, then one must believe that an inferior intelligence should be capable of creating a superior one. My bad.

I still think the second illustration is valid, i.e. the fact that one can write a scramble solver but cannot write a scramble solver writer implies that the former task is less complex and hence, requires less intelligence to accomplish.

Labels: ,

 
Friday, April 04, 2008
 
Outburst

After struggling for 2 days to make some Javascript and CSS display code work on all versions of Internet Explorer ("overflow: hidden", anyone?), I had gotten increasingly frustrated. Today, in the office, after IE 8 refused to acknowledge what Javascript was trying to tell it*, I finally blurted out something that precipitated some merriment among the colleagues:

"Firefox is open-source! Go copy their code, for gods' sake!"

This goes out to all the engineers and programmers working on IE 8, who I know (hope?) are probably trying hard to address these issues.

In other news, I recently met with the ThinkingPHP.org guy, Felix Geisendörfer. If you're a PHP geek, you should know the name. Cool guy.

*IE 8 was listening to his Zune and whistling while Javascript spoke till she was blue in the face.

Labels: , ,

 
Laughing at the cosmic gag reel since March '04!

Links
L.E.W.D (click to know more):


Fred And Phil

Fiction

Hot Babe Blogs:

Other Blogs (that are not quite as good as mine):


Unforgettables:

Recent Posts:

ARCHIVES

To Those Who Wish To Link Me:

Due to the fact that my ego is a humongous, bloated monstrousity, it is not highly unlikely that I wouldn't say no to your linking my blog, so there is no need to ask me.


Winners of Adrian Coolness Points:

The Feisty Bitch: For reasons best known to ourselves. (1)
The Feisty Bitch: For getting featured on the Sunday Times (2)
Adri: For being geeky enough to write recursive prose. (1)
Sheena: For really, really liking my blog. (1)
Sheena: For the use of her finger. (2)
Sheena: For getting on the Straits Times. (3)
Ivan: For referring to me as one of "Singapore's leading bloggers". (1)
Ivan: For coming up with the PubicLicezilla idea. (2)
The Big Fuck: For being such a big fuck. (1)
The Big Fuck: For making the miniature Badge of Lewdness. (2)
Anonymous fan: For making a cool finger. (1)
Celly: For appreciating the genius behind the Pagan Bible here. (1)
Icebreeze: For being wise enough to flatter me. (1)
Barffie: For furthering the LEWD cause by appearing in the papers. (1)
Blinkymummy: For furthering the LEWD cause by appearing in TWO papers within the space of two days, fuckin' A! (2)
Jess: For being observant enough to spot the similarity between Lewdites and Luddites. You rock, babe. (1)
Jiameei: For being my champion against anonymous hecklers. (1)


Powered by Blogger

Ablewise.com Free Classifieds - The Online Classifieds Solutions (TM)




free dating sites

Get custom programming done at GetACoder.com!