12
Nov 13

Summary of migration to nodejs at paypal

  • Focus on re-use
  • Utilize an Open Source Stack
  • Bootstrap with Bootstrap
  • Use JavaScript Templating
  • Make UI Bits portable to legacy
  • Make it easy to understand and easy to experiment
  • Bring Node to Production
  • . . .

Read details here

29
Oct 13

js features in js engine

Wikipedia has listed them well enough.

07
Oct 13
07
Oct 13

vmware fusion and shared directory on a host machine

I’m using vmware fusion to create many development environments so that I have completely isolated ubuntu for client A, windows 2008 server R2 for client B, centos for client C, and so on.

Actually it was several months ago, but I was bothered to find a solution to this weird bug couple days.

On vm ubuntu, every time I use *composer* to update PHP project dependencies I end up with php parse error. They look something like this:

  • PHP Parse error: syntax error, unexpected ‘)’ in …
  • PHP Parse error: syntax error, unexpected ‘F’ in …
  • PHP Parse error: syntax error, unexpected $end
  • and so on…

BTW the temporary solution was to open a file, save, and then quit vim.

To fix the issue better than the temporary solution was:

  1. sudo vmware-uninstall-tools.pl (on the vm ubuntu)
  2. sudo apt-get install open-vm-tools

Since then I have not had the same issue before. Some reported that the solution that I took steps stopped working for them, but it wasn’t the case for me.

06
Oct 13

laravel’s database migration and seed

I have not used laravel 4′s migration and seed features much until couple days ago.
Oh boy, it’s a really sexy tool.

It does not matter whether you are in a team or you are all alone doing everything. It’s a feature that every single develop must use if integrating with a database!

Theoretically if you are a disciplined developer and use those features, confidence level of your database changes when deploying will be very high. I promise!

You will end up needing these if you decide to go with it:

*migration* file should be used for any changes that affect db schemas.
*seeding* file should be used to pre-populate data into db.

UPDATE #1:
I thought it’d be beneficial to add some sample codes.

To create migration file, run this at Laravel’s app directory:

1
php artisan migrate:make change_to_table_a

The above command line creates a file something like:

1
2013_10_07_065929_change_to_table_a.php

And its content looks something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
use Illuminate\Database\Migrations\Migration;
 
class AddColumnsToUsersTable extends Migration {
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
	}
 
	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
	}
}

As you can take a guess, up method is where you change db schema. down method is where you rollback the change.

So let's say I want to add column "username" to "users" table.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	public function up()
	{
		Schema::table('users', function($table)
		{
    			$table->string('username');
		});
	}
 
	public function down()
	{
		Schema::table('users', function($table)
		{
			$table->dropColumn('username');
		});
	}

(If you want to know more about available methods to manipulate db schema, click here.)

Now you want to run against your db? Then don't look further. Just run this:

1
php artisan migrate

After you run the command line, Laravel adds that particular code to migrations db table and that's how it keeps track of history.

Now you realize that you made a mistake and want to rollback your last change, run this:

1
php artisan migrate:rollback

I'll add seeding sample to the blog post later...

21
Aug 13

Why I am going full JavaScript

Recently I claimed that I would go full FE. Since I’ve been working on couple projects utilizing Backbone/Marionette, I realized that it’s about time for me to go full JavaScript even for BE using nodejs.

To be honest, I did not use nodejs much except running nodejs via forever and some hello world type apps. However, I’m planning to use javascript for everything as much as possible. Reasons are:

  • Community seems to be there to support you
  • One scripting language for FE/BE
  • Data transport over HTTP is done using JSON mostly
  • Many 3rd party Rest APIs support JSON
  • Performance got much much better

So that means, I will dig up build process, deployment process, and CI for Javascript sooner or later, which I’m happy to investigate.

12
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.

13
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

08
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

github

24
Jan 13

PHP PSR-[0-3]

At my work place, we use PHP and CodeSniffer hooked up in Jenkins.
I liked the fact that PSR-1 and PSR-2 are approved by the committee.
The PSR0 standard is found at:
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

The PSR1 standard is found at:
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md

The PSR2 standard is found at:
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

The PSR3 standard is found at:
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md

p.s. Kohana 3.3 has PSR-0 and the migration from 3.2 to 3.3 is quite tough for me. It requires a lot of refactoring on my side…


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