10
03
2011
I just recently switched to using Gmail as my universal e-mail for manageability purposes, which means (1) I can now send e-mail using my Yahoo! or Hotmail account within Gmail and (2) All my e-mails in Yahoo! and Hotmail is now archived in my Gmail account.
I was able to accomplish #1 easily by adding POP accounts, but only stumbled on the importing of mail and contacts today. When I did, I was happy and relieved, so sharing this info, as others may benefit from it.

Comments : No Comments »
Categories : Email, How-to, Resource
29
07
2010
Adding for archival purposes…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
namespace Classes
{
public class Hash
{
public Hash()
{ }
#region Hash Choices
/// <summary>The wanted hash function.</summary>
public enum HashType : int
{
/// <summary>MD5 Hashing</summary>
MD5,
/// <summary>SHA1 Hashing</summary>
SHA1,
/// <summary>SHA256 Hashing</summary>
SHA256,
/// <summary>SHA384 Hashing</summary>
SHA384,
/// <summary>SHA512 Hashing</summary>
SHA512
} /* HashType */
#endregion
#region Public Methods
/// <summary>Generates the hash of a text.</summary>
/// <param name="strPlain">The text of which to generate a hash of.</param>
/// <param name="hshType">The hash function to use.</param>
/// <returns>The hash as a hexadecimal string.</returns>
public static string GetHash(string strPlain, HashType hshType)
{
string strRet;
switch (hshType)
{
case HashType.MD5:
strRet = GetMD5(strPlain);
break;
case HashType.SHA1:
strRet = GetSHA1(strPlain);
break;
case HashType.SHA256:
strRet = GetSHA256(strPlain);
break;
case HashType.SHA384:
strRet = GetSHA384(strPlain);
break;
case HashType.SHA512:
strRet = GetSHA512(strPlain);
break;
default:
strRet = "Invalid HashType";
break;
}
return strRet;
} /* GetHash */
/// <summary>Checks a text with a hash.</summary>
/// <param name="strOriginal">The text to compare the hash against.</param>
/// <param name="strHash">The hash to compare against.</param>
/// <param name="hshType">The type of hash.</param>
/// <returns>True if the hash validates, false otherwise.</returns>
public static bool CheckHash(string strOriginal, string strHash, HashType hshType)
{
string strOrigHash = GetHash(strOriginal, hshType);
return (strOrigHash == strHash);
} /* CheckHash */
#endregion
#region Hashers
private static string GetMD5(string strPlain)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
MD5 md5 = new MD5CryptoServiceProvider();
string strHex = "";
HashValue = md5.ComputeHash(MessageBytes);
foreach (byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetMD5 */
private static string GetSHA1(string strPlain)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
SHA1Managed SHhash = new SHA1Managed();
string strHex = "";
HashValue = SHhash.ComputeHash(MessageBytes);
foreach (byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetSHA1 */
private static string GetSHA256(string strPlain)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
SHA256Managed SHhash = new SHA256Managed();
string strHex = "";
HashValue = SHhash.ComputeHash(MessageBytes);
foreach (byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetSHA256 */
private static string GetSHA384(string strPlain)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
SHA384Managed SHhash = new SHA384Managed();
string strHex = "";
HashValue = SHhash.ComputeHash(MessageBytes);
foreach (byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetSHA384 */
private static string GetSHA512(string strPlain)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] HashValue, MessageBytes = UE.GetBytes(strPlain);
SHA512Managed SHhash = new SHA512Managed();
string strHex = "";
HashValue = SHhash.ComputeHash(MessageBytes);
foreach (byte b in HashValue)
{
strHex += String.Format("{0:x2}", b);
}
return strHex;
} /* GetSHA512 */
#endregion
}
}
Comments : No Comments »
Categories : ASP.NET, How-to
28
07
2010
jsSHA - A JavaScript implementation of the complete Secure Hash Standard family
(SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512) by Brian Turek
About
-------------------------
jsSHA is a javaScript implementation of the complete Secure Hash Algorithm family as defined
by FIPS PUB 180-2 (http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf)
With the slow phasing out of MD5 as the standard hash to use in web applications, a client-side
implementation of the complete Secure Hash Standard family was needed. Due to SHA-384 and SHA-512's
use of 64-bit values throughout the algorithm, JavaScript can not easily natively support the calculation
of these hashes. As a result, a bit of hacking had to be done to make sure the values behaved themselves.
SHA-224 was added to the Secure Hash Standard family on 25 February 2004 so it was also included in this
package.
Files
-------------------------
src/sha.js
The complete SHA implementation
src/sha1.js
A smaller/web friendly implementation of only SHA-1.
src/sha256.js
A smaller/web friendly implementation of only SHA-224 and SHA-256.
src/sha512.js
A smaller/web friendly implementation of only SHA-384 and SHA-512.
src/wrapper.js
Wrapper functions to be added to the above script files if the jsSHA 0.1 interface is desired
test/test.html
A test page that calculates various hashes and has their correct values.
Usage
-------------------------
Include the desired JavaScript file (sha.js, sha1.js, sha256.js, or sha512.js) in your header (sha.js used below):
<script type="text/javascript" src="/path/to/sha.js"></script>
Instantiate a new jsSHA object with your string to be hashed as the only parameter. Then, call getHash with the desired
hash variant (SHA-1, SHA-224, SHA-256, SHA-384, or SHA-512) and output type (HEX or B64). In the example below,
"This is a Test" and "SHA-512" were used as the string to be hashed and variant respectively.
var shaObj = new jsSHA("This is a Test");
var hash = shaObj.getHash("SHA-512", "HEX");
NOTE: If you are using sha1.js, omit the SHA variant parameter as there is only one option.
Since the interface was changed drastically from 0.1 to 1.0, src/wrapper.js is included in case the old interface is desired.
Simply copy and paste the correct functions from wrapper.js to the bottom of the used jsSHA JS file.
Contact Info
-------------------------
The project's website is located at http://jssha.sourceforge.net/
Comments : No Comments »
Categories : General Development, How-to, jQuery, Resource
22
07
2010
PS C:\> gc servers.txt | foreach { [system.diagnostics.fileversioninfo]::getversioninfo($_) }
Comments : No Comments »
Categories : How-to, PowerShell
19
07
2010
This applies to any device that uses lithium ion batteries (i.e. laptops, smartphones).
Battery
- For lithium ion batteries, you do not need to discharge them fully and recharge constantly. Since they don’t have the same "memory" as older nickel-metal hydride batteries, it is actually better to discharge a lithium ion only partially (10 to 20%) before recharging. You need to do a full discharge only about every 30 charges (usually around every 2 to 3 weeks).
- Consider taking your battery out when using your laptop plugged into AC power. Just make sure to keep the contacts clean. If you need to clean them, use a lint-free cloth moistened with rubbing alcohol every couple of months.
Software & Hardware
- Defrag your hard drive regularly
- Dim your screen to the lowest level you can tolerate
- Close unused programs running in the background
- Disable WIFI when not in use.
- Hibernate your computer, not standby.
Environment
- Avoid propping your laptop on a pillow, blanket, or other soft surface that can heat up or block cooling fans.
- Clean your desk. It sounds strange, but if you have a dusty, dirty desk, that dust will get into the vents and clog the cooling fan. Once the dust is inside your laptop, it is much harder to remove. You can try blasting it out with canned air, but you run the risk of damaging internal components. You can also remove the vent and clean out the grit, but remember that taking apart your laptop can void the warranty. So clean your desk at least once a week, if not daily.
- Try not to store your laptop in a place where the air temperature exceeds 80 degrees Fahrenheit, such as a hot car or an outdoor patio. And if your laptop heats up or is cold, let it return to room temperature before starting up.
- Use a cooling pad when using a notebook computer on your lap.
Comments : No Comments »
Categories : Gadgets, How-to, iPad, iPhone, Resource