Tuesday, June 29, 2010

Internet connection speeds

Internet connectivity technologies – fastest to slowest

1.       Fiber optics

2.       Cable

3.       DSL

4.       Dish

5.       Dial-up

Friday, June 25, 2010

Unchecking a html radio button

Given the following code,

 

<input type="radio" value="PG" name="courseType" /> Post Graduate </input>

<input type="radio" value="UG" name="courseType" /> Under Graduate </input>

 

To check the "PG" html radio button in jQuery:

 

jQuery(blahBlahBlah).attr('checked', 'true');

 

To uncheck it:

 

jQuery(blahBlahBlah).removeAttr('checked');

 

Note: the following will **NOT WORK**

 

jQuery(blahBlahBlah).attr('checked', 'false');

jQuery(blahBlahBlah).attr('checked', '');

Monday, June 21, 2010

Tomorrow is always fresh with no mistakes in it.

“Tomorrow is always fresh with no mistakes in it.”

- Anne of Green Gables through Julie911

You know, I think you try a little harder when you're scared.

“You know, I think you try a little harder when you’re scared.”

- Rocky Balboa through Julie911

Sunday, June 20, 2010

Knowing to read

Haji Ali...picked up his dog-eared, grease-spotted Koran and held it before the flames. "Do you see how beautiful this Koran is?" Haji Ali asked.

"Yes."

"I can't read it," he said. "I can't read anything. This is the greatest sadness of my life. I'll do anything so the children of my village never have to know this feeling. I'll pay any price so they have education they deserve"

...Mortenson says "...Here was this illiterate man, who'd hardly ever left this little village in the Karakoram,"..."yet he was the wisest man I've ever met."

- From "Three Cups of Tea" by Greg Mortenson and David Oliver Relin

The oppressor benefits for the day, the oppressed - for life

He saw five men approaching. The four burly men walking behind carried clubs made of poplar branches that they smacked against their palms in time with their steps. The leader was a thin, unhealthy looking older man who leaned on his cane as he climbed to Korphe. He stopped, rudely, fifty yards from Haji Ali, and made Korphe's nurmadhar walk out to greet him.

Twaha leaned toward Mortenson. "This man Haji Mehdi. No good." he whispered.

Mortenson was already acquainted with Haji Mehdi, the nurmadhur of Askole. "He made a show of being a devout Muslim," Mortenson says. "But he ran the economy of the whole Braldu Valley like a mafia boss. He took a percentage of every sheep, goat, or chiken the Balti sold, and he ripped off climbers, setting outrageous prices for supplies. If someone sold so much as an egg to an expedition without paying him his cut, Haji Mehdi sent his henchmen to beat them with clubs."

... Mehdi ...said ..."I have heard that an infidel has come to poison Muslim children, boys as well as girls, with his teachings....Allah forbids the education of girls. And I forbid the construction of this school."

"We will finish out school," Haji Ali said evenly. "Whether you forbid it or not."

....

"And you, are you not a muslim?" Medhi said, turning menacingly toward Haji Ali. "There is only one God. So you worship Allah? Or this kafir?"

Haji Ali clapped his hand on Mortenson's shoulder. "No one else has ever come here to help my people. I 've paid you money every year but you have done nothing for my village. This man is a better Muslim then you. He deserves my devotion more than you do."

"If you insist on keeping your kafir school, you must pay a price" Medhi said,..."I demand twelve of your largest rams"

"As you wish," Haji Ali said, turning his back on Mehdi, to emphasize how he had degraded himself by demanding a bribe....

"You have to understand, in these villages, a ram is like a firstborn child, prize cow and family pet all rolled into one"...

....

'It was one of the most humbling things I've ever seen," Mortenson says, "Haji Ali had just handed over half the wealth of the village to this crook, but he was smiling like he'd just won a lottery."

..."Don't be sad...Long after all those rams are dead and eaten this school will still stand. Haji Hehdi has food today. Now our children have education forever"

- From "Three Cups of Tea" by Greg Mortenson and David Oliver Relin

Friday, June 11, 2010

JSF 2.0 - Automatic resource bundle resolution

User message localization is achived by placing messages in resource bundles (userLoginMessages_en_US.properties for example).

In JSF 1.2, these resource bundles had to be configured in faces-config as follows:


...
    <application>
        <resource-bundle>
            <base-name>test.Messages</base-name> 1 References the file Messages.properties anywhere in the classpath
            <var>msgs</var> 2 Messages in Messages.properties will be referenced in xhtml using "msgs" prefix e.g. #{msgs.userName}
        </resource-bundle>
    </application>
...


Messages in Messages.properties could then be accessed as follows in xhtml pages

<h:outputText
    value="#{msgs.userNameLabel}"/>


In JSF 2.0, the faces-config entry has been made optional. To avoid making the faces-config entry,
1. Rename the properties file to match the xhtml file name. For example, if the xhtml file is named userCreate.xhtml, name the properties file as userCreate.properties.
2. Place the .xhtml and .properties files in the same directory. In our example, place userCreate.xhtml and userCreate.properties in the same directory
3. Change the references in .xhtml to #{cc.resourceBundleMap.<symbol_in_properties_file> where <symbol_in_properties_file> is any symbol in the properties file. For example, if the userCreate.properties has a line as "userNameLabel=User Name" then reference this symbol as follows

<h:outputText
    value="#{cc.resourceBundleMap.userNameLabel}"/>


JSF 2.0 Templating

Templating is used to encapsulate (separate interface from implementation) and reuse page layout across. Templating can be achieved using frameworks like Tiles and SiteMesh. 

In JSP, templating is achieved by defining a header.jsp and <jsp:include...> ing the header.jsp in each page. If header.jsp is changed, all pages that jsp:include header.jsp will automatically get that change. Thus the header content has been encapsulated in header.jsp and reused in multiple pages.

In JSF templating, there are 3 elements to templating

Element 1. Template

Defines layout of pages. Layout has markup to construct the structure of page (5, 6 & 7 in the example below) and sectionsnot standard terminology (1 in example below)that can be filled up with contents. Templates can optionally define default contents for sections (2 in example below defines a default, 3 and 4 don't define a default).
Example: template.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets">
    <head> 5 structure of layout
      <link href="styles.css" rel="stylesheet" type="text/css"/>
      <title> 6 structure of layout
        <ui:insert name="title"> 1 Defines a section named "title"
            Default Title        2 Default contents for the "title" section
        </ui:insert>
      </title>
    </head>
 
    <body>
      <div class="heading"> 7 structure of layout
        <ui:insert name="heading"/> 3 A section named "heading" with no default contents
      </div>
 
      <div class="content">
        <ui:insert name="content"/> 4 A section named "content" with no default contents
      </div>
    </body>
</html>


Element 2. Section ContentsNot standard terminology

These are contents that could go into any section defined in the template. For example, there could be one section-contents xhtml file for user login and another for new employee creation.
An user login page could look like this
Example: userLogin.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets">
  <ui::composition>
    <h:form>
      <h:inputText
        value="#{user.name}"/> 1 User name
      <h:inputSecret
        value="#{user.password}"/> 2 Password
      <h:commandButton
        action="#{userController.loginAction}"
        <h:outputText
          value="#{msgs.login}"/> 3 Login button
      </h:commandButton>
    </h:form>
  </ui:composition>
</html>

Element 3. Composition 

The composition brings the template (template.xhtml in this example) and section contents (login.xhtml) together by specifying which section contents (each in its own xhtml) should go into which sections (defined in the template)
Example: login.xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:ui="http://java.sun.com/jsf/facelets">
  <ui:composition template="/template.xhtml"> 1 This composition will use sections defined in template.xhtml 

    <ui:define name="content"> 2 Child elements of this ui:define is the content of section named "content". The section named "content" is defined at 4 of template.xhtml.
      <ui:include src="userLogin.xhtml"/>
    </ui:define>

    <ui:define name="heading"> 
      User login heading 5 Contents of "heading" section
    </ui:define>
  </ui:composition>
</html> 6 This composition chooses not to override the "title" section (define at 1 of template.xhtml). So the default contents defined by template.xhtml will take effect.

By encapsulating the layout, it can be reused across multiple compositions.
[ Source ]





Wednesday, June 09, 2010

I can choose my thoughts

“There is so much about my fate that I cannot control, but other things do fall under the jurisdiction. I can decide how I spend my time, whom I interact with, whom I share my body and life and money and energy with. I can select what I can read and eat and study. I can choose how I’m going to regard unfortunate circumstances in my life — whether I will see them as curses or opportunities. I can choose my words and the tone of voice in which I speak to others. And most of all, I can choose my thoughts.”

- Elizabeth Gilbert: Eat, Pray, Love through Julie911

other people's way of living

“I’ve learned about other people’s way of living: how you cope with life’s challenges, how you celebrate good times, how you feel about issues, how awesomely goofy some of you are, and how, in the end, we all truly just want the same thing: to love and be loved, to understand and be understood, to leave this world knowing that we mattered and made a difference. We are all different, but so much alike.”

 

-       Julie911

Wednesday, May 26, 2010

Learning

A Chinese saying:

I hear and I forget

I see and I remember

I do and I understand

 

Try to make sure your study is uninterrupted. You will need to find both the time and place where you can study.

 

It is important to remember that learning is not a race – everyone learns at their own rate. So don’t rush your leaning – make sure you get the most from the book.

-          An introduction to derivatives

Friday, May 21, 2010

Searching for more proof is futile. Searching for more determination makes more sense.

“That's the way a friend described someone she had just met. She was sure (just as I'm sure) that he's going places. Once the determination is in his eyes, the learning will take care of itself.

On the other hand, if I can see the fear in your eyes, then I'm not sure that learning alone will take care of the problem. No one can prove that the path you're on is risk free or guaranteed to work. Searching for more proof is futile. Searching for more determination makes more sense.”

-       Seth Godin

Thursday, May 20, 2010

I'd learned long ago how to leave things behind without regret

 I'd learned long ago how to leave things behind without regret – Tony Kahn

Tuesday, May 18, 2010

Multiple tabs in gvim

The following will open all xml files found in the current directory (and its sub-directories) in multiple tabs in gvim

 

$ find . -name '*.xml' | xargs gvim -p

Thursday, May 13, 2010

The ability to choose who judges your work...is the key building block in becoming an artist in whatever you do.

Here's the mistake we make in high school:

We let anyone, just anyone, judge our work (and by extension, judge us.)

Sue, the airheaded but long-legged girl in Spanish class gets the right to judge our appearance.

Bill, the bitter former-poet English teacher gets the power to tell us if we're good at writing.

And on and on.

The cheerleaders are deputized as the Supreme Court of social popularity, and the gym teacher forever has dibs on whether or not we're macho enough to make it in the world. These are patterns we sign up for, and they last forever (or until we tell them to go away).

In high school, some people learn to ship, they learn to do work that matters and most of all, they learn to ignore the critics they can never possibly please. The ability to choose who judges your work--the people who will make it better, use it and reward you--is the key building block in becoming an artist in whatever you do.

-          Seth Godin

Wednesday, May 12, 2010

HTTP Debugging Proxy

To see the requests (http and ajax) being made from browser to server: FiddlerTool

 

 

Tuesday, May 11, 2010

Every moment of life is a new beginning point as we move from the old

“In the infinity of life where I am, all is perfect whole, and complete, and yet life is ever changing. There is no beginning and no end, only a constant cycling and recycling of substance and experiences. Life is never stuck or static or stale for each moment is ever new and fresh. I am one with the very Power that created me, and this Power has given me the power to create my own circumstances. I rejoice in the knowledge that I have the power of my own mind to use in any way I choose. Every moment of life is a new beginning point as we move from the old. This moment is a new point of beginning for me right here and right now. All is well in my world.”

~ Louise Hay (You Can Heal Your Life) through thinksimplenow

 

Thursday, May 06, 2010

To the change to comment/log on a existing svn revision

svn propset svn:log --revprop –r <revision_no> “<new_comment>”

can

“Your biggest challenge isn’t someone else. It’s the ache in your lungs and the burning in your legs, and the voice inside you that yells ‘CAN’T’. But you don’t listen, you just push harder. And then you hear the voice whisper ‘can’, and you discover that the person you thought you were is no match for the one you really are.”

- Author Unknown through Julie911