February 2004 - Posts

Today's article is about making hash functions easier to create.

We create a class around MD5, SHA1, SHA256, SHA384 and SHA512.

I've used this in a small project a while ago to hash passwords and it has proven really usefull.

Check it out if you need a hashing class: Create Hashes - MD5, SHA1, SHA256, SHA384, SHA512.
with 6 comment(s)
Filed under:
As a follow up to my C# Script program, I've added an article on how to associate your program with every file by adding a registry key.

I also made a small article about including resources in your .exe as an answer to someone's question about Non-Rectangular Forms.

The Notepad bug issue still spooks around in my mind. So very strange...
with no comments
Filed under:

Someone showed me a weird text file today. It was a bat file with 'copy MeYou.bak MeYou.txt'. When you would ran it, it would work. But when you opened it in Notepad, there was nothing.

So we decided to look a bit into this and here is something we came up with to 'create' invisible text:

Open notepad and enter:
' abc.bak abc.txt'

(That is: space abc dot bak space abc dot txt, no line break, without the quotes)

It doesn't work with every string, just follow us on this example and use that one.

Save your file. Notepad picks default ANSI as encoding.

Open your file, Notepad seems to open by default in Unicode encoding.

Your text is now invisible.



Does anyone know why the saving default is different from the opening default?

And why does it happen to that particular piece of text. It doesnt happen to ' b.b b.b' or ' .bak .txt'.

It looks the same when viewing it through a hex editor. But apparently it has to do something with encoding.

Anyone who can explain?

Update: When you paste it in IE or Trillian you get '????????', like some people tried in the comments ;)

Update2: In my notepad screenshot the font was Terminal, when I choose Verdana it are indeed squares. Not that invisible anymore, but still wrong :)

Update3: You can find an explanation on why this is happening at The Old New Thing.

with 24 comment(s)
Filed under:
I was playing around with the thought of being able to figure out some other possibilities for C#.

One thing I came up with was, why not make a possibility to quickly write something small in C# and run it. I'm talking really really really small here.

So I decided to write an article about it, maybe someone thinks of something and extends it. Before you tell me it's useless, let me say this is only something done to try out new things and to get ideas.

Here is my version of C#-Script ;)

One frustrating thing that keeps bothering me is. In code i specifically said to not create an executable, and what happens? It creates an executable. Anyone an idea of why it's doing this? Doesn't 'InMemory' mean in RAM, without files on your HD?

Hope you like it :)
with 2 comment(s)
Filed under:
I added another article in the 'Basic C# Examples'-series. ;)

It should answer the question of how to make nonsquare windows?

There is another example out there (which I can't find the link of anymore) that uses pointers to run over the image. Because of performance issues. So, I decided to take the GetPixel approach and see if it worked. And it does ;) Don't notice any performance hit here thou, maybe on weaker computers..

How To Make Non-Rectangular Forms.
with 2 comment(s)
Filed under:
I was thinking last night, all posts here are very great, and made by all those smart people. But why is it that my fellow students hardly read them? Or why don't you hear them a lot?

Some of my possibile conclusions were:
  • It's too hard, most of the posts here require background or understanding, which we as students don't have that much yet.
  • No real basic examples. There are snippets, there is a lot of code being posted here, but the target audience here isn't the beginning programmer, we mostly write for people who already know a lot.
  • ...?

And because of that, and because I want to raise interest among the people I know, I decided to ask them for questions they had about C#, and try to answer them by example.

I'm gathering subjects to write on, very basic subjects, appealing to students as well. And I'll try to create an application that answers their question and provides code they could extend.

Hopefully I can keep this up, because I'm learning a lot from it as well. It helps you to think of subjects you wouldn't have tought of otherwise. And I have to check out docs and examples as well to write an article about it from scratch.

The first article is about 'How to get on IRC with C#'. I created a basic Console IRC Bot along with some comments. The example uses tcp connections, streams and events. Source code is provided as well.

I hope other students like the idea... (not only students by the way, everyone can use samples!)

Let me know if this is a good plan. (Or if you have negative comments, go ahead as well ;))

with 9 comment(s)
Filed under:

The Longhorn SDK enables you to create XAML apps from VS.NET, so I did.

One of the things I'll be looking for is an editor that generates XAML for me. Because, I find XAML "difficult" to write. Yes it's powerfull and "easy" to do, but if you have to do it all by hand, it takes time. So I'm hoping there will be some editor fast :)

I've seen the demo during the DevDays, where you had a different layout per user. And one of those was the kiddie layout, with the very cool button, which was shaped totally different. So I set out course to create a 'NTFS Permissions For Dummies'.

Here's what i created in Photoshop as a quick idea of what I wanted:



Looks kiddie enough, doesn't it?

Then I started my quest, it seems Longhorn doesn't like it when i want to skew a Listbox with AngleX. When I go over the items it renders strange lines everywhere in my app. Gone was my idea to create these nice shaped controls.

But the gradient worked! And that's actually very nice.

Here's what I ended up with:



It looks kinda nice, the colors still make it look kiddie-like.

Going to check writing the C# codebehind later on this week if I find some time.

If anyone feels lucky and has the time, feel free to try to create my attempt in XAML ;) I'd be very gratefull for it, and amazed.

Update:
Here's an example of my skew experience: AngleX, AngleY. Notice the blue lines.
This is the XAML I used. It also happens with other values.

with 6 comment(s)
Filed under:

This post has been moved to http://blog.cumps.be/visual-studio-2008-and-php-coloring/ where you can find more information. (with screenshots!)

Archived version below
-----------------------------

Visual Studio is a great editor! But when editing other file formats I miss the coloring.

I'm a PHP coder as well (coming from the fact that I don't like Classic ASP) and I use VS.NET for editing my PHP files as well. And guess what, that's another file format, so no coloring. But I want it, badly.

So, here's the solution:

Download this .zip file, and extract it somewhere.

Run the registry file that matches your VS.NET editor. (The only difference is the 7.0 to 7.1 from 2002 to 2003).

Now copy usertype.dat to your VS.NET directory (default: C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE).

If VS.NET is running, close it and restart.

Now just open a .php file, and admire the coloring. And the '+' signs to collapse functions also work as a nice extra!

with 35 comment(s)
Filed under: ,
Well, here I am, playing mini-Evangelist in my class, telling about all nice .NET things.

And now with Longhorn installed, I wanted to show some screenies, and also prove that Pre-Alpha does not mean "If you touch it, it'll destroy your pc" ;)

I know you can find these anywhere, but these are *my* screenies, my personal sweeties, my preciousssss :)

First The Desktop.

Followed by hitting Ctrl-Alt-Del.

And don't worry, all your great software is still there, like Paint, Calculater and Notepad ;)

Here you got the proof that the IE team actually does add new things, and that it still exists. One of the features is to Clear Browsing Records. And in the back you see Visual Studio .NET Whidbey, with the nice yellow/green indicators to show which unsaved changes there are and which changes already have been saved.

And the end of this screenie round is during the Logoff, after which Remote Desktop closed.

I really like the default look, no kiddie look as in IE. But also not the Win98 look. Very nice black, stylish.

Regarding layout, Explorer doesn't seem to like me, it doesn't want to set my preferred settings for every map, even if I have told it to do so on every occasion.
with 2 comment(s)
Filed under:
I got Longhorn installed!

I'm guessing the .iso got corrupted during my download.

It didn't took as long as I expected to install, no 5 hours like some blogs say. But more something like one hour. I didn't use Virtual PC thou, got my laptop running on LH.

No 4-bit mode on first boot, and after I used my gfx drivers (which installed without any problem) I got it back on 1024x768 on 32-bit.

First did all the tweaks posted on the net, disable the right dockingbar, disable services, ...

Everything was running smooth when I rebooted after those changes. Not so terribly slow, althou shutting down takes some time ;)

It doesn't like Winamp 5, gets closed immediately after it's started. Winamp 2 works great thou. Trillian Pro going fine as well.

Then I installed VS.NET Whidbey. Which gave me about 3 BSOD. but in the end I managed to install it using the 'Repair' function. Going to look at the dump file later on. Could be that my laptop got to warm and that the hardware went crazy.

Made my first HelloWorld in Whidbey, I already love the green/yellow status on the side. As well as the great 'Format Document' together with all the new settings about braces and indenting.

Also did my first XAML file. Then I noticed that I'm missing the Longhorn SDK. Everybody is talking about the PDC DVD. But I only have a CD with Longhorn?

Anyway, after setting the PATH var to include the 1.2 Framework and setting the LAPI var as well, MSBuild works and everything compiles. Next thing I'm going to look for is how to make XAML files with C# codebehind in VS.NET and compile them there.

One big annoyance I'm having: the Download Manager is evil!

I have 2 files in there always saying 'Connecting' and I can't delete or pauze them. If I dare to do that, it doesn't respond anymore, killing explorer doesn't help, logging on again doesn't help either. Only thing I can do is reboot.

Well, I'm running on LH now. When I have some free time and am somewhat familiar with it, expect some comments on it from me.

Update: Apparently I can get the SDK anyway, must have looked over it, another 574.1 MB to download.

Update 2: I can NOT get Longhorn for you, do NOT request it in the comments, I won't give it to you, you have to get it yourself. There's no warez here...
with 14 comment(s)
Filed under:
More Posts Next page »