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

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

Mac Newlines Can Cause PHP Headaches

August 31, 2010 at 21:47 (php, web dev)

While working on a project, somehow the majority of my PHP files acquired Mac style \r newline characters rather than DOS/Windows \r\n or UNIX \n. I don’t know exactly how this happened, but the \r newlines were perpetuated by Notepad++, which identified the files as Macintosh and displayed them transparently. The problem is if I take this code:

echo 'hello';

and upload it to the Linux project server (on Go Daddy), it becomes:

<?phpecho 'hello';?>

which of course causes an error. It took a while to trace the problem to its source, mainly because I had no idea such newline characters existed. So now you know, and knowing is half the battle.

Permalink Leave a Comment

Undocumented Ext JS PagingToolbar Method

August 22, 2010 at 07:01 (extjs, javascript)

Background: I’ve mentioned Ext JS in a previous post and am still using version 3.2.1.

After another fun-filled trip through ext-all-debug.js, I’ve discovered a simple yet hidden way to load an arbitrary page number in a grid that uses a PagingToolbar (Ext.PagingToolbar). Simply call yourGridPanel.getBottomToolbar().doLoad(start), where start is the row index starting from 0. So for example if you set pageSize = 10, then to display the first page call doLoad(0), second page call doLoad(10), etc. Note that when choosing a non-multiple of pageSize, the page number gets rounded up, so for example doLoad(1) would display items 2-11 (if you have 11 or more items) and report the page number as 2.

And of course, as the title of this post implies, this method is absent from the official API documentation (as of the time of this post) despite its being a public and very useful method.

Permalink Leave a Comment

Undocumented Ext JS Grouping Sort Property

July 22, 2010 at 04:28 (extjs, javascript)

Background: Ext JS is an open source JavaScript library used for web design and geared towards interactive apps using technology such as Ajax. I am using version 3.2.1.

Today after an hour or two of frustration, I discovered an omission in the official online documentation of Ext JS. Under, the very useful property groupDir is mentioned nowhere, as of the time of this post. Without this property, it is exceedingly difficult (in my experience) to specify a simple sorting preference on the grouping field for this type of grid.

Read the rest of this entry »

Permalink 2 Comments

MediaWiki – Multi-Line <pre></pre> within List

July 14, 2010 at 21:03 (mediawiki, tutorial)

Background: MediaWiki is open source software used to create wikis; it was developed for and is currently used by Wikipedia. I am using version 1.15.4.

I’ve spent a lot of time searching without success for a way to insert a multi-line pre-formatted block of text within an ordered or unordered list in MediaWiki using wiki markup * and # syntax. Today I finally figured out this can be done using either &#10; (Line Feed) or &#13; (Carriage Return). I haven’t tested across platforms or browsers, but here is an example:

Read the rest of this entry »

Permalink 3 Comments