HOME | Blog | YouTube | LinkedIn | About Me         || Calculators    | SoftEng/Tech Posts    | Code/Scripts

Friday, February 27, 2015

Solutions and Design Patterns - what comes first?

I have always been a believer of the following approach in software engineering field:

  1. Have a problem to solve or a requirement to implement
  2. Figure out a solution for it
  3. If your solution ends up being one of the known design patterns, all good. 
What you should NOT do after you get a problem to solve:
  • Do NOT go through a list of design patterns trying to find out which one could solve your problem.

The reason why I am saying this is because we are all guilty of this at some point in our careers whether we want to admit or not. What I am trying to say is that picking a design pattern first might just solve a part of your problem and it might even introduce unnecessary complexity. Please focus on finding the right solution.

- almirsCorner.com -

#architecture #coding #programming #softwaredevelopment #softwareengineering #ITsolutions

Thursday, February 26, 2015

A very good read about Javascript frameworks....

Check out this article about Javascript frameworks on Andy Walpole's website.


- almirsCorner.com -

Sunday, February 22, 2015

Emulate Database in HTML/Javascript - Here is the sample page/code

Here is the example. You can refresh the page and close the browser and it will still maintain the updates you make as it is using a collection of cookies to emulate database.

You can use this sample to build a full prototype site maintain the state of the customer and all the configuration. If you look at the javascript code in the below page, the key thing is the function that saves the encoded JSON string into multiple cookies by using a simple distribution in order not to run into individual cookie size limitation.


NOTE: The dropdown selection does not properly work in IE because of one line of code. I know what to change, but I will not fix it yet. I figured this would be a good way to show a good interview question that you could ask in your company :)

Here is the full explanation of how it works:


- almirsCorner.com -

#html5 #javascript #coding #programming #code #programmer #softwaredevelopment #webdeveloper #database #almirsCorner

Wednesday, February 18, 2015

Emulate Database in Client HTML/Javascript code ??

Emulating database feel in the client HTML/Javascript code is a good option if you want to quickly prototype something while working with your product owners. You can build pages with forms and submit that data from page to page and emulate the concept of saving the data and that data can be used in other pages. This can be all handled within plain HTML files and Javascript code without server-side code.

To achieve this, the following needs to be done:

  • Set up Javascript objects and do some initial loading from some Javascript variables as strings of JSON. 
  • While you are loading these Javascript objects from default JSON string variables (using JSON.Parse method) that are set in the head of your page, you also need to save that information into cookies. The cookies would also need to be updated as you are adding/changing data on your prototype pages.
  • If the data exists in cookies, your page-load could be loading the information from the cookies and that's how you maintain the data and emulate the concept of database without having any server-side code.
Let me comment more on how you would save that information into cookies. The size of this data would cross the limits of cookie sizes. Every time you decide to save your Javascript object into cookies, you can do the following:
  • Using JSON.stringify method convert your Javascript object into a string
  • Then you need to encode this string variable using encodeURI function
  • Then you need to split your encoded string into smaller pieces and create cookies with a specific naming convention and sequence.
  • When you need to load this information from the cookies, you need to load all the cookies following the chosen naming convention and load them into your Javascript object. Don't forget to decode it before JSON.Parse function.
Here is the example. You can refresh the page and close the browser and it will still maintain the updates you made as it is using a collection of cookies to emulate database.


- almirsCorner.com -

#html5 #javascript #coding #programming #code #programmer #softwaredevelopment #webdeveloper #database #almirsCorner 

Tuesday, February 17, 2015

Seat Covers - A nice refresh

I never considered getting seat covers for my cars until I found Wet Okole seat covers. Obviously if you paid money to get leather seats in your car, it does not make sense that you cover them with seat covers; if you are paying for that leather, you should enjoy it. If you are going cover your leather seats, I would like to thank you for saving them for me because I want to be the 2nd owner of your car :)

However, if you have cloth seats, getting Wet Okole seat covers is a good option to protect the seats and to also improve the interior look. Here is a picture of my 2007 Honda Pilot interior with Wet Okole seat covers. It is a perfect fit.

- almirsCorner.com -

#cars #carreviews #interior #seatcovers #seats 

Sunday, February 15, 2015

Coding a quick prototype or a quick tool - what to do?

If you want to put together a quick and lightweight prototype, Javascript and plain HTML are a good option because you only need a text editor and a browser. The end result is presentable. 

One example is a fuel consumption calculator that I quickly coded for myself. My Calculators

- almirsCorner.com - 

#programming #coding #programmer #coder #javascript #HTML5