Yahoo! Deactivation Design Issue

October 20, 2010 at 21:44 (web dev)

Although I would like to reproduce this behaviour to be sure it wasn’t a fluke, today I discovered what I consider a design flaw in Yahoo!’s automated account deactivation logic. On the one hand, there is an option during login to “Keep me signed in”, which will keep the user signed in indefinitely on that computer and browser until cookies are cleared or the user signs out. On the other hand, there is a policy to deactivate accounts for which the user has not signed in for some set period of time. The problem is that one can be using Yahoo!’s services every day without signing in, and then suddenly discover that the account has been deactivated when signing in on another computer. While my experience with this problem resulted in no data loss, it was still a bit unnerving. What if that archive of emails and contact information going back several years had been lost?

I plan on reporting this to Yahoo! as soon as I can reproduce it to be positive it is a consistent problem.

Web developers beware! If it can happen to a large corporation with vast resources, maybe it could happen to you too.

Permalink Leave a Comment

Simple Asterisk Pattern with Recursion

October 18, 2010 at 14:23 (code golf, java)

Background: I introduced code golf in a previous post.

I recently came across an easy but fun problem posted on Yahoo! Answers. It could make for a good code golf exercise. I will write the problem statement in a purposely vague manner, but clear enough to make the goal obvious; specifics can be added according to any particular contest or testing environment.

Using only recursion and no loops, print a triangular pattern of asterisks according to the following example:





Read the rest of this entry »

Permalink Leave a Comment

Mental Health Point of View

October 16, 2010 at 18:16 (psychology)

I’ve been somewhat active on Yahoo! Answers recently, and a question came up about someone being depressed and not wanting to take medication, but needing help. I decided to re-post my answer here in case anyone would find it useful. I have not edited it in any way while transferring it from Y!A to WordPress. So, here it is:

I also personally dislike the idea of medications for such problems, although in some extreme cases (for example, having hallucinations that won’t go away) then I think medications are perfectly reasonable. But for non-hallucination type situations, I believe in human spirit to overcome such things!

Of course many will disagree, but I believe this firmly.

To me it boils down to two things: (1) awareness (2) control.

Read the rest of this entry »

Permalink Leave a Comment

Reflexive Assignment in Java

October 11, 2010 at 06:54 (code golf, java)

Background: Code golf is a game in which the goal is to solve programming problems using as few keystrokes as possible. It has its roots in Perl golf, and anyone with golfing experience knows that Perl is particularly well suited to such challenges. J and K, as well as the more esoteric GolfScript, are also known for combining terse syntax with powerful features. Obfuscation is a related topic.

In this post, I will discuss a snippet of Java code one might not normally think to write. I understand that “Java code golf” is practically an oxymoron, since it seems the goal of Java is to write code using as many keystrokes as possible, but let us overlook this point for now.

Suppose we want to increment a variable by an integer from standard input, but only if that integer is positive. We could use this code fragment:

Read the rest of this entry »

Permalink Leave a Comment

Happy 10-10-10 Day

October 10, 2010 at 22:41 (special occasion)

Not that I set much store by such things. Why no movie 10 to complement the two movies 9 and Nine last year?

Permalink Leave a Comment

Microwave Design

October 5, 2010 at 01:48 (rant)

This is how a microwave should work: If you press 2, then 3, then 5, then start, it should start counting down from 2:35 while heating your food. Pressing the number 2 should not make the microwave automatically start counting down from 2:00. Whoever designed such microwaves should be forced to [censored by internet monkeys] while a gang of midgets [censored by internet monkeys] by a unicorn with [censored by internet monkeys] helplessly and [censored by internet monkeys] just for good measure.

Permalink Leave a Comment


October 2, 2010 at 06:07 (esoteric language, tutorial)

Background: I introduced SPOJ in a previous post.

If you haven’t heard, LOLCODE is a powerful programming language used mainly by cats. It is deplorable that such a beautiful and natural language has not received wider support thus far. To help remedy the situation, I decided to code a solution to TEST using LOLPython, which is derived from LOLCODE and is just as elegant. Of course the program cannot be submitted because neither LOLCODE nor LOLPython is currently supported by SPOJ. But we must have faith that one day such blatant discrimination against cats and their programming languages will end, and we must prepare for that glorious day!

I can haz code?


Save a kitten – ask for LOLCODE support in your local programming competition (and syntax highlighter) today!

Permalink Leave a Comment

Java Custom addSlashes()

October 1, 2010 at 06:56 (java, javascript, tutorial, web dev)

Java regexes can get pretty clunky due to the dual use of the backslash character, as is commonly known. Although there’s not a lot to it, below is some code to add slashes for these characters: backslash, line feed, carriage return, null, single quote. It is used in a web application to format JSON strings on the server before passing to the client, where the objects are then processed by JavaScript/Ext JS. Maybe someone will find it useful!

public class StringUtil {
    public static String addSlashes(String s) {
        s = s.replaceAll("\\\\", "\\\\\\\\");
        s = s.replaceAll("\\n", "\\\\n");
        s = s.replaceAll("\\r", "\\\\r");
        s = s.replaceAll("\\00", "\\\\0");
        s = s.replaceAll("'", "\\\\'");
        return s;

Incidentally, there are other places where the following JavaScript replacement is necessary:

s = s.replace(/"/g, '"');

Permalink Leave a Comment