Aug 13

future seems to be already here! TED talk


Raffaello D’Andrea explains robotic athleticism, algorithms, math, etc.
Just mind blowing how far we have gone already with this kind of stuff.

Jul 13

ECMAScript 6 modules

AMD is new standard in my book and I am glad that ECMAScript 6 introduces modules.

This blog has great depth of the new ECMAScript 6 module.

From the spec, importing a module is very flexible in ECMAScript 6, which I like a lot.
Examples are (also found in the blog above):

  • import { square } from ‘lib/calc';
  • import { square, MY_CONSTANT } from ‘lib/calc';
  • import ‘lib/calc’ as c;
  • import { square as squ } from ‘lib/calc';

As you can see there are 4 ways to import.

Aslo it has requirejs like syntax such as:

    function (module1, module2) {
        // success case
    function (err) {
        // failure case

which is very similar to AMD syntax

    function (module1, module2) {
        // code
Jul 13

having much fun with backbone & requirejs

I’ve been working on a project that requires intensive javascript right now, so that I went with backbone and requirejs as fundamental framework for the project.

It’s multiple pages project so my structure would look something like this:


Obviously common.js defines paths and shim for require.config that are shared among all pages.

Each html page has require’s initialization code like this:

<script type="text/javascript">
    require(['js/common'], function(common) {
        require(['apps/home'], function(home) {

That way, common js containing require configuration can be shared among pages. Also I did not want to create main.js to reduce a number of javascript files.

apps directory contains page’s main javascript files. So in the example, I have 2 pages, which are home and profile, so I have home.js and profile.js. Those app javascript files are the key piece that has the core business logic to pulls necessary views, models, and necessary lib files for the page.

Everything has been very modularized and between modules, communication occurs via event aggregator, which is yet simple, but very very powerful. Without that, I don’t know how I would have separated logics and made them still modularized.

I really like how you can modularize your javascript code with requirejs. I think that is one of best things that were invented for javascript!

Jul 13

migration to joe’s datacenter

Did it again. However, this time I’m getting a dedicated server instead of cloud virtual servers based on one blog post.

Since I do not have virtual servers, my environment is rather limited.
So I decided to just go with apache instead of nginx and everything is vhost.

It’s been a few weeks since I migrated and everything has been so far so good.

Jun 13

faded images by category

Today someone asked me how to implement fading images by category. Triggering event should be “click”.
So I made a sample page for him and it took literally less than 10 mins to achieve the effect.

Here it is.

Jun 13

nodejs and forever

When I first learned nodejs, its version was something like 0.1.x. Also back then setting up nodejs application as service so that it keeps running continuously was a bit daunting job.

Now with nodejs v0.10.10 and forever, that issue is gone.

One thing I had a trouble with installing forever was “-g” option. This is what needs to be executed.

sudo npm install forever -g

using forever to start an nodejs app is easy as pie.

start your app
forever start yourapp.js

list running nodejs via forever
forever list

kill a nodejs app via forever
forever stop {indexnumber}

Even if you kill the process with kill {pid} your nodejs app will come back live, so you have to kill the app via forever.

good stuff.

note: when installing the latest nodejs I had a trouble adding repository “ppa:chris-lea/node.js”:

sudo add-apt-repository ppa:chris-lea/node.js

This guy’s post has the solution to the issue of add-apt-repository being not valid command.

sudo apt-get install software-properties-common

Jun 13

javascript frameworks: angularjs

Ok I admit that I lacked the latest javascript frameworks such as AngularJS or Backbone.js.
So I decided to do some digging around those frameworks starting with AngularJS as that’s the one of the questions interviewer want to ask about. I’ve asked multiple times already and was neglected to learn more about it until this morning.

First thing first. minified javascript file size is 82KB. Maybe I have not adapted to the new mindset that many users have high speed internet service so 82KB is small number to download? I still think that 82KB is pretty big file. That is another reason why I avoided those frameworks as much as possible. On the second thought, server side gzip will take care of that issue much since compression rate against static text files is pretty damn good.

Ok. going back to learning more on angularjs… will be back…

Jun 13

Genghis mongodb admin UI

Downloaded it, installed it and love it.
Simple and clean UI.

I was using mongoHub, but the app has stability issue on my mac and it would crash here and there often although it is a mac os native app.

I was quite impressed with Genghis.

their website


Mar 13

Look at your html page as xml data for the sake of SEO

I’ve been working on a script that goes to a URL and scraps some parts of data, which is pretty much a crawler or spider.

If all pages that the crawler landed were valid, my job would have been so easy. However, in reality many many pages are not valid and the script has to use regular expression.

This can be a good or bad thing for those web owners.

However, exposure is very necessary in terms of marketing for the site and valid html page means it has greater chance to get exposed by search engines such as google.com because valid html page will provide what search engine crawler wants more efficiently.

I believe engineers who work on those crawler have overcome many difficulties due to the invalid markup on a page. However, if HTML in a page is not valid (treating it as a xml), those smart engineers would have to come up with a logic to overcome that by using regular expression perhaps. That could be prone to mistakes so lead to scrapping only few from invalid HTML in a page. After all engineers are human and human make mistakes.

Also just for the same reason, if well formed semantic HTML is used, it will have higher chance to get exposed to a certain keyword typed by users.

That’s just my idea of how html page has to be constructed considering SEO and future use.

So my recommendation is this:

1. Treat markup in a page as data. Forget about presentation and such. Just make sure the data is valid.
2. Use CSS to visualize the data (= HTML markup) to appeal users

It’s quite simple after all.

Mar 13

Using .plist to get app-wide variables

In web application architecture, there is usually a file that has system configuration info.
In objective c development, there is a file called {name}.plist and it has some information regarding your application.

This is how you can get a specific information out of the file.

NSBundle *mainBundle = [NSBundle mainBundle];
NSString *myValue = [mainBundle objectForInfoDictionaryKey:@"myVariable"];

There you have it!

« Older Entries
Newer Entries »

Copyright © 2015 web technologist
Proudly powered by WordPress, Free WordPress Themes