1. What will you do when people are taking advantage of your normal friendly conversation into SPECIAL conversations?
2. What will you do when the above affects your work and life?
3. What will you do when you are troubled by the name of FEEDBACK?
4. What will you do when you come to know that people are taking obvious negative meaning when you are on the positive side?
5. What will you do when your normal actions are identified as mistakes?
Wednesday, September 1, 2010
Monday, August 30, 2010
Train ITems
Have you ever had a chance to taste Tea or Coffee served by the vendors in the train? During your travel especially during the day travelling, you will feel like munching or drinking something. If you have any ideas like drinking tea or coffee by the walking vendors, just drop that idea. Have seen pictures from one of the blog spot that tea/coffee can is filled with water coming from toilets. Recently had one tea because of headache but ended up in the same bitter taste.
Also there are lot of Items that are sold by those walking vendors are not good for health for example had some groundnuts and ended up with headache. But food items that are sold in authorized shops located at railway stations are OK type items. For example had a chance to have idlies as one of the food Item in Madurai railway station and they are good. In Madurai, normally temperature is on the higher side and you will end up with making yourself comfortable by removing some of your clothes etc. But there is no need to follow it everywhere say for example in a rainy season in chennai, while standing on the road side etc.
Also there are lot of Items that are sold by those walking vendors are not good for health for example had some groundnuts and ended up with headache. But food items that are sold in authorized shops located at railway stations are OK type items. For example had a chance to have idlies as one of the food Item in Madurai railway station and they are good. In Madurai, normally temperature is on the higher side and you will end up with making yourself comfortable by removing some of your clothes etc. But there is no need to follow it everywhere say for example in a rainy season in chennai, while standing on the road side etc.
Wednesday, July 28, 2010
Second largest element in an unsorted array
How will you find out second largest element in an unsorted array?
If you would like to do it in one pass, then have two variables as max, secondMax. Do compare all values with thest values. Initially assign, firstValue as max and secondValue as secondMax do compare them.
Now the next question is, will it scale if you have large stream of numbers and if you would like to find Top N from that large stream of numbers?
Have array withe size N and repeat the above steps.
If you would like to do it in one pass, then have two variables as max, secondMax. Do compare all values with thest values. Initially assign, firstValue as max and secondValue as secondMax do compare them.
Now the next question is, will it scale if you have large stream of numbers and if you would like to find Top N from that large stream of numbers?
Have array withe size N and repeat the above steps.
How to convert Version 1 requests into V2 requests?
Scenerio: If existing application is using lot of Version 1 requests that need to be converted into version 2 requests.
Solution: Write a wrapper over the existing V1 class. For example if you import some class org.version.Version1 and calling various methods like addHeader(), addData() etc, write a wrapper org.wrapper.Version1Wrapper and define all methods present in org.version.Version1. Inside org.version.Version1Wrapper call org.version.Version2 methods. Now do a Search and Replace in all your existing code such that org.version.Version1 should be replaced by org.version.Version1Wrapper. Write a well defined unit test case for the newly written org.version.VersionV1Wrapper class.
Advantages: Very less implementation and testing effort.
Solution: Write a wrapper over the existing V1 class. For example if you import some class org.version.Version1 and calling various methods like addHeader(), addData() etc, write a wrapper org.wrapper.Version1Wrapper and define all methods present in org.version.Version1. Inside org.version.Version1Wrapper call org.version.Version2 methods. Now do a Search and Replace in all your existing code such that org.version.Version1 should be replaced by org.version.Version1Wrapper. Write a well defined unit test case for the newly written org.version.VersionV1Wrapper class.
Advantages: Very less implementation and testing effort.
Java code to convert base 10 value to a hex value
import org.junit.*;
import static org.junit.Assert.*;
public class HexValue
{
private static final char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
private static String toHexValue(int baseValue) throws IllegalArgumentException
{
StringBuilder builder = new StringBuilder();
if(baseValue < 0)
{
throw new IllegalArgumentException("Given base value "+baseValue+" is less than zero");
}
else if(baseValue == 0)
{
return String.valueOf(0);
}
while(baseValue > 0)
{
int mod = baseValue%16;
builder.insert(0,hexArray[mod]);
baseValue = baseValue/16;
}
return builder.toString();
}
@Test public void testZero()
{
assertEquals("0",HexValue.toHexValue(0));
}
@Test (expected=IllegalArgumentException.class)
public void testNegative()
{
HexValue.toHexValue(-8);
}
@Test
public void testValidInput()
{
assertEquals("A0",HexValue.toHexValue(160));
assertEquals("100",HexValue.toHexValue(256));
assertEquals("EA",HexValue.toHexValue(234));
}
public static void main(String a[])
{
if(a.length != 1)
{
System.out.println("Help: java HexValue [baseValue]");
return;
}
System.out.println("Hexa Decimal value of "+a[0]+" is "+HexValue.toHexValue(Integer.parseInt(a[0])));
}
}
import static org.junit.Assert.*;
public class HexValue
{
private static final char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
private static String toHexValue(int baseValue) throws IllegalArgumentException
{
StringBuilder builder = new StringBuilder();
if(baseValue < 0)
{
throw new IllegalArgumentException("Given base value "+baseValue+" is less than zero");
}
else if(baseValue == 0)
{
return String.valueOf(0);
}
while(baseValue > 0)
{
int mod = baseValue%16;
builder.insert(0,hexArray[mod]);
baseValue = baseValue/16;
}
return builder.toString();
}
@Test public void testZero()
{
assertEquals("0",HexValue.toHexValue(0));
}
@Test (expected=IllegalArgumentException.class)
public void testNegative()
{
HexValue.toHexValue(-8);
}
@Test
public void testValidInput()
{
assertEquals("A0",HexValue.toHexValue(160));
assertEquals("100",HexValue.toHexValue(256));
assertEquals("EA",HexValue.toHexValue(234));
}
public static void main(String a[])
{
if(a.length != 1)
{
System.out.println("Help: java HexValue [baseValue]");
return;
}
System.out.println("Hexa Decimal value of "+a[0]+" is "+HexValue.toHexValue(Integer.parseInt(a[0])));
}
}
How to Spam one's personal mail id?
1. Somehow get hold of that person's mail id. You know your own ways of knowing that person's personal mail id.
2. Subscribe that person's mail id to the websites you would like most. Those websites obsivously irritate the victim.
3. If you think that person is blocking your marriage, then subscribe that mail-id to some matrimonial site. You have the privilege of choosing the RIGHT match for your victim. After doing this you will have full satisfaction and inside happiness forever.
4. Subscribe him for some adult jokes web site.
5. As always you can send some actress pictures since sending your pictures could be a waste of time.
Sigh.....
2. Subscribe that person's mail id to the websites you would like most. Those websites obsivously irritate the victim.
3. If you think that person is blocking your marriage, then subscribe that mail-id to some matrimonial site. You have the privilege of choosing the RIGHT match for your victim. After doing this you will have full satisfaction and inside happiness forever.
4. Subscribe him for some adult jokes web site.
5. As always you can send some actress pictures since sending your pictures could be a waste of time.
Sigh.....
Tuesday, July 27, 2010
A mobile - A Car - A hardware
Can you draw a block diagram for a mobile application that communicates with a Car and a hardware which has legacy C, C++ module?
And here it is ...
And here it is ...
Subscribe to:
Posts (Atom)
