Sam McDonald's Blog http://sammcd.com Sam McDonald's web site and blog. en-us sam@sammcd.com Rewriting the Microsoft Ad Campaign http://feedproxy.google.com/~r/sammcd/~3/oHHfPJ5ljxk/Rewriting-the-Microsoft-Ad-Campaign <p>Microsoft’s recent Ad campaign has been been clearly ineffective. Microsoft has decided that the best course of action is to retaliate directly to the Apple ads, however they are clearly the underdog on Apple’s turf and the public is smart enough to see. If Microsoft wants a successful ad campaign they need to show their strong points, business and games.</p> <p>Microsoft, it is time for you to stand up and show your strength. Your simple numbers in the business world are amazing, and you should use that to make everyone else feel inferior. Make me believe that if I buy an Apple computer I will not be able to be a successful businessperson. Show me that I won’t be able to properly talk to exchange. Show me that business software runs on PC’s. Show me that if I want to function as an adult in this world I must have a Microsoft computer. Otherwise, I’m some jobless art student. Let Apple have the art students, they don’t like you anyway. Focus on your strengths.</p> <p>Tell me that schools run mainly on Microsoft software. Make me fear what I am giving up. Apple’s version of word is crap, and make me know it. If I were to walk in an Apple store I should fear what I am losing. Make the switchers afraid. Tell me that the world runs on Microsoft.</p> <p>When it comes to games you have this market too. Heck, many of the current games that run on mac run under <a href="http://en.wikipedia.org/wiki/TransGaming_Technologies">wine</a> which makes the same performance near impossible. If you don’t want to make your platform the “gaming platform” thats okay. Make the connection. Tell me that since my computer doesn’t have DirectX that it is simply an inferior computer.</p> <p>Its simple, you have money, you have the business market, you have the gaming market. Do something with these things. Show your power, not your weakness.</p> Sam McDonald Mon, 08 Dec 2008 03:20:12 CST http://sammcd.com/blog/2008/12/08/Rewriting-the-Microsoft-Ad-Campaign http://sammcd.com/blog/2008/12/08/Rewriting-the-Microsoft-Ad-Campaign Where the programmer fits in the Kingdom of God http://feedproxy.google.com/~r/sammcd/~3/cPOtSfQFEhU/Where-the-programmer-fits-in-the-Kingdom-of-God <p>As a Programmer, and as a Christian, I have always wondered how the two intertwine. I think it is good to glorify God with the skills that he has given me. Those skills are in the area of programming, but at the same time programming is a very recent trade. The bible obviously has no reference to programmers or computer science (CS), and something about this seriously bothered me. At the time it was even hard to pinpoint exactly what was bothering me, but after thinking about it I realized that the problem was that I couldn’t find a spiritual connection between programming and God.</p> <p>A couple months ago I was in a bookstore, and stumbled across the book, <a href="http://www.amazon.com/gp/product/0201835959?ie=UTF8&amp;tag=sammcdcom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0201835959">The Mythical Man-Month</a> by Frederick P. Brooks. I had heard a lot about this book from both professors and from CS blogs. The book stands out as an anomaly in the CS book genre. Very rarely does a CS book last more than a few years, because of changing technology, but this book was still for sale in a store after being first printed over 30 years ago (1975). The reason is because he does a great job of talking about managing computer scientists, in a way that is still relevant today. However, the passage that I enjoyed most came in the first chapter. It reads, </p> <blockquote> <p>Why is programming fun? What delights may its practitioner expect as his reward?</p> <p>First is the sheer joy in making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God’s delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake.</p> </blockquote> <p>It is a pretty easy connection. The programmer is of the same breed as any occupation that turns thought into a tangible item. Under this idea it is easy to see similarities between the programmer and the architect, or even the carpenter. </p> <p>It is possible that this came as common sense to most programmers, but to me it didn’t. To me it meant seeing that something I love to do comes from the nature of God. It meant that when I sit down, and program, and am loving my work. I am loving something that is of the image of God, which really helps to put things into perspective.</p> Sam McDonald Fri, 05 Dec 2008 15:31:54 CST http://sammcd.com/blog/2008/12/05/Where-the-programmer-fits-in-the-Kingdom-of-God http://sammcd.com/blog/2008/12/05/Where-the-programmer-fits-in-the-Kingdom-of-God Improving the Mac Installation Process http://feedproxy.google.com/~r/sammcd/~3/F1lLUN771mI/Improving-the-Mac-Installation-Process <p>About three years ago I bought my first mac. I remember downloading my first third-party application. Once it downloaded, I was greeted with something that looked a lot like this:</p> <img src="http://media.sammcd.com/img/ctminstall.png" alt="Countdown Maker Install"/> <p>So, what did I do? I double clicked the program icon, and the program launched. Even though the program launched and was working, there where a few things that bothered me. First what was that DMG thing? Where does my program go, when I eject the DMG? So, I ended up dragging the application to my Applications folder, and all of my worries disappeared. </p> <p>Although this process felt a bit awkward, I didn’t let it bother me. It was much better than what I was used to on windows, and it gave me a great sense of control, so I stopped worrying about the awkwardness and continued to install all kinds of third party applications on my mac.</p> <p>I didn’t think twice about the install process, until I downloaded a Dashboard Widget. Once downloaded, I was greeted with this:</p> <img src="http://media.sammcd.com/img/dashboardinstall.png" alt="Dashboard Widget Install"/> <p>Once install is clicked the strange file that I downloaded disappears into nothingness and I end up with dashboard widget perfectly installed to the proper place. So, why can’t my third party application be installed that easily?</p> <p>So, here is the part where I blame apple because obviously it is their problem. But the more I think about it, every apple application I have ever installed has used an installer. Some third party applications do the same, but it has become common practice that if you don’t need an installer, you shouldn’t use it. </p> <p>I then realized that, as third party developers, we really have all the tools we need to to change this install process. It would be quite simple to create and an application that could run from a DMG to move a third party application to your applications folder. So, in the end, this has become one more project on the “to do” list for me.</p> Sam McDonald Fri, 28 Nov 2008 02:52:24 CST http://sammcd.com/blog/2008/11/28/Improving-the-Mac-Installation-Process http://sammcd.com/blog/2008/11/28/Improving-the-Mac-Installation-Process The Problem with Databases http://feedproxy.google.com/~r/sammcd/~3/rXQ-YJDadYc/The-Problem-with-Databases <p>After working on both web and desktop apps, I must say that there is a gaping hole in web development in the area of databases. Specifically, there is a large disconnect between the data structure (schema) and the business logic, that for the most part, developers are ignoring.</p> <h4>The Problem</h4> <p>When writing a desktop application, data storage is simple and elegant. I simply get a top level view of the data (usually a dictionary), and send it a message to turn into file data. Every object in that dictionary knows how to package itself, and how to unpack itself. With this simple elegant approach, saving and loading is solved on the desktop. Here is an example from an iphone app I recently wrote:</p> <codecolor> - (NSDictionary*)dictionaryForSaving { NSDictionary* dictionary = [NSDictionary dictionaryWithObject:cardsArray forKey:@"cards"]; return dictionary; } </codecolor> <p>Of course the web can’t be quite as simple as the desktop. For one, instead of saving data for one user, I am saving data for everyone, but this isn’t where my gripe is. My problem is simply that the data storage is completely disconnected from the code written to access it. If I were to hand you a PHP application without any information on the schema, it would be a nightmare for you to run it. This means that that open source php apps such as <a href="http://wordpress.org">wordpress</a> are forced to write database creation code. Although the code should create the database as well as use it, the facilities to do this elegantly in PHP just don’t exist.</p> <h4>The MVC Approach</h4> <p>In the web a programming world there has been a large jump towards MVC (Model View Controller). <a href="http://cakephp.org">CakePHP</a> and <a href="http://kohanaphp.org">KohanaPHP </a> are great examples. Abstracting the model out in this way is a great push in the right direction, however this does little to solve the problem of the disconnect, if I am given this code without knowledge of the schema, I still have a lot of work to do.</p> <h4>A move in the right direction</h4> <p>So what is the right way? After using Django to program this blog, it is definitely a push in the right direction. Take a look at my model for a comment on the blog:</p> <codecolor> class Comment(models.Model): post = models.ForeignKey(Post, blank=True) text = models.TextField() name = models.CharField(max_length = 50) email = models.EmailField(blank=True) url = models.CharField(max_length = 100, blank=True) def __unicode__(self): return self.email </codecolor> <p>This segment of code contains everything I need for comments. I don’t have to write a single query. Instead of writing an SQL query to get all posts for a particular post my code looks like this:</p> <codecolor> comments = Comment.objects.filter(post__id=post.pk) </codecolor> <p>Now to get back to the main issue, schema description. Those 8 lines of code aren’t only everything I need to have full control over the model, but as you can see, they also describe my schema for a Comments table. After running a simple python command that model is converted to this database schema:</p> <codecolor> mysql> desc blog_comment; +---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | post_id | int(11) | NO | MUL | NULL | | | text | longtext | NO | | NULL | | | name | varchar(50) | NO | | NULL | | | email | varchar(75) | NO | | NULL | | | url | varchar(100) | NO | | NULL | | +---------+--------------+------+-----+---------+----------------+ 6 rows in set (0.00 sec) </codecolor> <h4>Where it should be</h4> <p>Although this is a step in the right direction, there is still much more that should be done. First, this type of model needs to be happening in more places specifically php. If anyone knows of anybody that is currently doing this, I would be very interested, but so far I don’t see any popular attempts. Also, Django is definitely not purpose, there is no reason why my database can’t be edited when I edit my model, but the current solution is to recreate the table upon editing. </p> Sam McDonald Sat, 22 Nov 2008 17:31:19 CST http://sammcd.com/blog/2008/11/22/The-Problem-with-Databases http://sammcd.com/blog/2008/11/22/The-Problem-with-Databases Dropping Subversion for git http://feedproxy.google.com/~r/sammcd/~3/fH3VHYXdpTc/Dropping-Subversion-for-git <p> For the past year I have been using subversion to control my code for various projects including this web site. However, an open source project I worked on recently uses git. For this reason I printed off the manual and got to work. Here is a quick look at some of the high points:</p> <h4>Distributed</h4> <p> The biggest difference between Git and subversion is the distributed model. With subversion there is one repository and everyone merges with it, but with git everyone has their repository locally. This means that the main method of collaboration moves away from everyone syncing with one server, to the idea of pulling code from other people. When someone gets some work done that you want, you simply write a command to grab the changes from their server. This allows you to take what you want and leave what you don’t. Your local copy has only the changes that you want.</p> <p> Torvalds argues that this model works much better for development because it works off trust. Instead of having to the take the code of anyone who has access to the repository you can choose to only take work from people that you trust.</p> <h4>The Local Repository</h4> <p> Having a fully functional working repository locally on my machine is a huge improvement to what I was doing with subversion. Unlike subversion, when you create a “working copy” it is a fully functional repository. With svn if I wanted to commit some code, I had to wait to connect to my server first. With git, I do all my committing locally, and if I want to push to a server, I can. </p> <h4>Branching Done Right</h4> <p> In the development process a branch is very important. It allows you to have the freedom to go off and make big changes with the safety net that there is a working branch waiting for you if you need it. However in subversion, this was not an easy or intuitive process, it involved copying files into a branches folder, which would then be shared with everyone who connects to the server.</p> <p> In git since all your branches are local, you can easily create a branch without worrying how it effects other people you are working with. Also there is no complicated directory structure. Git keeps track of all of your changes and when you change branches it changes the files for you. This means that when I change branches, my text editor really doesn’t know a difference, except the code and files change properly.</p> <h4>Concluding Remarks</h4> <p> After a simple 3 hours learning git, I felt more comfortable with it than I ever did with subversion. Since then, I have changed all of my projects to work with git, and hope I don’t have to touch svn again.</p> Sam McDonald Tue, 18 Nov 2008 07:59:49 CST http://sammcd.com/blog/2008/11/18/Dropping-Subversion-for-git http://sammcd.com/blog/2008/11/18/Dropping-Subversion-for-git