Technical Links


Posted in few links I liked!! | Leave a comment

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 satisfied at this level? did we achieve everything that was required to be satisfied at “this level”?

Continue reading

Posted in Failure>>Success | 2 Comments

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 and asked us to improve the code coverage and write the unit test cases. We started writing unit test cases and we found few bugs. Now those bugs were in the code that was copied by me in a lot of other places as well. So the person who actually wrote that code finally made corrections and checked in the code. Again I did the same thing copied the correction and tried to run the tests. My tests were failing then I realized that there are more scenarios in my case. which needs to be implemented.

Then I realized that Instead of copying CODE I was copying bugs. So I decided to study about copy and paste programming. Here are few points that we need to take care while we do copy paste from the existing code:

  • Do read comments on the Method from where you are copying the code.
  • In case comments are not there try to understand the code first. Don’t just go by name of the method.
  • After understanding that what that piece of code does. Look at your requirement and compare if it is the same.
  • If it is the same then you can copy and paste and write test cases. TDD helps here a lot. If you write your tests before you write the code then instead of doing the above three steps you can simply copy and paste the code and run your tests to check if it works for your requirement or not.
  • If it doesn’t complete your requirement you may need to modify the code.

So the idea is don’t just blindly copy and paste the code. Because you never know you are copying the CODE or copying the BUGS!!

I hope you will like this post. I will be looking forward for your feedback.
Thanks,
Pawan.

Posted in General | 4 Comments

Recursive function for finding factorial in Assembly Language


.type factorial function

.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

Posted in Assembly Language | Leave a comment

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 $0×80

Posted in Assembly Language | Leave a comment

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 $0×80

Posted in Assembly Language | Leave a comment

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:

Continue reading

Posted in Assembly Language, General | Leave a comment

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 crawling instead of running.

You will get just one life and all you want to do you have to do in that only. Time is running, already lost so many years just thinking about what to do. Now it is the time to decide. You can not decide in one day. It will take time may be 1 week or 1 month.But you have to decide it now. It will be too late after this.

You have to go step by step. You may have to spend money for that. But you have to do everything to achieve it. If I should say in simple words. I will say GIVE YOUR BEST SHOT THIS TIME.

  1. First step will be to identify what is your GOAL. As said “Setting a goal is much harder than achieving it”. Sit in a room and think about your Dreams …those BIG BIG Dreams. Where you are always a KING.
  2. Now you know what your dreams are. Try to find out how can you achieve them. You may have to search on Internet or talk to people who have already achieved those kind of dreams.
  3. After finding the solutions. Plan for those solutions. Plan for each and every fraction of nano seconds that you are going to spend working on those Dreams.
  4. After all this all you need is passion. Just keep working hard. Every second just think about your dreams nothing else.

Your dream should be your life.

Posted in Failure>>Success | Leave a comment

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 on the Android platform using the Java programming language.

So basically what I understand is Android is an API for creating applications of Mobile devices or if you make it simple creating applications for Android based operating System. Just like we have API for windows programming on Windows based mobiles. Seems like nothing new? But no Android is much more powerful and have plenty of features for you and off course If you know Java then it is really easy to build Applications in Android.

Features of Android:

  • Application Framework: Android provides a very powerful library for building applications. Most of the core Java classes are accessible to Android developers. It provide features like running services in background threads and localization of text strings etc.
  • Run time Libraries: Android comes with number of third party libraries that can be used for Various Purposes. One example is SQLite which is used to fetch data from some source through a Query or some other way.
  • Dalvik VM: Each Application in Android runs in its own Process. Dalvik VM is written in such a way so that a system can initialize multiple VMs at a single time. Dalvik VM is based on Linux kernel and use linux for Thread and low level memory management.

Security in Android

As mentioned in the third point of Android Features. Each application runs in its own process and have access to files that are related to that application. This isolation among the application provides great level of Security. It is possible to share same resources among the applications that may run on different Process or may share same Dalvik VM.

So this is just an introduction to Android. You will find very good information from the Android Site. I have taken most of the stuff from their site. Keep watching my blog I will post some tutorials for starters very soon and please give feedback!

Posted in General | 1 Comment

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

Continue reading

Posted in General | Leave a comment

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.

Continue reading

Posted in JavaScript | 3 Comments