Wednesday, November 25, 2009

Evenstar!

Many of you who would be reading this post of mine would have some own blogging experience. Many amongst them would be avid bloggers. Some have their own personal blogs, where in, they put down everything that goes in through their hearts and not the mind. Few like me put in everything for we have no mind. And all of us has friends. Now, What do such mindless blogs and sage friends have in common?

Well, sometimes our friends become our biggest foes. Sometimes, when their intelligence, loaded with sanity, soaked in logic, with a fragrance of reason, decorates our blog as a token of their liking, the blog owner's insanity turns insane. At times it leads to defeat the sole purpose of the post and turns off the very visitors whom you adore. To add appreciation to glory, if you try some legal ways (read as, settings in your favorite blog engine), these sage start expressing their wisdom vocally than in writing; at this point you only wish to be reborn.

With such instances most of us wish if there was a way to bury such friends in the deep deserts of North Pole. Some turn to hibernate in the cool comfort of the Sahara Desert. Well, I tried doing both and failed. And now, the only thought up my mind is,

May it be an evening star,
Shines down upon you,
May it be when darkness falls,
Your heart will be true,
You walk a lonely road,
Oh! How far you are from home! (Enya)


Being just another good for nothing person, I am using the power of primary language of expression to do believe in the above, waiting for the evenstar to shine down upon me soon! Till time, if I could remain as sane as my thoughts above, there would be more in here soon. Keep Watching the space!

Keep Walking, Keep Hiding!

PS: None-the-less, if anyone has suggestions on how to bury in the North Pole, please leave your comments, which would be highly appreciated and acknowledged with due respect. For those whose sanity is troubling them find an answer as to why I chose North pole, here is my insanity packaged in a line; I live in the northern hemisphere, and I don't want my friends to suffer (more) when I drag them to the pole.

Tuesday, November 24, 2009

[Mac] Flex Builder 3 unable to run AIR applications

If you are using a Mac and running Flex Builder 3 to develop AIR applications on AIR 1.5 runtime, you may encounter an issue where Flex Builder simply refuses to debug/run the AIR application giving you the following popup,
"Process terminated without establishing connection to debugger. If the program is already running, close it before attempting to debug."

Most of the solutions you would find via Google, would ask you to change the AIR application descriptor to point to 1.5 namespace. Well, this is one of the biggest reasons for this problem. But another small bug may lead to this occurrence. For details on the same refer to http://bugs.adobe.com/jira/browse/SDK-19707

Fixing the bug is too easy,
  1. Download the file change.sh from the Bug Database.
  2. Copy this file change.sh into the SDK parent folder. On a typical installation on Mac, it would resemble /Applications/Adobe Flex Builder 3/sdks/3.4.0
  3. Adjust the file permissions to 755 using chmod 755 change.sh
  4. Execute the script ./change.sh
  5. Open your Flex Builder, open the project, run your AIR app and have fun!

Hope this helps!

Saturday, November 14, 2009

Power of Google | Birth of Chrome

So funny could not stop sharing this...



Thursday, November 12, 2009

(a XOR b) using NAND gates

Recently, someone asked me to construct the expression (a XOR b) using NAND gate/operator only. The first thing I did was write down the expressions which I thought I would need during the expression,
NOT (x OR y) = (NOT x) AND (NOT y)
NOT (x AND y) = (NOT x) OR (NOT y)
NOT (x AND y) = x NAND y
NOT x = x NAND x
x AND NOT x = 0 (ZERO)
and then I started expanding the expression like I knew everything.
a XOR b
= ( a OR b) AND NOT (a AND b)
= (a OR b) AND (NOT a OR NOT b)
= (a OR b) AND (a NAND b)
= NOT(NOT(a OR b))  AND (a NAND b)
= NOT (NOT a AND NOT b) AND (a NAND b)
= (NOT a NAND NOT b) AND (a NAND b)
= NOT { (NOT a NAND NOT b) NAND (a NAND b) }
= NOT { (a NAND a) NAND (b NAND b) NAND (a NAND b) }
= { (a NAND a) NAND (b NAND b) NAND (a NAND b) } NAND { (a NAND a) NAND (b NAND b) NAND (a NAND b) }
And I was happy to have done this very easily. But then if you succeed in first attempt it indicates you did a blunder. And I did one too. The mistake was to write down the rules initially. This stopped my mind to think of other boolean algebra rules.
(a XOR b) = (a OR b) - (a AND b)
= (a OR b) AND NOT (a AND b)
= (a OR b) AND [ (NOT a) OR (NOT b) ]
= [a AND (NOT a) ] OR [ b AND NOT b] OR [a AND NOT b] OR [b AND NOT a]
= [a AND NOT b] OR [b AND NOT a]
Also someone suggested me to use . (dot) for AND operator, ' (apos) for NOT operator, + (plus) for OR operator. Taking all this into my mind here is a simpler expansion,
a XOR b = a.b' + a'b
= ((a.b' + a'b)')'
= ( (a.b')' . (a'.b)' )'
= (a NAND b') NAND  (a' NAND b)
= [a NAND (b NAND b) ] NAND [ (a NAND a) NAND b ]
If only I hadn't stopped using my mind :)

Thursday, July 23, 2009

Magical Behavior of Microsft Products

Today morning I received one of those another forwarded mails telling me of all those crazy magical things that Microsoft products do, and which no one from Microsoft including Bill Gates (as claimed in the email) is able to explain.

Without wasting a minute let's take a look at the magic and the magic behind it ;)

Magic #1: An Indian found that nobody can create a FOLDER anywhere on the Computer which can be named as "CON". This is something funny and inexplicable. At Microsoft the whole Team, couldn't answer why this happened! TRY IT NOW, IT WILL NOT CREATE A "CON" FOLDER
Magic Behind: First, why do every Indian has to proclaim that it was discovered by an Indian? Is it some sort of egoistic game we all are playing in this world?

Leave it, anyways, the reason one cannot create a folder called CON is because CON is a special redirect for CONsole (meaning Monitor output, in general). You can use CON along with pipes to redirect the output streams to monitor, say in case it was going to a printer. Hence, the observed behavior. It is analogous to something like you won't use the variable *sin* in a trigonometric equation, or you can't use an *if* as a variable in a programming language.


Magic #2: For those of you using Windows, do the following:
1) Open an empty notepad file
2) Type "Bush hid the facts" (without the quotes)
3) Save it as whatever you want.
4) Close it, and re-open it.
Noticed the weird bug? No one can explain!
Magic Behind: This is simply an encoding issue. When notepad opens a file it tries to identify the file type encoding, and because of a bug where the characters form a particular pattern make notepad believe it is Chinese, it seems to us as if everything disappeared. Save the file in UTF-8/16 and everyhting would work fine. Open the file in Wordpad/Notepad++ etc and you can see the original text. For more details read the following Wikipedia page: Bush hid the facts


Magic #3: Again this is something funny and can't be explained. At Microsoft the whole Team, including Bill Gates, couldn't answer why this happened! It was discovered by another Indian. Try it out yourself. Open Microsoft Word and type =rand (200, 99) And then press ENTER And see the magic.

Magic Behind: Oh gosh... another Indian thing. I am upset.

On a serious note, this is nether a bug nor an easter egg in Microsoft word. This is a feature developed specifically on the request of users. This is a functionality that Microsoft provides. Don't believe me, well, read this Microsoft Support page. rand(p,l) is a special command you issue to Word to insert sample text in the localized language of the OS. This helps content editors, localization testers, and others a lot.

If only people could stop boasting about things done by Indians. I am proud to be an Indian, but not the one's as these.

Thursday, May 21, 2009

Synergy - One keyboard/mouse for multiple computers

Many of us use multiple computers at work, most probably, a laptop and the desktop. And most of the time we find ourselves wondering as to why the cursor isn't moving with the mouse, only to realize that we were using the wrong keyboard/mouse combination. Sounds familiar, huh? I have been irritated by this a lot in the past, and recently, I discovered this magical tool which left me cursing as to why I didn't discover it earlier.

Synergy, an open source tool that seems to be doing magic. In its own words,
Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It's intended for users with multiple computers on their desk since each system uses its own monitor(s).

Yes, it really does that. In reality, as soon as I configured this tool, this is the first post I am making using the other screen and smiling :) Configuration in super easy - it was over under 2 minutes and now I have the pleasure of cleaning up my office desk of all those useless wires. I can now only have multiple screens with a single pair of keyboard and mouse and work seamlessly. How easy, isn't it?

Another major power of the tool is to bring the universal clipboard into existence. You want to copy from one computer to another, simply, copy from the screen of the first, move keyboard to second, and paste. Voilla - its simpler than buying an ice-cream. Enjoy!!!

Are you left gasping for more? Here it comes... Screensaver's on all computers are in sync. They start at the same time and end at the same time. Amazing - yes atleast for me.

In anticipation that some fellow world citizen might easy his/her pain with this tool. Hail Synergy, Hail the power of Open-Source!!!

Friday, May 15, 2009

New York Times launches Times Reader 2.0

New York Times released a Times Reader which makes reading online newspaper fun and exciting. Times Reader enables a user to read New York Times without a web browser. This might not look like a big change considering the fact that NYT is already available on web via a browser, but, the sparkling difference is the compelling and commanding interface. And yes, for those who might not have picked it up, Times Reader is a desktop application. Yes, it is !!!

Times Reader makes reading news worthy as the interface is built specifically for the purpose. Again there is no need to wait for page refreshes to get updates, Times Reader would itself refresh the contents continually, without any user input. It keeps displaying the last updated time in the top right corner, can browse through pages, and user clicks for details on a story take them directly with a nice transition effect, creating that Wow effect.

Here is what I saw on my first run,


Try it and let the world know of your opinion.

Unlike its predecessor, Times Reader 2.0 is built over Adobe AIR technology which enables it over Windows, Macintosh and your favorite flavor of Linux, as opposed to the earlier WPF version that was restricted to Windows.

I wish something similar is developed by the 'Times of India', for they already have an e-paper edition which kind of sucks. Rise India, leverage technology to show prowess to the world.

Sunday, February 1, 2009

Power of Civil Engineering

The power to observe, perceive and act has elevated man into a class of his own. This god gifted ability has led him to cause change within and around himself.

Change - as they say is the only thing that is permanent. This unquenched thirst for change is the sole spark that drives one to create the world around into a home fit for coexistence of all.

God being the master sculptor has provided all the sources and amenities but in cocooned state. The power to reach out, to metamorphose the resources into useful, fruitful and healthful objects has been bestowed upon only a privileged few.

The air we breathe, the water we drink, the roads we drive on, the bridges we cross, the home we all so love, the life we live, the environment we value is all indebted to those pioneers and fore runners who have exhausted their all for changing just mere existence to living.

Today the life we live is due to the dream that an engineer had seen. The dream to create fire, to make a wheel, to build a house, to cultivate a field, to raise a family is all an engineers vision.

What he dares to dream is unheard of, what he imagines and hopes to achieve is beyond ones wildest imaginations. The engineer who builds a wheel for transport, needs a road for plying. The one who invents electricity, needs transmission setup. He who casts metals for mankind needs a refinery to be set up. From telephone signals to Information Technology laying and setting is a prerequisite.

The water we use for our fields, the electricity harnessed by dams, the bridges bridging our gap, the solid foundations upon which you make your home, the mighty walls that withstand the nuclear reactions, the laying of cables over and below the mother earth, are all conceived by none but one and that one is none but a CIVIL ENGINEER.

Remember, all seven wonders of the world, are civil engineering marvels.
PS: This is in response to an IT Manager's question on me being a Civil Engineer by choice.

Saturday, October 18, 2008

Url based Tile name Controller

Tiles, a framework that is used extensively for templating in Java based web applications. Spring Framework, a dependency injection container that makes configuration easier. There are several controllers available in the Spring framework which makes mapping static JSP/JSF pages directly to the URI's without writing boiler plate code. But in most of the cases, we use Tiles for a templating. What to do in such a case? There is no single controller that would help us map URI's to a tilename. Here is what I came up... A simple controller that would directly map a URI to a tilename and forward the request out.

A typical usage example is as under,

<bean name="urlTilenameController" class="org.springframework.web.servlet.mvc.UrlTilenameViewController" >  
<property name="indexTile" value=".homePage" />
<property name="toLowercase" value="true" />
<property name="stripAfterLastDot" value="true" />
<property name="insertStartingDot" value="true" />
</bean>
The parameters should be self explanatory. In case you would like to know more on this, feel free to contact me.

Hope this helps. Keep Walking!
package org.springframework.web.servlet.mvc;

import java.io.File;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* TODO: type comment.
*
* @author Sandeep on Sep 25, 2008 @ 9:29:54 PM
*
*/
public class UrlTilenameViewController extends AbstractUrlViewController {

private static final Log log = LogFactory.getLog(UrlTilenameViewController.class);

private String indexTile;

private boolean toLowercase;

private boolean stripAfterLastDot;

private boolean insertStartingDot;

/**
* @param request
* @return
* @see org.springframework.web.servlet.mvc.AbstractUrlViewController#getViewNameForRequest(javax.servlet.http.HttpServletRequest)
*/
@Override
protected String getViewNameForRequest(HttpServletRequest request) {
String uri = extractOperableUrl(request);
String tileName = getViewNameForUrlPath(uri);

if(log.isDebugEnabled()) {
log.debug("uri " + uri + " converted to tilename " + tileName);
}

return tileName;
}

protected String extractOperableUrl(HttpServletRequest request) {
String uri = request.getRequestURI();
ServletContext context = request.getSession().getServletContext();
File rootFile = new File(context.getRealPath ("/"));
String rootContext = rootFile.getName() + "/";

if(log.isDebugEnabled()) {
log.debug("Request uri received is " + uri + " in the application context " + rootContext);
}

if(uri.startsWith("/")) {
uri = uri.substring(1);
}
if(uri.startsWith(rootContext)) {
uri = uri.substring(rootContext.length());
}

return uri;
}

protected String getViewNameForUrlPath(String uri) {
if(uri == null || "".equals(uri)) {
return this.indexTile;
}
uri = uri.replaceAll("/", ".");
if(this.toLowercase) {
uri = uri.toLowerCase();
}
if(this.stripAfterLastDot) {
int index = uri.lastIndexOf(".");
if(index != -1) {
uri = uri.substring(0, index);
}
}
if(this.insertStartingDot) {
uri = "." + uri;
}
return uri;
}

/** Returns the indexTile.
* @return the indexTile.
*/
public String getIndexTile() {
return indexTile;
}

/** Sets the indexTile to the specified value.
* @param indexTile indexTile to set.
*/
public void setIndexTile(String indexTile) {
this.indexTile = indexTile;
}

/** Returns the toLowercase.
* @return the toLowercase.
*/
public boolean isToLowercase() {
return toLowercase;
}

/** Sets the toLowercase to the specified value.
* @param toLowercase toLowercase to set.
*/
public void setToLowercase(boolean toLowercase) {
this.toLowercase = toLowercase;
}

/** Returns the stripAfterLastDot.
* @return the stripAfterLastDot.
*/
public boolean isStripAfterLastDot() {
return stripAfterLastDot;
}

/** Sets the stripAfterLastDot to the specified value.
* @param stripAfterLastDot stripAfterLastDot to set.
*/
public void setStripAfterLastDot(boolean stripAfterLastDot) {
this.stripAfterLastDot = stripAfterLastDot;
}

/** Returns the insertStartingDot.
* @return the insertStartingDot.
*/
public boolean isInsertStartingDot() {
return insertStartingDot;
}

/** Sets the insertStartingDot to the specified value.
* @param insertStartingDot insertStartingDot to set.
*/
public void setInsertStartingDot(boolean insertStartingDot) {
this.insertStartingDot = insertStartingDot;
}
}

Thursday, September 4, 2008

Google Chrome!

As with any other computer geek, I was amongst the downloader's of the new Google Open Source Browser, Chrome! Downloading and installing it was a breeze, just a couple of minutes. Upon the first start, as with Mozilla Firefox, it asked whether to import data from the current Internet Explorer. Hehe, I don't know why all browsers target IE as their arch-rival.

The first instant liking was its icon and the comic strip that accompanied the Google Chrome launch. For those of you, who didn't had a chance to go through the making of Chrome, here it is. The strip actually explains the theory why the concept of a new browser originated. And they explain really well, keeping the reader tied and wanting for more.

Anyways, Chrome looks much like the Mozilla Firefox and takes its base from it (I think). The icons, the loading style, the address bar etc. match very closely with FireFox 3.0 But the best part was the reading pane area - its so much large. The tab bar has been merged with the window title bar, and with just the address bar beneath, the whole of the rest screen is available to the user for working.

At first look, you notice that the tab window has shifted to the title bar. Nice idea - why do we need a title bar in an application when we have the whole application on screen, and in-focus. Cool! The animations while opening new tabs, resizing windows, and closing tabs just adds more funk and UI-appeal to Chrome! Must say, Google has the best UI and Usability analysts.

A new tab displays some of the most frequently sites as tiles alongwith the last snapshot, which is ultra-cool. In a fraction of second I could locate my favorite site and a click brought me to it. Amazing!

Another sparkling feature, is the introduction of application short-cuts. I tried that with GMail, and yes, it looks amazing. You have a window with GMail running, without anything else except the title bar, like a desktop application. Ummm.... is Google planning to venture into bringing everything to the desktop ;) Well, that would be a boon for all users from countries where the broadband penetration is still a dream.

The popup blocker displays a notification as a hovering window on the bottom right, and the connection information comes as notifications on bottom left, fulfilling the task bar's functionality. Infact, this adds to the beauty of Chrome, adding more space, and removing information which a normal internet user is least bothered of.

Two features introduced in Chrome, would instantly draw a huge fans base amongst the developers. One is the 'View Source Code' - just right click on any page and it shows you the source code of the page. So, whats new? Well, the source code is syntax highlighted, color-coded and line numbered. Also, you have an option to view the source code of an inline frame, which I haven't seen in IE, FF or Safari, except with usage of plugins. I personally am not very comfortable using plugins!

Another is the introduction of Javascript Console. At first look, it seems like a normal console, but upon exploring further its almost a FireBug in place. Whats more is the concept where you can actually see the files being downloaded for a page in a timeline, and optimize your code accordingly. Is this a competition to YSlow! ;)

Yet, there were a few disappointments. While opening MS Exchange 2000, I could not view my inbox, the frame had the whole source code, but I guess there is a problem with the rendering engine. Second, the browser crashes if the internet connection breaks and you try and close it down. But, with the current version as 0.2 and Chrome in beta, its a long journey ahead. I am sure by the time Chrome comes of age, it would be a mature and robust browser taking on IE one-on-one, and is gonna change and shape the future of web.

Keep Walking, Chrome!/p>