Note: This blog has been moved to http://blog.yuvisense.net

Tuesday, June 27, 2006

Wanna see a Phishing site ?

If you do, go over here. Got this by email:D


Technorati Tags: ,

Sunday, June 25, 2006

[Tech]Trying to save Bytes may Byte you back!

Update: Just clarified a bit of stuff towards the end after a reread.

This tech post is long overdue, and has spent quite a lot of time in my drafts folder. I guess it's atlast time for it to see the light of day, so I'm posting it...

Lemme start off with code samples right away.

What's the output of this code snippet ?

Dim i as Int64 = 200
Console.WriteLine ( i.GetType.ToString )
Console.WriteLine ( (i-10).GetType.ToString )

Compile the code in your mind, and you'll find a lot of Syntax errors if you're a C# guy, and the following output if you're a VB guy:

System.Int64
System.Int64

Pooh. Nothing unexpected. But, wait....What's the output of this code snippet ?

Dim b as Byte = 200
Console.WriteLine( b.GetType.ToString )
Console.WriteLine ( ( b -10).GetType.ToString)


So, just like in the last example, you should get System.Byte as the output both times, right ? Wah! I told you to wait, right ?

System.Byte
System.Int32


So, where did that System.Int32 come from? If an operation on an Int64 results in an Int64, then why is an operation on a Byte resulting in a System.Int32? Were the consipary theorists right, after all?

Oh wait! Lemme add one more to the mix!

What's the output of this ?

Dim s As Short = 200
Console.WriteLine( s.GetType.ToString )
Console.WriteLine( (s - 10).GetType.ToString )


If you've been sleeping all along, you would have expected two System.Int16s, but ofcourse you weren't sleeping, so you'll see:
System.Int16
System.Int32


Uh-oh. So, what the hell is actually going on? So, to find out this, and some other things, I was digging through ECMA-355, the .NET ECMA Specs.

Aha! And, I fount out. The aptly named section 1.1.1 of the document says:
The CLI only operates on the numeric types int32 (4-byte signed integers), int64 (8-byte signed
integers), native int (native-size integers), and F (native-size floating-point numbers). However,
the CIL instruction set allows additional data types to be implemented:

Uh oh. So, what that means is, that the .NET CLI only knows about 32 Bit and 64 Bit Ints. When they say Native Int, they mean that if you implement .NET for a, say 16 bit Machine, then the CLI will "get" 16 bit Integers...

But wait, you say. The CLI already has 16 bit integers. Heck, it even has 8 bit integers!

But, ah I love to prove people wrong, and that's why I spent the time to read that headsy Technical Document. In the same old Section 1.1.1, it says:
Convert instructions that yield short integer values actually leave an int32 (32-bit) value on the stack, but it
is guaranteed that only the low bits have meaning (i.e., the more significant bits are all zero for the unsigned
conversions or a sign extension for the signed conversions).

Well, basically, what this means is, even if you use a Byte datatype[8 bits], you are still using 32 bits. Only that the 24 extra bits are Zero, always. They just lie there, useless, taking up precious memory space which could be used for some more 1s. Same for 16 bit ints: It still uses 32 bits, but only that 16 of those are not used and left zero.

When you see Short and Byte types in the Framework, they are just a mere illussion. They are still using 32 bits, just pretending that they're using less. That's why, the operations return the true type, rather than the illussionary one.

Update:Just thought that I'll add that the operation returns the true type, because the values are held on the Evaluation Stack while the operation[in this case addition] is being performed. Atleast, that's the reason I think. The normal GetType on the type gives you the illussionary type, because it's on the heap, not on the Evaluation Stack, which is real Harichandra v2.0.


Moral of the Story: Don't use Shorts and Bytes, if your sole reason is thinking that you're saving space: You are not....

Now, the best appreciation you could give to this small depressed kid living in a lone world surrounded by non-geeks with not many to talk to is to leave a comment here...

Technorati Tags: , , , , , , , ,

Monday, June 19, 2006

School

I am in the 11th Standard Now. I AM IN THE 11th STD! WOA THIS IS JUST SO FREAKIN AWESOME! When I joined the school in the 5th STD, my one and only dream then was to get to STD 11. That was because, atleast in our School, 11th STD means joining the NSS. Now, the NSS are like the Police of our School, supposedly maintaining discipline. Just as in real Life, most of NSS boys are pretty corrupt, but then, it's not morally wrong being a corrupt NSS boy. And, since being corrupt doesn't mean you hurt people, it's pretty cool. So, all that it means is just plain Fun. Add to that that I spend lotsa time in the Computer Science Lab, and you get heaven. But anyway....

It's been a week since School, and it's been pretty much filled with Paronia, whatever that means. First off, many of my ol' pals in tenth STD left our School, but to their own peril, as I learned later. But that's for another post.

Right now, I've been choosen as the Academic Assitant Secretary, the Magazine Committee Secretary. The responsibility of the Academic Assitant Secretary, as you can say, is to carry a flag during Captains Day, and then do nothing. Yea, nothing. Well, maybe speak on stage somewhere once, but that's it.

As the Magazine Committee Secretary, however, I can cut lotsa classes towards the end of the year, sorting through piles of stuff written by our School kids. But ofcourse, most of it is taken off the Internet by some thoughtful kid who didn't want his class Magazine to contain just a front and back cover along with just a Preface. I too am guilty of that, with 95% of our last year Class Magazine being given by me, 1% being written by me. And, inorder to avoid giving the impression it's a Yuvi's Magazine rather than a Class Magazine, many of my articles were attributed to my Classmates. This led to the amusing Incident: "Hey Jagan your article was excellent". "Article? WHAT ARTICLE ?";)

And, Subjects, I have no problems with any, except for Chemistry. And, that too because of the Teacher. Like, say Snape minus the skills. Oh, and the dirty black evil loving costume as well.

Enough wasting your time I guess. Hope to get in some more posts about School Life around here, and bring back a better written SPAM Fun series as well...

Comments ? Even if you don't have any, add them here...

Monday, June 12, 2006

Wallop, Wallop, Wallop....

Well, I think I am starting a lot of my sentences with well, Well, but that's beside the point:D This one is about Wallop, Microsoft's answer to Google's Orkut. It's graduating from Microsoft Research, which I lamely relate to Google Labs. And, oh boy haven't they done it well! Wallop is much much much more like using a Desktop App than a Web app. Heck the responsiveness and UI they've got in Wallop is, uhm, pretty much hard work even to achieve in a Desktop App! Kudos to you guys, you've impressed me at first sight, even though I've not used it. Love at First Sight, eh?

 Well, it's in private beta now, and thanks to uber Microsoftie Krishna I got an invite. And, if you want an invite, just gimme a comment here, and I'll send you one:D

All I can hope and pray is that the naming guys at Microsoft don't rename Wallop into something more "appropriate", like, say, Windows Telephony Foundation ? err, or, maybe, Windows Telepathy Foundation ? Windows Telepathy Force ?

Thursday, June 08, 2006

Back...Sortof...

Hi guys. I guess a string of bad news did it. Something got to my brain, and it seemed to not function properly for some two or three days. Just went with killing people in Settlers, Age of Empires and some more... Looks like things are back to normal with the internals of my brain today.... Looks.... School tomorrow.... I'll do some more stuff after my Brain gets back to normal....

Just did a blog redesign. Not exactly a redesign, since all I did was copy and paste. I'll have to do lots more customization, but I'll do that once I'm back to normal...

Monday, June 05, 2006

Tenth Results Out!

Ahem. My tenth Results were out today morning. 914 out of 1000. So, 91.4%. Not bad, eh ? I guess I can't give you the URL, because the stupid Government Website doesn't use QueryStrings for the info, so I can't just copy-paste the URL. I guess they're using Server.Transfer from ASP.NET, since I got an error about SQL Server being busy right on the page some 2 mins after release:D So, here's how it went:

Tamil 82
English 164
Maths 198
Science 289
History and Geography 181
Total 914
So, ther you go! Well, dad's not happy. I'dve been happy if he's not happy because the marks are not enough. He says he's not happy because four other guys got ahead of me!. Well, well, well..... Comments, Wishes, Bashes, Curses ? I want them:D Technorati Tags: ,

Sunday, June 04, 2006

Tenth Results...

Ahem. I am trying not to think of it, but my tenth results are due tomorrow..... Hope to get something nice..... I'll post the marks as soon as they come.... Please pray for me guys:D

Saturday, June 03, 2006

Disappearing Posts...

Well, some posts have disappeared. Why ? Well, I read them back after some help from Aswin, and I noticed one thing: THEY WERE ABSOLUTE CRAP! Yeah, like, I was violating every thing I've read by Joel. Those were, like, absolute crap. No good. So, I'm goanna practice some good writing, and come back to you, to make sure that nobody dies reading my posts:D So, I just want to thank Aswin for pointing out my flaws, and enabling me to correct them. So, if you feel that something here is crappy, just blast me here, in the comments section;)