Saturday, January 17, 2004

So it's now been a month since I've started this blog. And to quote Captain Jack Sparrow <quote author="Jack Sparrow">I think we've all arrived at a very special place... spiritually... ecumenically... grammatically.</quote> I'd personal would like to thank all four of you who reads this blog. If you read this blog either mistakenly or intentionally, I thank you.

At work we just got through the first step of a VA test. My part was giving strangers access to all of my code. Now for a developer, half of you goes sure here test it, I want you to check out my work, and the other part goes No, NaNaNaNaNa not listening, no, no no! But in the end your brain goes, this is okay, and you get over it.

Thursday, January 15, 2004

So last night I stayed at work a little later, and I got to work on my C# project. It was one of those times when things just flowed. What I needed to write was something that displayed files in a directory and I need to be able to specify the directory on the fly. So first thing I did a google search. So I come across this article from 4GuysFromRolla.Com on "Displaying the Files in a Directory using a DataGrid". This is almost what I need, however the examples are in VB.NET not C#, not really that big of a deal, just translate some syntax. So in the end what I wrote was a Datagrid that displays all files in a given directory, and that directory can change on the fly within the scope of my project.

So this is what my code behind looks like:
using System.IO; //very important

namespace secureload
{

public class download : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid downloadlist;

private void Page_Load(object sender, System.EventArgs e)
{

string dir = Request.QueryString["directory"];

if(dir == "")
{
dir = Session["dir"].ToString();
}
//gets the infomation for the DirectoryInfo Object and Create a string Array
DirectoryInfo dirinfo = new DirectoryInfo(HttpContext.Current.Server.MapPath(dir));
//Pass string array with file information to Datagrid's datasource
downloadlist.DataSource = dirinfo.GetFiles("*.*");
//bind datagrid
downloadlist.DataBind();

}
}


And this is what my datagrid code looks like:

<asp:DataGrid id="downloadlist" runat="server" Font-Name="Verdana" AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="Navy" HeaderStyle-ForeColor="White" HeaderStyle-Font-Size="10pt" HeaderStyle-Font-Bold="True" AllowSorting="True" Font-Names="Verdana">
<AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
<ItemStyle Font-Size="Smaller"></ItemStyle>
<HeaderStyle Font-Size="10pt" Font-Bold="True" ForeColor="White" BackColor="Navy"></HeaderStyle>
<Columns>
<asp:HyperLinkColumn DataNavigateUrlField="Name" DataNavigateUrlFormatString="dltrack.aspx?filename={0:d}" DataTextField="Name" HeaderText="File Name" NavigateUrl="dltrack.aspx?filename="></asp:HyperLinkColumn>
<asp:BoundColumn DataField="LastWriteTime" HeaderText="Last Write Time" DataFormatString="{0:d}">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Length" HeaderText="File Size" DataFormatString="{0:#,### bytes}">
<ItemStyle HorizontalAlign="Right"></ItemStyle>
</asp:BoundColumn>
</Columns>
</asp:DataGrid>



Now the one thing to now of the datagrid configurations is that I wanted my document urls to be dynamic. I want every download to be logged. So I need that url in the HyperlinkColumn. So in the DataNavigateUrlFormatString is where all of the magic happens. I add the url I want "dltrack.aspx" and my parameters, "?filename=" then to dynamically add the file names to the url you add "{0:d}". This adds the "Name" from the DataTextField field of HyperlinkColumn. DataNavigateUrlFormatString="dltrack.aspx?filename={0:d}" This seems to run pretty fast, and took lets time to code up then creating your own dynamic tables. In classic ASP, I would touch datagrids with a ten foot pole, but in ASP.NET they do actually make your life easier!

Wednesday, January 14, 2004

So last night, we went out and got the new Crystal Method album "Legion of Boom". I have been eagerly anticipating this release/ I really love this album. It keeps with the same groove that you would expect from them, however you can hear them growing as artist. There are some great collabrations on this album. One of them happens to be with Wes Borland. (Gutarist of Limp Bizkit fame) So, yes you are going to hear guitars on a Crystal Method Album. Songs like "Weapons of Mass Distortion" show that Method knows what to do with great guitar tracks, and Wes' playing is solid. Also there are some great vocal tracks on this album. "Born to Slow" and "Wide Open" have good lyrics and feel a little different them most Method songs, but they are really good. It shows the Method growing, and that is a good thing!
Well, I just loaded NewsGator in to my Outlook here at work. It is a really nice RSS reader. It really intgrates in to Outlook very well. Also I love the fact that it has a feature that lets you update your blog from within Outlook. Now it will look like I am workin' when I am bloggin'. I really like the way that it displays feeds. I am going to test it for a couple more days. But the way it looks right now, I am going to have to buy it. I was using clevercactus, and that works really good for me at home, but at work it just isn't powerful enough. Well, I don't know if it's that or, that it just doesn't seem to fit in to my workflow here at work.

Today has been another day of lots of work, but your not sure what you did. I mean I did some graphics work for the marketing department and it was even fun. But as a rule, if you are a web developer, try to hide how good you are at graphic design. You will be asked to pull double duty.

Tuesday, January 13, 2004

Today was a day that you work hard and long, and don't remember what you worked on. It wasn't one big thing. It was more like lots of little things. It makes the day go by, but you don't have the same sense of accomplishment, that you have when you work through a programming problem.

Ed got his linux web server up and running! (Go Ed!) He is using TikiWiki (written in PHP, PHP rocks), check it out!

Monday, January 12, 2004

I just got off the phone with my brother. It looks like him, and my other brother are going to be taking a job in San Diego. So K and J are going to be living down there. I am a little melancholy over it. My brothers have never lived more then 20 minutes away. 2 hours away is a big jump. I know they are going to be great. And I will make sure that I get to go and see them. It's just not going to be the same. And I won't get to see them as often.

Sunday, January 11, 2004

Well it was just another beautiful winters day in L.A. I went into work this morning and got what I need done, done. It actually went pretty well. We were having an issue with one of our Dell Servers. Every time we went to check the network properties it would flicker and close the properties window. So I did the easiest thing first. I uninstalled the NIC driver and reinstalled it. Viola`, back in business.

So I just fixed the intranet web server and saved a bunch of time, what am I going to do now? I'm going to Disneyland! And that is just what we did.(This is where being an Annual Passholder comes in nicely) When I got home, called my Folks and we (My Beautiful Wife and the Little Boy) met them down at the park. It was a beautiful afternoon. 77 degrees and blue sky's. (Now that is what I can winter!) We had great time. When went on the Autopia, which is the Little Boys favorite ride. Somehow, someway, My Dad, The Little Boy and I squeezed in to one car. The Boy steered, I manned the gas pedal, and Dad laughed all the way through the ride.

Next was Pirates of the Caribbean. Now this was my favorite ride when I was a kid and it is become one of the Boy's favorites too! So we scurried aboard. And we were off going through treasure troves, in between pirate ships and forts, and a quick trip to tortuga. By the end of the ride we were all singing "A Pirates Life for Me". Of course, none of us were singing in the same key, and if there was some harmony thrown in there, it was completely accidental.

After that we went to the "Golden Horse Shoe" to see Billy Hill and the Hillbillies. This is such a great show. They are bluegrass musicians with a sense of humor and gobs of talent. There is nothing like the bluegrass version of the Beatles "She's Got a Ticket to Ride" when they are wearing overalls and moptop wigs!

We had dinner at the Plaza Inn, which was very nice. It was great to get to spend an afternoon with Mom and Dad, My Beautiful Wife, and the Little Boy. It's days like today that make you remember why you work so hard during the week.