Software Geek

March 20, 2008

TransparentProxy

Filed under: Software


Also see: Silverlight 2 Beta 1 Cross Domain Bug

One of
the recurring requests for a blog is related to TransparentProxy, RealProxy,
Contexts, Interception, etc.  As
usual, I’m typing this where I don’t have access to our corporate network and
the sources, so some details might be a little off.  (When will my dentist provide free
wireless to his customers?)  And, as
usual, none of this is going to help you in developing applications.  In fact, I postponed writing about this
topic – despite all the requests – because it seems so obscure.  But if you are struggling through the
Rotor source base, it might explain some of the code that you see.  I say ‘might’ because I’ve never
actually looked at the Rotor sources. 
I’m just relying on the fact that they are a pretty faithful of a
cleansed snapshot of our desktop CLR sources.  Anyway…

size=2> 

size=2>Normally, a reference to a managed object is just that: a native memory
pointer.  This is reported
accurately to the GC so that we can track reachability and so we can update that
pointer if the object is relocated during a compaction.  But in the case of an object that
derives from MarshalByRefObject (MBRO), it’s possible that the object instance
is actually remote.  If this is the
case, a proxy stands in for the server instance.

(more…)

Important changes to the BASE element for IE 7

Filed under: Software

Looks like my post went live over on the IETB regarding changes we made to the BASE element in IE 7. Previously the BASE element had some issues, primarily by design, that made certain actions within the guts of IE very easy to do, but polluted the exposed object model and overall tree hiearchy. Well, it was time to fix that. If you are interested in how we fixed it, go check out my entry All your <base> are belong to us.

There have been some comments on the post so I’ll try to cover them over here with what might be some interesting posts about how IE works.


http://weblogs.asp.net/justin_rogers/archive/2005/08/30/424084.aspx

Java design, operator overloading and people

Filed under: Software

Java’s design is often intended to protect programmers from themselves, not allowing certain constructs that might produce unintended consequences. This post address the peeve of operator overloading in Java and a workaround to its limitations.

Also see: Access to old blogs


http://feeds.feedburner.com/~r/techtarget/tsscom/blogs/~3/244474932/thread.tss

Language parsing and compiler design doesn’t have to be hard, but boy this book really sucks!

Filed under: Software


Also see: Stand alone FXCop download

How’d you like that for an opening title? Did it grab your attention? Hell, your reading this far so I guess it did. The book I’m focusing on here is Build Your Own.NET Language and Compiler  and please, don’t click the link and then go buy it. I don’t care about the 50 cents worth of referral money I’ll get if you do. I wouldn’t even recommend the book if I got 50 bucks of referral money (well, money talks, so maybe I would).

The book starts out with the basics of parsing and regular expressions and all that jazz. But the extent of the code is a bunch of screen shots. We are writing a parser/compiler dang it, we aren’t WYSIWYGing our way through life at this point, you have to show some real frigin code. What you end up with is a bunch of screen shots of many tools for writing a compiler, but not really the code, unless of course you go grab the CD and break through all of the code without a lick of explanation from the book. God I hope the code is well documented with comments, or you just bought an issue of Compiler’s Illustrated and this isn’t the Swimsuit edition. I’ll include some of my own links at the bottom, where I give actual code for many of these processes.

OK, so you get to see a bunch of tools, and what do you get? Well, you get a bunch of half-assed tools (sorry for the language if your kid is reading my highly technical blog… In fact, if he/she is I could use some interns, must type 50+ WPM and be proficient at C, C++, or C#). A mathematical expression evaluator is the first. I think it is always the first. People always trivialize math. So make sure you look at all the pretty pictures and try to glean some wisdom from the text. I have a mathematical expression evaluator by the way, it’s called calc.exe and from what I can tell it has shipped since 16-bit windows. He also makes an attempt at a regular expression workbench. You can’t have enough of those (actually I’m not being sarcastic here, I always appreciate a new regex tool), but then he never writes anything or demonstrates compiler technology that uses regular expressions. Does he go into NFA/DFA technology? Well, he does talk about it for a few sentences. BNF format? Again a few sentences here and there. But wait, another tool is what you get and this time it is a picture of a drop-down menu with all sorts of really tantalizing names (convert from BNF to XML, display a BNF parse tree, display formatted docs, etc…). At this point use one of the pages to catch the drool coming off your lip, because that is as close as you’ll get in this book to anything cool.

(more…)

AppDomains (”application domains”)

Filed under: Software


An
AppDomain is a light-weight process. 
Well, if you actually measure the costs associated with an AppDomain –
especially the first one you create, which has some additional costs that are
amortized over all subsequent ones – then “light-weight” deserves some
explanation:

size=2> 

A Win32
process is heavy-weight compared to a Unix process.  A Win32 thread is heavy-weight compared
to a Unix thread, particularly if you are using a non-kernel user threads
package on Unix.  A good design for
Windows will create and destroy processes at a low rate, will have a small
number of processes, and will have a small number of threads in each
process.

Live Person Software: Turn website visitors into your customers.

size=2> 

Towards
the end of V1, we did some capacity testing using ASP.NET.  At that time, we were able to squeeze
1000 very simple applications /
AppDomains into a single worker process. 
Presumably that process would have had 50-100 threads active in it, even
under heavy load.  If we had used OS
processes for each application, we would have 1000 CLRs with 1000 GC heaps.  More disturbing, we would have at least
10,000 threads.  This would reserve
10 GB of VM just for their default 1 MB stacks (though it would only commit a
fraction of that memory).  All those
threads would completely swamp the OS scheduler.

(more…)

Publishing: Good reviews, bad reviews, and hurting oooh so many feelings.

Filed under: Software


Also see: Using JSR-105 with JDK 1.4 or JDK 5

Well, apparently you aren’t allowed to have an opinion on the web anymore. I got flamed by an author after posting a personal review of his book. It wasn’t an objective review, I didn’t mark it as such, but I wasted a good deal of my life between reading the book and then turn that around with the extra hour I spent writing the review so I figured I’d put my real thoughts in there. Anyway, seems the author had some comments.

Guess what? Authors need to learn that not everyone can write a book. I don’t care how technically able you are, how smart, or how much of an industry professional. I don’t care if you’ve been writing X for Y years where Y > Z and Z is my age… Just because you’ve been working on technology since before I was born doesn’t mean you have the ability to produce a book that is able to capture a wide audience and instruct them in a given area. I’ll throw some points to back this up.

Microsoft Windows is a great piece of software and some insanely talented developers wrote the OS. But guess who wrote the documentation? Sure as hell wasn’t the people that wrote the OS. What about the CLR? Super smart people doing super smart things over there. But how many of them dare write a book about it? Adam Nathan did a great job, but I think he took more than a year writing his. What about Brad Abarams and the annotated CLR? Well, that isn’t a book of explanation but rather a book of comments that was very tactfully edited. The people that really write about the CLR are the tech writers that produced the oh so complained about.NET Framework SDK Documentation. If you think it’s bad now, you wouldn’t want to know what it would look like if there wasn’t a dedicated team of technical writers with English degrees working on it.

(more…)

A first stab at BaseN encoding with a focus on general alphabet encoding.

Filed under: Software


Also see: A quick update on me.

The comments in the code-only article are fairly decent, but I dislike being extremely verbose in my commenting because then I can’t see my code. A little explanation of the problem is probably in order because of the lack of extremely verbose comments. First, what is base N encoding or alphabet encoding?

Most people assume that encoding into any base in some way equates to mapping a number to some digits, plus some additional characters to represent values we don’t have digits for. This isn’t always the case. An integer encoded as Alphabet{0,1} = 1001 = 9 decimal is identical to Alphabet{+,-} = -++- = 9 decimal. I’ve just change the represenation or alphabet, but the base is still the same (aka base 2).

Explaining bases could take a few years of college courses, as you take the concepts and create increasingly more abstract versions of them. In fact, bases are strange things in some theoretical maths where concepts of groups, colors, stripes, and other words are used to describe how they work. A very simplistic view of the base is available over on Mathworld. In general though, the concept is that any base has a number of digits equal to the base number b (aka radix) where the digits represent the values 0 through b-1. That is easy enough, and it gives us a very generic method for converting a number to any alphabet and back.

To start, we’ll denote an alphabet as a char[] of digits. Digit in this sense is any character that will represent the array index at which it is placed. The base of the alphabet is the length of the character array. The first element in the array at offset {0} has a value of 0 and for all other indices n greater than 0 the value of the digit at n is equal to the index n. That’s all there is to it. Any alphabet of characters can now be translated to and from an integer using this mapping table and the base.

(more…)

The PDC and Application Compatibility, but still no Hosting

Filed under: Software

Also see: ASP.NET MVC in CodePlex and Extensible Unit Testing

The PDC has happened, which means two things.  I
can post some of my (slightly self-censored) reactions to the show, and I can talk
about what we ve disclosed about Whidbey and Longhorn more freely.  In
this particular case, I had promised to talk about the deep changes we re making
in Whidbey to allow you to host the CLR in your process.  As
you ll see, I got side tracked and ended up discussing Application Compatibility
instead.


 

But first, my impressions of the PDC:


 

The first keynote, with Bill, Jim
& Longhorn, was guaranteed to be good.  It had all the coolness of Avalon,
WinFS and Indigo, so of course it was impressive.  In fact, throughout all the
sessions I attended, I was surprised by the apparent polish
and maturity of Longhorn.  In my opinion, Avalon looked like it is the most mature
and settled.  Indigo also looked surprisingly real.  WinFS looked good in
the keynote, where it was all about the justification for the technology.  But
in the drill-down sessions, I had the sense that it s not as far along as the others.

(more…)

Merry Christmas Indeed!

Filed under: Software


Also see: Mix08 Session Overview: Building Great AJAX Applications from Scratch Using ASP.NET 3.5 and Visual Studio 2008

Janice went all out this year and got me an Ibanez JS1000 (Joe Satriani series) guitar, a Line 6 POD X3 Live effects board and a pair of Roland CM-30 amplified monitors. My fingers are all tore up now since I’ve been out of practice for some time now. But it sure is fun to get back to some jamming. The JS1000 is pretty light and has easy action. Combined with the POD X3 I can get quite a variety of amazing sounds. I even got the X3 hooked up to my MacBook Pro and finally was able to try out Garage Band. I was able to lay down the rhythm track for Crushing Day (what I could remember from back in the day) and then play the lead part over it with no lag. The roland CM-30s are nice because I can run my Alesis QS8 and the POD X3 into them at the same time. This is probly the best setup I’ve ever had.

Later today I hooked up a microphone to the X3 and the kids had a blast talking and play singing into it. “Daddy it sounds kinda like I’m in a cave…”. Perhaps I should cut down some of that reverb. :)  

Santa Clause was good to me this year. (Thanks Janice)


http://weblogs.asp.net/dfindley/archive/2007/12/26/merry-christmas-indeed.aspx

Simplifying Web Service development with JSR-181

Filed under: Software

POJO based development along with annotations have become the preferred method for many developing Java applications. This entry contains an article discussing this same methodology in the area of Java Web Services

Also see: Memory Model


http://feeds.feedburner.com/~r/techtarget/tsscom/blogs/~3/244474931/thread.tss

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com