Saturday, December 11, 2010

Failed to download repository information

GPG error 'NO PUBLIC KEY FOUND':

Still, I am not sure that how public keys were deleted, but these keys can be recovered by running the following command in terminal.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AF5ED91C56978EF9

Replace hexadecimal numbers with the number written in the error while updating ubuntu. If there are more than one error then run the above command by changing the hexadecimal numbers associated with each error. At the end run the following command,
sudo apt-get update

I hope it will work :)

Saturday, December 4, 2010

Base64 – Encode and Decode JAVA Functions

Find information on Wikipedia about Base64
privatestatic String toBase64Encode(Serializable o)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos;
try
{
oos = new ObjectOutputStream( baos );
oos.writeObject( o );
oos.close();
}
catch (IOException e)
e.printStackTrace();

returnnew String(Base64.encodeBytes(baos.toByteArray()));
}

privatestatic Object toBase64Decode(String s)
{
byte [] data = Base64.decode(s);
ObjectInputStream ois;
try
{
ois = new ObjectInputStream(new ByteArrayInputStream(data));
Object o = ois.readObject();
ois.close();
return o;
}
catch (IOException e)
e.printStackTrace();
catch (ClassNotFoundException e)
e.printStackTrace();

returnnull;
}

Integration of SQLite3 and Netbeans C/C++ IDE

Few days back, I wanted to use SQLite database for one of my project. I spend couple of hours to find a way to integrate with Netbeans. Mayb...