Many .Net developers that have experience in presentation-layer development have previous exposure to this one, but to those who haven’t, I must share: Request.ApplicationPath is evil! Request.Application path should never be used. Ever. I hate it!
It’s misgivings are most commonly exposed when concatenating strings to the end of it to create a URL of some sort.
sURL = Request.ApplicationPath & “/someDirectory/somePage.aspx”
This is evil. Neither will work in all situations due to the method’s inconsistency with trailing slashes.
If the application root is in a sub-directory, say “http://server/myRoot/index.aspx”, then the appPath is “/myRoot”. Note: there is no slash at the end, and the above sURL gets a value of “/myRoot/someDirectory/somePage.aspx”.
If the application root is not in a sub-directory, say “http://server/index.aspx”, then the appPath is “/”. Note: there is a slash at the end, and the above sURL gets a value or “//someDirectory/somePage.aspx”. In this case, rather than requesting
“http://server/someDirectory/somePage.aspx”, wonderful Internet Explorer requests “http://somedirectory/somePage.aspx”. (I don’t fault IE for this. I commend it. It is actually one of the few cases where IE doesn’t kludge together a band-aid for Developer mistakes.)
So, don’t use Request.ApplicationPath. Ever. With no exception. You could make a method, perhaps MyUtilities.ApplicationPath, that checks to see if the return contains a trailing ‘/’, and if it does, give it the axe. This will turn your domain-root appPath to an empty string. Use your new method rather than Request.ApplicationPath, and all will be well with the world. But, don’t do it! Don’t make a new method. That just continues the evilness.
Use Page.ResolveURL(”~/someDirectory/somePage.aspx”) or the counterpart Control.ResolveURL if you want it to be relative to the control’s location. This is the only scenario you should use. ApplicationPath is evil!
In yet another post on the Xbox 360 and associated games and accessories, I am excited about the upcoming game lineup for Xbox Live Arcade. Contra has to be one of the coolest video games in the history of video games. I lost weeks of my life to that game. In addition, Frogger, Galaga, Dig Dug, Pacman, Defender, Sonic, and Street Fighter have all been announced. I’m going to be glued to my television, with nostalgia oozing out of my pores, once these things hit XBLA.
It is a bit old news by now, but this is all from E3. You can read all about it on microsoft.com.
Everyone is always seeking the old cliché, “a bigger piece of the pie.” I propose a new cliché, penned by a colleague, Dennis Burton: “Make the pie bigger.”
In my experiences and interactions with other people, when someone gets a bigger piece of the pie it is usually at the expense of the person that used to have that portion. A simple Google for “bigger piece of the pie” returns a slew of articles about somebody who is miffed because their buddy is getting a larger percentage that they are, or the buddy is miffed because somebody stole their piece. I say, “Make the pie bigger.” When the pie gets bigger, so does your piece of it.
Our company has a revenue sharing bonus at the end of every year. Anyone who has been with the company for three years evenly splits up 1% of the total revenue for the year. For 2006, roughly 20 people will be eligible for that bonus. Hypothetically, let’s say we made $10m in total revenue this year; that means I get a nice check in January for $5,000.
$10m x 1% / 20 people = $5,000.00/person
I could just seek a bigger piece of the pie, off Dennis, and I would get another $263! However, depending on what I did, Dennis is miffed because he lost his job or his wife his miffed because Dennis is dead.
$10m x 1% / 19 people = $5,263.16/person
But, what if I instead try to make the pie bigger? Let’s say some recruiter at “XYZ Placement Services” called me up trying to give me a job, and I refer the head-hunter to our head recruiting guy. Soon, we have a new Corporate-to-Corporate deal with “XYZ Placement Services,” helping them fill job openings, and suddenly we are an $11m company. I gross another $500, which is $237 more than if I off’ed Dennis. Dennis, his wife, and the other 18 eligible people are happy because they also gross another $500, and to top it all off, my boss is thrilled because I just brought in another cool million, so he gives me a raise!
$11m x 1% / 20 people = $5,500.00/person
So, do not be concerned with getting a bigger piece of the pie. Change your focus to making the pie bigger; it will make everyone else happy, too, and you might just get a raise in the end. And, if you are the boss, provide incentives for making the pie bigger, like revenue or profit sharing bonuses; you will look better, too, when your team is contributing to the bottom-line of the company.
If you are new to testing, are looking for some experience in testing, or just want to have fun breaking things, check out the WordPress Bug Hunt on 5 July 2006. The WordPress clan is holding a Bug Hunt against versions 2.0.4 and 2.1 in true “fixing them as fast as we can break them” style, as volunteer coders will be jumping on the bugs as fast as you can get them logged. These guys would truly appreciate any help you can supply, and you can have some fun unleashing all of those crazy testing / breaking / hacking tactics that sit in your closet.
WordPress is what runs this site, so your assistance ultimately helps me out, too.
Last weekend was the wife’s birthday. She hates having 14 different remotes to control the entertainment center; none of the “universal” remotes that came with any single component are really universal. The Comcast PVR universal remote cannot change inputs on the receiver. The receiver’s universal remote cannot access the PVR functionality of the Comcast box. So, for her birthday I got her a Logitech Harmony Advanced Universal Remote for Xbox 360. She loved it—or at least, the idea—but it sucked, so we returned it the same day.
I have heard great things about the Harmony remotes. The Harmony 360 is just another choice in the product line, with a few modifications:
- It controls the Xbox 360, out of the box
- It contains Y, X, A, B buttons to ease use of the Xbox via the remote
The Harmony 360 is nearly identical to the Logitech Harmony 550, except for different colored display (green vs. blue), different color casing (Xbox White vs. Black / Grey), and a few button changes (Y, X, A, B replace the Info / Guide buttons, though Y is sub-labeled ‘Guide’ and B is sub-labeled ‘Info’).
This is, or was, my first experience with the Harmony remotes. I am not a fan of this remote. Most of my distaste lies from the programming / editing software for the remote that is installed to your computer.
The interface is unbelievably slow After all, performance is important to me. The installed application (not a browser application) would regularly take 5+ seconds to switch between screens.
The “future proof” codes were incorrect
For my A/V Receiver, my Comcast PVR cable box, and for my TV, the codes were incorrect. Though it identified my receiver, a brand new Panasonic SA-XR57 released only a month ago, it didn’t even know the receiver had a DVR input. As the only other component-video-equipped input on my XR57 besides TV, I use it for my Xbox. The problem here is that the software forces you to choose an input for the Activities macros, after which you can specify additional custom commands. My “Play Xbox” activity macro included ‘Turn on the Receiver’, ‘Set the Receiver to TV Input’, then a custom ‘Set the Receiver to CustomInputDVRCommand’. A kludge. A hack. I’m not a fan.
The “smart help” wasn’t so smart The remote comes complete with a Smart Help feature via a Help button right on the remote that assists you when things go wrong. Because of my incorrect codes, the remote would do things wrong, but the Help would retry in an infinite loop. “Is your TV on?” No. [Sends IR command] “Did this fix the problem?” No. “Is your TV on?” No. [Sends same IR command] “Did this fix the problem?” No. “Is your TV on?” … It is quite annoying.
The remote went back into the box after 2 or 3 hours of trying to get it set up correctly. It was more hassle than the 14 other remotes. It was not worth $129.99. I am just going to save some cash, and pony up for a Pronto TSU7000. Touch screen, configure my own button layout using my own bitmaps (for the UI side of me), more programmable interface (for my Developer side of me), and a lot more control over how I want my remote to be.
The folks over at SvN found this gem. In another case of “Let’s all point and laugh” or “Don’t be that guy,” I direct you to Usability.gov, courtesy of the U.S. Department of Health and Human Services. Note the side-nav article on “Navigation: Left is Best.” Note how the navigation is on the right side.
Hanlon’s Razor. “Never ascribe to malice, that which can be explained by incompetence.”
If you haven’t bought an Xbox 360, yet, stop reading this and go buy one. Even if you do not play video games–I certainly don’t have much time to play them–then you still need one.
I finally convinced the wife a week ago. We picked one up from Best Buy with a copy of Need For Speed: Most Wanted. It is a great game, and I am quite addicted to it, but I’m more impressed with the non-game features.
Windows Media Connect 2.0. (Sell your CD player)
I have already disconnected my CD player. It is going in a box, and I will probably sell it at the neighborhood garage sale next weekend. All of my CDs were long ripped to MP3, so that they can be played on the computer or on the iPods. The only bad thing is the home stereo system has always been the best in the house, expectedly better than iPod headphones or the computer speakers. However, now all that has changed. The Xbox 360 will stream all of my music from my computer. I no longer have to pick 5 CDs and toss them into the player. I can just turn on the 360 (wirelessly, via the remote or controller) and play whatever music I want to play. I’m not even sure if I will ever even buy a CD, anymore, instead opting from some sort of digital media, like iTunes.
One of my favorite “Cool Features” with this is that you can play your MP3s while playing a game. You can replace the in-game music with tunes to fit your current mood, yet it does affect the other sound effects in the game (like the sound of the police car behind you in NFS: Most Wanted). Through the 360, you can also control the volume of the MP3s independently of the other game sounds.
iPod Friendly
I plugged in my iPod. They had a chat for a few seconds, and I was instantly able to play anything off my iPod, just as if I was playing through the iPod UI. There was no setup, no drivers, and (my favorite) no iTunes installation. The 360 just knew what it was, and that was that. It even uses the iPod name that you gave your unit for iTunes. So, in the 360 Dashboard, I have “Jay’s iPod” or “Amy’s iPod.” This was the system I used in the 2 or three days before I got my 360 on the network. Though it is really cool, I no longer needed it thanks to WMC2.0 and streaming MP3s from the computer, since all of my MP3s are on the computer.
It’s all Wireless!
This may seem small, but it is the feature to beat all other features: the unit is totally wireless. The controllers are wireless, and the controllers can turn on the unit. I no longer have wires running across my livingroom (well, I do when I play GameCube or PS2). And if I’m going to be playing the same game I just played, or if I want to play some tunes while I’m sitting on the couch reading a book, the controller can turn on the unit, so I can be lazy and never have to get off the couch.
Xbox Live Arcade
There are over a dozen (and growing) small, downloadable games you can buy from Xbox Live Arcade. My wife loves Hexic, a small Bejeweled-like game that came with the unit (I got the fully-loaded package), though it can be purchased on the Arcade. She is addicted to it. Soon I will also buy Bejeweled 2, Gauntlet (”Warrior needs food badly.”) and Joust. This feature was available on the original Xbox, though not as fluid. There are a bunch of cool Xbox-only games that I hope come over to the 360, soon, like Pacman.
As for the games:
Need For Speed: Most Wanted
I love this game. It is a mix of NFS: Hot Pursuit and NFS: Underground. I like this much better than either one. It has the city-based racing of NFS:U, without some of the street-racing types that I didn’t like, such as URL or street-X, and above all, drifting. The pursuit is much better than NFS:HP, as the cops are much smarter, and will tag-team you to box you in using 4 or 5 cars.
I did download the demo of Project Gotham Racing 3, and I liked NFS much better. PGR3 was too touchy for me.
The next games on the list to buy are Fight Night and Oblivion.
I’m finally catching up on some of the blogs that I haven’t checked out in a while. I came across an intriguing post (on 04 March 2006) by Daniel Grunwald on the #develop teamblog. It seems that he created a tool to analyze Subversion’s ‘Blame’ output to check the ‘Blame’ data from #develop repository and tell what percentage of the code was committed by each contributor. (Incidentally, he has contributed 27% of the application, according to the post’s screenshot.)
My analyzer program gets the person who committed each line of code. Additionally, it searches log messages for the term “patch by” and uses that name instead.
He admits that the tool may need some love, and that some of his parameters are hard-coded, but it may be worth a look. I’m curious to see the contribution stats on our LMS.
Additionally, it is coded in Boo. I’ve been meaning to check out Boo, and getting Daniel’s app working against our configuration might serve as a great introductory Boo task for me.
Most of our VS.Net solutions contain hundreds of files (classes) organized neatly into dozens of folders (namespaces), but despite all of this organization the vertical content size of the Solution Explorer can get quite large. Finding a particular file when the majority of the tree is expanded is tedious and time-consuming, considering it should be a simple effort of less than five seconds. Fortunately, all of this is solved by the click of a button (assigned to handy macro).
The most useful macro for Visual Studio that I have ever encountered (and in the running for most useful VS tool, period) is the CollapseAll macro authored by one current and one former colleague, Dennis Burton and Mike Shields. In a quick XP effort, Dennis and Mike created a handy macro that recursively collapses the entire Solution Explorer tree down to just the solution and its projects.
With the tree collapsed, it is easy to find that desired file.
CollapseAll Macro for Microsoft Visual Studio.Net 2003
Dennis Burton & Mike Shields | Published with Permission
Imports EnvDTE
Imports System.Diagnostics
Public Module CollapseAll
Sub CollapseAll()
‘ Get the the Solution Explorer tree
Dim UIHSolutionExplorer As UIHierarchy
UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
‘ Check if there is any open solution
If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
‘ MsgBox(”Nothing to collapse. You must have an open solution.”)
Return
End If
‘ Get the top node (the name of the solution)
Dim UIHSolutionRootNode As UIHierarchyItem
UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
UIHSolutionRootNode.DTE.SuppressUI = True
‘ Collapse each project node
Dim UIHItem As UIHierarchyItem
For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
‘UIHItem.UIHierarchyItems.Expanded = False
If UIHItem.UIHierarchyItems.Expanded Then
Collapse(UIHItem)
End If
Next
‘ Select the solution node, or else when you click
‘ on the solution window
‘ scrollbar, it will synchronize the open document
‘ with the tree and pop
‘ out the corresponding node which is probably not what you want.
UIHSolutionRootNode.Select(vsUISelectionType.vsUISelectionTypeSelect)
UIHSolutionRootNode.DTE.SuppressUI = False
End Sub
Private Sub Collapse(ByVal item As UIHierarchyItem)
For Each eitem As UIHierarchyItem In item.UIHierarchyItems
If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
Collapse(eitem)
End If
Next
item.UIHierarchyItems.Expanded = False
End Sub
End Module
Based on code from Edwin Evans
Here, the macro is so popular that it is a part of our default developer’s build for every new machine, and is conveniently assigned to a toolbar button. The default button icon list contains an Up Arrow (in the Change Button Image menu when customizing the toolbar) that seems quite appropriate. That little button has saved us all from a lot of pain, five seconds at a time.
|