Scott Hanselman

Heres an interesting thing Jon Udell founda POPSMTP Proxy and Web Server that Googles and Blogs your email Seems like a

October 08, 2002 Comment on this post [0] Posted in
Sponsored By

Here's an interesting thing Jon Udell found...a POP/SMTP Proxy and Web Server that Googles and Blogs your email. Seems like a thinner/cleaner/smarter version of Enfish.

Googling your email. ... [Jon's Radio]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Well I got the big idea that Id convert my Tiny Abstract OS in C

October 08, 2002 Comment on this post [0] Posted in Web Services
Sponsored By

Well, I got the big idea that I'd convert my Tiny Abstract OS in C# to other languages (VB.NET, J#, etc)  and platforms (.NET CF, Mono).  I figured it'd be a good exercise to practice VB.NET since it's moderately complex and moderately OOP.  I've never been one who can bang out little samples - I really need something cohesive and meaty if I'm going to really dig into it.  Plus, it'd be cool to have other versions of the TinyOS around in other languages. It really exercises the basics of the .NET Framework, and it's been downloaded 4955 times from http://www.gotdotnet.com, which is very exciting and I get mail about it all the time.

So, I figured I'd start with VB.NET before I fire up VMWare and my Mono VM.  I sat down and started using the C# to VB.NET converter VS.NET Add-In.  I converted the who project and received 102 Todos, which is about more than I expected.  I had no idea what was really going on...until I saw things like this in my new VB Project:

If instr.Param2 <> System.UInt32.MaxValue Then 'ToDo: Unsigned Integers not supported

and:

Public Sub New(id As System.UInt32, memorySize As System.UInt32)
'ToDo: Unsigned Integers not supported
'ToDo: Unsigned Integers not supported
pid = id
registers(8) =
CType(pid, System.UInt32) 'ToDo: Unsigned Integers not supported
processMemorySize = memorySize
End Sub 'New

Turns out, from a CLS point of view, I really shot myself in the foot on this one.  I wrote this Tiny OS using exactly what I needed - when the system called for UInt32, I used one.  Apparently (I knew this, but never really grokked it) the CLS does not define an unsigned integer, and the UInt32 type is marked as not CLS compliant. So, what type should I use?  It was a silly thing really, to build something low-level bits-and-bytes with a managed language, but since I was at a low level, it seemed silly to only use the signed half of an Integer.

Well, I'm going to re-think this little exercise, perhaps I'll first try to get it running as a C# app in Mono and go from there.


Let me add one particuar point of note.  I'm interested in this valiant attempt by the C# to VB.NET Converter and appreciate any insights.  When trying to convert this particularly icky (hacky...now that I look at it, I could have done it easier with adding the bytes and shifting bits as I added...ah, how time refactors for you...) bit of C# code:

public unsafe static uint BytesToUInt(byte[] BytesIn)
{
     fixed(byte* otherbytes = BytesIn)
     {
    
uint newUint = 0;
    
uint* ut = (uint*)&otherbytes[0];
     newUint = *ut;
    
return newUint;
     }
}

The C# to VB.NET converter came up with this:

Private Declare Sub CopySystem.UInt32 Lib "Kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As System.UInt32, ByRef Source As System.UInt32, ByteCount As Integer)

Public Shared Function BytesToUInt(BytesIn() As Byte) As System.UInt32 'ToDo: Unsigned Integers not supported
    
Dim otherbytes As Machine.BytePtr = New Machine.BytePtr(BytesIn)
    
Try
          Dim newUint As System.UInt32 = 0 'ToDo: Unsigned Integers not supported
         
Dim ut As Machine.TypePtr = New Machine.TypePtr(Machine.TypePtr.Cast(Machine.NewPointer(otherbytes(0)), GetType(System.UInt32)), typeof(System.UInt32)) 'ToDo: Unsigned Integers not supported
         
CopySystem.UInt32(newUint, ut.Address, Runtime.InteropServices.Marshal.SizeOf(GetType(System.UInt32)))
         
Return newUint
    
Finally
         
otherbytes.Dispose()
    
End Try
End Function 'BytesToUInt

Hmm...

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Couple of new books over at my bookstore DiabeticBookscomnbsp check them out

October 08, 2002 Comment on this post [0] Posted in Diabetes
Sponsored By

Couple of new books over at my bookstore, DiabeticBooks.com - check them out!

Guide to Healthy Restaurant Eating, 2nd ed - Hope Warshaw

This best selling book, now in it's bigger and better second edition, is just the resource you need if you frequently eat restaurant meals. If you are like most Americans you eat out at record breaking frequency and know, only too well, the hazards of restaurant foods-fat and sodium count and overwhelming portions. You can still eat restaurant meals, you just need to learn the skills of healthier restaurant eating and to get the low down on the nutrition data of restaurant foods. Guide to Healthy Restaurant Eating helps you do just that.

You'll get the nutrition low down for over 3500 menu items at more than 55 of the best known restaurant chains across America-McDonalds, Boston Market, Denny's, KFC, Pizza Hut, Taco Bell, Dunkin' Donuts and more. In addition to calories, you'll find carbohydrate, fat, saturated fat, cholesterol, sodium and more as well as the diabetes servings or exchanges.  

The Guide to Healthy Restaurant Eating also helps you learn the pitfalls of today's restaurants, strategies for self-defense, and the keys to healthy eating. Plus you'll get hundred of tips to estimate restaurant portions.

Simply put, this book is an indispensible resource for people who eat out regularly.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Chris Brooks pointed this A hrefhttpwwwcsharpcornercomCode2002Se

October 08, 2002 Comment on this post [0] Posted in Web Services
Sponsored By

Chris Brooks pointed this C# SNMP Library out to me...I wonder if it's better to go lightweight like this when doing SNMP or to go through WMI?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Sam Gentile makes an important point about the Golden Rule of Blogging and r

October 08, 2002 Comment on this post [0] Posted in
Sponsored By

Sam Gentile makes an important point about the Golden Rule of Blogging and reminds me of the differences between respectful Blogging and just Copy-Pasting!

Sam says: "If you...take stories off [a blog] please attribute [the source]. This is extremely important to building the blogging community. By doing this, we create links to one another."

Thanks Sam!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.