Waynerd's

.Net Stuff and More

  Home  |   Contact  |   Syndication    |   Login
  14 Posts | 0 Stories | 12 Comments | 18 Trackbacks

News



Archives

Post Categories

Code Development Links

Thursday, July 27, 2006 #

Either ping –a or nslookup.

Ok, so I'm using this as a dumping ground for any tidbits that I would like to be able to remember.


Monday, March 27, 2006 #

Why, oh why, do people think that just because they are in the country, they shouldn't be deported?  I'll tell you why, because we have had a bad history of enforcing this law.  For years, immigrants have come across the Mexican and Canadian boarders in search for a better life, which, they probably find here.

Our country is host to several illegal and undocumented workers that they say, if deported, the jobs they fill will have no one to replace them.  Why is that?  Is it because we as American's don't want to do those jobs?  Perhaps we don't see that because they will work for a wage that is nearly half what the average American would work for.  But I believe that if we didn't have all those undocumented workers, and needed to fill thier shoes that we would be able enough people (teenagers, seniors etc....) that DO need those jobs and can better themselves by having those jobs available to them.  As it stands right now, they don't have a prayer.

I would never expect to be able to enter a country and expect the welfare, the medical, etc...without going through the naturalization process myself.  They are taking advantage of us and it needs to stop.

(I live in Southern California, where we are outnumbered by illegal immigrants).


Sunday, March 05, 2006 #

Ya know, of all things I'd expect to find in the news, this is probably the last one if not not really close.  http://hoth2014.com/ is putting thier bid in to host the 2014 Olympics on the ice planet of Hoth.  Yes Hoth.  I'm as big a geek on Star Wars as the next kid that grew up, waiting in anticipation of the next release after another...

Some of the signature comments on the petition are kinda funny, if not disturbing.  Amazing what free time can dream up.


Friday, February 17, 2006 #

So I'm trying to get a DataGridViewColumn to display an icon for me.  While implementing this is rather easy, I got stuck on the size of it.  I was confused....

If you look at the size on the .ico it said 16x16, however, when I added it to my resources for the App I'm writing, it appeared to change it to 32x32.  The result turned out that it showed in the data grid, however it was twice as large as I had wanted it, and dwarfed the text in the row next to it.

I finally figured out how to change the size of the icon and here is the result.

void dgUploadFiles_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
    
if
(e.ColumnIndex == 0)
     {
          e.Value =
new Icon(LFUClient.Properties.Resources.inifile, new Size
(16, 16));
     }
}

By creating a new Size object, you can specify the size you need your icon to be.  The above code looks at what column is being formatted.  In this case, I have an image column in first position (base 0).  While the formatting routine is running, I specify the icon to use by creating a new icon object and loading the icon I want from the resource file.  I also define the size by creating a ne Size object and applying it as a property of the new icon object.


Tuesday, February 14, 2006 #

You scored as Satanism. Your beliefs most closely resemble those of Satanism! Before you scream, do a bit of research on it. To be a Satanist, you don't actually have to believe in Satan. Satanism generally focuses upon the spiritual advancement of the self, rather than upon submission to a deity or a set of moral codes. Do some research if you immediately think of the satanic cult stereotype. Your beliefs may also resemble those of earth-based religions such as paganism.

agnosticism

100%

Satanism

100%

Paganism

79%

atheism

67%

Buddhism

63%

Hinduism

58%

Islam

42%

Christianity

25%

Judaism

25%

Which religion is the right one for you? (new version)
created with QuizFarm.com

Monday, February 13, 2006 #

Thanks go to Malcom for posting this today....I'm only spreading the love.  I'm drooling over this...


Can be found here.

Saturday, February 11, 2006 #

That's all I'm going to say...

Wednesday, February 01, 2006 #

The app I am currently building will need to be deployed to several users on our network.  So far from what I've experienced with ClickOnce, it is really on the right track.

My app has a dependency on the Web Service Enhancements 3.0 package.  The ClickOnce prerequisites determined that, and when my clients install the package, it installs the prerequisites as well.  I was initially wondering how it would handle dependencies that are not the norm (.Net redistributable, MDAC etc..).  WSE 3.0 was identified and installed without a hitch.

Absolutely fabulous!  Love it!  Read more about it here.


Sunday, January 29, 2006 #

Assuming you have a RichTextBox that you need to supply text to, and you want the control to auto scroll for you.  The following code will append some new text and a new line, and scroll to make the new item visible.

this.txtSessionLog.AppendText(“Some text“ + '\n'.ToString());
this.txtSessionLog.SelectionStart = this
.txtSessionLog.Text.Length;
this.txtSessionLog.ScrollToCaret();

From my research, there was some question whether the control needed focus or not.  In my implementation, I did not have to.  Also, I never knew you could do a newline like I did above.  No clue if it's a good way to do it, so let me know if it is or not.


Saturday, January 28, 2006 #

I'm pretty fond of this method, now that I have over come a few hurdles.  With .Net 2.0 out now, developers have another source to databind controls to.  We can now use a custom collection as a source for databinding.  Pretty cool.  However, there are some nuances that really got me down.

  1. Even though I have established my custom collection as a datasource for a list control, if I add or remove any items, my changes will not be reflected until I set the controls datasource property to the same collection object.  But that's not enough.  I come to find that you need to set the dataSource property to null first, before you apply the custom collection as the datasource.
  2. Now that you have done item one above, you see the new items, but the items only show the object type information, not the text as you wanted.  Hmm...ok, set the datasource to null, set the datasource to a custom collection, ah!  Since we set the datasource to null, we also need to reset the DisplayMember the control will use.  Duh!  We zapped out datasource information with applying null, and that took the DisplayMember info with it as well.  Nice.  Setting the DisplayMember to the public field name of your collection will provide that fields output.

The custom collection code:

///


///
The SessionLogItem exposes a string member named Text.
///

public class
SessionLogItem
{
      
///

      
///
Constructor
      
///

      
/// The string message you want to log

      
public SessionLogItem(string
message)
       {
             
this
.message = message;
       }
      
///

      
///
Holder for this items message
      
///

      
private string
message;
      
///

      
///
Provides public access to this items message.
      
///

      
public string
Text
       {
             
get { return this
.message; }
       }
}

///


///
Our custom collection. Implements CollectionBase.
///

public class SessionLogCollection :
CollectionBase
{
      
public int Add(SessionLogItem
logItem)
       {
             
return
List.Add(logItem);
       }
      
public void Remove(SessionLogItem
logItem)
       {
              List.Remove(logItem);
      
}
      
// Indexer for referencing the items by index
      
// Example: UploadItemCollection[0] = blah
      
public SessionLogItem this[int
index]
       {
             
get {return ((SessionLogItem
)List[index]);}
             
set {List[index] = value
;}
       }
}

With the above two gotchas taken care of, my final procedure for adding items to the collection, and having the listcontrol show this new data is this.  Note, this.SessionLog is a local property that references an instance of the collection.

public void LogItem(string message)
{
      
// Add a new item into the collection
      
this.SessionLog.Add(new SessionLogItem(message));

       // Update the datasource on the control, remembering to reset the
      
// DisplayMember property.
      
this
.lstSessionItems.BeginUpdate();
       this.lstSessionItems.DataSource = null;
//Wipes out DisplayMember property
      
this.lstSessionItems.DataSource = this.SessionLog;
//SessionLog is a Collection
      
this.lstSessionItems.DisplayMember = "Text"
;
       this
.lstSessionItems.EndUpdate();
}

Now, whenever something happens in the code (a long running process completes, something worth logging), I only need to call LogItem and pass in my message.  The listbox will be updated, and the world is a much better place once again, because the damn thing works now....

I beat my head for about an hour or two on the DisplayMember thing.  Hopefully this helps someone.


Monday, January 16, 2006 #

Found this little nugget o' knowledge.  There isn't a .ToByteArray method off the string object, so I found these procedures that will do this for me.

// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
    System.Text.ASCIIEncoding  encoding=new System.Text.ASCIIEncoding();
    return encoding.GetBytes(str);
}

also....

// Convert a byte array to a string
byte [] dBytes = ...
string str;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
str = enc.GetString(dBytes);


Sunday, January 15, 2006 #

So, had another round of Landscape Architects/Designers come out to quote me on the stuff we want done around the house.  I was really impressed with Designscape.  They seemed to have a more technical solution put in place.  Just need to find out more about how well that wheel turns.

Things we want done are:

  1. Backyard BBQ and wet bar - Jacque's number one item, and one of my favorites as well.  One of the benefits of doing this one is that the property will gain a room.  I need to read up on this, but I'm told that we can make our 3 bed a 4 by doing this.  And what is the added value we could see?  Need to do a cost/benefit on this, and the others too.
  2. Driveway - the driveway is now blacktop.  I'm considering pavers as a replacement.  As well, when the driveway is done, the walkways might as well match, right?  Good return in the form of added curb appeal.
  3. Side yard - We don't even use it now since we have no access to the backyard by it.  This project will strip all the shrubs that currently divide my property and my neighbors.  Planning on dropping down some cement to make a walkway with some flair added by the design company.  This will open up the backyard for access as well as provide a place for the trash cans.
  4. Various other little projects.

 


Saturday, January 14, 2006 #

Ok, so I'm working with the WSE 3.0 package and I have everything installed and I'm ready to code up a webservice.  I get the procedures built up and go to configure WSE and find that I don't have a link when I right click on the project to configure the WSE settings.  Hmm...where is it?

After a few minutes of trying to figure out why the link isn't showing, I head off to Google and find that there really isn't a ton of info out there on this particular issue.  What I do find is info on things that don't apply, happens all the time right.

One of the items I found suggested that you have Visual Studio already installed and running to resolve this.  Running?  Hmm....setup told me to shut everything down before install.  That doesn't seem to make sense, but I try it anyway.

During install, I decide to do a 'custom' setup rather than the 'developer' setup.  Guess what I found.  When you do a custom setup, there is an item to install the Add-In you will need in VS to setup the config files.  Nice.

Having VS open or closed has nothing to do with this issue.  It was user error.  I learn, yet again, always do a custom install and take time to review all that the install offers.