Yes, it is true, I’ve switched to the dark side. The last bastions of VB.NET have fallen.
After a conversation with a pair of developers I work with, I have finally been convinced that C# is a better syntax than VB.NET. That’s saying something, considering I used to believe I liked my languages verbose. You know, like COBOL. There were three things in the C-based syntax of the language that bothered me:
- Case sensitivity
- Curly braces
- Semicolons
We came to a traffic light on our way home where a State Trooper was stopped with lights flashing. In front of the trooper was a minivan, obviously broken down in the right traffic lane. As we passed them on the left, our eldest made a comment.
“Ahh, a 30-year old woman,” he said, as if that explained everything.
Being in my thirties I was somewhat offended and unsure of the relevance of the driver’s age. “What does that have to do with anything?” I asked.
The 9-year-old answered: “You can’t trust those young hippies.”
While retail stores refer to the Friday after Thanksgiving as Black Friday because it celebrates the day they begin to turn a profit. Black Friday at our house is a different matter. Why? The Friday following Thanksgiving is the day Christmas begins. It is the day I trade in my sanity for what can only be described as Clark Griswald Syndrome (CGS). Our eldest son hates CGS because it means he won’t see his dad for three weeks. It means I’m up on a ladder somewhere. My wife hates CGS because I’m obsessing about our tree not having enough lights I’m sorry, 1200 lights on a 9 foot tree is nowhere near enough. The Outagamie Regional Airport hates CGS because airplanes must be routed around the beacon that is our house.
Since it was over 50 this weekend, I was talked into hanging lights outside this year. My photographer sister took some photos of the insanity – me on the aforementioned ladder assisted by the younger, and straddling the peaks of the house. I think the results speak for themselves, though. Inside is next.
In the Windows common Open/Save dialog, there are five folders traditionally listed on the left hand side: My Recent Documents, Desktop, My Documents, My Computer, and My Network Places. While these are all handy locations, I was hoping to include my source code folder in this list to save me some time browsing to the correct location during my client’s system testing phase.
Searching the internet, I found a hack at puppypy.com. Using a registry setting, you can change any of the five placeholders with a folder of your choosing. Additionally, you can choose from and change to a number of standard Windows locations. Puppypc even provides a quick web form that generates the code for the registry file.
In summary, you need to add a folder or two to the registry and populate a “PlaceX” value with your folder.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Policies\comdlg32\PlacesBar]
"Place0"="C:\\my folder\\"
I have my own personal holiday each fall. I call it “Picture Changing Day”. It isn’t set on any particular day; in fact, it is pretty random. Picture Changing Day is the day I bring in new 5×7 pictures of the boys and put them in the picture frames on my desk at work.
What makes that so special? The fact that I keep all of the old pictures in the same frame, each older picture stacked beneath a newer one. I only open up the frame on Picture Changing Day, so it is the only time of the year that I see how much my little men have grown.
On my client’s project one of my tasks was to write a search engine and corresponding UI screen. The results of the search are displayed using an asp:Repeater control in a pattern similar to Google. One more requirement is a section that pops open to reveal additional, less-frequently-used actions. Sort of a “dropdown” of more options.
I thought I would use a hyperlink with a call to javascript that toggles the display of a <div>. It seemed like the best solution within the context of the existing page.
With that in mind, I added some javascript to my ASP.NET page (using RegisterClientScriptBlock) without a problem. But when it came to adding the “more” link and the show/hide div, I ran into a serious issue.
What I really wanted to do in the repeater’s ItemTemplate was:
<ItemTemplate>
<a href="javascript:toggleDisplay('<%=pnlMoreLinks.ClientID%>');">show / hide</a>
<asp:Panel runat="server" ID="pnlMoreLinks" CssClass="morelinks">
Show and hide me!
</asp:Panel>
<ItemTemplate>
My thought was that it would render code to the browser along the lines of:
<a href="javascript:toggleDisplay( 'ctl00_ContentPage_Repeater_ctl01_pnlMoreLinks');">show / hide</a>
<div id="ctl00_ContentPage_Repeater_ctl01_pnlMoreLinks" class="moreLinks">
Show and hide me!
</div>
The problem is that causes a compile error:
The name 'pnlMoreLinks' does not exist in the current context
Not good. Outside of the repeater, the <%=pnlMoreLinks.ClientID%> works beautifully. Inside the repeater: compile error. It seems the reference to the asp:panel is not available to other controls in the designer. In case you were wondering, proximity had no effect either.
A quick check with the other smart people led to no real epiphanies though the designer. In the end, I manually set the reference in the link to the ClientID of the panel through the ItemDataBound event on the repeater. In the code behind, this method lets you control the formatting of each row as its being rendered. The ClientID of the panel is available at this point of the page’s life cycle.
protected void rptSearchResults_ItemDataBound(object sender, RepeaterItemEventArgs e) {
HyperLink link = (HyperLink)e.Item.FindControl("lnkMoreLinks");
Panel panel = (Panel)e.Item.FindControl("pnlMoreLinks");
if (panel != null && link != null)
link.NavigateUrl = "javascript:toggleDisplay('" + panel.ClientID + "');";
}
The repeater’s ItemDataBound method has been invaluable to me in a few other tasks… having more control of the repeater than is provided by the designer and data binding is essential to usable, well-built web apps.
And now I have a hide-able div in a repeater control. Sweet.
Each week, our youngest learns a new letter of the alphabet at day care. As part of the activity, the class comes up with words that start with the letter for that week. While most of the children think of words during their classroom time, our youngest likes to think of words at home. Normally, he makes me write them all down and the teachers tack the 3×5 card to the letter wall when he brings it in.
Last week he came up with about 75 words that started with “G”. Guacamole, Girard, ginger, geese and grow all made his list. As I helped him with it, I noticed he had missed a very simple one.
“You missed one,” I said. “It’s a fruit.”
He looked at me with a furrowed brow as he tried to think of a fruit that started with “G”.
“It’s round,” I offered.
He continued to think.
“You eat them for Sunday Night Supper ™.”
He thought some more.
I gave him an easy one: “They come in bunches.”
He smiled at me with the blank look that told me he hadn’t a clue.
“They can be green or red.” I smiled back.
Suddenly a look of excitement came over his face as he realized the answer:
“Ga-matoes!”
The wife and I went on a date this past Saturday. We had dinner at Fusion in downtown Appleton. It’s a pretty trendy place, so I ventured out of my normal steak and potatoes routine and had the Mako shark instead. The food tasted excellent, and it was sad to destroy its wonderful presentation.
After dinner we went to the PAC to see Mamma Mia. For those who don’t know, its a musical based completely on the music of ABBA. Despite that, it was one of the best shows I’ve seen.
My only complaint is that I thought it was a little bit too “United Nations”:
The music is by a Swedish pop group from the seventies.
The title is Italian(ish).
The play takes place in Greece.
Most of the characters are Americans.
There’s also a Brit and an Aussie.
37 Signals, the Web 2.0 darlings, published an eBook (in PDF format) last year called Getting Real. At the time, I had just bought their other book, Defensive Design for the Web. Defensive Design is a thin tome and is mostly screen shots with some quick notes describing them. After flipping through it a bit, I parked it on my bookshelf and, until I needed its ISBN, haven’t looked at since.
At the time, I passed on purchasing Getting Real. Recently, Fried and the gang have offered an html version of their book for free on their website. Sales must have tapered off or something. I read through it over the last few nights, and my review is as follows:
I paid nothing for it, and got what I paid for.
The book is simply a bunch of essays stitched together by the thread of marketing their products to their readers. Nothing in the book is new or particularly revolutionary. Some things are even scary… like working without any sort of a spec. As they admit, web apps aren’t the same as designing software for NASA, but there’s still a use for some documentation – like thinking through problems before you start solving them. Communicating with your customers and building some buzz ahead of launch make sense. That’s pretty much the playbook for the rest of the Web 2.0 followers.
Over all, it was worth reading, but had I plunked down $19 for the PDF, I would have been highly disappointed.
