Wednesday, July 27, 2011
Apple Magic Mouse
I've been using the Apple Magic Mouse for over a month now, and I must say that I really like it. Make sure that you use it with BetterTouchTool. With BetterTouchTool, you can program the mouse to do different things to your liking. ButterTouchTool has a "windows snapping" feature like Windows 7 if you like that.
Tuesday, July 26, 2011
Acer Aspire 5732z Touchpad Not Working
Problem:
A friend asked me for help.
Acer Touchpad suddenly stopped working. Tried Fn+F7 as suggested, not working. Tried uninstalling/reinstalling driver, not working.
Solution:
Wednesday, July 20, 2011
Removing Sweat Sheen With Photoshop
- Create a new layer and "darken" for blending mode
- Choose the brush and set "opacity=20%"
- Alt (keyboard) to pick the area without the sweat and apply to the sweat area
Friday, July 15, 2011
HmacSHA1 in Java and C#
Java:
byte[] password = "password".getBytes();
SecretKeySpec keySpec = new SecretKeySpec(password,"HmacSHA1");
Mac hmacsha1 = Mac.getInstance("HmacSHA1");
hmacsha1.init(keySpec);
byte[] hash = hmacsha1.doFinal("test".getBytes());
String hashBase64 = new String(Base64.encodeBase64(hash));
System.out.println(hashBase64);
C#:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] password = encoding.GetBytes("password");
HMACSHA1 hmacsha1 = new HMACSHA1(password);
byte[] hash = hmacsha1.ComputeHash(encoding.GetBytes("test"));
String hashBase64 = Convert.ToBase64String(hash);
Console.WriteLine(hashBase64);
Base64 Encoding String in Java and C#
Java:
String base64 = new String(org.apache.commons.codec.binary.Base64.encodeBase64("test".getBytes()));
System.out.println(base64);
C#:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string base64 = System.Convert.ToBase64String(encoding.GetBytes("test"));
Console.WriteLine(base64);
Convert String To Hex in Java and C#
Java:
String hex = new String(org.apache.commons.codec.binary.Hex.encodeHex("test".getBytes()));
System.out.println(hex);
C#:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string hex = System.BitConverter.ToString(encoding.GetBytes("test")).Replace("-", string.Empty);
Console.WriteLine(hex);
Thursday, July 14, 2011
Parse XML String in Java
Here are a couple of easy ways to parse an xml string in java:
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><string xmlns=\"http://playingtreee.blogspot.com/\">4654ebd75e9cbd8a4823e964f0dceef0</string>";
Example 1:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(xml)));
System.out.println(doc.getFirstChild().getTextContent());
Example 2:
DOMParser parser = new DOMParser();
parser.parse(new InputSource(new StringReader(xml)));
Document doc = parser.getDocument();
System.out.println(doc.getFirstChild().getTextContent());
Subscribe to:
Posts (Atom)