quick note on “use strict”

I just want to make a quick note on “use strict” in javascript.

Restrictions:

  1. won’t allow to create a global variables
  2. Illegal assignment throws an exception
  3. attempt to delete undeletable properties throws an exception
  4. all named properties must be unique
  5. function parameter names must be unique
  6. octal syntax is not permitted

computer science fundamentals for one with no computer science background

I’m working as software engineer with broad range of technology stacks. Frontend and backend and sys admin and so on. It’s because I love to learn something new.

It’s funny how my career has come this way. My major during college was Mass Communication and then later I changed it to Graphics Design. Back then I loved visual effects using 3d and was fascinated with digital artists’ work. I had a few chances to learn multimedia authoring tool and web development tool such as Macromedia Director and designing web site. Naturally I wanted to learn “Lingo” language while learning Macromedia Director and HTML/CSS while learning website design.

By the time I had a final test, I was able to make a simple game using Macromedia Director on top of the main course of the class. Same to HTML/CSS on top of website design. My attraction had started shifting to interaction from static design.

Flash 4 and 5 were the web when it was the most popular thing in web development community. I was so into them as well. So I started learning a lot of them myself again like the way I learned Lingo and HTML/CSS during college. And I got pretty good at them and that’s when my programer life has started.

Basically I’m a programer who does not have computer science degree. However, I tried to learn CS knowledges as much as possible by myself. Simply because I wanted to know more about programming, algorithms, techniques, and so on. Also I wanted to become a better programmer. At one point I wanted to go back to school and get a CS master degree, but having a full time job as a programmer and a family hasn’t helped me much.

So far I’ve learned Big-O, sorting algorithms, map/reduce, hashtables, numbering system. When I have more chances, I am planning to go at Tree, Graphs, Data structures, Discrete math whenever I have time.

These are topics that eventually I want to cover basically:

  • Sorting (bubble, quick, insertion, merge, selection)
  • Data Structure (NP-complete)
  • Searching
  • Trees
  • Graph
  • Path Finding (A* & Dijkstra)
  • Mathematics

Maybe I missed something, but I hope to know all of topics really well soon. 🙂

VirtualBox and VBoxVmService for browser testing

When it comes to browser testing, I had struggled to keep an user session open for testing box when Jenkins initiated a browser testing job. So my solution for that was to run VirtualBox and VBoxVmService so that each virtual box runs as a windows service and it worked out very nicely for my purpose.

I used VirtualBox 4.2.18 and some settings are:

  • Network settings
    • Adapter 1 for NAT(for outbound)
    • Adapter 2 for Host-only (for inbound)

VBoxVmService

  • Download
  • It makes a virtualbox machine run as a window service in headless mode
  • When Virtualbox machines run as a window service, VirtualBox should not be run. They cannot run simultaneously.
  • Add a list of VBox machines in VBoxVmService.ini file as seen below:

in Tips | 149 Words

I feel so dumb…

I just found out that most of browsers already have Array.prototype.map, filter, and reduce implemented natively… dumb me…

Late inheritance with __proto__ in javascript

In JavaScript there are so many different ways to inherit a super class. For example, Object.create, jQuery.extend, Child.prototype = new Parent(), and so on.

However, it’s not common to use __proto__ to create inheritance chain in javascript. Let me get to it right now.

So that does not look quite impressive. One cool thing about __proto__ is that any instance gets it when created. In javascript pretty much anything can be overwritten, which means after you create a regular object you can still make the instance inherit from a particular Class. Here’s a good example of late inheritance.

It sorta worked, but how about parent Class’ constructor execution? Unfortunately you will have to run one line of code as a late inheritance penalty.

That was a technique used by many old actionscript developers back in the days to create inheritance chain… We were cautious about its usage since it was undocumented feature and it could have been changed without telling anyone. I’m not sure if all browsers support that syntax, but that’s something good to know and understand how javascript works in my opinion anyways.

News Ticker (HTML5 : canvas)

I used to make news ticker in flash very long time ago. Today I wanted to make a very simple javascript news ticker using canvas. It took about 15 mins for me to make this basic structure. If I want to make it dynamic like loading external rss-feed or something like that it can be done too, but for now I’m too lazy to add them… maybe later…

source code