Thursday 29 January 2015

Installing SNMP Service in Linux Environment

Installing SNMP Service in RHEL 5/6
SNMP ( Simple Network Management Protocol (SNMP) agent ) will help us to monitor the system from management utilities. SNMP exposes management data in the form of variables on the managed systems, which describe the system configuration. These variables can then be queried (and sometimes set) by managing applications.

Configure yum repository using RHEL 6 media

1)    Create and configure yum configuration file as below using vi editor.
             # vi /etc/yum.repos.d/repo.repo
             [repo]
             Name= RHEL 6
             baseurl=file:///repo
             enabled=1
             gpgcheck=0

2) Create a mount point and mount the RHEL 6 media [mount point name is specified in the yum configuration file]
            # mkdir /repo
            # mount /dev/cdrom /repo/

                mount: block device /dev/sr1 is write-protected, mounting read-only

Configuring SNMP service

1) Install the SNMP packages as listed below.
            # yum install net-snmp-utils net-snmp-libs net-snmp
            # rpm -qa| grep snmp
             net-snmp-utils-5.5-31.el6.x86_64
             net-snmp-libs-5.5-31.el6.x86_64
             net-snmp-5.5-31.el6.x86_64
2) Start the services and make sure that it is running.
           # service snmpd start
           Starting snmpd:                                              [  OK  ]
           # service snmptrapd start
           Starting snmptrapd:                                        [  OK  ]
           # service snmpd status
           snmpd (pid  4923) is running...
           # service snmptrapd status
           snmptrapd (pid  5401) is running...
3)  Configure the service to start automatically with system boot.
           # chkconfig snmpd on
           # chkconfig snmptrapd on
           # chkconfig --list | grep snmp
           snmpd             0:off   1:off   2:on    3:on    4:on    5:on    6:off
           snmptrapd       0:off   1:off   2:on    3:on    4:on    5:on    6:off

4)  Edit the SNMP configuration file and add entries as per customer requirement. Below is as a example.
               # vi /etc/snmp/snmpd.conf
               rwcommunity kummitha
5) Reload the services.
               # service snmpd reload
               Reloading snmpd:                                            [  OK  ]
               # service snmptrapd reload
               Stopping snmptrapd:                                        [  OK  ]
               Starting snmptrapd:                                          [  OK  ]

Note:

We can check the snmp service functionality using the snmpwalk utility.
# snmpwalk -v2c -c kummitha 192.168.1.2 system
SNMPv2-MIB::sysDescr.0 = STRING: Linux kummitha.com 2.6.32-71.el6.i686 #1 SMP Wed Sep 1 01:26:34 EDT 2010 i686
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::org
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (489394930) 56 days, 15:25:49.30
SNMPv2-MIB::sysContact.0 = STRING: Srinivasulu Kummitha <sreenu.vas2004@gmail.com>
SNMPv2-MIB::sysName.0 = STRING: kummitha.com


Wednesday 14 January 2015

What is Open Source?

The Open Source Definition





Open source doesn't just mean access to the source code. The distribution terms of open-source software must comply with the following criteria:








1. Free Redistribution

The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale.









2. Source Code

The program must include source code, and must allow distribution in source code as well as compiled form. Where some form of a product is not distributed with source code, there must be a well-publicized means of obtaining the source code for no more than a reasonable reproduction cost preferably, downloading via the Internet without charge. The source code must be the preferred form in which a programmer would modify the program. Deliberately obfuscated source code is not allowed. Intermediate forms such as the output of a preprocessor or translator are not allowed.











3. Derived Works

The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software.






4. Integrity of The Author's Source Code

The license may restrict source-code from being distributed in modified form only if the license allows the distribution of "patch files" with the source code for the purpose of modifying the program at build time. The license must explicitly permit distribution of software built from modified source code. The license may require derived works to carry a different name or version number from the original software.




5. No Discrimination Against Persons or Groups

The license must not discriminate against any person or group of persons.





6. No Discrimination Against Fields of Endeavor

The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research.











7. Distribution of License

The rights attached to the program must apply to all to whom the program is redistributed without the need for execution of an additional license by those parties.





8. License Must Not Be Specific to a Product

The rights attached to the program must not depend on the program's being part of a particular software distribution. If the program is extracted from that distribution and used or distributed within the terms of the program's license, all parties to whom the program is redistributed should have the same rights as those that are granted in conjunction with the original software distribution.






9. License Must Not Restrict Other Software

The license must not place restrictions on other software that is distributed along with the licensed software. For example, the license must not insist that all other programs distributed on the same medium must be open-source software.





10. License Must Be Technology-Neutral

No provision of the license may be predicated on any individual 

technology or style of interface.




Saturday 3 January 2015

Java program to arithmatic operations(input from command line)

package com.srk.core;
/**
 * @author skummitha
 *
 */
public class CmdArgs2 {
       public static void main(String args[]) {
             int a = Integer.parseInt(args[0]);
             int b = Integer.parseInt(args[1]);
             System.out.println("Addition :" + (a + b));
             System.out.println("subtraction :" + (a - b));
             System.out.println("Multiplication :" + (a * b));
             try {
                    System.out.println("Division :" + (a / b));
             } catch (Exception e) {
                    System.out.println(e);
                    System.err.println("cant divide");
             }
             System.out.println("finished");
       }

}

Java program to armstrong number

package com.srk.core;

import java.util.Scanner;

/**
 * @author skummitha
 *
 */
public class Armstrong {
       public static void main(String args[]) {
             int n, sum = 0, r;
             Scanner sc = new Scanner(System.in);
             System.out.println("Enter any integer");
             n = sc.nextInt();
             int n1 = n;
             while (n > 0) {
                    r = n % 10;
                    sum = sum + r * r * r;
                    n = n / 10;
             }
             if (sum == n1)
                    System.out.println("Armstrong");
             else
                    System.out.println("not Armstrong");
       }

}

Java program with out main()

package com.srk.core;

/**
 * @author skummitha
 *
 */
class StaticBlock {
       static {
             System.out.println("I am from static");
             System.exit(0);
       }
}

Friday 2 January 2015

Why array index start with zero?

Here I gathered
Ans1:-
1) In my opinion, 0 is the lowest positive value that is why it starts from 0.
Reasons
1.In very earlier languages like pascal, c, logic computer memory was very limited hardly in bytes, also their not os like windows or linux
so programmers them selves had to locate memory loc to variables as we done even in 8085 kit
2.all computer data is digitally organized(ie in binary) even today
0- 0000
1-0001
2 0010
3-0011
...
3.so their was a physical existance of zeroth location in computers
4.for better memory loc calculation it was a trend to have arrays starting with zeroth loc, so is now

Ans2:-
Simple for computers, but not for humans... We don't, or shouldn't care how the computer maps memory. The compiler should handle this.
Programming languages should make it simple to model every day objects in life. As humans we don't use zero as a base. For example:
January is the first month of the year, not the zero month.
"A" is the first letter of the alphabet, not the zero letter.
Other programming languages, like Cobol use 1 as the starting index of an array. So it can be done.

Ans3:-
u see in general the architecture of memory in computers has the memory starting from 0 for xample if there are 5 bit memory the first location would be 00000 then the next would b 00001 and so on
in general the compiler allocates memory to contents of program while creating exe file in the memory
so when contiguous locations are allocated the first one will b identified just as the original memory
thats the reason why the indexing starts from 0

Ans4:-
this is because all computers start counting from 0, not 1.
let's take 3 binary bits-
0 0 0
which can be used to count. Those 3 bits represent 8 possible states. Now we start counting:
Binary - Decimal
000 - 0
001 - 1
010 - 2
011 - 3
100 - 4
101 - 5
110 - 6
111 - 7

computers will always start at 000, because thinking logically, there is no reason to start at 001 until you've done it once.
In loops and such you can start your sentinel value at 1, but that's just because you define it that way. Computers count from 0, always.

Thursday 1 January 2015

To be a successful S/W Engineer

1. Object orientation is much harder than you think
      Maybe it’s just me, but coming from Computer Science class I thought that OO was easy. I mean, how hard can it be to create classes that mimic the real world? It turns out that it’s pretty hard. 4 years later, I’m still learning how to model properly. I wish I spent more time reading up on OO and design patterns. Good modeling skills are worth a lot to every development team.

  2. The difficult part of software development is communication
      And that’s communication with persons, not socket programming. Now and then you do run into a tricky technical problem, but it’s not at all that common. Much more common is misunderstandings between you and the project manager, between you and the customer and finally between you and the other developers. Work on your soft skills.

  3. Learn to say no
      When I started working, I was very eager to please. This meant that I had a hard time saying no to things people asked of me. I worked a lot of overtime, and still didn’t finish everything that was asked of me. The result was disappointment from their side, and almost burning out on my part. If you never say no, your yes is worth very little. Commit to what you can handle, and if people keep asking you for more, make it very explicit that this would mean not doing something else. What I did was to have a list of stuff that I needed to do on a piece of paper with me. When someone asked for something, I showed them the list and asked what I should bump to have time to help them. This allowed me to say no in a nice way.

  4. If everything is equally important, then nothing is important
      The business likes to say that all the features are as crucial. They are not. Push back and make them commit. It’s easier if you don’t force them to pick what to do and what not to do. Instead, let them choose what you should do this week. This will let you produce the stuff that brings value first. If all else goes haywire, at least you’ve done that.

  5. Don’t over-think a problem
      I can spend whole days designing things in front of the white board. That doesn’t mean it will be any better, it just means it will be more complicated. I don’t mean to say you shouldn’t design at all, just that the implementation will quickly show me stuff I didn’t think of anyway, so why try to make it perfect? Like Dave Farell says: “The devil is in the details, but exorcism is in implementation, not theory.”

  6. Dive really deep into something, but don’t get hung up
      I spent a lot of time getting into the real deep parts of  Web Services(SOAP and REST) and JMS. It was great fun and I learned a lot from it, but after some time I realized that knowing that much didn’t really help me solve the business’ problems. I spent countless days experimenting, I read loads of material.

  7. Learn about the other parts of the software development machine
      It’s really important to be a great developer. But to be a great part of the system that produces software, you need to understand what the rest of the system does. How do the QA people work? What does the project manager do? What drives the business analyst? This knowledge will help you connect with the rest of the people, and will grease interactions with them. Ask the people around you for help in learning more. What books are good? Most people will be flattered that you care, and willingly help you out. A little time on this goes a really long way.

  8. Your colleagues are your best teachers
      A year after I started on my first job, we merged with another company. Suddenly I had a lot of much more talented and experienced people around me. I remember distinctly how this made me feel inferior and stupid. I studied hard, reading book after book but I still didn’t catch up. They had too much of an advantage on me, I figured.

      Nowadays, working with great people doesn’t make me feel bad at all. I just feel I have the chance of a lifetime to learn. I ask questions and I try really hard to understand how my colleagues come to the conclusions they do. This is why I joined ThoughtWorks. See your peers as an asset, not competition.

  9. It all comes down to working software
      No matter how cool your algorithms are, no matter how brilliant your database schema is, no matter how fabulous your whatever is, if it doesn’t scratch the clients’ itch, it’s not worth anything. Focus on delivering working software, and at the same time prepare to continue delivering software using that code base and you’re on the right path.

  10. Some people are assholes
      Most of the time, most of the people around you are great. You learn from them, and they learn from you. Accomplishing something together is a good feeling. Unfortunately, you will probably run into the exceptions. People that because of something or other are plain old mean. Demeaning bosses. Lying colleagues. Stupid, ignorant customers. Don’t take this too hard. Try to work around them and do what you can to minimize the pain and effort they cause, but don’t blame yourself. As long as you stay honest and do your best, you’ve done your part.




How to estimate project deadlines

Before jumping into calculating or estimating a Project Timeline, I will go through the steps of how a software should be executed, so that whatever is estimated, actually works out that way.

In the present day scenario where Time-to-Market issues achieve greater precedence over other issues, which we have learnt over the years, the developers’ productivity and quality of the software go out of the window. Has anyone thought why more and more open-source projects are gaining such popularity compared to their proprietary counterparts?

The simple reason is the desire to build robust and good quality software where revenue earned is not the major criteria. Open-source developers have a different mindset, they code without selfishness, however that’s a different story.

Coming back to the topic, the software life cycle consists of: -
  1. Analysis
  2. Design
  3. Construction
  4. Deployment
  5. Maintenance
Each of the phases is tightly coupled with each other and a slippage in any of the phases will always carry down to the following phases. This brings us to the first phase, i.e. Analysis.

Phase 1 – Analysis
This is where the whole story begins. Analysis is the process of understanding the customer’s requirement and mapping it to the use cases. The most essential requirement of this phase is effective communication, however this fact is normally ignored. It must be understood that not all people are good at everything. Allocating the brightest brain in the organization for the Requirement Analysis may not be the best idea. By communicate effectively I mean a person who can give a patient listening rather than showing his oratory skills and of course one who is experienced in doing such kind of a job.

Phase 2 – Design
Once the foundation is laid with good use cases, it’s not that difficult a task to design the system. However one must keep in mind to use the best tools available for creating the software model. It is wise not to architect something new and venture into unseen territory to prove one’s designing skills, rather than use accepted models and architecture, which have matured over the years. Putting one’s designing prowess to test is best done with personal or open-source projects. Following the standards of designing will always result in a stable model.

Phase 3 – Construction
Again as the skills of developers vary, the only way we can get good consistent code is by following high class coding and documentation standards. A good practice is to have an independent Code Reviewer, who is well versed with the coding and documentation standards, and who will do the review as the programs are being written so that the developers will not run a mock with their code with the attitude that ‘It will be done later’. This actually never happens. Once a code is written it always stays that way. The other important implementation during this phase is Unit testing and System testing. It sounds synonymous but there is a difference between the two, Unit testing is testing the performance of the methods of a class whereas System testing is the performance of a class when accessed from another class. This is important at this stage, as a bug is less expensive when found at an early stage as compared to when found during Functional testing. By implementing these simple measures, the Quality of software will definitely be enhanced.

Phase 4 – Deployment
One of the most critical steps in the software lifecycle is the deployment process. This is often a customer’s first experience with a product and a bad experience can have lasting effects. Successful deployment depends on good System design and architecture of the project, which brings us back to the design phase. It is during the design phase itself deployment considerations should be kept in mind so that there are no hiccups during deployment.

Phase 5 – Maintenance
This phase will be a breeze if the Analysis, Design, Construction and Deployment have gone off smoothly. The reason is that the issues to deal with, during this phase, will be considerably reduced.

There are many software processes formulated over the years, which deal with building robust and stable software of which the Rational Unified Process (RUP) and the Agile Unified Process (AUP) are widely used. Extreme Programming is also gaining popularity these days. No matter which process is being used by the organization, it has to be followed sincerely without making any exceptions.

Calculating the Project Time
The reason why I had elaborated on the phases of the software development cycle was to stress upon the fact that whichever method you use for estimating the timeline for a project, the project will be on schedule if and only if the aforesaid are implemented with sincerity.
Making good time estimations requires a combination of qualities, which are experience, intuition and good technical skills.
The method I am illustrating is the one by Derek C Ashmore, from his book titled the “The J2EE Architect’s Handbook”, which states that the approximate time for a project can be calculated by:

  a. The total number of screens multiplied by 2 man-weeks each
  b. The total number of External application interfaces multiplied by 4 man-weeks each
  c. The total number of Database tables multiplied by 2 man-weeks each
  d. The total number of Tables or files updated multiplied by 2 man-weeks each

This will give the base estimate for a single developer. Multiply the base estimate by 2.5 to include analysis and testing activities for each usecase, lets call this figure as the total estimate for a single developer. Now for each developer added to the project multiply the total estimate with 1.20 (As each developer added increases Communication and Management time, which is also time consumed for the project).
At times when implementing the above strategy, some time estimations for certain modules of the project may seem a bit too inflated. In these circumstances adjust the assumptions made in a, b, c, d for those specific modules.

Hope these inputs will be helpful to those interested.

Http Codes

Successful 2xx
200 OK
201 Created
202 Accepted
203 Non-Authoritative Information *
204 No Content
205 Reset Content *
206 Partial Content *

Redirection 3xx
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other *
304 Not Modified
305 Use Proxy (proxy redirect) *

Client Error 4xx
400 Bad Request
401 Unauthorized
402 Payment Required *
403 Forbidden
404 Not Found
405 Method Not Allowed *
406 Not Acceptable *
407 Proxy Authentication Required *
408 Request Timeout *
409 Confict *
410 Gone *
411 Length Required *
412 Precondition Failed *
413 Request Entity To Large *
414 Request-URI Too Long *
415 Unsupported Media Type

Server Error 5xx
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout *
505 HTTP Version Not Supported *