Wednesday, January 28, 2004

In a previous post I stated that I thought it would be nice to treat methods as objects.  I then found that delegates do just that, in a pointer sort of way...

But in Whidbey, you'll be able to wrap code blocks in anonymous delegate containers and pass them rather than having to create an external delegate and pass the ref.  Just cool. 

“Current bits” capability - passing delegates as parm...

and now for Whidbey!

The following is an except from this article on MSDN - Sneak Preview of Whidbey

Anonymous methods can be thought of as the ability to pass a code block as a parameter. In general, anonymous methods can be placed anywhere that a delegate is expected. The simplest example is something like:

button1.Click += delegate { MessageBox.Show("Click"); };

There are a few things to notice here. First, it's legal to write a method inline. Second, there is no description of either the return type or the method parameters. Third, the keyword delegate is used to offset this construct. The return type isn't listed because the compiler infers it. That is, the compiler knows what is expected (EventHandler), and then checks to see if the anonymous method defined is convertible to that method.

You may notice that in the previous example there were no parameters listed. This is because they weren't needed within the code block. If these parameters were used, then the declaration would look like this:

    button1.Click += delegate(object sender, EventArgs e) 
      { MessageBox.Show(sender.ToString()); };

Notice that both the type and parameter name are given.

 

 

Programming | .Net | C#
1/28/2004 5:29:35 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

I google stalked myself and this blog already shows up...  The really scary part is that about.com has my email address right there in the results.  Not cool.  So now the email listed has blog appended.  It will still work, I get anything -at- vitaminzrecords

While I hate allowing government to legislate how we can use the internet, I sure would like to see spam heavily penalized.   This new law that's been passed is supposed end spam.  I won't hold my breath.  But, to be honest, I'd rather have to delete some emails then let big brother watch my emails for violations to their law of the moment.  Hey, I know, I'll post a public weblog, that'll keep me incognito with a capitol E

 

1/28/2004 5:09:44 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
Monday, January 26, 2004

Let's say we have an object that is going to consume some object but, in the process, will be affected by that object or, perhaps, the environmental context of the action. 

To bring that closer to home, consider eating.  The eater consumes the eatie.  The eatie, by being consumed, can cause all sorts of possible affect to the eater: indigestion, increased energy, nourishment, or even death by poison...

So the eater does its eating thing but then the eatie does its decomposing via digestion.

 

Here's a simple example.

 

/// define our delegate

public delegate void Digested(Organism Predator); 

/// base class Organism.

public abstract class Organism

{

private System.Collections.ArrayList alMeals = new System.Collections.ArrayList();

public bool IsAlive = true;

public virtual void Eat(Organism prey, Digested PreyDigestion)

{

  PreyDigestion(this);

  alMeals.Add(PreyDigestion);

}

public virtual void BeDigested(Organism predator)

{

  this.Die();

  for(int iMeal = 0; iMeal < alMeals.Count; iMeal++)

  {

    Digested DigMeal = (Digested)alMeals[iMeal];

    DigMeal(predator);

  }

}

public virtual void Die()

{

  this.IsAlive = false;

}

public virtual void Nourish(){}

}

 

 

/// class Mammal

public class Mammal:Organism

{

public override void Eat(Organism prey, Digested PreyDigestion)

{

  //Bite...

  //Chew...

  //Swallow...

  base.Eat(prey,PreyDigestion);

}

public override void BeDigested(Organism predator)

{

  predator.Nourish();

  base.BeDigested(predator);

}

public override void Die()

{

  //Moan();

  //Heart.Stop();

  base.Die();

}

}

 

/// class fish

public class Fish:Organism

{

public override void BeDigested(Organism predator)

{

  predator.Nourish();

  base.BeDigested(predator);

}

public override void Die()

{

  //Heart.Stop();

  base.Die();

}

}

 

 

/// class Algae

public class PoisonousAlgae:Organism

{

public override void BeDigested(Organism predator)

{

  if(predator is Mammal)

  {

    predator.Die();

  }

  else

  {

    predator.Nourish();

  }

  base.BeDigested(predator);

}

public override void Die()

{

  //Photosynthesis.stop();

  base.Die();

}

}

 

Now, If the bear eats the fish, she will be nourashed and happy.  If the fish eats the algae, he is nourished.  If the Bear eats the Algae, she will die of Ciguatera Toxin Poisoning.  If the Fish first eats the Algae before the Bear east the fish, the Bear will die of poisoning just the same. 

Using inheritence and delegates passed as parameters, everything an organism consumes becomes part of them and, should they be eaten, their consumer will have to digest their meal as well.

What did we learn? Bears shouldn't eat algae and should avoid large quantities of fish that eat algae.  Stick to Salmon and Tuna.

As opposed to the service class having to expose a method or support an interface that the client can call, the client can expect a delegate as a parameter.  That parameter might be something completely separate from the service class.  Perhaps a transponder was attached to the fish and now the transponder is in the bear... 

See and step through the attached example if you want to watch it in action.

DelegateExample.zip (6.99 KB)
Programming | .Net | C#
1/26/2004 6:08:49 PM (GMT Standard Time, UTC+00:00)  #    Comments [5]  |  Trackback

Xml Limitations

I just read a short article on ConciseXml. Some of the points made are very valid. 

·         Developers are incentivised to use short, abbreviated names because of the verbosity and bulk of Xml, sometimes reducing readability.

·         Attributes and elements have no clear standards for appropriate use, resulting in ambiguity in structure and content.

In the following example, Color is both an object with child objects and a simple field of an object.

<food>
       <item>
              <id>yx324</id>
              <food>chicken</color>
              <cost>10</cost>
       </item>
</food>

I don’t think this is necessarily a limitation of the Xml Standard!  This is a shortcoming on the part of the author.

If the same data were represented as:

<foods>
       <food id=”yx324” value=”chicken” cost=”10” />
</foods>

The data makes more sense to the reader and is less ambiguous.  This piece of data now stands on its own as something.  It’s apparent that foods is a collection of food items and each has an id value, a descriptive or title value and a cost.   

at this point, I suggest you move on...  the rest of this post is meandering observation but leads to this interesting concept

ConciseXml less verbose

Xml's purpose is to be self-describing. Some of the conventions described in the article violate that objective.

ConciseXML: <person "Mike" "Plusch"/>

in the above example, What is "Mike" and "Plusch" in the person node? Plusch could be a nickanme or a profession or an action.

XML 1.0: <person first="Mike" last="Plusch"/>

This syntax is obvious even out of context.

Xml as a programming language?

ConciseXml is a programming language.  Now it begins to become clear.  A new syntax to do the things we do everyday that merges data, presentation, logic…  Is this a good idea?  Do we really need another programming language?  What is the objective in making xml more than mark up?

I think it is both inappropriate and misleading to even call this Xml.  I don’t know yet whether it is an exciting technology or simply another new language that is designed to replace the syntax that people are used to.  I love curly braces.  I love parenthesis to separate and partition a multi-step equation.  I was ecstatic to leave VB behind and pick up c#.  Microsoft recognized that some of the common constructs for common programming concepts work really well.  They created C# and did a fabulous job making it make perfect sense.  Xml is the most intuitive way to represent data.  Sometimes it isn’t so efficient but there are a million ways to deal with performance. 

I don’t know Lisp but this looks a lot like Lisp to me.  I do like some of the concepts that I read about.  I like that a method is an object.  It would be nice to be able to pass a method in C#. 

Consider: 

Class:  “Animal”

Contains method: “Eat”

Which accepts parameters: “Animal” and “Digest” (Digest is an action)

In researching what C# can do, I found that a delegate can indeed be passed as a parameter!  Passing a method is dicey…  Leave the method where it is and pass the pointer.

// delegate declaration
delegate void MyDelegate(int i);
 
class Program
{
   public static void Main()
   {
      TakesADelegate(new MyDelegate(DelegateFunction));
   }
 
   public static void TakesADelegate(MyDelegate SomeFunction)
   {
      SomeFunction(21);
   }
   
   public static void DelegateFunction(int i)
   {
      System.Console.WriteLine("Called by delegate with number: {0}.", i);
   }

}

A delegate in C# allows you to pass methods of one class to objects of other classes that can call those methods.

See more on that here 

In my brief introduction to ConciseXml, I learned of a few grievances developers have with modern languages and standards and was able to learn about an available mechanism in C# (passing a delegate to a method of a class as a parameter) and some basic good practices with Xml – choice of attribute or element usage.

This makes me want to indeed write a program in Lisp.  I have repeatedly heard it improves a person’s overall perspective on programming. 

If I have some time, I may well do that.  

 

Xml
1/26/2004 6:06:59 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
Friday, January 23, 2004

this made me laugh

1/23/2004 3:51:57 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

My wife went to CVS on N. Highland in Atlanta to fill our sick son's prescription.  He has an ear infection.  The plan was to get the medicine and pick up our takeout across the street in one trip.   (Harry and Sons, awesome restaurant).  Tonight it was a bit cold to walk and because of a sick child, she didn't want to mess around.

She went in to CVS and, as usual, the prescription wasn't ready.  They are very slow.  This we expect.  We did not expect that the parking lot attendant would threaten to boot her car if she left while waiting for the prescription to be filled.  It would be about fifteen minutes, perfect time to go directly across the street and pick up the food we called in and ordered before she left.

She went back into the store to ask them to tell the parking lot attendant to back off but they concurred with the parking lot bully.  She would not be permitted to leave the store without her car, even for five minutes, while they were filling her presription, or CVS would allow her to be booted.  So she had to wait for twenty miinutes, sick child at home with me, hungry as hell, and return home, sans food, and send me back out to get the food from the restaurant across the street from the CVS on N. Highland in Atlanta.  What a pain in the butt@!

Parking lot attendant? at CVS?  Booting?!  Yes.  See, they have decided that generating extra revenue from their prime location parking lot is more important than respecting and appreciating their regular local customers.  We spend hundreds of dollars every month there, or, we used to, up until today, thursday, January 22, 2004.  It seems that it is more important to them to collect $5 on a thursday night from people desiring to park their cars than it is to have loyal shoppers.  Alright, I heard you.

This inconvenience completely destroys all value that store had for us.  It was close to home.  As I said, they are slow and inefficient and, obviously, rude.  Now, they are also inconvenient. 

Clearly, I'm pissed off.  I went there before getting our dinner from across the street from CVS on N. Highland in Atlanta.  I spoke with the night manager.  She told me, “I am hearing your complaint and will pass it up the chain (after I informed her that I would be writing a letter) but you are wrong,” she continued, “whether the customer is right or wrong we will listen to them.”  Great.  That is reassuring, isn't it?

My advice is to boycott them.  Don't ever go there again.  Why?  The Highlands is a very prestigious location.  Here we enjoy a very European existence where we can walk to restaurants and shops and enjoy a life where our vehicle gets us to work and back but everything else is right around the corner.  Its the coolest geographic area I've seen in the entire country.  The CVS in the Highlands doesn't really fit!  Imagine if they were to close down...  What would take that large piece of realestate?  I would hope it would be another excellent restaurant, a club and an art gallery.  Or perhaps some beautiful, prime apartments.  Anything but a franchise drug store!  Take convenience out of a convenience store and you have...  store.  Take 't' away and that's how I feel about this whole experience...  sore.

 But it's so close and I live in the Highlands, what am I to do?...

Eckerd Store # 2708 (1.26 mi.)
891 PONCE DE LEON AVENUE NE
ATLANTA GA 30306
(404) 874-0640

They are close to the Whole Foods where you should buy your food because Whole Foods Rocks!  CVS, if you want to know how to treat a customer, go shop, jjust once, at Whole Foods on Ponce.  Everyone there makes me want to go there every day...

Life | Rants
1/23/2004 3:19:53 AM (GMT Standard Time, UTC+00:00)  #    Comments [6]  |  Trackback

Music transcends all other means of communication.  Music can get through any defense and dig deep in your soul.  Music can save lives, music can impassion people.  Music is the human spirit carried on physical vibrations.  Music can capture everything about a moment.  That moment can be an eternity.

1/23/2004 2:59:26 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
A mixing board that taunts me and makes me want to cry
1/23/2004 2:39:53 AM (GMT Standard Time, UTC+00:00)  #    Comments [2]  |  Trackback
Thursday, January 22, 2004

We all remember what it was like to bring up web pages before fast access.  We swore alot.  We were much more uptight.  Life on the internet was a much less pleasurable experience.  Shop online?  We were lucky if we could check the weather before the weather changed! 

Hey, guess what?!  There are still people out there using dial-up.  No, seriously, I'm not kidding!  Some of them are just not interested in the web.  Others haven't yet been hooked by experiencing it in all its new speedy glory.  Still others are outside of the service boundries of fast service providers.  This is really a tragedy and I do feel sorrow for these poor souls who not only live far from cultural epicenters and stimulation but can't even while away the time surfing for their digital self.  They are forced to resort to the propaganda box, the tv, and watch what they are told to.  No choice by click.  Sorry y'all, blame the phone company for being slack.

Internet product managers and producers have to make a choice as to whether they should continue to cater to the slow lane or embrace new technologies which bloat the size of each page, thereby decreasing its loading quickness but increasing its boom, bang, zoom... 

Of course, they could do both, create an adaptable website that only delivers the content the user can tolerate.  Unfortunately, that significantly increases the development cost, even when well thought out, because focus must be directed in duplicity.  One site that loads fast, one site that does or has a lot of cool stuff.

After this long introduction, I finally approach a point and some technical experience.  

Images are used for all kinds of things.  Some images are for display.  Some of them are advertisements (which we hate but need at the same time - unless you want to pay to surf a site...) Others are for holding space.  A purist will tell you not to do that, don't use images as stretchers, placeholders or background colors.  Use stylesheets and WC3 compliant html.  Anyone whose worked in the real world will agree that this is not always possible.  If some of your customers are still on Windows 98 and some of them use netscape, you have to support their choice of browser.  Therefore, to make the page look nice, you have to stick an image here or there to make things align and lay out nicely.

Here's the trouble.  Images are requested independently from the page.  The page starts to load in the browser and in comes an image reference.  It must now make a seperate request to the web site to get that image.  The image loads and is placed where it belongs.  This presents a problem but also a solution...

If you have some javascript that fires onLoad, the page may wait for all the images before it runs the javascript.  If that javascript is important, a dial-up user may never actually see what it does. 

If the javascript references some image on the page or some part of the DOM, it may not be able to execute until the images are finished loading. 

<script>

function RunMyCoolJavascriptfunction(){
var iLeftLocation=document.getElementById('holdspace').offsetLeft;
//the above requres the images be loaded before it can get info about it.
}

</script>

Moving the call to execute the javascript from the page load to some location in the page causes the entire page to wait for the images

...some html content
<script>
RunMyCoolJavascriptfunction();
</script>

...some more html content

What to do?!

I don't want to wait for the entire page load to fire my javascript but I also really want to start that very important javascript!  The images aren't necessary for the javascript to do its thing so let's make this work in a more desireable order of execution.

first of all, we need to remove the reference to the image in the javascript.  We need a left position.  If we know where we are putting that placeholder image then why can't we figure out programatically where that is?

this worked for my situation, yours might be slightly different...

function RunMyCoolJavascriptfunction(){
    var iBodyWidth=document.body.clientWidth;
    if(iBodyWidth<(iMyWidth+166)){ 
        iMyLeft = 166;
    }else{ 
        iMyLeft = ((iBodyWidth - (iMyWidth+166)) / 2) + (166-12) ;
        //body minus module width plus width of left nav divided by two then shifted over half of left nav width mnus scroll bar
    }
}

Now that the image ref is gone from the javascript, lets call it...  where? 

You could probably place this inline but, just to be sure, lets find something that will ensure that the page html is there before we call the function.

<IMG src="/images/clear-dot.gif" onload="if(typeof(RunMyCoolJavascriptfunction)!='undefined') RunMyCoolJavascriptfunction();"
   WIDTH="1" HEIGHT="1"  STYLE="visibility:hidden; position:relative;display:none;">

this will first make sure the function is there and then execute it when this image loads.  This is a small image and should return more quickly then, say, the huge, stupid, annoying flash ad that takes over the screen in  a moment.  Yes, you'd better get your cool stuff to fire first because that flash ad is about to make them leave.

I duplicate this call in the body onload just in case the image doesn't fire and ad a flag that only allows the start to happen once

var bStarted = false;

function RunMyCoolJavascriptfunction(){
    if(!bStarted ){
        var iBodyWidth=document.body.clientWidth; 
        if(iBodyWidth<(iMyWidth+166)){ 
            iMyLeft = 166; 
        }else{ 
            iMyLeft = ((iBodyWidth - (iMyWidth+166)) / 2) + (166-12) ; 
            //body minus module width plus width of left nav divided by two then shifted over half of left nav width mnus scroll bar 
        }
        bStarted = true;
    }

}

Cool!  Now the page loads.  The html displays.  Then, as the images begin to download, a small image causes the javascript to start.  Our spiining, flaming logo does its most excellent stuff, and the rest of the images come down in turn.

The bottom line is that you have to think about the impact each page item has on your user, the order you want things to load and execute and what the overall user experience will be in different browsing situations.  Someday everyone will have fast connections, standards compliant browsers and advertisers will stop believing that pop ups, pop unders and take overs are good things.

Until then, good luck

 

1/22/2004 4:37:57 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Saturday, January 17, 2004

You gotta eat.

I thought I'd share my thoughts on diet. I am very passionate about health. No, I don't mean militant exercise and draconian, restrictive food consumption. I’m talking about living as long as we’re built to due to the intentional development of positive habits and lifestyle without degrading the quality of life we live everyday.

Basic Philosophy

I’ll start with the overall philosophy, since it is so simple, and get up on my soap box and start a-hollering…

Moderation in all things. Meet basic requirements based on your personal situation. Limit known hazards. Achieve and maintain balance. Consider the whole picture, address the smallest details. Chose disciplines that you enjoy. Work within your means.

The last part of this philosophy is the most important and is a quote from someone who I sincerely miss, a good friend who showed me all I needed to know to do anything I want to do. His name was George Hydor and he always parted ways by saying, “It's a great day to get better!” Never think you can’t succeed and when you do, always know you can still improve. Attitude will carry you further than genetics, experience, connections, money or any crackpot MD who comes up with a fad.

Expansion

That is pretty vague, isn’t it. Think about this mentality with regards to exercise. Don’t work out so much that you have no time to live. Get at least enough exercise to raise your heart rate three times per week. Don’t overdue too much knee compressing, jarring activity or take supplements which aren’t good for the rest of your health. Compliment a high intensity aerobic workout with an anaerobic, muscle straining workout and throw in something that addresses flexibility and range of motion. Take a couple days off each week. Set lofty body goals but only do what is reasonable each day. Make it fun.

Now apply that to diet. You can create a very healthy diet with average knowledge based on your own experience and a little light reading. Frankly, I don’t know what I need vitamin E for but I take a vitamin supplement that makes sure I get what vitamins and minerals are not in my food.

I have been an opponent of the “Atkins Diet” for some time. I have reconsidered.

On one hand, it violates many of the above mentioned principles stated above. It does not practice moderation but elimination (carbs) and excess (fat, red meat, dairy). There is no balance. There is no consideration to overall nutrition but only focuses on weight.

On the other hand, it is something that people are willing and able to do. When addressing overall health, and you are excessively overweight, there is no point in taking fish-oil supplements followed with a Big Mac. Doing flexibility training is helpful won’t help you live longer. So trying the “Atkins Diet” can help you extend your means. If you can lose a large amount of weight, you are then able to do things you could not do before.

Losing the weight is a grand accomplishment. Its not, however, the end of the road. This is where you then need to change. Get better. Don’t go off a diet to return to the lifestyle that required it. Instead, adopt a less extreme, more balanced dietary regimen. Most importantly, find yourself something that is not difficult to maintain and make sure to take a day or two off every week. Sure, this approach might cause a five pound belly bulge but that’s better than a fifty pound Dunlop condition (my belly donlopped over my belt). There is nothing unhealthy about 10-15 % body fat(women are a little higher). Over all, the balance you achieve in weight will be reflected in your blood sugar and your hormones and, though you may know nothing about these systems, they will be positively affected as well. If you’re not a model, don’t fret about gaining five pounds at Christmas time. Just don’t mudslide into obesity. Balance and moderation in the good and the bad.

Now, what about the food pyramid? The food pyramid was created by the U. S. Department of Agriculture. Hey, wait a minute, shouldn’t that be the responsibility of the FDA or the American Medical Association? Exactly! What is cheap to produce? Everything at the top of the pyramid. When you realize that the pyramid was sponsored and proposed by lobbyists for the Dairy and Meat Councils in America, you can’t disregard the evidence.

Cows milk is really good… for baby cows. I am not a member of the “Milk is death” camp. I grew up in Wisconsin and grew up on the stuff. milk makes the best cheese and ice cream. Too much of anything is a bad thing. I think kids in the Midwest drink way too much milk. I think the whole population consumes a little too much dairy in general. That’s an entirely different rant but worth mentioning. What happens to a baby cow drinking cow’s milk? They get big and fat, just like they are supposed to. Cow’s are slow, grazing, stupid animals, it’s ok for them to be huge. What happens to a person when they consume a lot of Cow’s milk?

It seems that the medical and scientific community are making some progress and getting the word out. People are starting to reevaluate nutrition. Scientists and doctors are getting on the same accord and we may have an unofficial standard appear in the near future. The government will not back it because it will likely not be what our country farmers are planting at the moment. On the other hand, we now have this little internet and what the government says is only one source you can listen to. Politicians are often fat and very unhealthy. I’ll pass on their opinion.

Everyone is different and you have do what is right for you. Common sense goes an awful long way. After everything I said there is only one tiny piece that really matters at all…

“It’s a great day to get better” - George Hydor

1/17/2004 8:24:46 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
Friday, January 16, 2004

...in my post about Dynamic Attributes, I was specifically looking at the runtime modification of serialization attributes.  This is not exactly appropriate.  Attributes are there to add additional information to your assembly about a particular method, property, field, class, etc.  The attributes are compiled into your assembly and available through reflection.   This is very useful but not a good place to implement conditional functionality.

My solution was really not so complex.  My need was to conditionally serialize a property of a class.  Basically, under condition a, serialize PropertyA to xml and skip PropertyB.  Under condition b, serialize PropertyB to xml and skip PropertyA. 

One way to accomplish this would be to have to derivations of a common base class.  FooA and FooB inherit from base class Foo.  Each could use Attributes to mark the appropriate property [XmlIgnore].  So, in a sense, dynamic attributes, in an indirect sort of way.

The way I decided to accomplish this is pretty simple...  The class has a public method called SerializeToXml.  This method handles the serialization details for this class.  Within this method, if a check for PropertyA finds it full of data, PropertyB is copied to a temporary local variable and then PropertyA is nullified.  The class is serialized to file and then the value of the local temporary variable is returned to PropertyB.  The result?  PropertyB is not serialized because it is empty.  Additionally, state is not disrupted because everything is restored following serialization.

Certainly, if someone implementing the Class were to serialize the class using System.Xml.Serialization, they would get both properties.  I like this result because there may be a case where an application wants to save or transfer its state to some other application using the same class.  Or maybe a different, third party application might need to consume the state data.  It makes sense that should I deserialize and rehydrate this class, it would be pretty much the same instance.  Of course, context comes into discussion, but not this one.

 

 

 

1/16/2004 10:02:32 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback
Thursday, January 15, 2004

Here is sometking I was not privy to and ran across by accident...  Nesting Classes.

Take a look at the following Class declaration.  Notice that there is a public class inside the first class. 

Another interesting point to note is that the private static fields of the containment class are available to the nested class.  This can come in useful when you have worker variables that are messy if you expose them as public but necessary between class instances.   

namespace Test.ServiceClassAssembly

{

       /// <summary>

       /// Summary description for Class1.

       /// </summary>

       public class ServiceClass

       {

              protected static string _privateString = "parent private string value";

              public ServiceClass()

              {

                     //

                     // TODO: Add constructor logic here

                     //

              }

              public string GetTestValue()

              {

                return "Version 1";

              }

              public class nestedService

              {

 

                     private string _nestedVal = "I am a nested Class value";

                     public string GetNestedTestValue()

                     {

                            string sParentVal =  _privateString;

                            string sLocalVal = _nestedVal;

               

                            return "ParentVal:" + _privateString + ", LocalVal:" + _nestedVal;

 

 

                     }

              }

       }

 

      

 

...Accessing the nested and containment class is as follows

 

 Test.ServiceClassAssembly.ServiceClass sc = new Test.ServiceClassAssembly.ServiceClass ();

_serviceClassReturnValue = sc.GetTestValue();

 

Test.ServiceClassAssembly.ServiceClass.nestedService ns = new Test.ServiceClassAssembly.ServiceClass.nestedService();

_serviceClassNestedReturnValue = ns.GetNestedTestValue();

 

     ...The result?

The value returning from the Service Class is: Version 1
The value returning  from the Service Class Nested Class is: ParentVal:parent private string value, LocalVal:I am a nested Class value
 

                         

There's a short little article that might come in handy

Programming | .Net | C#
1/15/2004 10:29:55 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

Here's my need.  

When certain data is present in a class (collection nuts) , when serializing that class, other data (collection bolts)  should not be serialized.  If that data is not present (no nuts), the other data (bolts) should be serialized with the parent class. 

When deserializing, if bolts are found, go ahead and consume them but if nuts are found, use the nuts to find the bolts from some other location. 

Primarily, this is to maintain backward compatiblity with a previous version of a serializable class that I have been using.  I can see this coming up again though. 

public class MarsRover

{

public nut[] Nuts;

[NonSerialized]
[XmlIgnore]

public
bolt[] Bolts;

public void SerializeToXml()

{

// Serialization - serilizes to some stadard file location
XmlSerializer xmlsSlzr = new XmlSerializer( typeof( MarsRover) );
TextWriter txWtr =
new StreamWriter( getXmlConfigFilePath() );

/// here's the thing ///  if there are no nuts, serialize the bolts.

//of course, I can manually serialize the bolts and insert them into the resultant doc,
//and vice versa, but it would be much easier to pass that instruction to the serializer...


xmlsSlzr.Serialize( txWtr,
this );
txWtr.Close();

}

}

 

 

Programming | .Net | C#
1/15/2004 8:27:21 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback

What a concept!

First let me begin with a moment of silence to all the electronic toys I have dismantled with intention of correcting some (unusally minor) defect only to snap a tiny piece of molded plastic necessary for reassembly. Of course, once you snap it, you know how to get it apart without snapping it, but then it is too late. May you rest in pieces.

Often, I attempt the super-glue repair, but its never quite enough skrumph. ...if only I owned a plastic injection moulding machine, I could fashion a wood model of a brace and then create a cast from the mold and then, oh then, I'd be back in buisiness.

Friendly Plastic is really all I need.  I could have saved many injured machines from the landfill doom had I owned a little hunk of moldable plastic.  Of course, that's assuming I can adhesive the new to the old...  

Much of this is the "Rog" in me. (Roger is my pop).  You can't throw it away if it can be fixed, even if you don't know how or where to fix it or don't have time to fix it.  We had two of those huge old wooden console TV's in our basement growing up.  Neither worked.  They might still be there.  There is a billiard table with no rubber bumbers (the ball doesn't rebound from the banks) and there were as many as nine cars in our yard at one time (four of them were mine).  Now, finally, all that training will pay off!


Recently, I have tackled a few projects which had been previously outside my area of comfort or knowledge.  One was indeed my wireless keyboard.  My brother paid me the favor of dumping a coke skraight down the middle of it the week I got it.  Two years ago.  I got it dried out but, over time, dust settled in on the sticky and eventually the buttons would not return to the up position “without tapping it lightly against a hard surface a few times” (we know that means slamming it repeatedly, screaming obsceneties).  So I dismantled it, finding it to be both simple and brilliant.  There were probably fifty screws in my jar by the time I got to the meat of it but I didn't break anything and now its sparking clean and wrks perfectly.  I also build a bench/toy box over the holiday.  Brad guns, routers, circular saws...  fun!  I clear-coated it with automotive enamel.  Not standard but super durable and...  eyeing that old decrepid Porche in my father-in-law's yard with a new ferver. 

The point is: when something seems to hard to be done or likely to end in failure, assess the cost of doing it anyway.  If the cost is only time, ie: it's already broken, dive in.  Go ahead and break it more.  You'll likely gain little bits of knowledge with each disaster, until, one day, someone mentions friendly plastic and the clouds blow away.

1/15/2004 3:28:49 PM (GMT Standard Time, UTC+00:00)  #    Comments [3]  |  Trackback
Wednesday, January 14, 2004

I tried to subscribe to my own Blog....   Ok, first, I know that this is retarded.  It would allow me quicker access to my most riveting entries!  I could see when someone comments, should someone ever comment, immediately.  Moving on then.

I can't subscribe!  This blog is the one that most reflects my interests.  This guy is right on every time!  Its like reading myself.  Oh, it is reading myself.  I am my own audience... 

here's the error

Refresh feed 'General Interest\me' failed with error: System.FormatException: Header checksum illegal at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.DecodeHeader() at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Decode() at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Inflate(Byte[] buf, Int32 off, Int32 len) at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[] b, Int32 off, Int32 len)

The rss is valid according to http://feedvalidator.org/check?url=http%3A%2F%2Flevous.cerkit.com%2Fweblog%

ah well....   I'm probably better off.  This guy tends to fill my head with all kinds of left-wing propaganda and nonsense.

1/14/2004 7:07:03 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]  |  Trackback

I Love sushi.  It is one of my favorite foods.  Prior to my move from Wisconsin to Georgia, the thought of eating raw fish, much less raw anything, would have frightened me something terrible.   Consider that fish have to travel across alot of land to get there (that big lake next to Wisconsin is pretty much unfit to eat from, thanks to industry).  Fish tastes “fishy” in the midwest.  There are probably some premium vendors but I never tasted such things growing up. 

My first experience with sushi was at “Harry and Sons” in the Virginia Highlands (that's in Atlanta, not Virginia). 820 North Highland Avenue - 404-873-2009.  I was hooked.  I discovered that nothing is quite as powerful in combating a hang-over than some raw fatty tuna.  Well, actually, a bunch of water, some excedrin, loads of sleep, some good lovin and an early morning beer - then some fatty tuna....   I digress

I don't do alot of hang-overs these days but I sure like me some sushi.  I tried Nakato last night.  It was pretty good.  I can't say that it was all that spectacular.  I dined in the steak frying, flying knife, flaming onion room.  Perhaps the atmoshpere detracted from the overall experience but I would give it 4 of 5 stars.  The shrimp and chicken on the grill by the egg spinning chef was 5 of 5.   So, overall, a great restaurant.  Perfect place to go with a large group.  Jackson (my 8 month old mini me) loved the fire.  He was about to get cranky when, 'poof' the grill was on fire and he was mesmerized...  The early birs before 6:30 special is a steal.

Ru-san's, in midtown - 1529 Piedmont Road -  is pretty good.  I have always liked their spicy tuna.  It's cheap and they play music that doesn't annoy me.  Its a cool place to hang out.  The Buckhead location is ok but not as good.  I have been to the Marietta location and it SUCKS.  It truly sucks.  I don't know if they are owned by the same family but they are far from consistent.  Further, the Buckhead location treated a friend of mine like shit because she is white.  That's wrong.  Just because a girl ain't asian doesn't mean you need to be angry with her.  Of course, she is blond and, well, she's blond...   So maybe they just didn't understand why she kept forgetting things.  Regardless, it is quite the converse attitude of what I have experinced from asian culture.  I have always admired eastern cuture and philosophy and will forever be intrigued by its values.

I have tried sushi in many places.  I work in norcross and have to endure the sushi up there for lunch.  Nothing is noteworthy.  Buford highway left me questioning my sanitation safety.  I was hitting a buffet for a while until one day it smelled a little ripe and a comrad got badly, badly ill.  Buffet, bad.  Unless appropriately expensive, how can they afford the american buffet professionals? 

Back to “Harry and Sons“!   They rock.  Always exceptional.  It is not a pillow and shoeless adventure.  In fact, I usually take it to go.  I love down the street so its just easier to take it home than pack up the baby.  They have a volcano roll which is awesome.  Big pieces of really fresh, tasty raw fish. 

...and now for something completely different.  Yoshino!  They have something that is probably heresy to a sushi traditionalist...  I don't know sushi rules but I know this is the first I have seen of this and all I can say is: mmmmmmmmmmm. 

 

oh my god rolls (they even have one called the "oh my god roll" - two pages from link)
1/14/2004 5:49:01 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  |  Trackback
Tuesday, January 13, 2004

I have been working on a labour of love for about six months.  It is essentially an online family photo album and journal.  I designed it to be configurable and reusable.  I would expect a beta product by summer.  I call it “Hello Sweet Baby”.  That was the message on our son's birth announcements.

Last friday, I finally finished the basic photo album portion of the site.  Now you can assign photos to albums.  This makes it so much more usable.  Rather than forty pics, you can see a few at a time.  I have a lot more work to do but here's the thing... I have been having so much fun with it that I can hardly tear myself away from it.  Whether programming the code or using the site, its a blast.  I hope that my professional life wanders in the direction of a more rewarding work experience.  It seems that most of what I work on has a very short life expectancy.  I always build with great consideration to growth and extension.  Nonetheless, decision makers tend to re-invent their product regularly.  If the company weren't making money, it would be a problem, but the are.  They're making lots of money.  Immagine what they would make if they tapped into the resources that reside in each of their very talented employees?  I see it in all of my peers.  When they get excited, they produce incredible things.  

Then again, what could be more fun than looking at pictures of my son?

well, being at home wth him.  But we have to make money...

Here's a screen from the site

If you want more, shoot me an email. 

 

1/13/2004 6:00:23 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

I am a programmer...   There!  That should keep the category “Programming” visible!

1/13/2004 5:46:25 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  |  Trackback

Intro

Building a project is no big deal.  Building a solution of inter-dependent projects is also no big deal.  Building multiple versions of the same solution full of inter-dependent projects and maintaining the association between source and binaries can get hairy.

 

NAnt and VSS

I have been working with NAnt for many months, VSS for many years.  NAnt is the compile portion of an automated build system I've written that supports (hacks) the concept of “promotion” in MS Visual Source Safe.  Promotion is the idea of tagging a file version for some target release.  Using the latest code is not appropriate in a multi-project, multiple-release schedule team-environment

 

Requirements

The basic workflow is as follows...  Developer makes changes intended for particular scheduled release and checks them into VSS.  She labels the file with the build label (B1.15.02 for instance) and then notifies QA that the changes will be available in build 1.15.02.  When QA is ready for that build, build application is executed using that label and all files labeled are collated and compiled.  The result is checked into a staging directory section within VSS along with the associated source files and labeled as a snapshot.  QA stages from VSS for test.  When approved, infrastructure admins stage from the same location.  Additionally, the build app can deploy the result.  Anytime in the future, any build, from any project, compiled result and associated source, must be recoverable. 

 

Additionally, we have outgrown building everything, every time.  Reusable libraries need not be recompiled with the client but we still need to have the ability to restore the source code for the reusable library should that version require debugging.  It would be nice if this were an easy, automated process.

 

NAnt solution task

I was excited to see all the additions NAnt has had in the last several months.  I downloaded the last stable build and set up a test solution with a similar inter-dependent project configuration that we have in our real solutions.  I was able to get <solution> task to work only after allowing full writable access to the virtual directory that held the web UI project.  did not work correctly (supposed to map virtual directories to file path).  Ultimately, it built the solution but did not copy resources such as aspx pages or images to the output directory.  In fact, it ignored my specified outputdir and instead copied to the location of the build file.  Perhaps it is a symptom of being on Win 2k Pro and using framework 1.0.  I cannot control this, it is company policy that dictates what I use.  So, while it did a good job of imitating what Visual Studio does, it does not provide a viable offline build solution solution....

 

NAnt contrib. Contains Slingshot, which converts a solution file to a NAnt build file.  I’ve already done this manually but in the future may try it as a good starting place.

 

Automated Build System

Presently, my little build app can reconstruct any previous version of the application, compiled result and associated source, based on a holistic snapshot in VSS.  That means build everything, check in all the source and result, label it.  Done.  Unfortunately, building everything, every time, gets cumbersome.  So...

I am currently working on build application enhancements that enable a return to the versioned library build approach we were used to with Com and before.  Each assembly will be built atomically, all by itself, independent of the projects it depends upon or which depend upon it.  In out present application, we have assemblies that reference assemblies which also reference the assemblies the referenced assemblies reference.   Uh huh.  What if assembly (b) version 1.0 references assembly (a): version 1.2.0 and assembly (c) references assembly (b) version 1.0 and assembly (a) version 1.2.1 ?   Furthermore, what if the development manager requests a restore of the solution as of 2 months ago?  How do we identify what source code is associated with the dll in the bin directory of the client application?  My plan is to label everything, embed the version in the assembly manifest and maintain a version specific reference configuration file in the source of each project.  It's like reinventing the solution file.  I would love to use the solution file but every developer has a little variation of the solution file.  Some have project references, some use file refs, some have test projects and files.  Getting everyone to conform is harder than maintaining a master file.  I have the NAnt file, the traditional version that calls out what to build, what to copy, etc, in the source.  I will now have the additional versioned references configuration file as well.  I'd like to combine them but haven't decided if that is appropriate.  It is better to have less files and fewer steps to set up but not at the expense of complication. 

 

Back to the source-binary maintenance.  When source for a project is reconstructed from VSS, the binary (actually IL, but you get the idea) will be in the bin.