Friday, March 4, 2011

Gender Connection

THE MALE PLUG


THE FEMALE RECEPTACLE



Learn More

Friday, January 28, 2011

Notifications in Chrome

Some of us would be familiar, and piqued, by the recent suggestion in our Gmail windows: "Click here to enable mail notifications in Chrome". Choose to, and whichever tab you might be browsing on, any new mail or chat message is reported in a tiny corner bottom right of the screen. This nifty addition surprised me enough to find out more about the concept, and its other possible applications.

Notifications to the desktop are nothing new, but notifications on the browser are.
The OSX folks have had something called Growl notifications in place, which requires installation, then could be accessed through the windows.fluid object built into Safari on Mac.

Google, with their support for Web Notifications, and their W3C recommendation in general, have tried standardizing this concept.
Here's a small working example for the same:

PS: Try it, in baby steps, on Jash. FUN!
<script type="text/javascript">
(function() {
var notificationStatus;

setupNotifications = function() {
if(window.webkitNotifications) {
if(window.webkitNotifications.checkPermission() == 0 ) { //permission granted
notificationStatus = 'Permission granted';
} else if(window.webkitNotifications.checkPermission() == 1 ) { //permission unknown
//notificationStatus = 'Permission not granted yet';
notificationStatus = "Unknown, click to <a href='javascript:window.webkitNotifications.requestPermission(setupNotifications);'>enable web notifications</a>.";
window.webkitNotifications.requestPermission(setupNotifications);
} else { //permission denied
notificationStatus = 'Permission denied';
}
} else alert('Not supported');

if(!!document.getElementById("notificationStatus"))
document.getElementById("notificationStatus").innerHTML = notificationStatus;
}

notifyMe = function() {
//permission already granted
if(window.webkitNotifications.checkPermission() == 0 ) {
var popup = window.webkitNotifications.createNotification(
"myicon.ico",
"You nailed it",
"My good sir, by delving into this notification thingy you open yourself to plenty of bobfoolery"
);
//ondisplay is one of the three events for the notification API
// ondisplay, onerror, oncancel
popup.ondisplay = function() {
setTimeout(function () {popup.cancel();}, 6000);
//we keep a timeout for the notification, since they don't have one by default
};
popup.show(); //this displays the notification
}
}
window.onload = setupNotifications;
})();
</script>
A simplified concept, a small API, and user security considerations - the spec has its bases covered. Presently these notifications only work on the Chrome browser across Windows and Linux.
For the old crowd, things were ridiculous, with the programmers having to resort to annoying and invasive hacks like window.alert. This new feature would give online tools like e-mail clients, calendering software, task managers, monitoring systems, etc. an elegant and consistent way to notify users.

However, not everybody is gaga over it. After some toying around, even I am a bit skeptical about the specs and the architecture: The notifications take a while to associate with their tab. They aren't a welcome experience to deal with when your friends start firing messages in your gmail chat window. Moreover, with the proliferation of these (among Tier 1 sites, to merely begin with) we can only anticipate an avalanche of these, since the recommendation suggests no way to restrict or control the notifications.

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.