In C# gzipping a file is easy, just use the good SharpLibZip library.

To use it, you need to include reference to ICSharpCode.SharpZipLib.dll and then add this using clause:

using ICSharpCode.SharpZipLib.GZip;

Then, given that filepath is a string containing a valid path for the to-be-gzipped file, this snippet will gzip it to a new file, without loading it all in memory (that’s good for big files).

Stream s = new GZipOutputStream(File.Create(filepath + “.gz”));
FileStream fs = File.OpenRead(filepath);
int size;
byte[] data = new byte[2048];
do
{
    size = fs.Read(data, 0, data.Length);
    s.Write(data, 0, size);
} while (size > 0);
s.Close();
fs.Close();

Given that filepath is C:\mypath\mygoodfile.ext it will create the gzipped version in C:\mypath\mygoodfile.ext.gz.

2 Comments »

Every linux lover knows Tux, the penguin-mascotte symbol of the best loved open source OS.

Tux dressed up as Indiana Jones

At this address it is possibile to find a wonderful collection of Tux images where he is dressed up as Rambo, Homer Simpson, Indiana Jones, Pocahontas and lots more.

A versatile actor. Who could imagine it..

Leave a Comment »

Internet Explorer 7 has made a big step forward compared to his predecessor, with regard to security and standards support (think only the transparency of PNG and CSS, although, unfortunately, not entirely).

Internet Explorer AntichitàThe golden rule of any good web developer is to test the site with various browsers in order to verify the different behavior, because not the standards are not so standard indeed (!!).
Read more »

Leave a Comment »

Sometimes it happens to remember one thing for years and suddenly forget it. Before writing this article I asked myself what I would do if my mind completely erased my Windows 2003 administrator password and I did not have any rescue disk to get back into my system.

As a first method I would certainly try to use Ophcrack. It comes with a Live CD, contains rainbow tables with the hash of all passwords and allows to find windows system passwords without causing any damage to the server. It doesn’t use brute force algorithms but direct verification of hashes, this means that if you can find passwords through rainbow tables it is just a matter of a few minutes. You just need to download the live CD, burn it, boot it and run the tool.

As a second attempt I would try a service such as Login Recovery. I don’t know exactly how it works, but it probably uses the same techniques as Ophcrack (I don’t think there are too many: brute force, reset or direct comparison of hash). The system provides a Live CD or floppy that extracts the files with passwords from your computer and, as a second step, it uploads them to the Login Recovery website. The free service allows to get results in 48 hours, while using the paid service (a few euros anyway) you can get results instantly. On the web site they say that this system is able to find an administrator password for Windows 2003 computers and ensure to get refunded if the method does not work. No theoretical damage to the server either.

Another attempt I could do is using a tool such as Windows Key. This program lets you create a Live CD or floppy and allows you to reset passwords for all users on your machine. The program should also support Windows Server 2003. In general, however, the tools and services to reset the password for Windows are so many and all theoretically painless. Note that not all of them recover passwords, some of them simply reset (blank) them. One method that I have personally tested some time ago on an XP machine is described here.
It should also work with Windows 2003, reset the password and allows you to change some policies by simply using a CD or floppy.

In all cases, however, you must reboot the machine (and boot from a CD or floppy) and you need to consider the fact that the file you want to read could be encrypted and it could be somewhat more complicated to see SCSI or SATA disks on boot. But this issue can be certainly solved by using appropriate drivers.

3 Comments »

If you want to retrieve the latitude and longitude of an address or a particular item you found with Google Maps, the problem is that Google Maps doesn’t display those informations in its interface.

To work around this problem, thanks to a function provided by Google, a tiny javascript code will help us. Read more »

1 Comment »

No, I’m not trying to unlock a carrier-branded phone, but an original HTC MTeoR shop-buyed phone.

Problem
A friend of mine bought an HTC MTeoR to read his mails from an Exchange 2003 SP2 server.
He thought it should be all ok, since the phone has a Windows Mobile 2005 OS installed.
Hey, be aware! It’s Microsoft, indeed!

The simple (sarcastic) thing to do is to install a server certificate to use the GPRS/UMTS ActiveSync capability on a SSL connection
Copied the certificate on the phone and… no privilegies to do this operation?!?!?!?!?

A little web search give us the hint: this phone has a wrong ROM installed that prevent the user to run not-Microsoft-signed application (and certificates).
And there is no fixed ROM to download!
Very well!

Solution
It took some time, but we finally found this forum post with the solution of our problem.

We had just to modify this three registry keys on the phone:

HKEY_LOCAL_MACHINE\Security\Policies\Policies\00001001 = 1
HKEY_LOCAL_MACHINE\Security\Policies\Policies\00001005 = 40
HKEY_LOCAL_MACHINE\Security\Policies\Policies\00001017 = 144

But again: the user has no rights to change the registry.
The simple solution to this is to use a registry editor that seems to be HTC/Microsoft signed: regeditSTG2.exe.

Finally, we installed the certificate and synced the phone.

Conclusion
Can a manufacturer like HTC release a phone with such a problem and do not release an update as quickly as possibile?
How many customers are able to do this modification?
Not so much I think.

3 Comments »


« Articoli successivi « Pagina precedente