Bee Eee Blog

Uncategorized

Gay Marriage — The farce.

by brian on Apr.14, 2009, under Uncategorized

Here we go again.  I suppose my beliefs will be mocked and I’ll be called a bigot, but public discussion needs to be open and full.  Not just one side.  So I’ll share my beliefs.

Marriage between a man and a women, fulfill a useful role to our society.  They raise citizens.  Even at 50% divorce rate the marriage relationship is by far the most stable, and best environment to raise children to become productive members of a society.  It has been proved that a child is mostly likely to grow up well adjusted with both a Father and a Mother.  As such it is in the interest of our society to protect and foster marriage between a man and a women.

In the eyes of the society in general the purpose of marriage is NOT sexual fulfillment, and NOT expression of love, but a means of perpetuating a sustainable society with productive citizens.

So what good are homosexual marriages to the state?  There is none.  They cannot procreate.  They also cannot provide both a father and a mother through adoption.  They cannot reliably raise well adjusted individuals.

I hear the cries of we have a right!  It’s not fair!  I ask when did you have the right to do what was wrong?

Jesus would never condone such homosexual actions.  Why?  Because he loves us and wants us to be truly happy.  He has said no unclean thing can enter the kingdom of God.  He has defined homosexuality as an action that will defile an individual and disqualify him/her to enter the kingdom of God.  How can we be happy if we cannot enter God’s kingdom in the end?  You cannot.  Nor can you have peace in this life.

Again I’m sure I’ll be mocked as old fashioned and out of touch.  But true principles do not change regardless of whether you believe them or not.

One unchanging fact is that God lives.  I witness it, and am not ashamed to stand as a witness.   From my own experience I know God lives.

Go on ahead and call me a bigot.  Mock if you wish.   I stand for virtue, I stand for that which is right and good and beautiful.

Leave a Comment more...

c# Property Grid – Getting a combo box

by brian on Oct.31, 2008, under Uncategorized

You’d think getting a combox display into the property grid would be really simple to do since it’s used everywhere in Visual Studio 2008.  And although it isn’t horrible it isn’t exactly straight forward.  I found a couple of dead-ends, poorly explained, or difficult to find the pith of examples.  Finally I ran across this one at http://gaaton.blogspot.com/ It’s nice and concise, easy to understand, and easy to adapt.  I’m going to put in my sample which essentially taken from gaaton.

internal class ProtcolConverter : StringConverter
    {
        public override bool
            GetStandardValuesSupported(
            ITypeDescriptorContext context)
        {
            //True - means show a Combobox
            //and False for show a Modal
            return true;
        }

        public override bool
            GetStandardValuesExclusive(
            ITypeDescriptorContext context)
        {
            //False - a option to edit values
            //and True - set values to state readonly
            return true;
        }

        public override StandardValuesCollection
            GetStandardValues(
            ITypeDescriptorContext context)
        {
            return new StandardValuesCollection(
                new string[] { "net.tcp", "http" });
        }
    }

And finally the we need to attach the string converter to the property by the following.

[TypeConverter(typeof(ProtcolConverter))]
public string ServiceProtocol
{
     get { return MediaServiceConfig.WCFProtocol; }
     set { MediaServiceConfig.WCFProtocol = value; }
}

Enjoy.

Leave a Comment more...

c# Command Line Arguments

by brian on Apr.14, 2008, under .NET, Uncategorized, c#, coding

Here’s how you access the command line arguments:

string[] argv = Environment.GetCommandLineArgs();
Leave a Comment : more...

O how beautiful!

by brian on Mar.10, 2008, under Uncategorized

“…Oh how beautiful upon the mountains are the feet of him that bringeth good tiding, that is the founder of peace, yea, even the Lord, who has redeemed his people; yea, him who has granted salvation unto his people…” Mosiah 15:18

“…being filled with compassion towards the children of men; standing betwixt [me] and justice; having broken the bands of death, taken upon himself [my] iniquity and [my] transgressions, having redeemed [me], and satisfied the demands of justice.” – Mosiah 15:9

He lives.  I testify of it.  I’ve felt His heavenward pull, His encouragement all my days!  I stand as a witness of Jesus Christ and of his love.  Follow where He leads for He only leads to happiness.  Beginning steps may be painful, but  always, always, his ways lead to happiness.

Leave a Comment more...

c# Copying a 2 Dimensional Array

by brian on Feb.12, 2008, under Uncategorized

Here’s a snippet to copy a 2D array.

double[,] a = new double[3,3]{{1,2,3},{2,3,4},{3,4,5}};
double[,] b = new double[3,3];
Array.Copy(a,b,a.Length);

Pretty simple isn’t it!

Leave a Comment more...

c# and Linq

by brian on Jan.28, 2008, under Uncategorized

Today I’ve been working at the usual problems of querying internal data model then flushing the changes out to an sqlite database. This is a real drag. I was going to clean up the class and make it more to my liking, so I went to add a new class when I noticed a ‘linq to sql’ option. Then it struck me that this must be something like automatic mapping of programming objects to database much like is had in ruby and rails. If so this would save me a ton of trouble

Well I started to dig. Wow! I’ve been programming for more than 20 years and had many different paradigm shifts. First of functional programming, object oriented programming, patterns, state machines and finite automota, standard template library, Borlands vcl libraries, and now I’m thinking linq is the next big paradigm shift.

I can remember many years ago wishing I’d had a way to do sql queries on my internal objects instead of a for loop over the list. Well I do know!!! Whoo hoo!! This is where the Linq technology comes in. Take a look at the following example:

public class Person
{
  public int id;
  public string firstName;
  public string lastName;
  public decimal cash;
  public Person(int ID, string FirstName, string LastName, decimal Cash)
  {
      id = ID;
      firstName = FirstName;
      lastName = LastName;
      cash = Cash;
  }
}
....
List&gtperson< people = new List&gtperson<();
people.Add(new Person(1, "George", "McNommy",50));
people.Add( new Person(2,"Adam","Bobbly",1500));
people.Add( new Person(3,"Billy","Freddy",2212));
people.Add( new Person(4,"Caddice","Anderdotter",-34));
IEnumerable&gtstring< result =
     from person in people
     orderby person.lastName
     where person.cash > 0
     select person.lastName+", "+person.firstName+": $"+person.cash.ToString();

foreach (string r in result)
     log.Text += r + "\r\n";

And here the results as displayed in a rich edit box.

Bobbly, Adam: $1500
Freddy, Billy: $2212
McNommy, George: $50

I’m just scratching the surface here. This will make my life as a programmer so, so, so, much easier!!!

Thanks to Markus Egger for his article I’ve just begun reading and was so excited that I had to make a blog entry before I could finish the article. I sure there are more wonderful surprises coming.

Leave a Comment more...

C# writing and xml file.

by brian on Jan.11, 2008, under Uncategorized

Writing xml files in c# is fairly painless and straight forward. I’ll use XmlTextWriter in the following example.

using System.Xml;
string name = "Joe";
int age = 23;

// create writer
XmlTextWriter writer =
         new System.Xml.XmlTextWriter("test.xml", Encoding.UTF8);
writer.Indentation = 1;
writer.IndentChar = '\t';

// start the document
writer.WriteStartDocument(true);

// start an element
writer.WriteStartElement("templates");
writer.WriteAttributeString("version", "1.0.0.0");

// create a sub tag people
writer.WriteStartElement("people");

// create a sub tag person
writer.WriteStartElement("person");

// add the attribute age="23"
writer.WriteAttributeString("age",age.ToString());

// write out the full tag Joe
writer.WriteElementString("name",name);

// close out the person tag
writer.WriteEndElement();

// close out the people tag
writer.WriteEndElement();

// close the template tag
writer.WriteEndElement();

// end the document
writer.WriteEndDocument();

// close and write to file.
writer.Close();

Here is the resulting xml (formatting added)

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<templates version="1.0.0.0">
  <people>
    <person age="23">
      <name>Joe</name>
    </person>
  </people>
</templates>

As I said writing xml is a piece of cake. Parsing on the other hand… I’ll keep you posted.

Leave a Comment more...

Getting the current state of keyboard and mouse.

by brian on Jan.09, 2008, under Uncategorized

Every once and a while I need to know whether the Control key is being pressed when I process a mouse event. And sometimes I need to know the mouse position when a key is hit. Of course the keyboard modifiers aren’t passed in mouse events and the mouse button state isn’t passed in the keyboard events.

No problem. For keyboard modifier state use these properties:

Control.ModifierKeys

For the mouse state use these properties:

Control.MouseButtons

Cursor.Position // this one you can set :)

Control.MousePosition
Leave a Comment more...

c# .Net double buffering — plus a little

by brian on Jan.08, 2008, under .NET, GUI, Uncategorized, c#, c# coding GUI, coding

It seems I left out something that helps the quality of the .Net provided form double buffering when you are doing custom drawing. Just override OnPaintBackground and leaving it blank. This prevents the background from being momentarily drawn when you don’t want it to be.

so again here’s how to enable double buffering on the form:

this.SetStyle(
          ControlStyles.AllPaintingInWmPaint |
          ControlStyles.UserPaint |
          ControlStyles.DoubleBuffer,true);

And then the override

protected override void OnPaintBackground(PaintEventArgs e)
{
}
Leave a Comment : more...

Making a UserControl a design time container for controls.

by brian on Jan.04, 2008, under Uncategorized

It turns out that a user control can fairly easily become a container control during design time. In other words being able to put other controls within your user control is fairly straight forward.

The steps are as follows.

add the following to your usings section:

using System.ComponentModel.Design;

and then add the following attribute just above your declared class.

[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]

public class UserControl1 : System.Windows.Forms.UserControl

{
...
}

Then recompile the project and there it is.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...