Thursday, January 13, 2011

Lightweight gmail

See my gmail inbox above - that's all there is. Pretty light.
How it got so is an inspired tale, having its origins from Matt Cutts' blog (a popular netizen who leads the Google Webspam team). This helps me twofold
* Lighter page
* More relevant inbox

It's the label-and-archive strategy.

Step I> Fix on a scheme

First thing to work out is whether
- I want my email and chats as different entities, or together. Personally, I'd like to keep them separately.
- I want my emails sifted chronologically, or by mail providers, or by family/friends/office. Let's call them sort-order aka "distinctions". For me, chronological distinction is convenient. I'd also like to keep my stupid chain mail forwards away from more important mails.
- Which emails might be overlapping distinctions. For example, I had several joke-of-the-day kinda forwards, that I wouldn't give a damn about; but alongside were other forwards that were important conversations.

Step II> Get your search filters right

This one is a custom affair. I decided to have my emails and chats for past couple of years filtered in separate boxes, while all else (2008 and earlier) went into a single huge box.
Here's a sample of the way my search filters went
for email: before:2011/01/01 after:2009/12/31 -is:chat
for chats: before:2011/01/01 after:2009/12/31 is:chat
for joke-a-day forwards: fw has:attachment -is:important -label:professional

Step III> Label and Archive

- Once I had the result from mail search, I did "Select All" by clicking on the dropdown arrow next to the select checkbox above mails, and then again clicking on "Select all * conversations" link that now appears.
- Then I applied an appropriate label, say "2010 emails", and finally
- Pressed the "Archive" button.

Back in Inbox
This one is easy. If you want your mail to appear back in your inbox, just click the appropriate label (say, "2010 emails"), and in case you want to see some/all in your Inbox, just select those (or all), and click Move To > Inbox

Unlabel My Email
Even easier.
- See those labels listed on the page (which generally lie on bottom left)? If you click on their dropdown, you'll find a "Remove Label" link.
- Or you could goto Label > Manage Labels, and Show/Hide/Delete them through there
- Or just select all those emails you don't want under that label, click on Labels in the bar above, untick the labels you don't want, then click Apply.

Wednesday, January 12, 2011

Fix your PHP!

The exclamation should be taken to its intended effect. A critical PHP vulnerability was identified in the PHP engine (PHP 5.3.4) - which allows an easy, creative, orchestrated DDoS attack. This affects both Windows and Linux. VERY SERIOUS.
"Due to the way the PHP runtime handles internal conversion of floating point numbers, it is possible for a remote attacker to bring down a web application simply by adding a specific parameter to a query string in their web browser.
This vulnerability is present on all versions of PHP including PHP 4.x and 5.x, on all Intel-based 32-bit PHP builds."
I'm merely being the information inspector here - source being a Zend newsletter.

Go Party at Wikipedia's 10


Jan 15th will now trump other days, like your cat's birthday. Wikipedia's 10 anniversary is not a small affair - as they themselves have made evident through their Anniversary page. Celebrations across the planet.
Mumbai (VJTI, Matunga)
New Delhi (IIT, Hauz Khas)
Lucknow (Fun Republic Mall, Gomti Nagar)

Saturday, July 24, 2010

Your Helvetica is not Helvetica

The most popular font on the web, Arial - in wide adoption owing to Microsoft Windows - has a shady history behind it. [As Mr. Mackey would say "Arial is bad, mkay?"]

Helvetica is the original chic; it stands an icon of swiss design and elegance. A font 10 years into India's freedom. It was chosen as one of the base fonts for Adobe's Postscript, and became the standard for much of print media. Trust me, the font is legendary!

All this time I had assumed I had Helvetica on my system. Firing up MSWord07 confirmed that, Helvetica was listed among my installed fonts. At the same time I also decided to check out the differences between either fonts (Helvetica vs Arial), to immediately condition myself to abhor the Helvetica clone. But on blowing up the fonts, I found that they were the exact same - no graceful curls as in the real Helvetica, or the poise in the letters R, G, C...

So finally the followings were done
- Visiting my fonts folder
- Firing up Adobe Photoshop to see the list of available fonts
- Using the fonts side-by-side on an HTML page
And it was confirmed I DID NOT have Helvetica. I have spent my lifetime not appropriately knowing or using Helvetica!
This fact also brought forth that Helvetica is still a licensed font, and it costs INR 1450. Even if people don't buy into the uber-coolness of the font, they would still get it for the association and conformity/exclusivity the font brings.

Why did MS Word 2007 show that Helvetica was installed? This might be because certain printers have this font embedded into their hardware; hence if your system lacks this font, you can still have it in print.

Two fonts walk into the bar, and the barman says, "sorry lads, we don't serve your type".

Sunday, July 12, 2009

Unloading external content doesn't work right

Flash conveniently dictates the use of Loader class to load external files, including SWFs. But what the developers ignored was how the SWF unloading takes place...in theory it doesn't. Besides being an irritation, this can also be exploited as a security flaw.

Symptoms
Loading, then unloading a SWF - with an embedded clip or some sound playing - still keeps that sound going regardless of NO VISIBLE instance of the clip anywhere on the stage or in the memory. In addition (if you check the memory consumption), repeated loads and unloads increase the memory consumption in direction relation to the size of the files being loaded.

Diagnosis
What happens here is memory mismanagement on part of the AVM2 (Actionscript Virtual Machine 2, that was built for Actionscript 3). Dig deeper, and its the garbage handling mechanism at fault. Much of this has to do with what the unload function does. Here's how the story goes:
  1. You write ActionScript 3 code to load/unload the SWF. (Yes, this bug is AS3-specific)
  2. Flash lets loaded child SWFs communicate with the parent container. Hence the events that the SWF monitors are linked to the main timeline. ENTER_FRAME and TIMER events are the lethal events here. [keep that in mind]
  3. Unload() simply removes a reference to the loaded content, and leaves the rest for the garbage collector.
  4. But the garbage collector works on the principle that a resource will be removed only when it has no references. Because the SWF is still linked to the main timeline, it stays in the memory. The SWF - technically - keeps playing.
  5. As a result of the SWF still out there, any sounds that the SWF had been playing continue to play; alongside, your movie file size bloats up because the garbage stays there in the garbage box (and stinks it up).

With nothing but the Flash IDE and its accompanying manual, one can get stuck for hours.

Prognosis (or the future course of events that you take)
There is no straight solution to this. Nothing can be done to fix the issue. Moreover, nothing on part of the parent swf can help (with a trivial exception).
  • Calling SoundMixer.stopAll() method in the parent SWF: This will stop all sounds playing. This is rarely helpful, since there will be other sounds playing as well.

  • Remove select event listeners: Open the FLA file of the one that's being loaded, and remove any ENTER_FRAME or Timer event listeners. These are the ones that communicate with the parent movie.

  • Clean Up on Event.UNLOAD: When unload() is called on an SWF loaded through the Loader component, an 'unload' event is fired. Use this to clean up your child SWF...remove/delete all (dynamic) variables, movie clips, event listeners and timers. Stop any sounds. Stop the advance of the main timeline. Stop any external content from loading (Loader, URLLoader, Socket). This is your best bet.



  • Some enlightening documentation of this bug can be found here, here.

Monday, June 22, 2009

Actionscript

The revision of Actionscript - Flash's native language - to version 3.0, comes as an escalating shock to most like me. Though commenting on something introduced in 2006 - 3 years back - is not trendy, this is just another 2 bits from another developer on this platform (after regular cycles of attempts to 'learn it all'). It's not meant to be comprehensive.

The first thing to get straight...AS3 functionality leaves AS2 behind a light year. All the things one can do is unmatched. People are going crazy with everything it offers.

AS3.0 is heavily Object-based. In my opinion it marks a shift in the userbase, exactly an inversion from the amateur crowd that it pulled initially. Now the bigger draw is professional studios and upstarts, not the lone wolf in the basement. The lone wolf is majorly left to the brilliant vector drawing features of Flash, but giving life to it through nifty coding requires a wide learning curve.

Unifying the event listening mechanism is very nice. No longer do we need to be aware of the several ways (and several locations one can implement that) to handle a button click - now it's all done through the combination of addEventListener and a listener function. This is possible because of some heavy inheritance - the most common classes that we know of all belong to 4th or 5th generation in the flash hierarchy.

AS3.0 means that the past is dead. The past gods are dead as well - all my earlier Flash documents downloaded from tutorial pages of some of the best websites (and best coders) are junk. Publishing them as AS2.0 does no harm, though, but modifying them to your own use is hopeless.
Then there's the support pages...they can kill your aspirations. They're badly indexed, badly linked, badly written. Tutorials spread all over the web are the best thing for an AS3 developer; that is unfortunate.

Maybe this review evolves as life goes on.

Sunday, May 10, 2009

Vidoop Flyout Captcha - Making it work

Vidoop Captcha (see implementation here) is an awesome thing for normal validation.
And even more awesome is the flyout version of it, which doesn't strip away the visual appeal of your page.

Implementing the flyout version is a bit confusing, primarily because there is a single document for this, and that too gets repetitive but misses out on the major details. I thought I could do better.

Here is a step-by-step how-to to making Vidoop Flyout work with your website (and also the automatic changes it makes to your page)

#1: Find the normal Vidoop Secure Captcha code implementation on your page. It should resemble this (note that the image src, categories to look for, and captcha_id would be different for you)
<form method="get">
<img src="https://api.vidoop.com/vs/captchas/IT42FKE7FE/image" />
<p>Type in the 3 letters you see on pictures of <span class="category_name">money</span>, <span class="category_name">birds</span>, and <span class="category_name">computers</span>, in that order.</p>
<input type="input" name="code" value="" />
<input type="hidden" name="captcha_id" value="IT42FKE7FE" />
<input type="submit" name="submit" value="Submit" />
</form>

#2: Wrap the image code and instructions in a <noscript> tag. This would be the non-flyout version of captcha that shows up when JS is disabled. Let the remaining code untouched.
<noscript>
<img src="https://api.vidoop.com/vs/captchas/IT42FKE7FE/image" />
<p>Type in the 3 letters you see on pictures of <span class="category_name">money</span>, <span class="category_name">birds</span>, and <span class="category_name">computers</span>, in that order.</p> </noscript>


#3: Include the jQuery library in your HTML file (can be placed anywhere). jQuery will give you the slick effects.
<script type="text/javascript" src="http://com.vidoop.demo-static.s3.amazonaws.com/js/jquery-1.2.6.min.js"></script>


#4: Include the code to initialise the flyout Vidoop captcha (place this before the <noscript> tag for best effect). The 'flyout.js' is the script that does it, and inserts the necessary HTML and styling into the page. The inline script, where we declare the vidoop_secure variable is essential to working of the whole thing, as well as provides configuration parameters (rip open the flyout script in some text editor to learn about that).
<script type="text/javascript">
var vidoop_secure = {
instructions: 'Type in the 3 letters you see on pictures of <span class="category_name">money</span>, <span class="category_name">airplanes</span>, and <span class="category_name">houses</span>, in that order.',
};
</script>
<script type="text/javascript" src="js/flyout-0.9.12.js"></script>


#5: So now your main block of HTML looks like this
<form method="get">
<script type="text/javascript" src="http://com.vidoop.demo-static.s3.amazonaws.com/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
var vidoop_secure = {
instructions: 'Type in the 3 letters you see on pictures of <span class="category_name">money</span>, <span class="category_name">airplanes</span>, and <span class="category_name">houses</span>, in that order.',
};
</script>
<script type="text/javascript" src="js/flyout-0.9.12.js"></script>

<noscript>
<img src="https://api.vidoop.com/vs/captchas/IT42FKE7FE/image" />
<p>Type in the 3 letters you see on pictures of <span class="category_name">money</span>, <span class="category_name">birds</span>, and <span class="category_name">computers</span>, in that order.</p> </noscript>
<input type="input" name="code" value="" />
<input type="hidden" name="captcha_id" value="IT42FKE7FE" />
<input type="submit" name="submit" value="Submit" />
</form>

And now you have the Vidoop Secure flyout captcha working on your own site.