I buy a few tech gadgets once in a while (okay whenever I have the money for cool toys). And sometimes my fancy tech gadgets break. And I wonder if it is still under warranty (or if I filed the warranty at all). Well, this Lifehacker WarrantyElephant article discusses a new website called WarrantyElephant that has definitely convinced me to both fill out the warranty information and keep track of the information easily.
WarrantyElephant, in a nutshell, is a way to keep track of warranty information and receive alerts when your warranties are going to expire! I definitely recommend going to the website and checking it out. I am actually going to take out my file folder with warrantee cards and move them all to this site sometime later today.
I love things that make my programs act like vi when I need to edit or jump to things quickly. Among the vi addons I use are: viPlugin for Eclipse, viEmu for Visual Studio and SQL Server Management Studio, and Vimperator for Firefox.
I was coding on a rather large project recently using Zend Studio for Eclipse with viPlugin. It adds vi functionality to Eclipse, which is really handy for coding. I was talking to Chris Weldon about it and how I wanted to have the ability to copy multiple lines of code into reusable buffers. I use snippets in Visual Studio for this same functionality, and I knew vi had a way to do it, but I had forgotten what it did.
Buffers
Introducing buffers… Buffers are vi’s answer to snippets. By default, any time you delete, yank, or change an open file, that line is saved in the default buffer. But you can add your own custom buffers using the ” character. Example: “ayy would yank the current line into a buffer name “a”. To reuse that buffer, simply execute in command mode: “ap to paste below or “aP to append to the current position. Buffers are a great way to increase your efficiency when you absolutely have to repeat lines multiple times (say across multiple files).
Marks
I also showed Chris how to use marks, which are basically bookmarks in a document. Marks are added to a document using ‘<mark_name> (single quote – mark name). Example: If you are on line 50 of a file, and you do ‘a and then jump to line 75 (75gg), you can easily jump back to line 50 using ma (go to mark “a”). Both IDEs that I use regularly (Visual Studio and Eclipse) have bookmark functionailty built in, but it is generally a much more involved process to add and jump to bookmarks.
There is one caveat to using viPlugin and viEmu – they don’t allow you to show registers and saved bookmarks! Another vi plugin I use for Firefox (Vimperator) does allow you to show saved bookmarks and registers by using the standard vim commands :bookmarks and :registers, respectively. I have filed bug reports for them and hope to see this functionality appear soon!
I had a hard time getting IIS 6 on my newly reformatted Windows XP Professional 64-bit to serve up ASP.NET applications. IIS was not installed by default, so I installed it through the normal control panel operations. Then I ran aspnet_regiis -ir, and figured that was that. When I added a virtual directory on the default site, I assigned the document root to where my ASP.NET website was located. When I went to the page however, it gave me a 404.
After searching around the internet for a while, I ran across a blog post at ILoggable about the issue. You have to go into IIS Manager and enable ASP.NET v2.0 as a Web Service Extension. After that, everything worked fine!
I am currently working on a Test Driven Development (TDD) Flickr API library in .NET. There already exists a FlickrNet library that is written in .NET, but it was written without using TDD and is very tightly coupled to the methods that send requests to flickr. I’ve tried refactoring the library but it just isn’t easy.
Instead I’m writing my own that I will share with others that is TDD driven. But that isn’t what this article is about. I’m writing today about Linq-to-Xml. Linq is basically an ORM technology for abstracting queries. You typically query a lot of data in programming such as XML, databases, files, and collections of information.
Linq allows you to look inside that data and pull out only what you need without having to write parsing methods. This is a gross over simplification of the process, but you can always read more at MSDN.
So why am I bringing this up? Well, the Flickr REST responses are all XML, so naturally my library has to do a lot of XML parsing. To test XML parsing, I have to pass in a bunch of XML somewhere, parse it in my classes, and then do assertions that the objects I get back contain the same data that I sent in.
Originally my tests were looking something like this (FlickrBlogTests.cs):
[Test]
public void GetList_Returns_List_Of_Blogs() {
FlickrBlog blog1 = new FlickrBlog() { Id = “72″, Name = “Test Blog 1″, NeedsPassword = true, Url = “http://testblog1.com” };
string rawBlogResponse = “<blogs><blog id=\”" + blog1.Id + “\” name=\”" + blog1.Name +”\” … /></blogs>”;
List<FlickrBlog> blogs = FlickrBlogs.GetList();
Assert.That(blogs[0].Id, Is.EqualTo(blog1.Id));
}
Now, I started my actual code using Linq, so you will already see how Linq will come in handy. In the actual FlickrBlogs class code, I have a parse method like this:
private List<FlickrBlog> ParseResponseForBlogs(FlickrResponse response)
{
XDocument doc = XDocument.Load(new StringReader(response.RawData));
var query = from blog in doc.Elements(”blogs”).Elements(”blog”)
select new FlickrBlog
{
Id = blog.Attribute(”id”).Value,
Name = blog.Attribute(”name”).Value,
NeedsPassword = Convert.ToBoolean(blog.Attribute(”needspassword”).Value),
Url = blog.Attribute(”url”).Value
};
return query.ToList();
}
As you can tell, the test code is pretty shameful and difficult to change and test with. The FlickrBlogs code isn’t bad and it’s readable. Introducing Linq as a way to clean the test up:
[Test]
public void GetList_Correctly_Parses_Xml_Blog_Return()
{
FlickrBlog blog1 = new FlickrBlog() { Id = “73″, Name = “Bloxus Test”, NeedsPassword = true, Url = “http://remote.bloxus.com” };
FlickrBlog blog2 = new FlickrBlog() { Id = “74″, Name = “Test Blog 2″, NeedsPassword = false, Url = “http://testblog2.com” };
XDocument doc = new XDocument(
new XElement(”blogs”,
new XElement(”blog”,
new XAttribute(”id”, blog1.Id),
new XAttribute(”name”, blog1.Name),
new XAttribute(”needspassword”, blog1.NeedsPassword == true ? “1″ : “0″),
new XAttribute(”url”, blog1.Url)
),
new XElement(”blog”,
new XAttribute(”id”, blog2.Id),
new XAttribute(”name”, blog2.Name),
new XAttribute(”needspassword”, blog2.NeedsPassword == true ? “1″ : “0″),
new XAttribute(”url”, blog2.Url)
)
)
);
List<FlickrBlog> inputblogs = new List<FlickrBlog>();
inputblogs.Add(blog1);
inputblogs.Add(blog2);
FlickrResponse response = new FlickrResponse(FlickrResponseStatus.OK, doc.ToString());
commstub.Response = response;
List<FlickrBlog> blogs = flickr.Blogs.GetList();
Assert.That(commstub.Request.MethodName, Is.EqualTo(FlickrMethods.Blogs.GetList));
Assert.That(Is.Equals(blog1, blogs[0]));
Assert.That(Is.Equals(blog2, blogs[1]));
}
}
Robert Stackhouse wrote an excellent article on his blog titled Frameworks as a Means of Creating Transferrable Expertise. I started writing a response in the comments and ended up going off on quite a tangent. Thus, I’ve reposted parts of his article and my responses here, as well as some followup dialog.
It almost seems as if Microsoft and Sun and every other Framework author out there in the world figured out that training people is expensive, so let’s build a framework to reduce the cost of that training. It is much easier to spoon feed people than to teach them to think for themselves. Microsoft even went one step further and said, “Let’s go one better and try to get the poor schlep who doesn’t have 5 years experience to try to pay for the training themselves;let’s create a certification program.”
The alternative to Microsoft and Sun developing enterprise frameworks as large as .NET and Java is to have people still writing buffer overflows and string format vulnerabilities in C/C++. These frameworks have the huge benefit of making more secure code in many cases, as well as making it feasible for companies to even hire developers full time. If they figure that frameworks cut down development time, they are more likely to invest the money in IT in the first place, thus creating jobs for all of us.
I hardly think training is the issue here. If I had to chose between training someone to the point of proficiency in either .NET/Java or C/C++, I would chose a framework in a heartbeat. The time it would take for entry level programmers to learn C/C++ and the figure out how to be secure and develop worthwhile code would be prohibitive at best, and outright unfeasible at worst.
Certifications make sure people have basic skills and can as they claim. It all depends on the difficulty of the certification. I wouldn’t put much stock in someone with an MCP and little experience. Someone with an MCSD however I would give more attention, even if the relative experience wasn’t equal. The same goes for any IT sector – look at the Security+ (entry level) and the CISSP (serious professional).
Why is it that the same people who will ask every friend they have who the best mechanic in town is (instead of going straight to the Toyota dealer) will trust the word of a Microsoft certification over the word of a developer’s brethren or even his own code?
Again, this is context driven. Looking for a mechanic is a personal endevour that is something almost everyone deals with. Looking for a developer for a corporation is a different context entirely. By the same token, did you know that most of those dealerships won’t hire mechanics who don’t carry their companies certifications? Ford dealerships typically require a certification before they hire mechanics.
It again boils down to something akin to “you can at least perform at the minimum level we require, and we can teach you our development culture.” No two software projects are alike, but .NET is .NET, regardless of where it is used.
Granted not every development shop (even some of the ones who use Microsoft.NET) think this way. The only question is: would you rather have an employee who spends all day programing around the framework, or one that knows when to ditch the framework and look for another one or god forbid roll something from scratch?
The ones who know by instinct to ditch a framework for a more appropriate technology have most likely moved up the chain to a team lead position or management. I think we do have the problem of developers moving into management without having proper communication and management skills. We would almost never take a manager and say automatically that they would make a good developer, so why do we assume the opposite is true? Until our industry learns how to justify our software in the same manner that a machinist justifies a new lathe, we will always have this problem. I’ve seen this more times than I care to remember.
I also don’t really think we should be trying to optimize costs at a human level. Why don’t we instead invest in our employees, train them, and who knows maybe even wind up with a person who doesn’t hesitate to think for themselves and a little workplace loyalty in the end?
Again, look at it in context. Cost optimization at a human level goes on in every industry, not just software development. The salesman who sells two contracts a month will be replaced if he’s being compared to salesmen who sell 10 contracts a month. Can you guarantee that training him will ever pay off? This is the whole existance of HR and reorganization consultants. If you choose to ignore this area of optimization the organization may not recover and all the jobs will go away.
…all that being said, I agree that frameworks are not the holy grail. I think fast, core frameworks are the start and extensions to those are the way to go. There are jobs out there completely based on using things like Telerik controls, or Infragistics controls. These are build on top of a nice, extensible framework and they serve a purpose and create jobs. A company that would not be willing to develop that control themselves will be willing to pay for it and talent that can put it to efficient use for their purposes.
We are also still considered in the same boat as infrastructure services, which are not the same as software development. This is a fundamental flaw in my opinion. There are infrastructures (routers, servers, cabling, power) that is necessary AND a cost center. But software development produces “tangible” goods that can be used as a profit generator or at the very least an optimization of processes.
These are very different areas of IT but management still doesn’t separate them. We are getting closer with the advent of seperation between CIO/CTO, but few companies hire both. They are typically considered interchangable by uninformed upper management. Some even still put the CIO under the Finance department because they are seen as a cost center.