HOWTO The Onion Router Tor on Back Track 5

PART I : Browser



Step 1 :



nano /etc/apt/sources.list



Append the following line to the file.



deb http://deb.torproject.org/torproject.org lucid main



Step 2 :



gpg --keyserver keys.gnupg.net --recv 886DDD89

gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -



apt-get update

apt-get install tor tor-geoipdb

apt-get install privoxy




Step 3 :



nano /etc/privoxy/config



Append the following line :



forward-socks4a / 127.0.0.1:9050 .



/etc/init.d/privoxy start

/etc/init.d/tor start




Step 3a (Optional) :



If you are behind firewall or NAT as well as router, you should append the following line at the configure file.



forward 192.168.*.*/ .



Step 4 :



Go to the Tor official site to download and install Tor button for Firefox.



Tor Button Plugin for Firefox



Step 5 :



Open Firefox. Go to "Tools" -- "Add-ons" -- "Extensions". Select "Torbuttons Preferences".



(a) At "Proxy Settings", unclick "Use Polipo".

(b) At "Security Settings", On browser startup, set Tor state to:" select "Tor".

(c) At "Display Settings", select "Icon".



** Now, your Firefox will enable Tor on every launch unless you disabled the "Tor Button" on the Firefox.



Step 6 (Optional) :



To check if it works or not. Go to the following sites to check your Ip address.



http://cmyip.com



or



http://whatismyip.com



or



http://check.torproject.org



PART II : Console



Step a :



apt-get install proxychains elinks



Step b :



nano /etc/proxychains.conf



Append the following line :



socks4 127.0.0.1 9050



** It should be there.



Step c :



Usage :



proxychains nmap google.com

proxychains elinks http://cmyip.com

proxychains elinks http://www.whatismyip.com




To see your real IP address :



elinks cmyip.com



Thats all! See you.
Read More..

Decorator design Pattern in Java with Example Java Tutorial

I was thinking to write on decorator design pattern in Java when I first wrote 10 interview questions on Singleton Pattern in Java. Since design pattern is quite important while building software and it’s equally important on any Core Java Interview, It’s always good to have clear understanding of various design patterns in Java. In this article we will explore and learn Decorator Design pattern in Java which is a prominent core Java design pattern and you can see lot of its example in JDK itself. JDK use decorator pattern in IO package where it has decorated Reader and Writer Classes for various scenario, for example BufferedReader and BufferedWriter are example of decorator design pattern in Java. From design perspective its also good idea to learn how existing things work inside JDK itself for example How HashMap works in Java or How SubString method work in Java, that will give you some idea of things you need to keep in mind while designing your Class or interface in Java. Now let’s Move on to Decorator pattern in Java.
Read more »
Read More..

HOWTO Make your Android running more faster by DroidBooster

DroidBooster makes your Android based smartphone running faster than before. Even Froyo (Android 2.2) can boost the performance a little bit. Older version of Android may find the performance increased a lot.



DroidBooster can be downloaded from the Market. You are required to do nothing after installation unless you want to send the benchmark to the official website.



Thats all! See you.
Read More..

Types of Antivirus Software

If your computer runs normally, it is a sign that it is working properly. If however, your computer starts to function in a way that it is far from normal, consider that as a warning sign that your computer is about to suffer from a viral attack. Computer viruses and trojans can have a serious impact on your computer such as deleting your hard drive and even taking control of your computer. With sufficient and adequate antivirus protection, you can counter the effects of an unwanted attack.
There are good free antivirus programs, however the only drawback is that it consumes a huge amount of memory. If installed on a laptop, there is a chance that this program will cause the laptop to hang. A desktop computer carries more memory than a laptop, therefore it may withstand the free antivirus softwares memory consumption. This is what happened in my case. As my commercial antivirus program expired, I was left with the dilemma of protecting my computer. As I searched for a good antivirus, I finally selected one which protects against most viruses and at the same time consumes the least amount of memory. Best of all, its free.
As compared to free antivirus programs, commercial antivirus software may be installed on a laptop or desktop without any unwanted effects. There are those programs whose software requires downloading from its main site. Paid software has some added features such as enhanced antivirus protection and firewall activation, as well as detecting unauthorized devices connecting to or attempting to connect to the protected network. Because of the nature of an open and public network, financial statements are never transacted under any circumstances. Phishing and other malicious software can find its way from a single source computer to multiple targets on a public network.
An employer who has several computers interconnected under a single network encounters certain benefits and risks regarding virus protection in the workplace. First, he must decide on whether to use free or commercial software. Employers who are constrained by budget limits aim for free antivirus software, but those who are willing to invest in a comprehensive program will get his return in the long run. Once the employer has decided on which software he will use, he has to install safety nets within each and every computer, such that every unit will access only what is authorized and no more. Employees who need to access such files by reason of their duties or functions must obtain the consent of their employer, and must take care of such files. If any important file has been ruined or the entire drive is infected with a virus through no fault of the employee, they must notify the employer immediately.
Article Source: http://EzineArticles.com/7686751
Read More..

JSTL forTokens Tag Example Split String in JSP

JSTL forTokens tag is another tag in core JSTL library to support Iteration or looping. It effectively complements, more useful <c:forEach> tag, by allowing you to iterate over comma separated or any delimited String. You can use this tag to split string in JSP and can operate on them individually. forTokens tag has similar attribute like forEach JSTL tag except one more attribute called delims, which specifies delimiter. For example to iterate over colon separated String "abc:cde:fgh:ijk", delims=":". By the way, forTokens tag also accept multiple delimiter, which means, you can split a big string into token based upon multiple delimiter e.g. colon(:) and pipe (|), This will be more clear, when we will see examples of JSTL forTokens tag in JSP. Rest of attribute e.g. items, var, varStatus, begin, end and step are same, as they are in case of <c:forEach> tag. For quick review, items specify String which needs to be split-ed in token and var hold current String.
Read more »
Read More..

HOWTO Ubuntu 9 10 for OpenVPN

To make your Ubuntu 9.10 box to connect to OpenVPN server is very easy.



sudo apt-get update

sudo apt-get install network-manager-openvpn

sudo /etc/init.d/network-manager restart




Now, you can configure the Network Manager for any OpenVPN server.





Thats all. See you!
Read More..

Core Java coding question converting String to BigDecimal

There are times while coding you need to convert an entity of one data type to another or validate a given input.



Q. Can you write a generic function that converts an amount in String to double amount?
A.

Step 1: Ask the right questions and arrive at a more detailed requirements.
  • Handling negative amounts like -34.01 or (34.01) with a parenthesis. Parentheses denote a negative value. 
  • Handling commas in formatted values like 1,205.45, etc.
  • Handling negative scenarios like amount being  empty as in ( ).
Since, it is a requirement to write a generic function, all the above scenarios need to be taken care of.

Step 2: Lets use a TDD (Test Driven Development approach).

So, write a skeleton class so that all our unit tests fail.

  
package com.mycompany.app5;

import java.math.BigDecimal;
import java.text.ParseException;

public class ConvertingAmount
{

public BigDecimal convert(String amount) throws ParseException
{
BigDecimal result = null;
return result;
}
}

Next, write the unit tests based on the above requirements so that all fail, but cover the requirements.

  
package com.mycompany.app5;

import java.math.BigDecimal;
import java.text.ParseException;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

public class ConvertingAmountTest
{
private ConvertingAmount ca;

@Before
public void setUp()
{
ca = new ConvertingAmount();
}

@Test
public void testPositiveAmount() throws ParseException
{
BigDecimal converted = ca.convert("2255.001");
Assert.assertEquals(new BigDecimal("2255.001"), converted);
}

@Test
public void testNegativeAmount() throws ParseException
{
BigDecimal converted = ca.convert("-2255.001");
Assert.assertEquals(new BigDecimal("-2255.001"), converted);
}

@Test
public void testNegativeAmountWithParanthes() throws ParseException
{
BigDecimal converted = ca.convert("(2255.001)");
Assert.assertEquals(new BigDecimal("-2255.001"), converted);
}

@Test
public void testPosiotiveAmountFormatted() throws ParseException
{
BigDecimal converted = ca.convert("2,255.001");
Assert.assertEquals(new BigDecimal("2255.001"), converted);
}

@Test
public void testNegativeAmountFormatted() throws ParseException
{
BigDecimal converted = ca.convert("-2,255.001");
Assert.assertEquals(new BigDecimal("-2255.001"), converted);
}

@Test
public void testNegativeAmountWithParenthesesFormatted() throws ParseException
{
BigDecimal converted = ca.convert("(2,255.001)");
Assert.assertEquals(new BigDecimal("-2255.001"), converted);
}

@Test(expected = ParseException.class)
public void testExceptionalScenario() throws ParseException
{
String amount = "()";
ca.convert(amount);
}

@Test(expected = ParseException.class)
public void testExceptionalScenario2() throws ParseException
{
String amount = "abc";
ca.convert(amount);
}
}




Step 3: Implement the functionality, so that all the above unit tests pass.

 
package com.mycompany.app5;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;

import org.apache.commons.lang.StringUtils;

public class ConvertingAmount
{

public BigDecimal convert(String amount) throws ParseException
{
BigDecimal result = null;

DecimalFormat df = new DecimalFormat("#,#00.00;-#,#00.00"); //positive;negative

//convert (2255.001) to -2255.001 and (2,255.001) to -2255.001
if (StringUtils.isNotBlank(amount) && amount.startsWith("(") && amount.endsWith(")"))
{
String valueStr = amount.substring(1, amount.length() - 1);
Number valInParenthesis = df.parse(valueStr.trim());
result = BigDecimal.valueOf(valInParenthesis.doubleValue()).negate();
amount = result.toPlainString();
}

//parse 2,255.001 and -2,255.001
Number val = df.parse(amount);
result = BigDecimal.valueOf(val.doubleValue());

return result;
}
}

Now, all green.


Read More..