Welcome to Srini's blog

Friday, April 30, 2010

Simhaaaaa ...Lolll

Heyyyy !!! it seems 2 b Ballayya got hit after a long time .. I came 2 know tht SIMHA succeed in satisfying his fans as well as others. Anyway today I am going to SHIMA(If everything is ok in off) along with Sai and Sreekanth, will update review soon. After a big struggle(to book tkts) finally Sreekath booked tkts in UPPAL(ohh .... it is so far frm my room, atlease 1.30 hrs journy on bike) to see Balayya movie firstday(Otherwise popular scenses may cut :P).

Did u lost your CEEP original hall ticket??

Uhhhhh... why u r such a careless boy in this age?? don't worry you can get duplicate hall ticket without going to polytechnic college, But at least u need to go Internet center. You can get it in 2 ways.
1. If you have xerox copy of hall ticket, Go to Get Hall Ticket and Print and enter the ICR Number which is in your xerox.
2. If you don't have xerox of hall ticket , Go to Search Hall Ticket and Print and enter your details.

@@@@ ... If you are from a village background, ur parents will feel little bit tense abt this.Plz B careful next time onwards .... All the best.

Saturday, April 24, 2010

Last night I njoyed with Daarling

Oopssss ..... Last night we(sreekanth and myself) went to Darling movie. I think u mis understand me with my post title, Anyway we njoyed the movie, Its a love story with commedy track. Prabhas did a good job in this movie. Movie with a twist in first half, If u knew the twist before u will definitely feel 1st half is bored. U can njoy the second half. Prabhas's dressing style is somewt different frm past movies...

Tuesday, April 20, 2010

Have U ever heard about LPG gas cylinder's expiry date....!!

Do you know that there is an expiry date (physical life) for LPG cylinders? Expired Cylinders are not safe for use and may cause accidents. In this regard, please be cautious at the time of accepting any LPG cylinder from the vendor.

Here is how we can check the expiry of LPG cylinders:
On one of three side stems of the cylinder, the expiry date is coded alpha numerically as follows A or B or C or D and some two digit number following this e.g. D06.

The alphabets stand for quarters -
1. A for March (First Qtr),
2. B for June (Second Qtr),
3. C for Sept (Third Qtr),
4. D for December (Fourth Qtr).

The digits stand for the year till it is valid. Hence D06 would mean December qtr of 2006.
Please Return Back the Cylinder that you get with a Expiry Date, they are prone to Leak and other Hazardous accidents ...

The digits stand for the year till it is valid. Hence D06 would mean December qtr of 2006.
Please Return Back the Cylinder that you get with a Expiry Date, they are prone to Leak and other Hazardous accidents ...

Monday, April 19, 2010

Is it possible to prevent "finally" block execution ?? -- Java

finally creates a block of code that will be executed after a try/catch block has completed and before the code following the try/catch block. The finally block will execute whether or not an exception is thrown. If an exception is thrown, the finally block will execute even if no catch
statement matches the exception. Any time a method is about to return to the caller from inside a try/catch block, via an uncaught exception or an explicit return statement, the finally clause is also executed just before the method returns.

Now I will tell you an interesting thing about finally. Consider the case. I have a try, catch, finally blocks in my code and I have a requirement like finally block should be executes only if any exception raised otherwise it should not be executed. From the above if there is finally block in your code then it must be executed. How can i solve this ?
Ans : we can able to prevent the finally block execeution by using System.exit(0). see the example below.

try {
String s1 = "abc";
String s2 = "abc";
if(s1.equals(s2)) {
System.exit(0);
} else {
throw New Exception("Both Strings are equal);
}
} catch(Exception e) {
System.out.println(e.getMessage());
} finally {
System.out.println("Finally block executed");
}

Try this example with different strings you may get some idea.

Thursday, April 15, 2010

Abstract Class Vs Interface -- Java

Interface :
1. Interfaces are syntactically similar to classes, but they lack instance variables, and their methods are declared without any body.Interfaces are designed to support dynamic method resolution at run time.
2. A class may implement several interfaces.
3. An interface cannot provide any code at all, much less default code.
4. Variables can be declared inside of interface declarations. They are implicitly final and static, meaning they cannot be changed by the implementing class. They must also be initialized with a constant value.
5. If you add a new method to an interface, you must track down all implementations of that interface in the universe and provide them with a concrete implementation of that method.
6. An Interface can only have public members.
7. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class.

Abstarct Classs:
1. A superclass that only defines a generalized form that will be shared by all of its subclasses, leaving it to each subclass
to fill in the details. Such a class determines the nature of the methods that the subclasses must implement, Called abstract class.
2. A class may extend only one abstract class
3. An abstract class can provide complete code, default code, and/or just stubs that have to be overridden.
4. Both instance and static constants are possible.
5. If you add a new method to an abstract class, you have the option of providing a default implementation of it. Then all existing code will continue to work without change.
6. Abstract class can contain private as well as protected members.
7. Abstract classes are fast.

Wednesday, April 14, 2010

String.valueOf() Vs toString() -- Java

1. If variable is primitive datatype(i.e int,float,char...) then it does not have the toString() method available. So If it requires to convert into string we use String.valueOf(variable).

2. If variable is non primitive datatype(i.e Integer,Float, Boolean....) then it has toString() method available. So here toString() is usefull.

3. The String.valueOf(Object) calls through to the toString() method of the given object (if it isn't null). Hence, if String.valueOf(int) is called, the primitive int will be auto-boxed to an Integer, and its toString() method will be called.

So Finally:
String.valueOf(i),
Integer.toString(i) and
Integer.valueOf(i).toString()
all the above stmts gives the same result.

Monday, April 12, 2010

SVN plugin installation procedure for Eclipse Galileo

By default Eclipse Galileo included support for CVS but not for SVN. Follow the steps to install SVN plugin.

1. Go to Help->Install New Software.
2. Select to work with Galileo – http://download.eclipse.org/releases/galileo.
3. Click on Collaboration and Select Subversive SVN Team Provider (Incubation).
4. Click Next and Slect the radio button to accept license agreements.
5. Click Finish.
6. Go to Window-->Open Perspective--> Other-->SVN Reposotory Exploring and Click Ok.
7. It will propmt Subversive connector discovery with the subversive SVN connectors.
8. Slect SVN Kit 1.3.0 and Native JavaHL 1.6.3.
9. Click Finish.
10. It will prompt the items that you wish to install, By default all items selected. Click Next.
11. It will prompt the review the items to be install, Click Next.
12. Slect the radio button to accept license agreements and Click Finish.
13. It will give you a warning as "You are installing s/w that contain unsigned content. The authenticity or validity of this s/w cannot be established. Do you want to continue with the installation?".. Just Click Ok.
14. It will ask you to Restart the eclipse. Click Yes to restart.
15. Done.

Sunday, April 4, 2010

Use of final keyword in JAVA

The keyword final has 3 uses.
1. It can be used to create the equivalent of a named constant.
2. It can be used to prevent method overriding. method overriding is one of Java’s most powerful features, there will be neccessity to prevent it from occurring. To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden.
3. It can be used to prevent inheritance. Sometimes you will want to prevent a class from being inherited. To do this, precede the class declaration with final. Declaring a class as final implicitly declares all of its methods as final, too.

Choosing an approach between "extends Thread and implements Runnable"

The Thread class defines several methods that can be overridden by a derived class. Of these methods, the only one that must be overridden is run( ). This is, of course, the same method required when you implement Runnable. Many Java programmers feel that classes should be extended only when they are being enhanced or modified in
some way. So, if you will not be overriding any of Thread’s other methods, it is
probably best simply to implement Runnable. This is up to you, of course.

when you are going for multiple inheritance..the only interface can help, So creating thread class implements Runnable is best choice.

Hashtable Vs Hashmap -- Java Collection framework

1. Hashtable and Hashmap both provide key-value access to data.
2. The key difference between the two is that access to the Hashtable is synchronized while Hashmap is not synchronized. Hashtable performs better when you use a sequence of numbers as keys but can perform quite bad if the keys follow some special patterns while HashMap has an overall better performance in the real word and doesn't have "any" problems with special patterns.
3. The Hashtable is not part of the Java Collections Framework. But it does support all the API that a Collection interface specifies. Hashtable is what the Sun calls, the legacy collection implementation. Hashtable inherits from the Dictionary class which is obsolete in Java 1.6, while the HashMap inherits from collection interface “Map”.
4. Iterator in the HashMap is fail-safe where Hashtbale is not.
5. Hashtable is thread-safe. However there is a way of making Hashmaps thread safe using Collections.synchronizedMap(new Hashmap()).
6. HashMap permits one null key & more null values where Hashtable not permits null keys and values.

Prevent USB access in windows -- B carefull

There are 2 cases we need to consider to prevent USB access

Case 1: If a USB storage device is already installed on the computer.
If a USB storage device is already installed on the computer, you can change the registry to make sure that the device does not work when the user connects to the computer. Important This task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article How to back up and restore the registry in Windows.

Follow these steps to set the Start value in the following registry key to 4 to prevent USB access:

1. Click Start, and then click Run. In the Open box, type regedit, and then click OK.
2. Locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
3. In the details pane, double-click Start.
4. In the Value data box, type 4, click Hexadecimal (if it is not already selected), and then click OK.
5. Exit Registry Editor.


Case 2 : If a USB storage device is not already installed on the computer
If a USB storage device is not already installed on the computer, assign the user or the group and the local SYSTEM account Deny permissions to the following files:
%SystemRoot%\Inf\Usbstor.pnf and %SystemRoot%\Inf\Usbstor.inf

Follow these steps:
1. Start Windows Explorer, and then locate the %SystemRoot%\Inf folder.
2. Right-click the Usbstor.pnf file, and then click Properties.
3. Click the Security tab.
4. In the Group or user names list, add the user or group that you want to set Deny permissions for.
5. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.

Also add the System account to the Deny list.
6. In the Group or user names list, select the SYSTEM account.
7. In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.
8. Right-click the Usbstor.inf file, and then click Properties.
9. Click the Security tab.
10.In the Group or user names list, add the user or group that you want to set Deny permissions for.
11.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control.
12.In the Group or user names list, select the SYSTEM account.
13.In the Permissions for UserName or GroupName list, click to select the Deny check box next to Full Control, and then click OK.

Note : We need to follow the same above steps to allow USB access ... All the best

Friday, April 2, 2010

CEEP 2010 Notification

Imp dates :
Start date for CEEP 2010 booklet selling : 23-03-2010
Last date for booklet submission : 30-04-2010
Examp date : 10-05-2010

Please check the notification details in CEEP 2010