comments edit

In case you were wondering, I thought I’d tell y’all how it’s going. First of all, I’ve somehow picked up a southern accent as evidenced by my use of “y’all”.

Health Insurance: I thought about limiting our insurance to taking vitamins and being VERY careful, but apparently that isn’t perceived as being very responsible nor wise. So with that option being, how shall I put it, stupid, Akumi and I researched the various options out there and settled on two individual PPO plans with Blue Shield. Getting two individual plans is cheaper than the cheapest family plan which was overkill for us. Since we don’t have kids and are both relatively young and relatively healthy, this is a good option for us.

Errors & Ommisions Insurance: I’ve read that this is important for independent contractors, but as I never make mistakes, I couldn’t imagine that it would apply to me. Even so, I am looking into it. In the meantime, I had my lawyer buddy Walter give me some wording for my contract to cap my liability at the amount of the contract. That was an idea that Jeanine, my former boss at Solien gave me when I had lunch with her recently. Right now, none of my contracts require E&O coverage. Do you need E&O coverage?

The Contract: Immediately after quitting my job, the start date for the bulk of the development work got pushed back to June. This kinda came out of left field, but that’s the risk I took by going independent. As it stands, it is actually working out nicely as I’m getting a much needed break. Tomorrow we’re getting started on some billable architecture work. We’ll definitely have some work to do, just nothing full time till June I think. In the meanwhile, I’m pursuing a couple leads on some short term work to fill in the time in between in case I need to do so.

open source comments edit

RSS Bandit Logo After much hard work by Dare and Torsten (and a little bit of hard work by yours truly), the Wolverine edition of RSS Bandit has been released to the public.

If you’re still using a 1.2.* version, I think you’ll really like the extra polish and speed of this latest version.

Some highlights to note:\

  • Newspaper Styles - Compatible with FeedDemon.
  • Column Chooser - Specify the columns to display in the list view.
  • Item Deletion - A hotly demanded feature.
  • and more…

For the full release notes, visit here.

Also be sure to check out the updated docs for more details on these new features.

Run, don’t walk, and download it here!

comments edit

Korean Food I’ve been told that for the best Korean food in the world, you need look no further than Los Angeles. The rationale is that you have a vibrant Korean community in Koreatown (affectionately known as K-Town) with access to better quality meat and vegetables than exists in the homeland.

I’m not ready to start an international food fight by saying whether or not I agree with that remark, but I will tell you about some of my favorite places for Korean food in Los Angeles. This is the short list.

Soot Bull Jeep - Korean Bar-B-Q 3136 W. Eighth St., (213) 387-3865. Be careful as your clothes and hair will smell like smoke leaving this place. Instead of your usual gas grills, they use coals to cook the meat at your table.

Beverly Soon Tofu (“BehVuhLee Soon Dubu” in Korean) ph: 213.380.11132 717 West Olympic Boulevard #108 Los Angeles, California 90006-2642 Northwest Corner of Olympic and Vermont This place has the BEST soon dubu. HIGHLY RECOMMENDED. The interior is small, but decorated such that it looks like you’re between two straw thatched houses in rural Korea. The Bi-Bim-Bap is very excellent as well.

Mandarin House 3074 W. Eighth St., (213) 386-8976. This is in a strip mall just west of Vermont. Don’t let the name fool you, this place has the best Cha Jang Mein around. To refresh your memory, that’s the thick noodles with the dark brownish black sauce made from black beans, onions, and meat.

Chosun Galbi 3330 W. Olympic Blvd., (323) 734-3330. Just west of Western and Olympic. This is a more conservative choice for Korean Bar-B-Q than Soot Bull Jeep, as you won’t stink. It’s more authentic than Woo Lae Oak.

Hodori 1001 S. Vermont Ave., No. 102, (213) 383-3554. 24 hour Korean restaurant for those late night Korean cravings.

BCD Tofu House (SoonDubu) 3575 Wilshire BlvdLos Angeles, CA 90010 (There’s actually a couple of locations in L.A. (213) 382-6677 This place is nowhere near as good as Beverly Soon Tofu, but it’s open 24 hours so it works as a fine backup for those late night munchies. In the late hours (after 2 AM), expect hungry bar-hoppers and club-goers. Watch out for projectile vomit. I’ve had my own bad experience there which involved a bowl of Mandu Soon Dubu and a few hard drinks prior.

comments edit

My last project involved writing a lot of HttpHandlers to respond to HTTP requests originating from a cell phone. To simplify my life, I created an abstract base handler that handled a lot of the repetitive tasks in writing an HTTP handler.

So today, I read Scott Hanselman’s post about the boilerplate HttpHandler he uses. He says one day he’ll get more organized and make an abstract base class to handle this kind of boilerplate stuff.

I’ve got your back Scott.

I went ahead and took my base class and quickly (about 10 minutes) incorporated some of the things he has in his boilerplate and voila! An abstract base class! Enjoy.

/// <summary>
/// An abstract base Http Handler for all your
/// <see cref="IHttpHandler"/> needs.
/// </summary>
/// <remarks>
/// <p>
/// For the most part, classes that inherit from this
/// class do not need to override <see cref="ProcessRequest"/>.
/// Instead implement the abstract methods and
/// properties and put the main business logic
/// in the <see cref="HandleRequest"/>.
/// </p>
/// <p>
/// HandleRequest should respond with a StatusCode of
/// 200 if everything goes well, otherwise use one of
/// the various "Respond" methods to generate an appropriate
/// response code.  Or use the HttpStatusCode enumeration
/// if none of these apply.
/// </p>
/// </remarks>
public abstract class BaseHttpHandler : IHttpHandler
{
    /// <summary>
    /// Creates a new <see cref="BaseHttpHandler"/> instance.
    /// </summary>
    public BaseHttpHandler() {}
 
    /// <summary>
    /// Processs the incoming HTTP request.
    /// </summary>
    /// <param name="context">Context.</param>
    public void ProcessRequest(HttpContext context)
    {
        SetResponseCachePolicy(context.Response.Cache);
 
        if(!ValidateParameters(context))
        {
            RespondInternalError(context);
            return;
        }
 
        if(RequiresAuthentication
            && !context.User.Identity.IsAuthenticated)
        {
            RespondForbidden(context);
            return;
        }
 
        context.Response.ContentType = ContentMimeType;
 
        HandleRequest(context);
    }
 
    /// <summary>
    /// Indicates whether or not this handler can be
    /// reused between successive requests.
    /// </summary>
    /// <remarks>
    /// Return true if this handler does not maintain
    /// any state (generally a good practice).  Otherwise
    /// returns false.
    /// </remarks>
    public bool IsReusable
    {
        get
        {
            return true;
        }
    }
 
    /// <summary>
    /// Handles the request.  This is where you put your
    /// business logic.
    /// </summary>
    /// <remarks>
    /// <p>This method should result in a call to one 
    /// (or more) of the following methods:</p>
    /// <p><code>context.Response.BinaryWrite();</code></p>
    /// <p><code>context.Response.Write();</code></p>
    /// <p><code>context.Response.WriteFile();</code></p>
    /// <p>
    /// <code>
    /// someStream.Save(context.Response.OutputStream);
    /// </code>
    /// </p>
    /// <p>etc...</p>
    /// <p>
    /// If you want a download box to show up with a 
    /// pre-populated filename, add this call here 
    /// (supplying a real filename).
    /// </p>
    /// <p>
    /// </p>
    /// <code>Response.AddHeader("Content-Disposition"
    /// , "attachment; filename=\"" + Filename + "\"");</code>
    /// </p>
    /// </remarks>
    /// <param name="context">Context.</param>
    public abstract void HandleRequest(HttpContext context);
 
    /// <summary>
    /// Validates the parameters.  Inheriting classes must
    /// implement this and return true if the parameters are
    /// valid, otherwise false.
    /// </summary>
    /// <param name="context">Context.</param>
    /// <returns><c>true</c> if the parameters are valid,
    /// otherwise <c>false</c></returns>
    public abstract bool ValidateParameters(HttpContext context);
 
    /// <summary>
    /// Gets a value indicating whether this handler
    /// requires users to be authenticated.
    /// </summary>
    /// <value>
    ///    <c>true</c> if authentication is required
    ///    otherwise, <c>false</c>.
    /// </value>
    public abstract bool RequiresAuthentication {get;}
 
    /// <summary>
    /// Gets the content MIME type.
    /// </summary>
    /// <value></value>
    public abstract string ContentMimeType {get;}
 
    /// <summary>
    /// Sets the cache policy.  Unless a handler overrides
    /// this method, handlers will not allow a respons to be
    /// cached.
    /// </summary>
    /// <param name="cache">Cache.</param>
    public virtual void SetResponseCachePolicy
        (HttpCachePolicy cache)
    {
        cache.SetCacheability(HttpCacheability.NoCache);
        cache.SetNoStore();
        cache.SetExpires(DateTime.MinValue);
    }
 
    /// <summary>
    /// Helper method used to Respond to the request
    /// that the file was not found.
    /// </summary>
    /// <param name="context">Context.</param>
    protected void RespondFileNotFound(HttpContext context)
    {
        context.Response.StatusCode 
            = (int)HttpStatusCode.NotFound;
        context.Response.End();
    }
 
    /// <summary>
    /// Helper method used to Respond to the request
    /// that an error occurred in processing the request.
    /// </summary>
    /// <param name="context">Context.</param>
    protected void RespondInternalError(HttpContext context)
    {
        // It's really too bad that StatusCode property
        // is not of type HttpStatusCode.
        context.Response.StatusCode =
            (int)HttpStatusCode.InternalServerError;
        context.Response.End();
    }
 
    /// <summary>
    /// Helper method used to Respond to the request
    /// that the request in attempting to access a resource
    /// that the user does not have access to.
    /// </summary>
    /// <param name="context">Context.</param>
    protected void RespondForbidden(HttpContext context)
    {
        context.Response.StatusCode 
            = (int)HttpStatusCode.Forbidden;
        context.Response.End();
    }
}

You can also download the file from http://tools.veloc-it.com/

comments edit

Crook Apparently someone went on an online shopping spree with our credit card number. Fortunately the Bank of America protection kicked in before they could do too much damage and we will not be charged for the fraudelent activity. It’s mind bogglingly easy for someone to fraudelently use your credit card. Think about that the next time you hand your credit card to the waiter at the local dive.

In any case, there are a couple of options at your disposal. My friend Walter writes about placing a fraud alert on your credit file as well as the California Credit Freeze option. I highly recommend taking a look at this whether or not you’ve been a victim of credit card fraud.

Walt also writes about Internet Fraud in this post.

comments edit

World of Warcraft On my drive home today (being my last day at work. I’m now fully independent.), I was listening to the show “All Things Considered” on NPR. Much to my surprise there was a reviewer named Robert Holt who was describing his experience with World of Warcraft, a massively multiplayer online role playing game.

If you’re not in the know (and I assume most of my readers are), an MMORPG is basically Dungeons & Dragons, but online in full color 3-D with surround sound. Holt describes an adventure in which he and four other real people are deep within the bowels of a thieves den, looking to nab the leader.

What struck me about this review is hearing it on NPR. As a kid, Dungeons & Dragons (or D&D for short) was a guilty pleasure. Guilty because I knew how stigmatizing it would be for people in some of the circles I ran with to find out I played. This was during the years where I was a bit of a closet geek.

It didn’t help when you heard from church types that playing the game would cause you to worship Satan, drink goats blood, and give you a “Go Straight To Hell, Do Not Pass Go” card.

Strangely enough, I’ve never killed anyone as a human sacrifice as a result of dabbling in the game. In fact, I felt that I learned good planning skills, improved my vocabulary, and learned how to tell a story as a result.

So now that RPGs have gone mainstream, I guess I can dust off my old D&D books, my oddly shaped dice, my back issues of Dungeon magazine, and display such items proudly. Until my wife gets tired of the clutter it would cause and kindly asks me to place them elsewhere. :)

comments edit

Looks like Google is responding to some critics who say Google takes all and doesn’t give back to the open source community. They’ve just launched Google Code, Google’s place for Open Source software.

From their FAQ:

What is code.google.com?\ Code.google.com is our site for external developers interested in Google-related development. Its where well publish free source code and lists of our API services. \ \ Who are the people behind code.google.com?\ A lot of people worked together to both prepare source code for release and prepare code.google.com for launch and ongoing maintenance. We really care about free and open source software (F/OSS) at Google, and this site is one aspect of that affection.

Via Google Blog - Live.

comments edit

Tiny Charms No, this post will make no mention of Paris Hilton. Promise. (Fully realizing that if I had mentioned her, it would attract an undesirable crowd via Google).

I don’t personally have a T-Mobile, but a former coworker of mine recently had a game he developed published on the T-Mobile stack. The royalties he receives from just one game is an eye opener. He can’t retire (nor quit his day job) just yet, but it sure is a nice source of extra income. His entire lineup so far can be seen at his site.

It’s almost enough to get me more involved in programming for mobile devices. It’s like the early days of programming on my Commodore. On many phones, you have roughly the same constraints. I wouldn’t be surprised to see a Commodor 64 emulator on a cell phone.

Apart from my limited contribution to RSS Bandit, I tend to be a server-side developer. My last project was to expose my company’s platform to mobile devices over HTTP. I didn’t spend much time in the client end of it at all.

humor blogging meta-blogging comments edit

In the 1998 movie, The Big Hit, the protagonists kidnap the daughter of an extremely wealthy Japanese businessman. When they call to deliver the ransom notice, they turn to Gump who employs a brand name Trace Buster to prevent police from tracing the call.

Unbeknownst to Gump, the father has a Trace-Buster-Buster at his disposal. This in turn triggers Gump to use his Trace-Buster-Buster-Buster in an ever escalating battle to evade detection.

I just love that scene.

But I’m not here to talk about movies. I’ve recently noticed a post or two critical of the practice of blogging about blogging i.e. Metablogging.

I couldn’t help but to think of the Trace-Buster-Buster-Buster… The irony of dismissing blogging about blogging is that in doing so, you’re blogging about blogging about blogging. And in highlighting this, I’m blogging about blogging about blogging about … well you get the picture. I’ve become a Meta-Meta-Meta-Meta blogger.

Not that I’m taking sides here. If you find blogging about blogging boring, so be it. It is quite easy to avoid it. But I doubt it will simply die off. Unless of course blogging itself dies off.

I recently walked through the hallowed shelves of the local Borders book store in Santa Monica with my wife and noticed an entire shelf of books on writing. The thought that we might see the end of writing about writing never occured to me.

comments edit

TRS 80 My first couple computers (TRS 80 and Commodore 128) led very solitairy lives. Though they had the constant company of a human companion, they lacked the familiar company of their own kind. I wonder if they longed for a form of communication that didn’t require a fur-less primate jabbing his fingers at a keyboard.

Commodore 128 To foster computer to computer community, I purchased my first Modem for my third computer, an Amiga 500. Not content to slap on just any modem, I shelled out the big bucks (in 1 dollar bills from tips bagging groceries) for a 1200 baud modem. That’s a full four times faster than the laggard 300 baud modem my loser friends were using at the time.

Amiga 500 It didn’t take long before I was a member of every bulletin board on the island (Guam). Then again, it doesn’t take long to join two or three boards. Surprisingly, Guam actually had more BBS systems running out of people’s homes than you’d think. I was a co-sysop of one board for a short while.

When signing up for a BBS (Bulletin Board System) membership, it was essential to choose a good handle. Now you might mistakenly associate a handle and a login as the same thing. But you’d be way off base. Way off base. A handle was much more significant than a measly login. It was your identity in the interconnected ASCII based world of the BBS. A well chosen handle was a reflection of your personality, or lack thereof.

Maverick Think Top Gun. He didn’t go by the moniker “TomC1962” he was freakin’ Maverick! How lame would a trucker feel if she was known as Ellie32. No way man. For those long lonely rides on the freeway, a trucker needs a handle with character and panache. Something that generates r-e-s-p-e-c-t. When you get on the CB, you’re talking to “Storm Chaser” and “Rusty Nail”, not some lame ass “JohnD” or “JaneD” (no disrespect if that really is your handle).

F-16 So back in those days I went by the handle “Dragon”, assuming it was available. I felt it was a good reflection of my east-meets-west heritage and love for LOTR. Of course every geek boy with a modem was after that handle, so I started going by “Falcon”, in reference to my favorite fighter jet, the F-16. I couldn’t be content with the handle “Dragon_Int64.MaxValue”

Nowadays, this concept of the “blogosphere” evokes some of the same feelings that the early days of the BBS craze (if you could call it that) did. Part of that feeling is rooted in the use of handles by some bloggers I know. For example, you might say Dare’s handle is “Carnage4Life”. Eric Porter dons a cape and parse tree and becomes the Human Compiler. Robert Scoble sprinkles his link juice (rel=”please do follow”) across the blogosphere because he is… (cue dramatic music) The Scobleizer.

And my handle? Well it should be obvious that it is “Haacked”. It’s basically a play on my last name, “Haack” (pronounced “hack”). So if I post as Haacked in your blog’s comments, it’s not to hide my identity. It’s merely a nod to a bygone era in online history. Just a small way to add a little flavor to an otherwise boring world of bits and bytes. It’s not my goal to hide the fact that my real name is … *transmission ended*

log4net logging aspnet comments edit

UPDATE: I wrote a post with notes on getting this to work with ASP.NET 2.0.

Looking around, I noticed a lot of people struggling with getting Log4Net to work with their web applications (ASP.NET 1.1). I’m not going to spend a lot of time digging into Log4Net here, as you can do a Google search for that. But I will give you a quick and dirty guide to quickly getting it set up for a website. Bar of soap not included.

Using a Separate Config File

Although you can put your Log4Net configuration settings within the web.config file, I prefer to use a separate configuration file. Log4Net is a bit of an elitist. It won’t dare put a FileSystemWatcher on web.config nor App.config. However, if you tell it to use its own config file, it will gladly monitor that log file and update its settings on the fly when the file changes.

Specifying the Log4Net Config File

If you use a separate config file, a quick and easy (and dirty) way to have your application find it is to place the config file in the webroot and add the following attribute to your AssemblyInfo.cs file.

[assembly: log4net.Config.XmlConfigurator( 
ConfigFile="Log4Net.config",Watch=true )]

Declaring the Logger {.clear}

At the top of each class that I plan to use logging in, I declare a logger like so:

private static readonly ILog Log = LogManager.GetLogger( 
MethodBase.GetCurrentMethod().DeclaringType);

The reason I place a logger in each class is to scope it to that class. If you read the log4Net docs, you’ll see what I mean by this.

Using the Logger

Once you’ve declared the logger, you can call one its logging methods. Each method is named for the logging level. For example:

Log.Debug("This is a DEBUG level message.  
Typically your most VERBOSE level.");

Now whether that message shows up in your logs depends on how you’ve configured your appenders and the logging level you’ve set. Don’t understand what that means? Read the Log4Net introduction.

Sample Web Solution

In order to make all this discussion very concrete, I’ve gone ahead and did all your homework for you by creating a simple ASP.NET 1.1 web solution (Log4NetSampleSolution.zip ) using Visual Studio.NET 2003. After unzipping this solution, you should be able to build it and then view the default.aspx web page. This page will log a few very interesting messages of varying levels to three appenders.

Of special note is the use of the RollingFileAppender as seen in this snippet.

<appender name="RollingLogFileAppender"    
        type="log4net.Appender.RollingFileAppender">

    <file value="..\Logs\\CurrentLog" />
    <appendToFile value="true" />
    <datePattern value="yyyyMMdd" />

    <rollingStyle value="Date" />
    <filter type="log4net.Filter.LevelRangeFilter">
        <acceptOnMatch value="true" />

        <levelMin value="INFO" />
        <levelMax value="FATAL" />
    </filter>

    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern 
        value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
    </layout>

</appender>

Note that the file value (with backslashes escaped) points to ..\Logs\CurrentLog. This specifies that Log4Net will log to a file in a directory named Logs parallel to the webroot. You need to give the ASPNET user write permission to this directory, which is why it is generally a good idea to leave it out of the webroot. Not to mention the potential for an IIS misconfiguration that allows the average Joe to snoop through your logs.

comments edit

My friend Walter points out some common sense advice about how not to get fired for the content of your blog. Of course this issue has been beaten to a pulp in the larger blogosphere, but one thing he mentioned caught my attention.

Of course most employers will probably never find any particular employees blog, and if they did they probably would not be offended.

You’d be surprised how easy it is for an employer to find your blog without even meaning to. Unless you restrict your content to something quite unrelated to any of your company’s interest, your content is almost certainly going to have posts that are related to your field. That’s when Google kicks in. The large majority of my referrals come from Google searches. Often from people searching for information on a particular technical problem I just happened to write about.

That’s why the solution is to hide your identity and lie lie lie!

comments edit

Currently, the only plug-in model supported by RSS Bandit is the IBlogExtension interface. This is a very limited interface that allows developers to write a plug-in that adds a menu option to allow the user to manipulate a single feed item.

The ability to interact with the application from such a plug-in is very limited as the interface doesn’t define an interface to the application other than a handle. (For info on how to write an IBlogExtension plug-in, see this article.)

So last night I was thinking about an email that a user sent me. He wants to know how to add an intelligent module for filtering and classifying RSS feeds to RSS Bandit. This is for his thesis project.

Since that might not be a necessary feature for RSS Bandit at this point, I suggested that he implement it in a private build. RSS Bandit is open source and he can easily obtain the source code. But it occurred to me that there are hundreds of feature requests like this that have the potential to be great solutions in the future, but would be best implemented as a plug-in in the near term.

So as I sat there thinking about it, Torsten goes ahead and implements a prototype for it. Mind you, I hadn’t talked to Torsten nor Dare about this yet, but I’m sure it’s something we’ve all been thinking about. Especially as the number of feature requests continues to accumulate.

So what areas of extensibility might we want to support? Well there’s the callback on feed item download that Torsten implemented. That alone is quite useful. I can imagine building a plug-in that would score items based on how likely I’d want to see it or not. Thus it could sort items based on importance in a special feed. This would help with the increasingly large number of feeds I’m subscribed to.

Dare mentioned (and he’ll write more on this) the idea to support new data sources and formats. For example, it’d be interesting to build NNTP support as a plug-in.

I’d also like to build the ability to provide an interface for plug-in data storage. For example, suppose you build a plug-in that keeps statistics of your RSS feeds. You might want that stored with your settings so that when you synchronize RSS Bandit, your plug-in settings are synchronized as well.

]

Thinking far out there, perhaps adding the ability to support IE toolbars might be an option as I think some users actually use RSS Bandit as their primary browser.

The important thing is to design a nice interface to expose the RSS Bandit application to the plug-ins. In tandem we need to prioritize these extensibility options by looking at current feature requests and thinking about how many of them could be implemented as plug-ins.

comments edit

Evolution of DevelopmentJet Brains released a free upgrade to their ReSharper product. Let me tell you, using this product feels like walking on land after a long stint trying to walk under water.

Recently, I was trying to write some code on a coworker’s computer and kept hitting funky key combinations that had no meaning on his machine since he didn’t have this installed. I had to actually type out a bunch of code that just spills out when using this add-in. It felt so stone age.

Just to be complete, I know many are fans of CodeRush for Visual Studio. I liked it enough, but the lack of Refactoring support was a problem for me, which is why I chose ReSharper.

comments edit

Via Dare’s blog, I found this interesting post on Random Number Generation on Michael Brundage’s website. My undergrad thesis was on the topic of pseudorandom number generation so I thought I’d take the two classes he provided for a quick spin.

Unfortunately, the C# samples did not compile as is. In his post he discusses how the C++ samples are optimized. I figured I might be able to use them to guide changes to the C# port and could post the results here. Please note that I have not tested them yet and need to verify that my changes were correct. Enjoy and let me know if I got anything wrong.

[CLSCompliant(false)]

public class MersenneTwister

{

    private ulong _index;

    private ulong[] _buffer = new ulong[624];

 

    /// <summary>

    /// Creates a new <see cref=”MersenneTwister”/> instance.

    /// </summary>

    public MersenneTwister()

    {

        Random r = new Random();

        for (int i = 0; i < 624; i++)

            _buffer[i] = (ulong)r.Next();

        _index = 0;

    }

 

    /// <summary>

    /// Returns a random long integer.

    /// </summary>

    /// <returns></returns>

    public ulong Random()

    {

        if (_index == 624)

        {

            _index = 0;

            long i = 0;

            ulong s;

            for (; i < 624 - 397; i++)

            {

                s = (_buffer[i] & 0x80000000) | (_buffer[i+1] & 0x7FFFFFFF);

                _buffer[i] = _buffer[i + 397] \^ (s >> 1) \^ ((s & 1) * 0x9908B0DF);

            }

            for (; i < 623; i++)

            {

                s = (_buffer[i] & 0x80000000) | (_buffer[i+1] & 0x7FFFFFFF);

                _buffer[i] = _buffer[i - (624 - 397)] \^ (s >> 1) \^ ((s & 1) * 0x9908B0DF);

            }

 

            s = (_buffer[623] & 0x80000000) | (_buffer[0] & 0x7FFFFFFF);

            _buffer[623] = _buffer[396] \^ (s >> 1) \^ ((s & 1) * 0x9908B0DF);

        }

        return _buffer[_index++];

    }

}

[CLSCompliant(false)]

public sealed class R250Combined521

{

    private ulong r250_index;

    private ulong r521_index;

    private ulong[] r250_buffer = new ulong[250];

    private ulong[] r521_buffer = new ulong[521];

 

    /// <summary>

    /// Creates a new <see cref=”R250Combined521”/> instance.

    /// </summary>

    public R250Combined521()

    {

        Random r = new Random();

        ulong i = 521;

        ulong mask1 = 1;

        ulong mask2 = 0xFFFFFFFF;

 

        while (i– > 250)

        {

            r521_buffer[i] = (ulong)r.Next();

        }

        while (i– > 31)

        {

            r250_buffer[i] = (ulong)r.Next();

            r521_buffer[i] = (ulong)r.Next();

        }

 

        /*

        Establish linear independence of the bit columns

        by setting the diagonal bits and clearing all bits above

        */

        while (i– > 0)

        {

            r250_buffer[i] = (((uint)r.Next()) mask1) & mask2;
            r521_buffer[i] = (((uint)r.Next()) mask1) & mask2;

            mask2 = mask2 \^ mask1;

            //mask2 \^= mask1;

            mask1 >>= 1;

        }

        r250_buffer[0] = mask1;

        r521_buffer[0] = mask2;

        r250_index = 0;

        r521_index = 0;

    }

 

    /// <summary>

    /// Returns a random long integer.

    /// </summary>

    /// <returns></returns>

    public ulong random()

    {

        ulong i1 = r250_index;

        ulong i2 = r521_index;

 

        ulong j1 = i1 - (250-103);

        if (j1 < 0)

            j1 = i1 + 103;

        ulong j2 = i2 - (521-168);

        if (j2 < 0)

            j2 = i2 + 168;

 

        ulong r = (r250_buffer[j1] \^ r250_buffer[i1]);

        r250_buffer[i1] = r;

        ulong s = (r521_buffer[j2] \^ r521_buffer[i2]);

        r521_buffer[i2] = s;

 

        i1 = (i1 != 249) ? (i1 + 1) : 0;

        r250_index = i1;

        i2 = (i2 != 521) ? (i2 + 1) : 0;

        r521_index = i2;

 

        return r \^ s;

    }

}

comments edit

Yes folks, it’s true. After working a while in VS.NET, it suddenly stops and asks if I’d like to send an error report to Microsoft. Then it shuts down. Almost like clockwork. This creates a very good time for me to take a break, stretch, and meditate on how much work I just lost as I was just about to hit the save icon.