I went and purchased a mini DV camera, and overall I am quite happy with it. I got a Sony HandyCam DC-30. I got it on clearance at Circuit City. This camera has a lot of cool features, is nice and tiny, has a good feel to it in the hand, and can be expanded with wide angle lenses, telephoto lenses, external mics, and external lights. Great camera.... Now the bad part.
Apparently, I got a dud. The firewire port on the camera seems to be defective. Hooked it up to the Mac Mini, and nothing worked. Didn't recognize it. Checked it with Apple, and its on the compatible list. For the fun of it, tried it with a Win XP box. Same results. So, today, I took it back to Circuit City. They tried it with two different cables, on a host of machines, and same results. Sent it off for repairs. I'll post more once I get it back, and I am able to use it with iMovie.. I can't wait!
Monday, May 30, 2005
Sony HandyCam
Friday, May 27, 2005
CiCi's Pizza
We go to CiCi's Pizza quite regularly. Great pizza at an exceptionally great price! One thing that I always have thought strange though is that every time, they ask me, "Are Coke products O.K.?" And I have always wondered what they would say, if someone replied, "No." So today, I asked them... The girl was a little shocked by my question, but quickly replied with a smile, "I guess they would go without." For the record, they have tea and water as well. I just thought it was strange that they even ask.
Pesky Neighbors
The two old ladies who live across the street from me are at it again. First, a little history:
When we bought our house a little over five years ago, these two old ladies took it upon themselves to decide that they needed to tell me what I can and cannot do to items on my property.
We have a privacy fence that runs along one side of our yard, and along the back side of our property. Behind this privacy fence, there is a second chain link fence that sits on the property line. We had some ugly vines growing between the two fences, and so when we moved it, I took down the privacy fence and began to remove the bushes. Well, they tried to tell me that the bushes weren't mine, and that I couldn't remove them. I quickly pointed out that the bushes were in fact on my property, and that I was going to remove them. Not to be outdone, they continued that the basketball goal in my front yard (that had been there when we bought the house, and 15 years prior to that) was against zoning regulations. Again, I pointed out that it passed zoning regulations according to the appraisal of the property prior to us buying the house. Since then they have also tried to tell me that I can't park my mini van on the street!
It has been quite some time (about 3-4 years now I guess) since they have tried these tricks, but now they are at it again. This time it is the basketball goal again. They have tried to get some fellow who owns the house next door to them to tear down my goal. Now, even if the goal was illegal, he can't do that, and he quickly told them so. If this were such a problem, they could easily call the mayor's office, and take care of the matter that way, but they haven't done so. Because of that, I am quite confident the goal is within regulations.
So, why do these old ladies insist on making my life miserable? I have no idea, but I sure wish they would just leave me alone!
Wednesday, May 25, 2005
.NET and JavaScript
It's kinda like mixing oil and water, except in this case, .NET without JavaScript makes for a terrible user experience. But on the flip side, .NET with JavaScript can keep a programmer up for weeks trying to cope with the troubles that ensue when you start adding custom JavaScript to .NET pages.
Take these past couple of days, for instance. I created this custom server control for selecting a date. The control was comprised of 3 DropDownList controls, one for the month, one for the day, and one for the year. I created a sample application to test my control, and everything seemed to be fine. Then, I used the control in a much more elaborate project we are developing at work, and the control was broke. Same JavaScript. Same HTML rendered, but now, when the page posts back, the control no longer remembers it's state. I remove the JavaScript calls on the month and year drop downs, and the control remembers its state just fine.
So what's up with that? I began to look at the JavaScript that I was using. It was simple. When the month or year drop-downs changed, I wanted to update the day control so that it only gave valid day choices for the month and year combination. So I thought to myself, maybe something in what I am doing in the JavaScript, even though it works, is causing this broke behavior. So I kept the calls to the JavaScript functions in the drop-down change events, but I removed all of the code in the function, leaving empty functions. The control was still broke in the post-back, not remembering its state.
Then, I began to get creative. I decided to create another control, this time a text input control to house the date defined by the three drop-down inputs. When any of the drop-downs would change, I would put the combined value into the textbox. Once again, though, when the page posted back, the textbox lost its state too. So, I removed the JavaScript calls on the drop-downs, and the textbox remembered its state.
By now, this had gotten too strange for me. So, to keep from wasting any more time, I removed the JavaScript calls, and implemented the code to update the items in the day drop down in the SelectedIndexChanged event of the month and year. All works.
I have yet to figure out what the real cause to the problem is, but the same control used in one web app, worked. Used in a different web app, and it fails. Strange, strange, strange. If anyone would have an idea, let me know.
Tuesday, May 24, 2005
A Smattering of Items
Today, I have several items. I haven't posted regularly for the past few days, so I have a few items worth discussing.
First up, American Idol. Watched the last performances tonight, and I think that the contestants did OK, but definitely not their best. I would have to call this one a toss-up, and for me that's fine. They are both great, though I like Bo a little better.
Next on the list, ASF file format. This format is used by several digital video camera makes, including the Mustek DV4500 that my wife has. And I have to say, I HATE IT! Why, oh why, could they not just use MPEG-4... The side of the camera says "MPEG-4", but it's not. It's ASF MPEG-4. BIG BIG BIG DIFFERENCE!! And basically, it makes it useless to me as a Mac user. Even when using my Windows PC, I can't find a suitable application, commercial, shareware, or otherwise, for converting it to a format usable by iMovie. It would definitely be in Apple's best interest to license the codec for this file format for the iLife app's on Mac OS X. So, right now, I am looking to get a new MiniDV camera to take on our vacation. Hopefully, I can find something reasonable on eBay.
On the .NET front, I have been chugging along fighting it's idiosyncrasies for some time now. Nothing in particular today worth mentioning, though tomorrow, I will probably go into the details of a problem I spent most of the day today working on. I found the culprit causing my many hours of headache, but, the why aspect of it, I have not quite figured out. I'll talk about that more tomorrow.
I am getting ready to do some more work with the Mac OS X widgets this evening. I have been tinkering mostly with the graphics I want to use for my widget, and have gotten myself stuck in that mode, and have not really been productive. This evening that should hopefully change. I'll keep you posted.
Monday, May 23, 2005
Full Moon Fever
Last night, I got my telescope out and did some moon gazing with my little girl. She really liked it. It was good to have some father-daughter bonding. It wasn't too bad for viewing... at least for a few minutes anyways. It was a cloudy night, so we had to keep waiting on the clouds to pass. When we get a nice clear bright evening, I think I'll let her do some star gazing too. That should be fun.
Wednesday, May 18, 2005
My First Widget
I created my first widget. It's not that pretty yet, but it is functional. I have to do some more reading on best practices, etc, etc. Right now, I'm using aqua controls on my widget, and apparently that's a no-no. All the buttons should be graphical. The size of my widget is fixed, and I would like to make it resizable. Also, I want to maybe add a preferences flip-side to it.
By far, in my opinion, this is one of the coolest features in Mac OS X (Tiger). Anyone with some web development knowledge can create these little things. I'll write about creating a widget in a future post.
Tuesday, May 17, 2005
American Idol's Final Three
I watched AMERICAN IDOL tonight, and as usual, Bo was incredible. His acapella performance was nothing less than spectacular. I don't see how Carrie or Vonzell can compete. Granted, they are all very talented, and I enjoy listening to each of them every week, but I think Bo has got this thing all wrapped up.
As they say, "It's all over, but the crying." Well, for the girls anyways.
Mac OS X Widgets
Having played a little bit with DashBlog, it got me thinking. I should create my own little widget The pefect candidate, at least for me, would be to take the simple app that I wrote to convert source code to formatted HTML and implement it as a widget. It shouldn't take too long, and if I get the time, I'll whip it up this evening.
Sunday, May 15, 2005
Cocoa and Java
No, I'm not talking beverages, but rather a development API for Mac OS X.
This weekend, I got my new Macintosh Mini, and I love it. So being a developer, I had to try and make an application for it. Also, since complaining about the blogger.com WYSIWYG composer, I have wanted to create a small application to take source code, and format it properly for displaying on the web. A perfect chance to learn a new programming API on my new Mac.
It took very little time to learn enough of the basics to get my application working. Apple has some great tutorials on the their developer website. I had some trouble at first. I tried to create it using Objectve-C and Cocoa, but Objective-C's syntax got in the way, so I decided to go with Java. Some may say that Java and Cocoa will only lead to trouble, but until that happens, it works for me.
I'll post more as I continue to learn. Right now, my little app simply takes the source code in a TextView, and then converts the text into a nice HTML format in another TextView. It replaces spaces with non-breaking spaces, less-than and greater-than characters with the proper ampersand versions suitable for HTML, and tab characters with four non-breaking spaces. Next on my todo list for this little app is to give it some options for how I want the code formatted.
Friday, May 13, 2005
Selecting Items in DropDownList
This morning, I found an ineresting behavior with the DropDownList. Take the following two lines of code, which appear to do the same thing on the surface, but in reality do two completely different things.
ddl.Items.FindByValue(value).Selected = true;
ddl.SelectedValue = value;
The second one works as expected. The first one though results in two items being selected in the DropDownList.
Moral of the story:
When you know the value of the item in a DropDownList that you want to select, use the SelectedValue property to set the selected item in a DropDownList.
Thursday, May 12, 2005
ASP.NET Validator CSS quirks
I just came across another "fun" issue with the Microsoft validation controls within ASP.NET. Every validator provides a CssClass property so that the validators can be styled to suit the situation.
When a validator is rendered in HTML, it renders something like the following:
<span title="Required" class="requiredValidatorClass" id="ctl1" controltovalidate="userId_textbox" errormessage="Required" display="Dynamic" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;display:none;">Required</span>
Notice that it renders the class attribute and applies the css class name I provided, BUT (and it's a big BUT), it also renders the style attribute for the tag as well. So, basically, if you wanted your text in your validation message to be a different color other than red you get unexpected results. The rest of your CSS would be fine, except for the color.
There is a way around this though. You have to use the "important" designation in your css to give weight to your CSS color attribute. Here's an example:
.requiredValidatorClass {FONT: bold 8pt Tahoma, Verdana, Arial, sans-serif; COLOR: #990000 ! important; }
Wednesday, May 11, 2005
Dynamically Loaded Controls in ASP.NET
For the past few months, I have become quite familiar with the in's and outs of dynamically loaded controls within the ASP.NET web development framework. While this is a powerful framework in which to develop applications, it can also be quite frustrating and quirky at times.
For example, today I was working on a user control that when loaded, connects to a database and dynamically creates it's user interface based on the architecture defined in the database. This is all just fine, until it comes time to catch the events. In order to catch the events for the controls on the page, when the page posts back, the controls that were on the page must first be recreated. Once that happens, the ASP.NET framework will hook the events that were posted, and everything works as expected.
This is all well and good until the page needs to change what it looks like during the post-back. In my case, the controls which are loaded are completely different... Some of the controls that were there during the previous page load will remain, others won't, and some new ones will need to be loaded. So basically, what transpires during a post-back is a little bit of a kludge, in my opinion. First the page posts back and rebuilds it's control hierarchy. The events are then fired by the ASP.NET engine. During the firing of the events, I need to rebuild the controls, so the controls that were loaded, that no longer need to be around, are discarded. Now the new controls are added to the page. The page renders, and the result is returned to the user.
It just seems a little bit of a kludge to me. I don't think there is any better way though since the web is stateless. So I am no complaining, but for someone just starting out with this stuff, it can be quite confusing. It would be nice, if as a developer, I didn't have to rebuild the page to catch the events. I don't mind rebuilding the page, but if the events could fire without that step it would be great. It seems that this ought to be possible by using the ViewState hidden controls in some way. But until that happens, just remember to rebuild the page just like it was before the post-back if you expect to catch any events.
Tuesday, May 10, 2005
Say What?!?
While driving home today, I was passed by a black Jeep with Kentucky tags, and two strange bumper stickers on the rear bumper....
The two bumper stickers where the following:
- Free Floyd Collins
- Garbage Kills Bears
I got home, and decided to look up the Floyd Collins one, and it seems it has something to do with amnesty. No idea where, or from what. The second one, I just had to chuckle....
I think I am going to put a bumper sticker on my van that reads:
Bears Kill People
Monday, May 09, 2005
IE Javascript Quirk
Today, while coding some javascript, I came across a javascript quirk that seems to affect only my workstation at the office. Here's the offending source:
<html>
<body>
<a target="_blank" href="http://www.yahoo.com">Yahoo!</a><br/>
<span onclick="window.open('http://www.yahoo.com');">
Yahoo!
</span>
</body>
</html>
Seems harmless, right? Well, that's what I thought as well. And it is harmless, except on my machine at work. What happens there is just short of bizarre. I click on either item, the link, or the spanned text, and a new window opens. The little windows logo starts animating like the page is attempting to load. But, nothing ever happens. It just keeps doing that for quite some time. I never let it finish, because after a minute of not loading anything, I am quite sure it will fail. So, I click the stop button. Then, in the URL bar, the link appears, and I get the page could not be loaded text in the window. A simple click of the refresh button, and the page loads.
I tried the same page on Firefox on my workstation, and everything worked as expected.
I did some googling, and found others with similar issues, but none of the resolutions solved my case. I also found something concerning it on MSDN, but it required manually re-registering dll's and rebooting after each. I had too much work to do to try that, but I did try the one it mentioned as most likely being the cause, and it didn't help.
Anyone else out there experience anything like this? I'd love to hear about it, and if you found a resolution to the issue.
Real ID
I rarely, if ever, take the same side on an issue with the ACLU, but in this case, I think I just might have to:
How Real ID will affect you
Sunday, May 08, 2005
What Kind of American English do You Speak?
I now know what kind of American English I speak.
| Your Linguistic Profile: |
| 65% General American English |
| 20% Dixie |
| 5% Midwestern |
| 5% Upper Midwestern |
| 5% Yankee |
Mother's Day
Today we celebrated Mother's Day. We had excellent weather, so I was able to finish the project I started yesterday -- painting our front porch railings. I cleaned the railings yesterday. It had been 5 years since anything had been done to them, and they were in dire need of some attention.
So after church today, we ate, I took a nap, and then painted the railings. They really look nice now. It's one of those things where you just dread doing it, hate it the whole time you are doing it, but once it is done, you are so glad that you did it.
I've still got to get the front porch swing painted, and in a few weeks, we'll be setting up our pool for the summer. It's finally starting to feel like summer, and I for one, am enjoying it!
The Lady in Black
Tonight, I watched the NASCAR race on television. I participate in a NASCAR fantasy league that our church has. I had been doing well, and was in second in the standings overall... but, tonight the Lady in Black took her toll on me... Dropped a spot in the standings, falling from a little over 60 points back from the leader to over 200 points back.
Sometimes, it just doesn't go your way.
Friday, May 06, 2005
Blogger.COM Composer
Well, I have to say... Blogger.com's WYSIWYG editor is the pits. Hopefully, I'll figure out a good way to create posts containing code snippets in a way that works.... Until then... bear with me.
ASP.NET Repeater Woes
This week, I have spent a good deal of time learning the inner-workings of the Repeater web control of ASP.NET. I have also spent a good deal of time being frustrated with it. So, to hopefully save some others some time, I have decided to post my findings.
I have found that there is a lot of information on creating and working with Repeaters when you are doing things in a typical form. By typical, I mean, you create a webform page (mypage.aspx for instance), create all the fun html anf asp.net tags jsut so so, and then use the code-behind page to fill in the data and catch events, etc, etc etc. However, there is very little good information on dynamically creating a repeater, its templates, and populating its datasource, and maintaining all of that through post-backs.
So here's my scenario... I wanted to create a repeater control dynamically when my page loaded, complete with custom header, custom item, custom alternating item, and custom footer, and I wanted to create all of this dynamically. Also, in each item, and alternating item, I wanted to have image buttons that could be clicked, and I wanted to catch those click events, and do some more processing of the data. Not every row, however would have these buttons. The details as to why I wanted this are not really important, so I'll leave those out.
Everything seemed to be fine... at first. My page loaded, the repeater was populated with the data, and all appeared just as I expected. Then I clicked one of my buttons. The page posts-back, and poof, my data is gone, and I didn't catch the event from the repeater. So, I started pouring through google looking for an answer. I found a lot of good information, but nothing that described my scenario exactly.
So, like most hackers I began to tinker with my code... and tinker, and tinker. Nothing I tried seemed to work. So, come the end of my day at work, I decided to go for a run, and come back to it later.
After my run, I had an epiphany. I created a simple test of the conventional way of putting a repeater on a web page. Here's what I had so far:
"webform1.aspx"
<table>
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td><%#Container.DataItem%></td>
<td><asp:button ID="button1" Runat="server" CommandName="cmd" CommandArgument="1"></asp:button></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
"webform1.aspx.cs"
private void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
ArrayList data = new ArrayList();
for(int i = 0; i < 10; i++)
{
data.Add(i.ToString());
}
this.Repeater1.DataSource = data;
this.Repeater1.DataBind();
}
}
private void Repeater1_ItemCommand(object sender, ItemCommandEventArgs e)
{
((ImageButton)sender).Enabled = false;
}
So I did that, and everything worked as expected. I caught my events as expected, and the data remained through the post-back. So I thought, this is doing exactly what I am doing when I create the control dynamically... the only difference is that the control hierarchy is defined in my aspx page. So what's the deal?
Some more pondering, and it came to me. I was creating the controls WITH the dynamically rendered parts from the data in my item template class. It seemed that the conventional way was doing this too, but I thought, maybe it's not. Let me try creating the controls, as placeholders, if you will, and then when the repeater binds its data in the ItemDataBound event, then update the control to reflect the dynamically generated parts. BINGO! It worked. Here's what I had at this point:
"webform1.aspx"
<table>
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td><%#Container.DataItem%></td>
<td><asp:button ID="button1" Runat="server" CommandName="cmd" CommandArgument="1"></asp:button></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
<asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>
"webform1.aspx.cs"
private Repeater results;
private void Page_Load(object sender, System.EventArgs e)
{
results = new Repeater();
results.ItemTemplate = new RepeaterTemplate();
results.ItemDataBound += new RepeaterItemEventHandler(results_ItemDataBound);
ph.Controls.Add(results);
if (!this.IsPostBack)
{
ArrayList data = new ArrayList();
for(int i = 0; i < 10; i++)
{
data.Add(i.ToString());
}
this.Repeater1.DataSource = data;
this.Repeater1.DataBind();
results.DataSource = data;
results.DataBind();
}
}
private void results_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
ImageButton b = (ImageButton)e.Item.FindControl("button");
b.Text = e.Item.DataItem.ToString();
}
class RepeaterTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
ImageButton button = new LinkButton();
button.ID = "button";
container.Controls.Add(button);
button = null;
}
}
Now, my page loaded, the repeater got its data, and when I clicked the buttons, the page posted back, and the data all seemed to be intact. Now, though, how was I going to link my events up?
Normally when you add a button to a repeater, the event bubbles up the repeater, and you capture the event in the ItemCommand event. But could I just assign an event handler to the button and handle it that way? And how would this work for all of the buttons? Well, i need to create the event handler, and assign it to the button, but where should I do this? I knew that the ItemDataBound event only occurs when the repeater is bound to the data source. This only happens once, and I need this to happen every time the page is loaded, post-back or not. So, I have to hook it up in the ItemCreated event. This happens everytime the page loads. So, I have this now:
"webform.aspx.cs"
private void Page_Load(object sender, System.EventArgs e)
{
results = new Repeater();
results.ItemTemplate = new RepeaterTemplate();
results.ItemDataBound += new RepeaterItemEventHandler(results_ItemDataBound);
ph.Controls.Add(results);
if (!this.IsPostBack)
{
ArrayList data = new ArrayList();
for(int i = 0; i < 10; i++)
{
data.Add(i.ToString());
}
this.Repeater1.DataSource = data;
this.Repeater1.DataBind();
results.DataSource = data;
results.DataBind();
}
}
private void results_ItemCreated(object sender, RepeaterItemEventArgs e)
{
ImageButton b = (ImageButton)e.Item.FindControl("button");
b.Click += new EventHandler(b_Click);
}
private void b_Click(object sender, EventArgs e)
{
((LinkButton)sender).Text = ((LinkButton)sender).CommandArgument;
}
Now, one more piece... I need to distinguish which button was clicked. I thought that I could simply use the CommandArgument property on the ImageButton, and, sure enough, that worked. Here's the final piece of code:
"webform1.aspx.cs"
private void Page_Load(object sender, System.EventArgs e)
{
results = new Repeater();
results.ItemTemplate = new RepeaterTemplate();
results.ItemDataBound += new RepeaterItemEventHandler(results_ItemDataBound);
ph.Controls.Add(results);
if (!this.IsPostBack)
{
ArrayList data = new ArrayList();
for(int i = 0; i < 10; i++)
{
data.Add(i.ToString());
}
this.Repeater1.DataSource = data;
this.Repeater1.DataBind();
results.DataSource = data;
results.DataBind();
}
}
private void results_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
LinkButton b = (LinkButton)e.Item.FindControl("button");
b.CommandArgument = e.Item.DataItem.ToString();
}
So, hopefully this will help some other poor soul hacking away with the Repeater, and getting nowhere.