Using:
declare @value VARCHAR(8000)Enjoy!
--Encrypt
set @value = dbo.fnEncDecRc4('Magic Word','password')
--Decrypt
select dbo.fnEncDecRc4('Magic Word',@value)
declare @value VARCHAR(8000)Enjoy!
--Encrypt
set @value = dbo.fnEncDecRc4('Magic Word','password')
--Decrypt
select dbo.fnEncDecRc4('Magic Word',@value)
Many years I’m use the best file manager Total Commander (Windows commander in the past). In the home site was found link to the site http://www.totalcmd.net which include additional plugins and utilities. But I would present only one very usability utility – Log Viewer Pro. Current application dedicated to viewing logs and available to using in every text file . Every level of Log may be define in different color, a program is free (for home users) and not required install.
Screenshot:
Main features of viewer:
Fast scrolling, eats low memory.
Supports any file size (4 Gb and larger).
Multitabbed interface.
Auto-reload file, Follow tail mode.
Allows to highlight some lines (e.g. "errors", "warnings").
Allows to view encodings: ANSI, OEM, Unicode LE, Unicode BE etc.
File search (both forward and backward).
Download here.
Size: 650 KB
Author: Alexey Torgashin
Current code is generate string in defined length and include chars, numbers and symbols.
public static string GetRandomString(int size)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
int[] symbol = new[] { 33, 36, 38, 64, 94 };
int[] digits = new[] { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 };
int symbolsAmount = size / 3;
int digitAmount = size / 3;
for(int i = 0; i < size; i++)
{
int switcher = random.Next(3);
char ch;
if(switcher == 0 && symbolsAmount > 0)
{
int id = random.Next(symbol.Length);
ch = Convert.ToChar(symbol[id]);
symbolsAmount--;
}
else if(switcher == 1 && digitAmount > 0)
{
int id = random.Next(digits.Length);
ch = Convert.ToChar(digits[id]);
digitAmount--;
}
else
{
bool isLower = random.Next(2) == 0 ? false : true;
ch = Convert.ToChar(
Convert.ToInt32(
Math.Floor(26 * random.NextDouble() + ((isLower) ? 65 : 97))
)
);
}
builder.Append(ch);
}
return builder.ToString();
}
Simple example to big item. Click here to read article.
using System.Data.Linq; using System.Data.Linq.Mapping; using System.Reflection; namespace Test { partial class DataClassesDataContext { //... } }
namespace Test { using System.Data.Linq; using System.Data.Linq.Mapping; using System.Reflection; partial class DataClassesDataContext { //... } }
A innovation of Dictionary got excellent solution in stocking data. After countless uses I decided to find alternative method in combination of key and object and now I offering KeyedCollection. Little example will present a using of aforementioned object:
Simple classes:
public class User
{
public int Id { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
}
public class Address
{
public string Country { get; set; }
public string City { get; set; }
public string Zip { get; set; }
}
Two object that inherits abstract KeyedCollections:
/// <summary>
///A key is ID of player
/// </summary>
public class UserCollection : KeyedCollection<int, User>
{
//Implementing member
protected override int GetKeyForItem(User item)
{
return item.Id;
}
}
/// <summary>
/// A key is User Name
/// </summary>
public class UserCollection1 : KeyedCollection<string, User>
{
//Implementing member
protected override string GetKeyForItem(User item)
{
return item.Name;
}
}
Little example to using:
public class Test
{
public TestById()
{
var userCollection = new UserCollection();
userCollection.Add(new User
{
Id = 5,
Name = "John Smith",
Address = new Address
{
City = "NY",
Country = "USA",
Zip = "12345"
}
});
userCollection.Add(new User
{
Id = 17,
Name = "James Brown",
Address = new Address
{
City = "LA",
Country = "USA",
Zip = "54321"
}
});
Console.Write(userCollection[6]);
}
public void TestByName()
{
var userCollection = new UserCollection1();
userCollection.Add(new User
{
Id = 5,
Name = "John Smith",
Address = new Address
{
City = "NY",
Country = "USA",
Zip = "12345"
}
});
userCollection.Add(new User
{
Id = 17,
Name = "James Brown",
Address = new Address
{
City = "LA",
Country = "USA",
Zip = "54321"
}
});
Console.Write(userCollection["John Smith"]);
}
}
If a project in VS 2008 you can run in heritable object LINQ requests and more. Enjoy!
Very impressive article! Click here