Thursday, July 2

Learnings #0008 - Web development

Chrome - Execute JavaScript inside an iFrame
Recently I tried to console a piece of javascript in console but it returned undefined. Later realized that I was working in iFrames and the Javascript was more related to the content frame instead of the top frame. Was surprised to see that chrome has a freature in console that let's you choose which frame you want to execute your javascript command in. Pretty neat!!!

All this while it was seating next to the clear button, but never noticed. Below is the screenshot




It's important that you put the JavaScript after your HTML div container.
I forget it most of the time. Well working on an existing application, where the script is placed right above in head somewhere. In my defense, I am used to working on application where javascript is placed right at bottom just above closing body div. So issues like this never suffice. However, note to self, always think about the issue and its root cause before jumping on to Google for a solution.

document.getElementsByClassName and document.getElementsByTagName returns an array
Can literally see in the console that it returns of type array, but sometimes we just cannot get our head around it. Feel ashamed due to my limited knowledge. jQuery has made me handicap.


document.getElementsByClassName("someClass")[0].innerHTML = "Yes, I will be changed";

same with

document.getElementsByTagName("strong")[0].innerHTML = "Yes I am Bold";

Strange padding error in table
So clicking on a tr should hide and show another tr was the scenario. This was done in long time back and the way the animation was achieved was incrementing the height of the content tr using setTimeOut javascript function. The main td had padding of top, right and left 20px and the bottom padding was 0. However the td inside the main td had bottom padding so the design looked a little even.

When clicking on the title tr, the body tr should collapse and hide. Just like an accordian. And to achieve this, a height was being applied dynamically to the body tr. Since an inline css for height was being applied, somehow, the padding was applied to even the bottom. And now, since offsetHeight of the body tr was being calculated, it would calculate inclusive of the padding bottom. Strange situation and I still have no clue if my analysis are correct and justifiable. However in the interest of time, I removed any CSS applied to the main body td and applied padding to the data that was inside that main td. I know, quite a mouthful but solving this issue was quite a feat considering how dull I had been with CSS for fast so many months. After writing it down here, now I feel I have achieved something.

Friday, June 26

What is Creative State of Mind?

Excerpts from a book I was reading, loved it, so posting it here.

What is the creative state of mind?
It is, one whose interest in what is being done is wholehearted and total, like that of a young child. With this spirit, it is always open to learning what is new, to perceiving new differences and new similarities, leading to new orders and structures, rather than always tending to impose familiar orders and structures in the field of what is seen.

If one will not try anything until he is assured that he will not make a mistake in whatever he does, he will never be able to learn anything.

Creativity Now: Get Inspired, Create Ideas and Make Them Happen! - Jurgen Wolff

The book was very colorful. Also, it was about creativity and I thought why not? I have read a lot about such topics and many times have practiced some of the methods, but alas, I wanted to read it.


Creative Success Manifesto
1) Success is what you say it is.
2) Commercial Success can take a year or hundred years.
3) Fewer than 1 percent have to buy what you do. Start by finding one person who likes what you do.
4) Crazy is the first step.
5) Ready, fire, Aim.
6) If at first you don't succeed, don't try, try again.
7) Failing feels crappy.
8) The only way to fail if you stop.

- Music stimulates your creativity - Music has the power to stimulate the sluggish brain.
- A mini break clears the way for new ideas.
- Remember how to play cards, how to draw, spend time with child. Play by their rules.
- Why? What? When? Where? How? Ask a lot of questions, it's a way to be open to more possibilities.
- Create your space
- Get the right stuff. The images and items around you can stimulate your creativity. Eg plants and flowers, posters and postcards, inspirational quote cards you make yourself.
- Be a streetcomber - seek interesting stuff and you shall find it. And photograph it.
-Get physical - Movements helps the brain as well as the body.
- Loose your limited thinking - Just because you can't do it doesn't mean it can't be done.
- You are not under arrest. Overcoming the imposter syndrome unleashes your creativity.
- Making up stories warms up your brain.
- Find a mentor - You can learn to be more creative by modelling your favorite genius.
- Dare to Daydream - Daydreaming is an essential form of creativity.
- Record your night dreams - Your dreams are a great source of idea.
- Transform your inner critic - your harsh inner critic can be turned into a constructive inner guide.
- Go back to pen and paper - Reconnecting your hand and your brain stimulates creativity. Handwriting makes one's relationship to words intensely personal.
- Stuff your head with facts. To incubate great ideas, your mind needs facts to work with.
- Keep a swipe file - Adopting what works is a worthwhile creative shortcut. Swipe file should contain good ideas and examples from your field of work or interest. Go into the habit of looking for and recording everything around you that is inspirational, well designed and effective.
- Balance your brain - Balance between the hemisphere of your brain encourages calmness and creativity.
- Feed your brain - What you eat affects your brain functions, for better or worse. Try to eat egg and drink skimmed milk. Have at least 8 glasses of water every day.  Avoid chocolate bars, sugar drinks, junk food etc.
- Create a goals board - Being reminded of what you want keeps you on the right course.
- Join the league of Adventures - A spirit of adventure makes life enjoyable, creative and exciting.


- Follow the four brainstorming guidelines
a) Quantity counts - During a brainstorming session come up with as many ideas as you can.
b) No judging - During brainstorming hold off judging of ideas.
c) Write down every idea - During brainstorming make sure to write down all the ideas.
d) Don't be afraid to build on other ideas.

- Ask the Ignorant - People who don't know what they don't know sometimes know more than the people who know only what they know.
- Try the opposite - Thinking of the opposite of what's usually done may lead you to a practical solution.
- Do a future interview - Being interviewed about having reached your goal gives you clues as to how to get there.
- Force a word association - Forcing a connection between your challenge and an unrelated word yields new ideas.
-When you have a good idea, keep going. Settling for the first goal idea you have stops you from having a better one.
- Start with the end - One way to come up with good solutions is to start at the end and work your way backward.
- Asking questions is a great way to explore any problem and discover solutions.
- Have a trendstorming session - Relating the important trends of the time to your product or service leads to improvements.
- Use mind maps - Using a graphic representation allows you to explore any idea more easily.
- Free writing - Writing quickly about a topic or question reveals information that may have been hidden.
- Challenge all the assumptions
- Image someone else's solution - Imagining how a well know innovator or company would attack the problem can lead to new ideas.
- Vary the attributes - Start with the idea or object or service as it is, than vary its attributes to find a better way.
- Teach your problem - When you describe how you do a problem, you also learn how you stop doing it. For eg, you might give a lesson on how to be late, how to over eat, how to make sure you never exercise, how to procrastinate or just about anything. Once you are done, what you have to do is just opposite of what you taught yourself.
- Summon your originator alter ego - Vividly evoking a time when you were very creative makes it easier to be creative again.
- Combining two ideas or things can lead to something new.
- Learn from Nature - Nature makes a great model for new ideas.
- Randomly matching your interests with your skills can give you new ideas for how to make money.
- Fist in a different pond - Targeting a different audience for what you already do may reveal lucrative new markets.
- Re-purpose - Finding a new way to use an existing idea in a different context yields new value.
- Steal their methods - Applying the methods of successful enterprise to your own challenge leads to success.

Eliminate creative blocks - Creative blocks are obstacles you can overcome.
- Interview the block - look for the source of the problem further back.
- Make the right comparison - there will always be somebody worse than you and somebody better than you. Others will judge whether or not they like what you have done.
- Try a different medium.
- Create an action map - Creating a diagram of what you need to do focuses your creativity.
- To get, ask - When you need help implementing a project the way to get help is to ask
- Give them a taste - Sometimes to sell something, you've to give a sample.
- To sell, pre-sell - Preparing your audience helps make them receptive.
- Declare a MAD (Massive action day) - It simply means you concentrate only on a project distraction free. No email, no online chat etc. Use a pomadoro technique.
- Use the pareto principal - 20 percent of what you do gives you 80 percent of the value. Pareto principal is also known as the 80/20 rule or the principal of the Vital few.
- Keep an Ideas box - While focusing on the project at hand, have a way to capture other ideas.
- Create a layalty card - working step by step towards a reward keeps you motivated.
- Give it a personality - Whatever you create will have a personality, make sure it's one you want.
- Keep it simple - Keep your eye on the core functions of what you create.
- Ready, fine, Aim!  - If you wait until the conditions are right, you will never move forward.
- Look for the quirk - The quirks always stands out.
- Have a plan B.
- Make a not to-do list  - If what you're doing isn't moving you forward, then its holding you back.
- Embrace Procrastination - Working with, not against, procrastination can help you get things done.
- Be the staff - There's a hard-working staff ready to be employed - in your mind.
- Chunk and micro-chunk - when you find yourself avoiding tasks, breaking them up into chunks helps overcome your resistance.
- Use timepods - Focusing your activity for 45 minutes at a time increases your productivity.
- Use the Einsteins levels - Once way to get over a block is to change the level at which you consider the problem.
 - Putting it all together - Having a plan for the entire creative process improves your chance of success.

Putting it all together
- Describe your dream
- Describe what elements would make the project as good as you hope it will be
- Get specific about the features of your project
 - Narrow down the options
- Build your framework and your plan
- Do it!
- Evaluate and improve

Monday, June 22

The Perfect Murder - Peter James

A very short and interesting read. The title was very catchy and so it was my next read. I completed the book in two seating. It was not that thrilling however every page had me intrigued. I loved the book and look forward to reading more from Peter James, an author, whose works I would always be looking for in future.

The story is about a couple Victory Smiley and his wife Joan. They have been married for almost 20 years, however their marriage is reached a crises point. Victor secretly loathes Joan more and more each day and Joan is bored by Victor and all the nasty habits of Victor drives her crazy.

Victor who is a methodical person and thinks about his actions bit by bit ensuring everything is perfect at the end, now decides to get rid of Joan. The only way to get rid of Joan would be to murder her, but he has to plan everything to be out of suspicion of anybody. He researches over the internet about cyanide, insurance policy fraud etc and notes down everything.

While Victor is preparing for the Perfect Murder, he's about to get a nasty surprise. As it turns out, Victor's not the only one with Murder in mind...


Friday, June 12

Workplace - My thoughts

Recently there has been discussion at work about the kind of workplace we should have. Note that this is an open ended discussion and I just want to share my thoughts.

1) The hardware
It has to be awesome i.e very good configuration and we should have laptops for all. We should have an option for the OS as well. I love Macs.

2) Huge Monitors
May be even two. But yes, if you are giving us a computer, please let us have huge monitors. There are plenty of advantages. If you spend 10+ hours per day, then having the right monitors and the right CPU, helps us feel relaxed and and the same time keeps us focused.

3) Music
Humans like to speak and share ideas. Sometimes it so happens that on a friday afternoon, a group gathers around a desk and discuss on the online purchases they made. Totally unrelated to work. But these discussions tend to get louder which can disturb someone else. And no one would want to get up and interrupt the group to lower their voices. Because it never helps. So the best option should be provide subscription to music at work. Have a limited playlist and include relaxation music, or music for focus. These are normally the sound of birds, rain, nature etc playing in a continuous loop. If possible also provide good quality headphones.

4) Activities
If you are having a ping pong table, ensure to provide the rackets and ball. Also have Chess boards. Due to the long commute hours, most of employees normally avoid leisure time because they need to complete their work and reach home to their families on time. But for those interested, have a Indoor sports room.

5) Quality Food
Please have a very good canteen with very good food. Have pantry and provide option for tea, at least herbal/green tea, if not other. Now a days we have machines that gives you a good beverage on click of a button.

6) Encourage Bicycling
For those who wish to cycle to work, have a dedicated parking and a good washroom for them to freshen up before starting their work.