Pointer Arithmetic (Basic stuff)

I was going through some old stuff these days and came across Pointer Arithmetic. I knew how it works ( or may be I should say I understand it but I was not exactly sure how it works). I decided to read it and started typing some examples. Really enjoyed it I thought I will share code. It has some comments. Feel free to ask if I am missing anything. It is pretty late night so I am not sure if I have written best code or comments. But I hope it will be fun to read it :) #include <stdio.h> //helper functions void nosize(int array[]); void arrayOfPointers(); void twoDimensionalArray(); void pointerSubtraction(); int main() { int array[10]; // %p…

Scheme Set Implementation

So I made some progress through little schemer. I was reading through relationship chapter. It goes through Set implementation. I knew how Set works but have never actually written one. So this was a good opportunity to write one. I needed some helper methods from previous chapters as well. Again it may not be the best implementation but I have tried to do my best. Also if you are reading book you may not find couple of implementations. One of them is diff between two sets. Here is the code: #| Helper functions. |# (define member? (lambda (x lat) (cond ((null? lat) #f) (else (or (equal? x (car lat)) (member? x (cdr lat))))))) (define atom? (lambda (x) (and (not (null? x)) (not…

Learning Scheme.

So I started learning Scheme today. Amazing language. I am reading little schemer book. The best part is more than a language I learnt a lot about lambda calculus. I have always loved functional programming language but using scheme has convinced me to think about it in a different and broad way. Working with Lisp(Scheme) is so easy. You can basically write your own language or atleast set of features in no time. Also you have more control. I started implementing basic stuff in scheme. I thought of sharing some code. I don't think its the perfect implementation but I guess its good for the start. I have implemented each, map, reduce and filter functions in scheme. Here is…

Learning Path

I have purchased a lot of books recently. Most of them are technical books. But I never got chance to read most of them. I have decided to finish all of them within 2 years of time. I have also decided to share what I am learning. For now I have picked up all Schemer series. Little Schemer Reasoned Schemer Seasoned schemer.…

Design Patterns

There are many thing in this. I will put it in some points. Again this is my opinion and what I have seen from my experience: First of all the most important thing is no matter what you decide in terms of using patterns, code style. It has to be something that you team is doing together. If required document it. So that even if a new developer will join things will still go in same way. Define a Style guide for your project. Google has one for JavaScript Page on googlecode.com . Addy osmani has one awesome blog on that JavaScript Style Guides And Beautifiers. Read it with team discuss it and come up with something that works best…

Stay Up to date with Web :)

I had similar questions about 2 years ago. I would like to write what I have done to improve my skills not only JavaScript but as a programmer. I have read couple of books. I personally believe that reading a book is completely different experience and it helps you to understand a lot of concepts that you do not find on blogs and article online. Some of my fav books are: Professional javascript for web developers Secrets of JavaScript Ninja High Performance JavaScript JavaScript Good Parts Then I subscribed to couple of channels on youtube. Like jsconf. You get to learn a lot about what is new coming up in JavaScript. I drive almost 1 hour a day I listen…

Agile and TDD: It may not be what you think.

I am an Agile developer. I have had many many discussions with people who are not working on Agile and TDD or are new in Agile and TDD. Also People who hate Agile and TDD. The most important thing that has occurred to me is that people (including me sometimes) has their own theory of Agile and TDD and have their own concepts. Very few people have put a good amount of effort to understand what is Agile and how it can help you to have a good product on Time! First of all if you are really interested in working in Agile or want to have detail knowledge of Agile and TDD I would recommend few books by some…

Why I will never buy a PC(Windows) again?

I remember the day Apple or I should say Steve Jobs launched Ipod touch within Iphone. He said you can touch your music with your hands.  I loved it and I am sure most of the people actually felt it. Having lived in the PC world for about 10 years. Last year I moved to Mac world. It really like from hell to heaven. People talk about windows being friendly but as they say: Once you Mac you never go Back! But more than using Mac I am in love with its OS which is built on top of Unix.  Unix is a great reason behind success of Macintosh OS. In case you wanna know more about it you can…

Meanings of Success.

Success has a number of meanings in this world. For some people its just money, others think it in the form of fame and their are very few of them who feel that success is being happy and satisfied. I have been in professional life from more than 5 years now. I couldn't figure out that what I wanna achieve? Its like an end less Journey. Learning new things everyday and still keep the feeling that there is much more to come. So eventually always be unsatisfied. Most of the people will argue that It has to be like this. If you will be satisfied then u will not reach to the next level. But my question is are we…

Copying CODE or BUGS?

Hi All, I have been working on various technologies and frameworks from past 5 years. I have seen copy and paste practice in most of projects specially when a developer is new to the technology or framework or project itself. Last month I started working on project using Grails. There was some amount of code that was already written. I was new to Grails and didn't get time to learn it because of strict dead lines. I started working and for saving time I did copy and paste from the existing code. We did the sprint release and we were happy about that. I was feeling confident that I have managed to complete my work. Client came back to us…

Recursive function for finding factorial in Assembly Language

.type factorial [function](http://function.tiddlyspace.com/ "External link to http://function.tiddlyspace.com") .globl factorial factorial: pushl %ebp # Push base pointer address on top of stack for return purpose movl %esp, %ebp # Now we will be using %ebp as a for all operations on stack 1. subl $4,%ebp # Make room for local varibales movl 8(%ebp), %eax # Take parameter in to the ebx cmpl $1, %eax je exit_factorial decl %eax pushl %eax call factorial; movl 8(%ebp), %ebx imull %ebx,%eax exit_factorial: movl %ebp,%esp popl %ebp ret …

set/reset a bit using Assembly language!

section .data byte_data: .byte 0b01111111 # This is 127 in decimal... we are gonna make it 255 by setting the least significant bit. .section .text .globl _start _start: movl $0, %edi # set the index movb byte_data(,%edi,1), %al or $0b10000000, %eax # Result of OR operation will go the eax register and $0b10111111, %eax # This is for reseting a bit movl %eax, %ebx movl $1, %eax int $0x80 …

Making all bits false using Assembly Language

.section .data data_items: .byte 0b11111111 .section .text .globl _start _start: movl $0, %edi movb data_items(,%edi,1), %eax start_loop: shrl $1, %eax cmpl $0b00000000,%eax je exit_loop jmp start_loop exit_loop: movb %eax, %ebx movl $1, %eax int $0x80 …

Back to basics

I was reading a wonderful book Programming from Ground up by Jonathan. It reminds me old good days about assembly language on Dyna Microprocessor kits.  I thought about writing some points from that. Let us start reading about the Computer Architecture: Have you every thought when you type something on the keyboard how does computer display that on the Screen? I know I know we don't need to bother about that but I believe anyone who is a programmer must know these concepts. So if we will look at architecture of Computer there are 3 main components: Hardware Kernel User Application Let us go through each point one by one I will discuss the most important one at the end…

You and Your dreams(A note to myself!)

It is hard to understand and hard to analyze what YOU want from YOUR life and what YOU wanna be in life. Every one has a goal and every one is working for that goal in their respective life. May be YOU are working hard. There is no doubt about it but YOU are still not clear about YOUR GOAL and AIM of life. YOU are still confused and sometimes scared that what will happen in the future. Its not that YOU don't have confidence. YOU have worked really hard in past 4-5 years and have seen some good results as well. But satisfying your self with the good results and not thinking about the great ones is just like…

Introduction to Android

Couple of days ago one of my Friend told me that he is working on Android. I know its nothing new but why everyone is using android these days??  If you look at your GMail friend list you will see that there are some icons of Android as status of your friend.I thought I must look in to this because it seems like something special in the programming world. I started learning about Android and here are some cool points on that. What is Android? According to Android Website Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications…

Coding guide lines for variable names

Here are some coding guidelines about using meaningful names in the program. Most of them are taken from from Clean code book Choosing good names takes time but saves more than it takes. Use Intention-Revealing Names The name of a variable, function, or class, should answer all the big questions. It should tell you why it exists, what it does, and how it is used. If a name requires a comment,then the name does not reveal its intent. for example: int d; /elapsed time in days/ This will be better if written like below int elapsedTimeInDays Avoid Disinformation For example we have a group of accounts. Do not refer it as *accountsList *until it is actually a List. Another…

A Note on Sencha(Extjs)

It is almost 4 AM in India and after reading about one of the best or I must say one of the most powerful JavaScript libraries. I couldn’t stop myself from writing a note about the features of that library. EXTJS as name says extended JS is a complete solution to your entire problem to have a Rich and interactive UI.  I have worked on various JavaScript libraries like YUI and DOJO. But none of them will give you features with flexibility like EXTJS. Features provided by EXTJS: (1)    Very easy and useful API for DOM element access. In simple steps you can access your DOM element and perform various functions on those elements. (2)    I am Asynchronous. Everything…

BIRT: Making internationalized reports

BIRT is widely used as a reporting tool in business intelligence projects. These days every client has a very first requirement that application must be multilingual. They want their customers to see application in their local languages.  Java provides great features to make an application multilingual. We have used BIRT in one of our project and Client wanted us to have reports in multiple languages. I am writing an article on how we had achieved localization in BIRT by using BIRT feature for localization and also using JavaScript as BIRT’s inbuilt feature for localization will not work in all the cases. As you can see the first image which is a non-localized report with a table. The header and…

Object A....present sir!!(Proxy object ;))

  I was really busy in last few days working on frameworks like spring and hibernate. While working on that I realized that like Java is a heart of Web development these days. Proxy pattern is also heart of these frameworks that creates objects at run time and map DB values to object attributes at run time.  I wanted to understand each and every aspect of Proxy design pattern and wanted to implement them to see how they actually work. So this is the real motivation behind this article. From couple of weeks it was in coming soon mode! I was busy with some hectic work. So here we are with Proxy pattern. Proxy is the word that I have…

Motivating self at de-motivating place!

Infrastructure, People around you and off course the kind of work you are doing   has a big impact on your enthusiasm and self motivation. Generally this happens during a job change or a project change in companies. It is possible or I must say it happens most of the time that things are not the same as you had expected them to be! With time you start feeling that you are not at right place and your motivation goes down.  I felt the same thing when I had changed my company last year January. I joined new company and couldn’t get work for about 1 month. It was frustrating because I was desperate to work on something new and…

Crash course of Java RMI

Here is a simple crash course of RMI api provided by Java. RMI is basically implementation of Remote Procedural Call It differs from CORBA which is used for communication between two different languages. These days we have a new implementation of RMI which is RMI/IIOP (RMI over Internet Inter-ORB protocol). This implementation internally uses CORBA. Server Client Create and interface that extends java.rmi.Remote interface provided by Java api. Create a client which has information about the Remote interface that server has created. But it does not have any clue about the implementation of that interface. Create a class which implements that interface to act as a remote object and also extends java.rmi.server.UnicastRemoteObject. By extending…

FaceMash algorithm from Social network movie.

Hi All, I saw social network movie and next day when I was discussing this movie with few of my colleagues we were thinking about the algorithm which Mark had taken from one of his friend who use it for Chess game. If you have seen that movie you will surely remember that scene. No body among us was sure what was that algorithm and how does it help in matching girls!  I thought I must search that and found some good points about that. Facemash is an algorithm which is actually based on another algorithm called Elo Rating System. Wiki says: The Elo rating system is a method for calculating the relative skill levels of players in two-player games…

My Poetry/Songs

[youtube=http://www.youtube.com/watch?v=cbbDjSlAiyY]…

Building simple WYSIWYG editor(Coming Soon!!)

Coming Soon!!…

Java Exceptions...expecting the unexpected(Coming soon!)

Coming Soon!!…

Have a Bite of Bytecode!!

This topic is very different from other Java topics.  I am sure a lot of developer think that why should I learn about byte code at all. Well I can give only two reasons of that (1)    Either you are a Byte code engineer for example using a library like BCEL which is used to change/enhance byte code generated by Java compiler. (2)    You are passionate to learn thing under the hood (Under the hood is used mostly by Bill Venners a great writer of a great book Inside the Java Virtual machine worth reading it.) What is byte code after all?? Just like C and C++ generates assembler code. Java compiler generates byte codes.  This byte code is…