Tuesday, July 03, 2012

Modern Web Architecture- Javascript driven?

Todays web has become a central point of all applications. HTML,CSS and JavaScript technologies have evolved quickly - The entire Web architecture is moving quickly towards real-time.In addition, doing all data processing in client side and making less load on server achieves two important things:1)Web experience is like Desktop application[faster] since ongoing client/server communication is only about data exchange and not rendering logic. 2] development of client side and server side can go in different cycle. It leads to think that server development can be implemented in any technology or can be hybrid technology until it gives data in common format like JSON or XML. Client side technology will consume these data and act as per application needs.There should be no or very less binding or dependencies with server side implementation technology. So most of data processing or presenting logic resides on client side.This again gives to think a structured way or framework based client side development as we did for server side. In Java world, Spring,Struts,play framework,Tapestry,Grails,Rails are few among name. They mostly follows MVC pattern to make the code for better maintainability,testability.  Nowadays Javascript is one of the major technology used for client side development. Using Javascript framework not only helps to organize the code but  helps to develop code easily. There are lot MVC based Javascript[see this] are out nowadays.Each framework has pros and cons. A nice comparison has been done [here]. Among then backbone.js and ember.js are quite popular. We also need to consider a good Javascript template system for better client side development. Click here for a good comparison by linkedIn.
Choosing right framework is also very tough as it totally depends on which application you are making. Still one should try to follow these features while choosing framework.

1.Testability
2.Good UI bindings
3.Composed Views
4.Web presentation Layer
5.Play nicely with other
6.HTML5 compliant

Try out this link and and see the Todo Application written in various JavaScript based MVC framework.http://addyosmani.github.com/todomvc/

recently Angular.js comes in light for its clear MVC pattern design ,solid UI binding,HTML5 compliance, good unit testing framework and very easy to write code. Try out http://docs.angularjs.org/tutorial/ and http://avalanche123.com/blog/2012/02/29/angularjs-superheroic-javascript-mvc-framework/.

I am very much impressed with AngularJs. their design philosophy and clear architecture is really good.I am learning this framework and will post more about it and other Javascript framework time to time. Given some good link
Stay tuned for more update.

Installing GIT client Windows 7

Git is now most popular code repository now a days. you may go to https://github.com/ to get a web based repository.Git is written by Linux torvalds , creator of GNU Linux Kernel.

To install Git client for Windows 7
1. download msysgit from here.
2. follow the screen shot while installing this.
3. Generate SSH keypair. Please follow this documentation here.


The Future of Deployment by Nic Williams

I copied this content from youtube---

"When you type "cap deploy", "ey deploy", or "git push heroku master" your intent is to deploy your local application source to your running system on the Internet. That seems to be the point - you changed your code, and you want to Just Ship It. But what is your actual objective? Is it really to just "deploy app code changes"? Is this "app-centric" view and user experience satisfactory?
Code deployment is your intent on some occasions. On others you want to change your production environments for applications, or change scale attributes of your system, or change how applications and services within a system communicate with each other, or with remote services (such as facebook).
Is "app-centric deployment" the best mental model and toolchain for shipping changes to productions systems? Or is "environment-centric" or "node-centric", enabled with frameworks like Chef or Puppet, the most powerful & effective model of the system to allow you to deploy and manage change?
Or perhaps we should describe the entire system - all the apps, all the system dependencies, all the interconnections, all the scale attributes - and command it to come into existence? To command the system to go from nothing to v1 to v2 to v3, where each version includes changes in attributes of the system.
Where should configuration/manifests/attributes go? Source code files in the config folder? PaaS configuration or environment variables? Or should components of a system dynamically discover information about itself and configure itself?
Perhaps we need the benefits of a "system-centric" build toolchain, with an "app-centric" user/developer experience to trigger deploys, with a "node-centric" experience for sysadmins.
In this talk, we will reflect on the current state of deploying production systems, including build/deploy toolchains, and continuous deployment. We'll look at the attributes of a complete system, how we explicitly or implicitly describe them and their relationships, and how to orchestrate changes in the system - from app-centric, node-centric and system-centric views.
Let's discuss the difference between deployment in month 1 and living with your system for the next 59 months."
BioDr. Nic is a developer's developer.
He writes blog posts for developers; creates tools, libraries and text editor extensions for developers; and speaks to developers at conferences.
He's the VP of Developer Evangelism at Engine Yard, the leading Platform as a Service.

http://www.youtube.com/watch?v=I0n2wiYvFNw


Sunday, February 20, 2011

Learning Grails

While studying IR technique, I was searching a fast,quick web development framework based on Java. After long research and trying with couple with web framework , I settled down with Grails.
I got impression and started building small application based on this framework. Grails is based on groovy dynamic languages. Groovy, you can say a superset of JAVA language. It runs under same JVM what you use for JAVA. So JAVA and groovy programs can run together. Here i am giving couple of link for tutorial. Grails framework is supported by springSource, creator of Spring framework and it supports well. It also supports all modern Object relational Mapping tool like hibernate. A based way to learn to watch screen-cast videos available in grails website and try along with that.

1. grails website
2. groovy website
3. git installation
4. screen-cast tutorial


Thursday, February 03, 2011

Information Retrieval study

Well, It's time to learn . Currently I am reading Information Retrieval Book from this Link.
I feel better while reading this book ,well written.This time my blog post will be quite less as I am more on reading book.Update soon.Meanwhile you can check out some great link about IR.
Resource:
Web Site:


Thursday, January 27, 2011

Started Again..

After three years!! Oops so many things have been changed. Technology,Me,You.....
After long gap, I realized more to have a blogging. I changed my interests too. I am still interest in Open Source but the fields got change. Currently my interests includes Information retrieval,social data mining and search technology.
I love open source and would always like to work on open source software(Use+Contribute).Hope I would continue from now onwards.

Saturday, August 09, 2008

I am back....

Since November,2006 i didn't write any single post in this blog. I am really sorry to me.
Several things has been changed during this two year.I moved chennai to kolkata,got married,changed my employer.Currently i am in Tata Consultancy Services,Convergence and Multimedia Innovation Lab,Kolkata.I have finished two projects - Rule Engine for RFID based Vehicle Management System and Remote upgrade for Intaractive Set Top Box.Now i am working with real time video streaming in J2ME. I hope i will be posting more and more tech stuff on this blog.

Tuesday, November 14, 2006

[off-topic] Something about MINIX

Nearly 4 months back, i came to know to MINIX 3 has been released as a free software. I downloaded this ran also with help of QEMU simulator.The latest relase has been made on 29th May 2006. I think you all people know about this teaching OS. It has been made by Vrije Universiteit, Amsterdam,headed by professor Andrew S. Tanenbaum. Most of the function is written by him. But that time i didn't look much inside of this OS or kernel part. But two days back, one girl from Haldia Institute of Technology , told me that she wants to build a OS like MINIX..then i though let's again visit MINIX. After reading some document , i got realy some good things in my mind realy i am realy getting love with MINIX achitecture. As all of you know MINIX kernel is based on Microkernel architecture. "A microkernel is a minimal computer operating system kernel providing only basic operating system services (system calls), while other services (commonly provided by kernels) are provided by user-space programs called servers. Commonly, microkernels provide services such as address space management, thread management, and inter-process communication, but not networking or display for example."(taken from wikipedia).
Now i am quite familar with Linux kernel and it's architecture is based on monolithic(See wikipedia for more information) kernel architecture. Though it has some good facility for modular programming.
The question which i want to figure out is, most of the device driver has been implemented inside the linux kernel though the biggest device driver (graphics driver ) is in user space. I couls see size of the driver code in linux kernel is 112 MB whereas the Whole kernel itself has 269MB. So nearly more than 50% code in kernel is driver code!!!!.And most of the developers want to make driver in user space and effort is user space device driver.The majority of bugs linux kernel are in device drivers. if you can move out these driver form kernel space to user space i think we can minimise the bugs. I think it would be applicable for Networking also. But their would be some issue like performance and latency. Still i love to see device driver in user space. Why should i take care about kernel when i am making one driver for device? . Let kernel to do that. Thecommunication between driver and kernel should be designed very carefully so that time required for communication would be minimized over a period of time.That's all..That's why i fall love in MINIX. It has fare architecture to do that.I would like to invest some time on that architure and also would like if someone can come with idea like a "conceptual Architecture of MINIX kernel"...Well this post is going to be big. So i decided to stop here, journey with MINIX kernel and hope to post another article in "User space device driver". Those who are realy interested in MINIX kernel please contact me.. And more ever there are very easy chances to be a main developer!!!!or you may say kernel haker!!! in MINIX world.
visit www.minix3.org

Friday, November 10, 2006

How to enable 3D Desktop

To enable 3D accelaration in your Destop, You should have some supported graphices card. If it is semi supported then it's also O.K... Now you should have some necessary packages , These are compiz, xgl, xgl-hardware-list, gnome-session and libwnck packages. Just install these packages. Next run gnome-xgl-setting from the command line and enable 3D Desktop option. After than just logout and login again. You will get 3D enabled Desktop. Remind one thing it's for GNOME Desktop not for KDE. To enable 3D Desktop in KDE you have to do configuration. Please follow this link
Link

Tuesday, October 17, 2006

Increasing HZ value in Linux kernel

i just came accross to know what are the effect if i increase HZ value ( CPU ) in linux kernel? . I found some good documentation. In this post, i am giving only the link which i found during my research. I will throw more light on that topic in next post. Have a look and think about it..
http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufreq.html
http://ubuntu.wordpress.com/2005/11/04/enabling-cpu-frequency-scaling/
http://kerneltrap.org/node/464
http://lxr.linux.no/source/Documentation/cpu-freq/

Happy Hacking..

Thursday, September 21, 2006

Know rss field in ps command also mm_struct in linux kernel

This post is for intended to be answer of one mail from kernelnewbies..Let me tell the question which was asked by someone..
"Task_Struct->mm->RSS different from ps -aux RSS kernelNewbiesHi,
I'm developing kernel modules for educational purposes, and I was trying to find out the amount of memory used by a process. When you go ps -aux it shows for example that a certain process is using 1.7% of memory and has an RSS of 16000, however when I go to the concerned task_struct and printk the rss from mm, I get a value which is in hundreds, compared to thousands? For finding out the memory three items in the mm_struct look interesting to me: RSS, Total_VM and vm_lock, will adding them
together give me the memory used by a process?
regards Irfan "
Rik Van Riel ( i think u knows this guy) if not so please visit his home page http://www.surriel.com/ If you want to see him visit this site http://www.redhat.com/magazine/014dec05/features/xen/Xen_Rik.jpg
Frankly speaking i am little bit fan of this guy.Anyway he has given the answer "The RSS reported by ps is in kilobytes, right ?The kernel counts in pages, which are larger".
Before that i also didn't look at the rss filed value and also franklt speaking i also didn't know what is the exact meaning of this value. I started hunting(should i say hacking!! Ok little bit) the answer..ofcource Rik's clue has given me the thought and i found the answer but still i am not confirmed which i have given explation regarding this question.i am waiting reply from Rik...i will update this blog if I and You find any wrong explanation or information. Please feel free to write comments. I am directly pasting mail which i have send to kernelnewbies mailing list ...
Hi Irfan,

On 9/21/06, Irfan Habib wrote: Hi,
" man ps "says me that
"The SIZE and RSS fields don't count some parts of a process including the page tables, kernel stack, struct thread_info, and struct task_struct. This is usually at least 20 KiB of memory that is always resident. SIZE is the virtual size of the process (code+data+stack). "
and also rss is for "resresident set size, the non-swapped physical memory that a task has used (in kiloBytes). " it means that the total size of the pages currently in memory.Which kernel r u using? I couldn't get rss fileld in mm_struct. I am using 2.6.17. I could get
mm_counter_t _file_rss;
mm_counter_t _anon_rss;
unsigned long hiwater_rss; /* High-watermark of RSS usage */
i think _file_rss and _anon_rss are for holding the value of the total number of resident pages in memory.So size of (_file_rss+_anon_file) should be equal to rss fileld value in ps command for particular process.Now let me prove:
my system i can get output for ps -aux .
[root@ajit pages_program]# ps -aux
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.6/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 1984 660 ? Ss 12:11 0:00 init [5]
root 2 0.0 0.0 0 0 ? SN 12:11 0:00 [ksoftirqd/0]
root 3 0.0 0.0 0 0 ? S 12:11 0:00 [watchdog/0]
[.....]
Now i can see that RSS is 660kb. In my system i am using 4kb page size. So total number of memory resident page is =660/4=165.Now i have written a small kernel module .....
#include
#include
#include
#include
static int pid_mem ;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Suman Adak");
module_param(pid_mem, int, 0);
static void print_no_pages(struct task_struct *task)
{
struct mm_struct *mm;
mm = task->mm;
printk("\nThis mm_struct has %d vmas.\n", mm->map_count);
printk("No of pages = %ld",mm->_file_rss + mm->_anon_rss);
}
static int pages_load(void){
struct task_struct *task;
printk("\n the process id to look up as %d.\n", pid_mem);
for_each_process(task) {
if ( task->pid == pid_mem) {
printk("%s[%d]\n", task->comm, task->pid);
print_no_pages(task);
}
}
return 0;
}
static void pages_unload(void)
{
printk("\nbye bye\n");
}
module_init(pages_load);
module_exit(pages_unload);

i just cut my dmesg here
root@ajit pages_program]# /sbin/insmod pages.ko pid_mem=1
[root@ajit pages_program]# dmesg
kobject pages: registering. parent: , set: module
kobject_uevent
fill_kobj_path: path = '/module/pages'
the process id to look up as 1.
init[1]
This mm_struct has 23 vmas.
No of pages = 165
I could see that process with pid 1 , It has 23 vmas and total no memory resident pages is 165, which is equal to rss field in ps command.i think you understand..So rss and size field doesn't give the exact size of the process...
Rik ,correct me if i am wrong., please clarify me ...How do we set value for hiwater_rss?
Thank

How to find PAGE SIZE in linux kernel

Sometimes i was finding what is the PAGE SIZE of my linux kernel? . I knew that it could be 4KB,8KB,16KB or 64KB. But the the real question was , how do i find the value? After lot of serching, i came to know the following command from Rik Van Riel (kernelnewbies mailing list)..
[suman@ajit ~]$ getconf PAGE_SIZE
4096
it says that i am using 4KB PAGE SIZE. Now i went to find out where the PAGE SIZE has been wriiten into the source code. I found it /include/asm-i386/page.h in my kernel-source(2.6.17) directory.My system architecture is i386 machine. I could see
#ifndef _I386_PAGE_H
#define _I386_PAGE_H
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
i see that PAGE_SIZE depends on the value of PAGE_SHIFT. i yet to see if i change the PAGE_SHIFT value,what would be the impact of my kernel? Let see..i will be informing....

Also i came to know that PAGE SIZE varries on architecture to architecure. Here is the code snapshot for ia64 archi.
 #ifndef _ASM_IA64_PAGE_H
#define _ASM_IA64_PAGE_H
* PAGE_SHIFT determines the actual kernel page size. */
#if defined(CONFIG_IA64_PAGE_SIZE_4KB)
# define PAGE_SHIFT 12
#elif defined(CONFIG_IA64_PAGE_SIZE_8KB)
# define PAGE_SHIFT 13
#elif defined(CONFIG_IA64_PAGE_SIZE_16KB)
# define PAGE_SHIFT 14
#elif defined(CONFIG_IA64_PAGE_SIZE_64KB)
# define PAGE_SHIFT 16
#else
So ia64 machine can use 4KB,8KB,16KB or 64KB depends upon the configuration during compilation.

Friday, September 01, 2006

Linux kernel linked List Implementation

Linked list is a very important data structure which allows large number of storage with efficiant manipulation on data.Most of the kernel code has been written with help of this data structure.So most of the kernel code (data structure) complexity depends on the implementation of that data structure. You could write your own code but the lack of bad design could give you bad performance. A good operating system should give not only stability but also good performance. So i was eager to know how linux implements linked list. Is it circular singly linked list or doubly linked list or circular doubly linked list ?
does It has some libray file where most of the functions would have been declared? Yes my search ends at
"/usr/src/linux/include/linux/list.h".
I could see all types of fuctions are declared here. Before discuss all these function i should tell somthing about how linux kernel adopts strategy to build efficiant implementation.
It has a unique style to implement the traversing,adding,deleting node into a circular link list.As it is circular , you don't need think about head node and last node.You just simple pick up a node and follow the pointers untill you get back the same original.This approch removes the extra head node implementation.So each routine simple needs a pointer to a single element in the list and it could be any element. You may be wondered to see the implementation.Normally we used to declared linked list as like
struct my_list{
int data,
struct my_list *prev;
struct my_list *next;
};
But if want to adopt linux implementation style then you could write like that
struct my_list{
struct list_head list; //linux kernel list implementation//
int data;
};
struct list_head { //Declared in list.h file
struct list_head *next;
struct list_head *prev;
}

Now note the name of the structure "list_node". Linux developers has taken this name in mind from the fact that there is no head node in the list. All node could be acted as a head node .The next pointer points the next element and prev pointer will point the previous pointer.Thanks the linux claver list implementation.You could forget about firat node and last node concept.Just just compare list as a big cycle with no first and last.There are many clever implementation of each function. Please go through the list.h.It is well documented.I thnik i couldn't make better documentation than this. I am sure , you can digest it within one hour.
Now some big questions may come:-)

1.) why should i learn linux kernel linked list implementation strategy though i could write my own code or i can take linked list library from somewhere?

2) How can i use linux linked list library in my user space application? What would be the benefit that i could get if i use this library?
Yes , I am trying to give answer of these two question. If you are not satisfied with my answer . please leave a comment...
Answer No 1:
1) If you want to see yourself as a future linux kernel hacker,you must learn this strategy. I can give a prof from a book "linux Kernel Development" by renowned kernel hacker Robert Love.See the Apendix-A
"All new User must use the exiting interfase,we are serious about this, do not reinvent the wheel"

2) Create various type of Data Structure: You can build any data structure as in your mind.
3) Portability: Otherwise it would not have been placed into main linux kerenl source tree.
4) East to learn. readibility: Yes, It is easy to learn, you can learn all function with one hour rigorious study.
5) Complexity: You would be wonderd that all these functions are O(1), means they execute in costant time regardless of the size of the list.

Answer: Q.No.2:
With some minor modification, You could include this list.h header file into your userspace application. It's a single header file. very handy! You need to do
a)Remove #ifdef __KERNE__ and its #endif
b)Remove all #include line
c)Remove rcu related functions(many of them there)

Yes , I am working on this list to publist my own list.h header file. I have already implemeted generic implementation of my own circular doubly linked list and have written same program with help of "list.h" file and compare

You could also ............

P.S: The kernel uses linked list to store the task list, Each process's task_struct is an element in the linked list.
look at this link...You will automatically understand how many times list_add function have been called:-)

Resource: Section
Yes i used to read from good article.Try to understand from the good article.And ofcouse i should share with you.Have a look
Ref 1: "Linux Kernel Development"-Robert Love Appendix -A
Ref 2: Linux kernel linked list for user space
Ref 3: Linux Kernel Linked List Explained
Happy Hacking...

Thursday, August 31, 2006

[off-topic]Hope One Day I Would Be..

I am alwayes very much keen to do my Ph.D in Operating System( It could be Real Time Opearating System also). I don't know when i will get chance to fulfill my dream. But i should do..i must do.. so now i have to prepare myself. But How? While I was thinking , i thouht first i have to find out what should i need? ...i could prepare a list like ..i need extensive knowledge , i have to do hard work, i have to read countless books or I have to ........................................................But first i could guess that , i should know how to do research ...while i was searching , i got a fantastic link which i should share with you...Have a look on this link
Advice on Reserch and Writing
You could visit this page. It's one of my research interest area...
CS Columbia University's Professor Erez Zadok Page

Tuesday, August 29, 2006

How to install GNU/Linux without any removal media

If you want to install GNU/Linux withoutany removal media(CD, USB, Floppy) then please cheack out
this given link.You need to just copy the (small) Linux installer on a hard disk and run it from your previous operating system. Finish using the network. That's all. In some cases you can substitute the network by a (big) hard disk if your network is not good..

LINK

Monday, August 28, 2006

Intrusion Detection System

We were searching for an efficient intrusion detection system. .We wanted to develop some differnt kind of system which can perform as a detection and prevention system.After a long time discussion and searching in the net, we finalized ythis approch..

In our system , We have two module. One from userspace called detection system.Another from kernel space called prevention system.System acts like

When packets come from the network to NIC, we capture the packets and send to the userspace program.
Still we are thinking to avoid IP stack for passing each packets to user space.Any way , a user space detection program checks the each and every packets and try to match with predefined rule. If this match happens then detection system calculates the rate of packets whichs falls under this rules. If it overtakes the thresold value then this packet address would be written into a configuration file and immediately send to the kernel module which is ruuning in kernel space. So next time if this type of packets is comming into the NIC, before passing to the network stack, our kernel module will drop theses packets. This procedure will occour recuresively and best way to name this project .....

" Knowledge based intrusion detection and prevention system"
While searching , i got very good metirial from net which i should mention here for further look up:

linux 2.4 Packet Filtering
Writing Network device Driver
Inside the Linux Packet Filter Part 1
Inside the Linux Packet Filter Part II

i will add more......

Friday, August 11, 2006

[off topic]Planning to go pondichery

Today , i decided to go pondichey as a weekend trip with anubhav and his friends.Last one year i am staying chennai but didn't go anywhere. Though i am not feeling well but i don't want to miss this trip.Next year,i would be a married person.So i would not get a chance to enjoy with friends.

Ok. Hope my trip will give me best enjoyment. Oh i didn't tell my parent that i am going. i thought i will tell when i will reach pondichery.

Wait for next trip blog....

bye bye

Monday, August 07, 2006

Kernel Hacking Free Course 2006

If you are interested in installing and using a Unix system based on the Linux kernel, you won't have any problem in finding all the documentation you need. In fact, there exist several excellent books that teach how to install Linux and how to run it. Furthermore, many courses are taught in many countries on the same topics.

If your problem is how to modify the Linux kernel and how to evaluate the impact of the changes you made (we call this kind of programmer's behavior kernel hacking) then you won't find as much documentation as in the previous case. In fact, you can find almost anything on the net, except that is scattered around many places and not all the documents you will find are outstanding, while many are obsolete.

So, the ambitious goal of this Kernel hacking course is to describe in a coherent way all you should know to become a reasonable kernel hacker[Written by famous author-Daniel P. Bovet and Marco Cesati, the authors of the popular O'Reilly's book "Understanding the Linux kernel"]

Have a look on this link.

Happy Hacking...

Monday, July 17, 2006

A small tips for C/C++ programming with Vi Editor

I am using vi editor to write my C program. I found some good feature with Vi editor which will help programmer to write C program clean and readble. Also reduce time to debug the C/C++ source file.

Start C style Indent in Vi Editor
:set cindent

ctags
just make a command " ctags *" on your source directory. Ctags command will create one file called tags which contains defined
macros defined by #define
enumerated values
function definitions, prototypes, and declarations
class, enum, struct, and union names
namespaces
typedefs
variables (definitions and declarations)
class, struct, and union members

Now open vi editor with source file name and put
: tag [i.e if i have a function fun() then it sould be :tag fun or just pressed ,it will list down all the tag name and hit enter . It willl jump where fun() has been defined. Just put ctrl+T to come back.

Syntax highlight:

:syntax on

Auto make

If you prepare makefile for your program then vi will allow you to run your program within vi. Just type
:make
[for more details :h make]