Deranged Ramblings

Friday, July 21, 2006

 

Yakama Indian Reservation


The Yakama Indian Reservation is a United States Indian reservation located on the east side of the Cascade Mountains of the state of Washington. According to the United States Census Bureau the size of the reservation is 2,187.56 mi² (5,666 km²) and the population in 2000 was 31,799. It was created in 1855 by a treaty signed by Washington Territory Gov. Isaac Stevens and represenatives of the Yakama tribe. A dispute over the treaty led to the Yakima war of 1855.




Sunday, March 19, 2006

 

SQL Server 2005 Service Pack 1 Express Editions and Tools - Community Technology Preview (CTP) March 2006

This is just out.

I'm quite happy that msft are offering more services with the express edition (Reporting and Full Text Catalogs) and I'm sure it will help win over more people.

Can't wait until it goes RTM:

SQL Server Express Edition with Advanced Services (SQLEXPR_ADV.EXE)
SQL Server 2005 Express Edition with Advanced Services is a new, free version of SQL Server Express that includes additional features for reporting and advanced text based searches. In addition to the features offered in SQL Server 2005 Express Edition, SQL Server Express with Advanced Services offers additional components that include SQL Server Management Studio Express (SSMSE), support for full-text catalogs, and support for viewing reports via report server. SQL Server Express Edition with Advanced Services also includes SP1.

http://www.microsoft.com/downloads/details.aspx?familyid=57856cdd-da9b-4ad0-9a8a-f193ae8410ad&displaylang=en

P.S Is it me or is 600GB Hard drive a bit high for system requirements :D

Enjoy.

 

Even easier high speed reading/writing of binary data files with C#

In my previous posting I presented a way to avoid unnecessarily copying data during read/write of binary files by using low level C CTR file functions like fread() instead of System.IO. This works just fine - but requires you to link in an unmanaged code C DLL if not even doing programming in C yourself.

Now, thanks to Christof Sprenger at Microsoft Germany, this hurdle has been removed. He showed me how to use the existing low level file handle of a stream with the kernel32.dll ReadFile()/WriteFile() functions. No more C programming is necessary, although unsafe code is still needed. But that´s ok, I´d say.

Here´s an example how simple your code is if you use the new BinaryFileStream class:

struct ID3v1Tag
{
...
};

ID3v1Tag tag;

BinaryFileStream bfs = new BinaryFileStream("track01.mp3", System.IO.FileMode.Open);

bfs.Seek(-128, System.IO.SeekOrigin.End);
unsafe
{
bfs.Read(&tag);
}

tag.Title = ...;
...
bfs.Write(&tag);

bfs.Close();

And here´s the BinaryFileStream itself:

using System.Runtime.InteropServices;

namespace System.IO
{
public unsafe class BinaryFileStream : FileStream
{
#region CTORs

public BinaryFileStream(string path, FileMode mode)
: base(path, mode)
{}

public BinaryFileStream(string path, FileMode mode, FileAccess access)
: base(path, mode, access)
{}

public BinaryFileStream(string path)
: base(path, FileMode.Open)
{ }

#endregion


public int Read(void* buffer) where StructType : struct
{
return Read(buffer, Marshal.SizeOf(typeof(StructType)));
}


public void Write(void* buffer) where StructType : struct
{
Write(buffer, Marshal.SizeOf(typeof(StructType)));
}


#region Low-level file access

protected int Read(void* buffer, int count)
{
int n = 0;

if (!ReadFile(this.SafeFileHandle, buffer, count, out n, 0))
throw new IOException(string.Format("Error {0} reading from file!", Marshal.GetLastWin32Error()));

return n;
}

protected void Write(void* buffer, int count)
{
int n = 0;

if (!WriteFile(this.SafeFileHandle, buffer, count, out n, 0))
throw new IOException(string.Format("Error {0} writing to file!", Marshal.GetLastWin32Error()));
}


[DllImport("kernel32", SetLastError = true)]
private static extern unsafe bool ReadFile(
Microsoft.Win32.SafeHandles.SafeFileHandle hFile,
void* pBuffer,
int numberOfBytesToRead,
out int numberOfBytesRead,
int overlapped
);

[DllImport("kernel32.dll", SetLastError = true)]
private static extern unsafe bool WriteFile(
Microsoft.Win32.SafeHandles.SafeFileHandle handle,
void* bytes,
int numBytesToWrite,
out int numBytesWritten,
int overlapped
);

#endregion
}
}

Copy and enjoy!

 

Installing Vista Feb CTP inside VMWare

It took me four times to fail installing Vista inside VMWare till I figured out that I should google for the answer…

So here it is… the steps you need to do in order to install Vista inside VMWare:

Installing the Guest Operating System
1. Insert the Windows Vista CD in the CD-ROM drive (or just mount the ISO image).

2. Power on the virtual machine to start installing Windows Vista.

3. If using a blank hard disk: When the Windows Vista installer menu appears, choose the first option, Install Now.

If installing over an existing guest operating system: Skip to step 9.

4. Press Shift-F10 to open a command prompt.

5. Start the disk partitioning utility.

diskpart

6. Enter the following commands to partition the hard disk:

select disk 0
create partition primary

7. When the partitioning process is complete, click the Reset button to reboot the virtual machine.

8. As the virtual machine begins to reboot, while the VMware logo appears on the screen, click inside the virtual machine window, then press Esc to get to the BIOS boot menu. Choose CD-ROM Drive as the boot device, then continue installing Windows Vista beta.

9. In certain Windows Vista builds, the installer chooses an incorrect default in the screen titled Choose your installation destination. It shows a partition with 0 MB free and makes that partition the default destination.

At that screen, you must change the choice to the disk (instead of the partition), then click Continue.

10. Follow the remaining installation steps as you would for a physical machine.

Archives

February 2005   March 2005   December 2005   February 2006   March 2006   July 2006  

This page is powered by Blogger. Isn't yours?

My Photo
Name: