Thursday, December 29, 2011

submit is not a function, error in javascript

Was trying to figure out why i am having this error "submit is not a function" while trying to submit my form within the javascript method.

Spent half a day finally to realized that i have a button that is having the name "submit".
Once i rename it to "submit_btn" the form gets submitted successfully!

So i learned that dom elements should not be named as "submit" =D

Wednesday, December 28, 2011

Parenting: Are your kids testing your patience?

Getting toddlers to cooperate with us can be a daunting task. Especially when they are starting to recognize themselves as individual.

Regardless if it is meal time, potty time, bath time or bedtime. They can hardly sit through the entire session without getting distracted or suddenly recall that they wanted to do something (or want you to do something), etc...

As parents and care givers, it is unavoidable that we get frustrated, upset or even angry trying to get our toddlers to obey and work within our limits.

Here are some simple practical ideas that I find useful on managing my precious little one.

Right Expectations

Firstly, check ourselves. Are we expecting too much from our toddlers? A 20+ month toddler just do not have the capacity to keep at a singular task for an extended period of time.  So exactly how long is considered too long?  Think about it, a fully functioning and intelligent teenager usually have an attention span of average about 30 to 45 minutes (why do you think lessons taught in schools are usually in periods of about an hour? )

My rule of thumb is this, when our kids start to get restless, protest and stir, the session has lasted too long.  So how do I manage that?  I let my boy go. Before letting him off, I  preempt him that after that, he will have to return and complete the current activity.

Here is the systematic approach:

1. Once the kid start to get restless, offer suggestions on alternate short, non-disruptive activity. Example: my kid loves his machine toys, during mealtime when he start to get restless, I will sometime offer "Do you want to bring your machine toy here to eat with you?"

2. Preempt them that after the "break" they will have to come back. My preempt usually goes like this. "Daddy let you go take one machine, after that you must come back and continue. Ok?" Only after he verbally agrees, then I will let him go.

3. Getting the kid to agree to come back is of course the easy part. The challenging part is getting them to do that. My kid usually gets distracted with other toys or will just run away to some corner and hide there.  This is usually the part that will test our patience to the max.

They will whine, cry, struggle and do anything within their means to escape. For me, it is a chance to hold him to his words and "play" the patience game with him. 

I will point out "Just now you told Daddy that you will take your machine and go back right?"  It is normal that they will get frustrated and cry.  I normally prevent him from playing with any other items and doing any other thing until he is ready to return to his meal.

Personally, I think that it is important that I should be responsible to my kid and myself by holding him to his words.  It is a very emotionally taxing task, seeing the pitiful looks and hearing him cry.  Sometimes I just feel like giving in and let him have his way, but I know that, in the long run that would probably do him more harm than good.

Feel free to cuddle, carry or hug them to sooth them. Love and discipline are not mutually exclusive! In fact, I believe that providing loving support during a discipline episode is extremely crucial so that it will not leave the kid feeling resentful towards us.

4. Be flexible and compromise within reasonable limits.  Normally, by the third step, I would have my kid back at the high chair for his meal.  However, depending on the circumstance, I am flexible to offer additional alternatives.  Which is to go through step 1,2 and 3 again!

KEEP in mind that every kid is different. Whatever strategy we use in parenting, it is important to be aware of our state of mind. I believe that the best results are obtained when we are in a calm, loving and balance state.

Today I finally realized that "Our kids are not testing our patience, they are merely TRAINING OUR PATIENCE."

Tuesday, December 20, 2011

quota_exceeded_err 22 on Mobile Safari (iOS) when using localStorage of html5


Using localStorage of html5 is pretty straight forward.

var bar = 'this is the value to store';
localStorage.setItem('foo',bar);
localStorage.getItem('foo');
localStorage.removeItem('foo');

Testing was smooth on Chrome, Firefox, desktop Safari...

However when testing on Mobile Safari, i got the following error...
"quota_exceeded_err 22"

Goggled around for the issue to no avail.
Finally came across a blog with the solution to this problem.

Which is to turn "private browsing" off in Safari.

To do that... Go to "Settings"
Scroll to "Safari"
Under "Privacy" group, Set "Private Browsing" to OFF.

Hope this can help you the few hours of googling.

The blog that i found : http://frederictorres.blogspot.com/2011/11/quotaexceedederr-with-safari-mobile.html 

Monday, December 5, 2011

Born To Run ~ Christopher McDougall

Just completed my fifth marathon yesterday. This was the most taxing marathon that i have participated so far. Mainly due to the lack of training. The furthest training that i ran was 10 Km... 3 times a week. And i stopped running 3 weeks before my marathon. Mainly because I was down with flu and I seriously though of giving up this year marathon.

At the back of my mind, I know that without much training, our body may not be able to take the strain of the long race.  I know that can still complete the marathon, it is just how much pain I have to go through both during and AFTER the marathon.  And i seriously prayed to God, Buddha and the Universe to help me complete the marathon safe and sound...

Knowing that i did not clock enough mileage for my training, i constantly remind myself to feel and listen to my body, not to push myself over the limit.  Completing this year race will be good enough for me.  So in the end, i came in 6 hours and 30 minutes...

Got the chance to talk to my friend after the race.  We were chatting about our running gears and i got to know that he was running in Sandals! YES! he ran the marathon in Sandals.. you heard it correctly.  When i queried further, apparently, he read about the Rarámuri or Tarahumara (Native American people of northwestern Mexico) which running a marathon is like an usual affair.  I heard about the book "Born to Run" by Christoper McDougall being reviewed on radio before but did not really pay any attention to it.  Now that i have someone I really know review and highly recommend the book, I am going to get the book and read it... Gonna see how it is going to change my life....

Asian Parenting