Basic specifications:
Thursday, August 12, 2010
Samsung Intensity II
Basic specifications:
Labels:
Samsung
Advanced Encryption in Silverlight and .NET Applications
AES encryption is implemented in both Silverlight and .NET run times, using exact same set of classes, primary one being AesManaged class.
using System;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace Encryption
{
public static class EncryptionUtility
{
public static string Encrypt(string input, string password)
{
byte[] utfData = UTF8Encoding.UTF8.GetBytes(input);
byte[] saltBytes = Encoding.UTF8.GetBytes(password);
string encryptedString = string.Empty;
using (AesManaged aes = new AesManaged())
{
Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(password, saltBytes);
aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
aes.KeySize = aes.LegalKeySizes[0].MaxSize;
aes.Key = rfc.GetBytes(aes.KeySize / 8);
aes.IV = rfc.GetBytes(aes.BlockSize / 8);
using (ICryptoTransform encryptTransform = aes.CreateEncryptor())
{
using (MemoryStream encryptedStream = new MemoryStream())
{
using (CryptoStream encryptor =
new CryptoStream(encryptedStream, encryptTransform, CryptoStreamMode.Write))
{
encryptor.Write(utfData, 0, utfData.Length);
encryptor.Flush();
encryptor.Close();
byte[] encryptBytes = encryptedStream.ToArray();
encryptedString = Convert.ToBase64String(encryptBytes);
}
}
}
}
return encryptedString;
}
public static string Decrypt(string input, string password)
{
byte[] encryptedBytes = Convert.FromBase64String(input);
byte[] saltBytes = Encoding.UTF8.GetBytes(password);
string decryptedString = string.Empty;
using (var aes = new AesManaged())
{
Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(password, saltBytes);
aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
aes.KeySize = aes.LegalKeySizes[0].MaxSize;
aes.Key = rfc.GetBytes(aes.KeySize / 8);
aes.IV = rfc.GetBytes(aes.BlockSize / 8);
using (ICryptoTransform decryptTransform = aes.CreateDecryptor())
{
using (MemoryStream decryptedStream = new MemoryStream())
{
CryptoStream decryptor =
new CryptoStream(decryptedStream, decryptTransform, CryptoStreamMode.Write);
decryptor.Write(encryptedBytes, 0, encryptedBytes.Length);
decryptor.Flush();
decryptor.Close();
byte[] decryptBytes = decryptedStream.ToArray();
decryptedString =
UTF8Encoding.UTF8.GetString(decryptBytes, 0, decryptBytes.Length);
}
}
}
return decryptedString;
}
}
}
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace Encryption
{
public static class EncryptionUtility
{
public static string Encrypt(string input, string password)
{
byte[] utfData = UTF8Encoding.UTF8.GetBytes(input);
byte[] saltBytes = Encoding.UTF8.GetBytes(password);
string encryptedString = string.Empty;
using (AesManaged aes = new AesManaged())
{
Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(password, saltBytes);
aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
aes.KeySize = aes.LegalKeySizes[0].MaxSize;
aes.Key = rfc.GetBytes(aes.KeySize / 8);
aes.IV = rfc.GetBytes(aes.BlockSize / 8);
using (ICryptoTransform encryptTransform = aes.CreateEncryptor())
{
using (MemoryStream encryptedStream = new MemoryStream())
{
using (CryptoStream encryptor =
new CryptoStream(encryptedStream, encryptTransform, CryptoStreamMode.Write))
{
encryptor.Write(utfData, 0, utfData.Length);
encryptor.Flush();
encryptor.Close();
byte[] encryptBytes = encryptedStream.ToArray();
encryptedString = Convert.ToBase64String(encryptBytes);
}
}
}
}
return encryptedString;
}
public static string Decrypt(string input, string password)
{
byte[] encryptedBytes = Convert.FromBase64String(input);
byte[] saltBytes = Encoding.UTF8.GetBytes(password);
string decryptedString = string.Empty;
using (var aes = new AesManaged())
{
Rfc2898DeriveBytes rfc = new Rfc2898DeriveBytes(password, saltBytes);
aes.BlockSize = aes.LegalBlockSizes[0].MaxSize;
aes.KeySize = aes.LegalKeySizes[0].MaxSize;
aes.Key = rfc.GetBytes(aes.KeySize / 8);
aes.IV = rfc.GetBytes(aes.BlockSize / 8);
using (ICryptoTransform decryptTransform = aes.CreateDecryptor())
{
using (MemoryStream decryptedStream = new MemoryStream())
{
CryptoStream decryptor =
new CryptoStream(decryptedStream, decryptTransform, CryptoStreamMode.Write);
decryptor.Write(encryptedBytes, 0, encryptedBytes.Length);
decryptor.Flush();
decryptor.Close();
byte[] decryptBytes = decryptedStream.ToArray();
decryptedString =
UTF8Encoding.UTF8.GetString(decryptBytes, 0, decryptBytes.Length);
}
}
}
return decryptedString;
}
}
}
Labels:
ASP .NET,
Silverlight
Create a Path Using Path Markup Language Silverlight 4 - Video Tutorial
Silverlight supports a powerful and complex mini-language that you can use to describe geometric paths. You use this mini-language when setting a property of type Geometry, such as the Clip property of a UIElement or the Data property of a Path element. In this video, Todd Miranda demonstrates how to manually create a path using Path Markup Language.
http://www.silverlight.net/learn/videos/all/create-a-path-using-path-markup-language/
Source: silverlight.net
http://www.silverlight.net/learn/videos/all/create-a-path-using-path-markup-language/
Source: silverlight.net
Labels:
Silverlight
Friday, July 30, 2010
RIA Services - Presentation Model & POCO Objects
RIA Services handles any relationship other than Many to Many. If you have a Many to Many you will need to have a linking entity between the two tables.
Each Entity POCO on the server needs to have a primary key (you mark the key(s) with the KeyAttribute). Related entities need a foreign key property and you need to mark the relationships with AssociationAttributes.
RIA Services is good at lazy loading, but you have to manually trigger the loads it will not do it automatically. If you want to load the Companies and the Employees at the same time then you need to decorate the association properties with the IncludeAttribute. If you don't want to include them then you don't. Because RIA Services is based on keys and foreign keys, you can load the Companies up in one load and then later if you want them load up the Employees and the relationships between the two tables will automatically link back on on the client based on the values of the foreign keys.
A few good resources to look at what be documentation of what RIA Services calls a Presentation Model:
http://msdn.microsoft.com/en-us/library/ee707347(VS.91).aspx
and there is a simple example of how the attributes work here:
http://tech.rofas.net/post/Working-with-associated-POCO-objects-in-WCF-RIA-Services.aspx
Each Entity POCO on the server needs to have a primary key (you mark the key(s) with the KeyAttribute). Related entities need a foreign key property and you need to mark the relationships with AssociationAttributes.
RIA Services is good at lazy loading, but you have to manually trigger the loads it will not do it automatically. If you want to load the Companies and the Employees at the same time then you need to decorate the association properties with the IncludeAttribute. If you don't want to include them then you don't. Because RIA Services is based on keys and foreign keys, you can load the Companies up in one load and then later if you want them load up the Employees and the relationships between the two tables will automatically link back on on the client based on the values of the foreign keys.
A few good resources to look at what be documentation of what RIA Services calls a Presentation Model:
http://msdn.microsoft.com/en-us/library/ee707347(VS.91).aspx
and there is a simple example of how the attributes work here:
http://tech.rofas.net/post/Working-with-associated-POCO-objects-in-WCF-RIA-Services.aspx
Labels:
RIA
Wednesday, July 28, 2010
Samsung Intercept
Basic specifications:
Android
Labels:
Cool Stuff,
Samsung Mobile Phones
Tuesday, July 27, 2010
Motorola CHARM
Basic specifications:
Android
Labels:
Motorola Mobile Phones
Monday, July 26, 2010
Samsung Acclaim
Basic specifications:
Android
Labels:
Samsung Mobile Phones