Geeks With Blogs
Tex-blog Mobile and other stuff September 2007 Entries
Simple MD5 command line check utility (Ch12)
Cryptography namespace is really very powerfull, as a test application I wrote a simple MD5 check utility that computes md5 checksum for file and compares it with md5 file that was provided with downloaded file. Because most of the files that are being checked are quite huge - I added simple user feedback as a dots showing in console. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Security.Cryptography; using System.Threading; using System.Text.RegularExpressi... ......

Posted On Sunday, September 23, 2007 5:06 PM

.NET Symmetric encryption sample wrapper (Ch12)
Below is a sample class showing how to encrypt and decrypt text when we have only password. It uses symmetric key algorithm. using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; using System.IO; namespace EncryptionTester { class RijndaelWrapper { // Retruns salt from password. private static byte[] Password2Salt(String password) { int saltLength = password.Length * ((int)password[0] % 3 + 2); saltLength = Math.Max(8, saltLength); byte[] resSalt = ......

Posted On Saturday, September 22, 2007 4:12 PM

Language independent user account naming (Ch12)
Charter 12 lesson 2 gives in its Lab a sample code that will not work on everyones computer. The problem is with the Guest account name that is in English, which will not work on systems in different languages, like mine for example. Below code: DirectorySecurity ds = new DirectorySecurity(); string gname = "Guest"; ds.AddAccessRule(new FileSystemAccessRule(gname, FileSystemRights.Read, AccessControlType.Allow)); // Exception! Directory.CreateDirectory(@... ds); File.Create(@"C:\Guest\Data... ......

Posted On Tuesday, September 11, 2007 6:02 PM

STLPort and Visual Studio auto expanding data feature
For a long time I have been a big fun of MFC template collections like CArray. The main reason was that they were easy to use and what’s most important quite easy to read in debugger what’s inside them, yet in many places I use mostly STL to take benefit of various collection types and available algorithms. Debugging with STL never was easy, VS 2005 out of the box supports auto expanding of its own STL containers, if you use other implementation than the Microsoft’s one, you have to write your own ......

Posted On Tuesday, September 11, 2007 5:07 AM

Exchange Volume Letters batch script (WinXP)
Suppose that you have the need to switch drive letters of two of yours volumes. Lets say you have one partition with assigned drive letter D and other drive with assigned drive letter E. To change those two drive letters, you normally would go thru control panel to computer management, where you would be able to change your partition assignments, that’s a lot of steps to be done. To make it shorter I wrote following short batch file. It uses diskpart command line tool that comes with Windows XP. ......

Posted On Sunday, September 9, 2007 5:25 PM

DPI awareness
Recently I was testing my Jawbreaker clone game (http://strony.aster.pl/mar... on my moms laptop with Windows Vista platform to verify that it works properly. This game was developed under Windows XP (C++, MFC), so I thought there should be no problems. After running it everything looked wrong, by that I mean that all controls were at wrong positions and actually I was unable to play my game. At first I thought that this should be some Vista thing, and since I had no access ......

Posted On Sunday, September 9, 2007 11:24 AM

Troubles with PrincipalPermission
While reading on Users Authentication and Authorization, I wrote a simple test code sample that didn't work at first as I would suppose it should. The code looks as follows: using System; using System.Security; using System.Security.Permissions; using System.Security.Principal; // ... public static void TestPrincipal(string role) { System.AppDomain.CurrentDom... PrincipalPolicy.WindowsPrin... try { PrincipalPermission sp = new PrincipalPermission(null, role, true); sp.Demand(); ......

Posted On Tuesday, September 4, 2007 3:28 AM

Copyright © Martinez | Powered by: GeeksWithBlogs.net