Mobil Mewah

Salah satu sumber Inspirasi.

Mobil Sport terbaik

Anda pasti bisa memilikinya.

Bermain dengan pesawat

Salah satu ide yang gila, Balapan di udara.

Bermain di angkasa

Apakah ini salah satu Goals dalam hidup anda? anda pasti bisa mencapainya

Sunday 21 August 2016

Creating a base view in backbone marianotte js the good way

Marionette JS is based on Backbone JS and a lot of the module extend from basic backbone modules. Here i learn when i extend a module whether it was a view or model or anything you will do like this :

var BaseForm = Marionette.ItemView.extend({

    

      initialize: function(){

           this.title = "title"

      },



});


and to use it on a custom page view base on the BaseForm you will do this :

var contactForm = BaseForm.extend({

    

      initialize: function(){

            this.rows = 2;

      },



});


Above problem is the main object title from the BaseForm is gone, except you do this inside contactForm :

       initialize: function(){

             BaseForm.prototype.initialize.call(this);

             this.rows = 2;

      },


With the above method, anything initialized on the BaseForm will still be available.

But this create problem that everytime you override the initialize, you need call the prototype. How if we not touch the initialize in the BaseForm, and just create a new method, that will be checked by the initialize method on the BaseForm.
So here are the new way on doing this :

//BaseForm default initialize

var BaseForm = Marionette.ItemView.extend({

    

      initialize: function(){

           this.title = "title",



          if (this.additionalInit){

              this.additionalInit();

          },



      },



});

//we extend from BaseForm without touch initialization code
var contactForm = BaseForm.extend({
   
      additionalInit: function(){
            this.rows = 2;
      },
});

The benefit of this, any developer want to use the module, no need break the module by override the initialization, or if do want additional custom function running after the initialization base modul load, provide the function that the initialization checks, in this case additionalInit function.


Saturday 20 August 2016

GlusterFS for scalable storage

When look for a storage, a simple thing for system admin was a NAS. With a NAS appliance, your life is easier. Plug and forget, if ever happend to the harddisk, just replace it as already have RAID system. But still, the storage size is limited to the disk bay provided and a disk size available, also with RAID, disk size is limited to the smallest disk available.

So when we need a future expanding of the storage size, NAS is not an easy way to do the storage expansion. Come the GlusterFS for storage cluster. With GlusterFS you can easily expand / scale out your storage size. just add a server and a disk storage, put it on the glusterFS cluster, your storage size is bigger.

Some of notes when using GlusterFS :
1. Run on Linux server
2. Use XFS file system (recommended by Redhat)
3. Use LVM system
4. Use Hardware RAID for disk level redundancy
5. Use native glusterFS client

The important thing to highlight is use the native glusterFS client as it will provide redundancy, because all the data stored on the storage nodes, the client will fetch it automaticly by connecting to all the nodes inside the storage cluster. The initial connection only to the mount point node of the storage cluster. This will provide load balance of load inside the storage.

Also the RAID on hardware level. If Disk problem, just swap it as provided by the RAID hardware. Easier to do than setup RAID on the OS level.

For the default configuration, GlusterFS distributed your file to each storage nodes. You can have other options in GlusterFS base on your needs as :

1. Distributed Volumes
2. Replicated Volumes
3. Striped Volumes
4. Distributed Striped Volumes
5. Distributed Replicated Volumes
6. Distributed Striped Replicated Volumes
7. Striped Replicated Volumes
8. Dispersed Volumes

To provide redundancy and availablility, i am using Distributed Replicated setup, where i set 2 replica and distributed the store to every nodes.
The minimum brick required are 4 (assumes each server have 1 brick only).
So we distribute the data to 4 storage node, with 2 replica on each data.

GlusterFS Distributed Replicated Volume. Source: GlusterFS Documentation

This storage setup i used for Owncloud storage backend.
With this, we able to expand the storage size anytime with adding more VM or server node to the cluster.

Wednesday 17 August 2016

Marionette JS the basic of javascript Front End

When talk about Front End development, developers will look how to build fast and update fast. With basic javascript, you can build a frond end app, but will have a boiler plate code. So people look for frameworks and library. As my journey on developing Front End web apps, first look to using plain HTML + CSS + Javascript , which will use Jquery of course.

Move on to the next level, developer tends will use a framework. There are plenty of frameworks, like AngularJS, EmberJS, BackboneJS. Each have their own benefits. I have try angularJS, and with current angularJS status, i don't fell like it. It breaks everything, and you will have to follow if you still want to use AngularJS. Do they even think about their users? How about my apps ?

I try to use the basic with javascript + Jquery, and see on backboneJS is trying help on dealing with javascript better, and also support Jquery. Even better with the available Marionette JS. I like the concept of region and layout, which every application will have that thing and you have full control over it as developer.

So now my journey on Backbone JS + Marionette JS will evolve, and with the backend will use Django as the horse power.

Like many framework, you need to see not only how to create apps faster, but manageable and reusable code. After using Django for web development, you will want the reusable and manageable code in your repository.

Front End web App is the way to a distribute work load, processing on client side.

My way is Backbone JS with Marionette JS.




Twitter Delicious Facebook Digg Stumbleupon Favorites More