Samer Ibrahim's Blog

The Samer I Warrior on battles with .NET

Sponsors

Lists/Forums/Etc.

Which Blogs do I read?

April 2003 - Posts

Khristos Anesti
Khristos Anesti
Chris Sells' First Day at Microsoft
It's out.  Chris Sells officially started working at Microsoft today.  Those who have dealt with Chris in anyway can attest that he's a great guy.  He was kind of enough to work out a deal with me through his mentoring program to help me gain a fuller understanding of .NET.  I was working with Chris to redesign the "Ask The Wonk" section of his site but that project has now been stopped with him taking on his new position at Microsoft.  Congrats and Good Luck to Chris and his family!!  Congrats to Microsoft for hiring such a great asset and a person who is genuinely interested in the teaching and advancement of technology. 
Don't Get Bitten by Integer Division

My first story which is entitled "Don't Get Bitten by Integer Division" is now up.

It's about integer division in the CLR and how to avoid unexpected results.  I didn't want to make it a regular post because of it's length (a bit of code goes a long way).  Please take the time out and read it if you are interested.

Posted: Apr 18 2003, 04:46 PM by SamerEyeWarrior | with 1 comment(s)
Filed under: ,
Scott Watermasysk posts on the future of .NETWeblog

Scott posted about the .NET Weblogs losing popularity when compared to individual blogs on the site.  I don't doubt this.

 

Let me start off by saying, if anyone ever feels that I'm out of line in any of my posts just tell me.  I appreciate constructive critism.  I don't mind being wrong but what I do mind is continuing to do things improperly.  I believe the most people who read blogs are reasonably intelligent and have much to give back to the community.  At first, I tried to post everyday then I came to the realization that I'd rather have a blog that people read and respect than one that just spouts posts for the sake of posting.  Joel on Software, for example, only posts every so often, however, the content is well respected and draws quite a following.  I'm striving to keep my level of content high for that reason.  Hopefully I'm not slacking in that regard.

 

I really think the problem with the .NET Weblogs feed is it has turned into more a "forum" than a feed of individual blogs.  I've seen that a lot of posts on the .NET Weblogs that seem to be just redundant posts, either people just copying and pasting other people's posts from within the .NET Weblogs feed or commenting on them on their blog when it's more appropriate to comment in the comment section of the orginal poster's blog.  (There was a post a while ago about this but I don't remember where it originated.)  I've seen many posts that seem very childish in nature.  People seem to be battling on who's right and attacking each other through the feed as well.  To me this is a place to learn, right and wrong is a matter of opinion. just ask the Linux guys what they think.  In my perception, as the .NET Weblog grows, it will become more and more important for people to be cognizant of their wording and of their fellow bloggers.

 

Scott has worked hard to bring this site to life.  I think we all owe him the respect of following the rules he set out at the get go.  This site is set up to discuss .NET and all at no cost to us.  Our personal lives are important to our readers so they can find out who we are and the individuality of our blogs however let's not lose focus of our objective.  Let's make Scott proud and bring more readers to the site by improving the quality of our content and the level of maturity in posts.

Running as non-Admin

G. Andrew Duthie wrote:

So I'm going to re-issue my challenge...how about some help from my fellow dotnetweblogs.com bloggers? If you're running day-to-day using an Admin account, try for a week running without Admin privileges. I know it's possible, and it's not all that difficult. Let's try to set a good example for the developer community, and do our part to increase security for everyone!

Ok let's be honest here... Running as non-Admin ABSOLUTELY SUCKS.  There is no doubt about this one. I've been on the running as non-Admin kick on my home machine for a while and quite honestly it's not easy.  We're all used to the "god powers" on our machines.  Running as non-Admin you are more like a peasant than a god.  I find myself having to switch back and forth between account ALL the time.  I have some setup somethings setup as  "run as" according to Raj Chaudhuri's recommendations (look in the comments).  That makes it easier but hell running as non-Admin is still hard and not everything works.  Andrew is right however.  Running as non-Admin teaches you not to cheat as a programmer and security issues you never knew existed.  Follow Andrew, Anil, and Keith's recommendation but dont fool yourself into thinking it's easy.  It's not.

Running as non-Admin

G. Andrew Duthie wrote:

So I'm going to re-issue my challenge...how about some help from my fellow dotnetweblogs.com bloggers? If you're running day-to-day using an Admin account, try for a week running without Admin privileges. I know it's possible, and it's not all that difficult. Let's try to set a good example for the developer community, and do our part to increase security for everyone!

Ok let's be honest here... Running as non-Admin ABSOLUTELY SUCKS.  There is no doubt about this one. I've been on the running as non-Admin kick on my home machine for a while and quite honestly it's not easy.  We're all used to the "god powers" on our machines.  Running as non-Admin you are more like a peasant than a god.  I find myself having to switch back and forth between account ALL the time.  I have some setup somethings setup as  "run as" according to Raj Chaudhuri's recommendations (look in the comments).  That makes it easier but hell running as non-Admin is still hard and not everything works.  Andrew is right however.  Running as non-Admin teaches you not to cheat as a programmer and security issues you never knew existed.  Follow Andrew, Anil, and Keith's recommendation but dont fool yourself into thinking it's easy.  It's not.

More on "DataGrid Columns"

I have replies once again about my DataGrid Columns best practices post, from both Scott and Robert.  Scott pointed me to the Andy Smith's MetaBuilders website.  Thanks Scott.  Great website and awesome tools.  However, Robert was right and Scott is mistaken so while I'll be using some of these tools they aren't useful for this topic.

Robert seems to like the idea of using the DataGrid's Cells collection.  He likes pass the numeric column index as opposed to an columns enum in the Cells collection indexer.  Robert also thinks standardizing the placement of your hidden cells, eg putting them all at the beginning, removes the need for the enum all together.  Example of Robert's code:

myDataGrid.Item.Cells(0).Text   

I tend to put all my invisible columns in the beginning of the Cells collection just as Robert does.  However, if I was to use the Cells collection, it would be through an enum to improve readability in the code behind.  I also believe the columns enum allows the next coder to use whatever standard they want with the placement of their invisible columns as long as they update the enum.  Example of my usage:

myDataGrid.Item.Cells(myDataGridEnum.PersonIDColumn).Text   

In the end, however, I find using the FindControls function of the DataGrid is easiest to use to find a hidden value, as was discussed in my initial post.  The rest of this conversation will be taken offline, however, if anyone has any further comments please contact me.

Robert McLaws' reply to my "DataGrid Columns" post

Robert McLaws replied to my DataGrid Columns post here.  Unfortunately, it looks like Bob is guilty of one of the same crimes I find myself repeatedly doing; he did not read the post in it's entirety and quick on the trigger.  His suggestion is that I use the Cells collection via the column index or option 1) in my post.  The difference is he is using the column index directly whereas I'm using an enum that defines the index.  The problem as I see it with Bob's approach is two fold:

  1. What happens when I add a new column to my grid?  Do I have to go in and change every place where I use the Cells collection via the direct index?
  2. He says to use the first column for the hidden value.  What happens when I need more than one hidden value?

I find that if you are going to use the Cells collection, it makes far more sense to use an enum so if a column changes you only need to change the enum as opposed to every instance where you reference a Cell by it's index.  For example

public enum dgrdMyDataGridEnum
{
 FirstColumn,
 SecondColumn,
}

In my senario I would use myDataGridItem.Cells[dgrdMyDataGridEnum] whereas Bob would use myDataGridItem.Cells[0].  Looks like Bob's way is better until the all of a sudden I need a new column.  Now what for me nothing really all I do is go in and place a new item in my enum:

public enum dgrdMyDataGridEnum
{
 FirstColumn,
 ThirdColumn,
 SecondColumn,
}

For Bob, however, he needs to go in and find every place he referenced the column by it's index and update it.  This is an oversimplied example but I'm sure you can see the difference after examining it for a few seconds. (Note: In my enum nameing, the FirstColumn name represents the first column added not the first column in the DataGrid.  This is just for illustrative purposes.)

The second issue with Bob's approach is for multiple hidden columns I need to use Cells 0-n, n being the number of hidden columns I need minus 1.  This again comes back to problem one.  Plus you'll also note the readablity difference between 0-n and grdDGEnum.ColumnName when you properly name your enum columns.

I generally don't like the idea of using the Cells collection so that is why I'm leaning towards option 2 in my post.

DataGrid Columns

So today, I had a discussion at work about how to deal with retrieving information from hidden columns in a DataGrid.  Here's the senario:

You have a DataGrid with a CheckBox column.  When a user clicks submit you want to get the selected rows and perform a particular task on them.  Most of the time these tasks are performed using an ID number which is a hidden column of the DataGrid.  What is the best way to access the ID number?

For accessing the DataGridItems, we have the option of the Cells collection or the Controls collection.  To use the Cells collection, we need the index of the Cell.  To use the Controls collection, we could use the index of the control via the indexer of the controls collection or the name of the control via the FindControl method.

Here are the best ideas we came up with for both choice: 1) use a enum to define the column (or cell) indices and use the Cells collection; 2) put each of values we wanted to hide in Literal controls placed into a < asp:templatecolumn visible="False" > tag and use the name of the Literal control in the FindControl method of the Controls collection.  The first choice is less work when defining the DataGrid columns because you can simply use < asp:boundcolumn > columns and probably faster because there is no search necessary when using an index.  However, we opted for the second choice because there is no need to maintain an enum in the proper order of the columns of the DataGrid and if there are more than one control in a cell we would need to know the name or index of that control anyway if we used the Cells collection.  Most DataGrids have no more than 10 columns, therefore, what can the overhead possibly be for a search for the control by name?

Any ideas, thoughts, suggestions?  Anything overlooked or different ways?  What are other people doing?

SharpReader

I've been using been using SharpReader since it came out a couple of days ago.  I decided to spare you guys from the boredom of reading yet another "SharpReader is great" post even though it truly is.  SharpReader is another convincing reason for me that purchasing a news aggregator isn't worth it.  I think Luke says it best:

Quite frankly I think there are way too many good free RSS aggregators out there to make much of a living off creating one anyway.

SharpReader isn't perfect.  Without the ability to forward posts like NewsGator, I think it is very important for news aggregators to have a way to copy the link easily so you can IM or email it to a friend.  SharpReader doesn't seem to have this feature.  It also has a very annoying clicking sound every time you move to a new post or when it loses internet connectivity (happened when I was accessing my job's VPN).  Also on my wish list is the ability to have SharpReader minimize the same way Syndrilla does to the system tray and a better indicator for the arrival of new posts.  (I have trouble keeping track of what color is what.)  This is something I'm not sure about but it also seems SharpReader doesn't ever delete posts.  I like the ability to set the aggregator to delete older posts but keep newer ones like Syndrilla does.

I do like the way you move from one post to another in SharpReader as opposed to other news aggregators I've tried.  It reserves the space bar for scrolling through a post and the CTRL + UP or DOWN for going between posts.  There are many other beautiful features which have already been mentioned if you just do a search so no need to reiterate.

I've decided to make the switch to SharpReader.  With SharpReader coming in with an amazing splash and Syndrilla's chief developer on his's way out, I think it's a good decision.

PS  There is great discussion in the comment section of Sam Ruby's blog about news aggregators.

Update:  Apparently, I'm wrong about not being about to copy links.  Thanks to G. Andrew Duthie for letting me know.  I like being wrong sometimes :).

More Posts Next page »