Posts

Shadow Master: Shadow DOM

I have had many sleepless nights trying to deal with CSS bleeds and clashing element id attributes. You have to expect this when you are working on a code base that is accessible to a lot of developers especially in an enterprise setting. Good thing that I am not the only one encountering this problem and the new w3c specification hopefully would address this problem. ( http://www.w3.org/TR/shadow-dom/#dfn-functional-encapsulation ) The SHADOW DOM As defined in the specification this addresses the functional encapsulation of element in the DOM tree. What does this mean? Well first you can now have chunks of html elements with styling that will not affect the rest of the DOM tree. Why would you want to have chunks of html elements? Of course to create widgets. This is the reason why the Shadow DOM is an important part of building web components. Once you created a chunk of html (like a widget) you can now re-use this widget all over the place without the fear of having...

How is the Weather ? Quick use of OpenWeather API

The Weather Now that spring is here and good nice weather. I can't resist trying out the Openweather api . So I quickly created an Single page app using Google's hosted jquery library . Here is the source code you can fork from GitHub from here  https://github.com/petabyte/HowsTheWeather Here is the link to the hosted page in github http://petabyte.github.io/HowsTheWeather.html

Some Fat are good for you: Fat Arrow Functions in ECMAScript 6

Image
The Fat Arrow I have been hearing about the arrow functions lately and everybody is excited about it. Arrow functions are still in experimental stage and are part of the Harmony (ECMAScript 6) proposal. Here is the  Arrow Function Reference on MDN . So I am curious what the excitement is about and wanted to try it. Spider Monkey Build But before I can try it I have to build my own SpiderMonkey engine that has this new javascript features. Here is the link to  Spider Monkey Build Documentation .  Sublime Text Build System Config After building SpiderMonkey i added it as a new build system in Sublime Text using this configuration. {     "cmd": ["js", "$file", "$file_base_name"],     "working_dir": "${project_path:${folder}}",     "path": "/usr/local/bin:/bin:/usr/sbin:/sbin",     "selector": "*.js" } Note: path may vary where the js executable is installed in your syste...

BootStrap 3 - Mobile first responsive design

BootStrap 3 - Mobile First Responsive Design Mobile Web As Mobile devices become more available to users,  creating web applications to cater to this mobile devices are becoming more crucial in reaching audiences. A mobile presence becomes essential in building a successful web product. In my experience as a web developer, ipad and mobile stories keep presenting themselves as additional tasks to web development efforts because users  out there are accessing the web using  mobile devices. Now there is a philosophy out there Mobile First Responsive Design that was introduced by  Luke Wroblewski . This philosophy or approach suggests to create websites to cater to different devices using  progressive enhancement rather than graceful degradation. The idea behind progressive enhancement is to scale up the user experience not down. This is achieved by having the default behavior of the website is to cater to mobile devices and scales up the experience if a ...

As Java Programmer, "Where has C# been when I was programming In Java "?

As a certified Java programmer I have been living in the Object world maintaining my states, favoring composition over inheritance and using design patterns until multicore CPU's came into the market. You maybe asking why did multicore cpus disrupt my object oriented world? Here is why -  It's time to get good at functional programming . The main thing in the article is the parallelism of functional programming to take advantage of those multi core cpus. Variables and data in functions will not have the side effects (deadlocks, race conditions) that we see in an object oriented language like java because functions only depends on inputs and not on any global state (translation - they only have local variables which is always thread safe).  So how does this relate to C# ? Well the designers of the C# language was heavily influenced by Haskell (functional programming language.  Erik Meijer  worked on LINQ in C#).  I am liking, favoring and talking about C# beca...

MyBatis Multiple Query Parameters - property of an Object Type

MyBatis Multiple Parameters I have been using ibatis (now mybatis) for quite sometime now. It is really quite a powerful ORM. It has come a long way and there are a lot if improvements from the xml configuration based version to the new annotations. Here are some things that i like the most: 1. the SQL builder class ( SQL Builder Class )     I was looking at other ways to use SQL in my projects like JOOQ ( JOOQ DSL ) because it offers generating SQL via typesafe way using DSL. I am so glad that myBatis has this typesafe way of creating SQL too. 2. the typeHandler - you never know when you are going to need one specially in java type to jdbc type conversions. For example time formats ( joda-time ) 3. the provider annotations (InsertProvider, SelectProvider, etc..) - gives you a flexible way of generating your SQL statements dynamically. Recently used a 'MERGE' statement in Oracle. I wonder if i could have used that with JOOQ ? 4. the SQL statement parameters - Di...

Recursion and Sort - should be asked everytime

I am surprised with my new manager because he is so technical (He can code). He is trying to come up with interview coding questions to test candidates and has asked me to look at it. If I don't know any better he is trying to test me too. I did an interview with coding questions before and most of the questions that i have encountered are mostly about recursion and sort. Recursion and sort questions are very reasonable to ask a candidate who is going to code because recursion and sort  will be mostly all over any code base. So when my manager asked me to look at his coding test in the back of my mind i would suggest a question about recursion and sort. When i was preparing myself for such an interview (the one with a coding question) I have found this  http://codingbat.com/  as a great place for practice..much like crossword puzzle.  After trying a few questions at codingbat.com , I thought i can come up with questions like that too. Here is a sample question ...