From the Bookmarks Bar – July 12, 2013

I’m going to give something new a shot here.  From the Bookmarks Bar is a weekly round-up of interesting software development related links from around the web.  In general, it’s just a collection of things that I think you may find interesting.  Without further ado, here some favorites From the Bookmarks Bar for this week:

New Programming Jargon

We’ve all run into these issues from time to time.  This article reads like a book of the best programming related jokes.  Smurf Naming Convention is my favorite.

Raspberry Pi Powered Microwave

Disappointed by the lack of features on your microwave?  Why not overhaul it by integrating a Raspberry Pi?

The Visitor Pattern Explained

Many developers have only a brief understanding of the visitor pattern even after using it.  This is a detailed and practical example of the usage and practices of the visitor pattern.

How to Modify Bootstrap Simply and Effectively

Here is a collection of some great Bootstrap mods as well as some tools to easily modify Bootstrap to your tastes.  Want to make your Bootstrap based site look like Facebook or Metro in Windows?  An add-on can make it happen.

Super Mario Bros. 3 Match Game in Javascript

This is a fun one.  A developer has built a slick recreation of the match game from Super Mario Bros. 3, written entirely in JavaScript.  The project is well segmented and structured and is a good example for those looking to learn modern JS.  Source code is available here:  https://github.com/callmehiphop/mario-cards

That’s it for this week.  I’ll be experimenting with From the Bookmarks Bar over the next couple of weeks.  Feel free to leave a comment and let me know what you think.  Thanks for reading!

Windows 8.1: Better without the start menu?

Details on the much awaited Windows 8.1 were released to the public at this past week’s Build conference. Microsoft seems to have relented a bit on the taskbar design in Windows 8.1, having added back the Start button that was previously missing since the initial release. Many critics see this a half measure on the part of the Windows 8 team, since the new Start button opens the Windows 8 Start Menu and not the legacy Start Menu from Windows 7.

Those critics seem to want new software developed for them, but resist changes or innovation. This makes some of the criticism toward Windows 8 is unwarranted. Much has changed in how we use PCs since the introduction of the Start Menu, and I’m not just talking about the rise of the tablet market. Here’s why Windows 8 is better of in this new direction.

The Start Menu is Outdated

The Start Menu was first implemented as a part of Windows 95. It’s been 17 years. Seventeen years. I’ll just let that sink in for a moment. Sure, the design has changed a bit since then and many features have been added in the meantime. It’s not a bad solution, but it’s closer to a “1995” solution than a “2013” solution. Today’s machines are much faster. These days, users expect quick access to application and information and the old start menu just doesn’t serve that purpose well. First, you click the start button to open the menu, click again to open All Programs and then you scan the tiny menu for the folder that the application is in. If it happens to be named according to the developer of the software and I’m looking for the application name, chances are that I may not find it quickly. There’s a much better way of doing things, and it’s been offered in Windows for quite a while now.

Windows key + Search query

Let’s leave 1995 behind.  Windows search is fast and it works great. Many power users have taken advantage of the great search features in newer versions of Windows, not just in Windows 8. It’s nothing new, but despite the public opinion against Windows 8’s Metro UI as a whole, the use of Metro for search presentation is new, and it’s fantastic. I’m not sure why it’s worth the bother of launching Microsoft Word through the old Start Menu when I can just hit the Windows key, type “Word”, hit enter and it’s almost as if it is done for me.

A New Purpose

I admit, the Windows 8 Start Menu really isn’t a “Start Menu” as you’re used to using it. Think of it as a middle ground between the taskbar and the “All Programs” menu from the old Start Menu. Perhaps you can see it as an updated version of Quick Launch, if you prefer it that way. For applications you use all the time, you pin them to the taskbar, or you could even use desktop shortcuts. Applications that you use often, perhaps daily or weekly, can be organized for easy access on the Windows 8 Start Menu. For all else, there’s search.

Unsung Features

In the arguments for Windows 8, I still rarely see mentioned the many little features that make switching to Windows 8 worth it on its own. Take for example, the power user context menu found by right-clicking in the bottom left hand corner in Windows 8:

Windows 8 Power User Menu

The power user menu in Windows 8, found by right clicking in the bottom left corner.

This menu combines all of the most commonly used system administration features into one quick and easy shortcut. The overhaul to the Task Manager and File Management dialog are also some of the best features added to Windows in recent versions.  The pity is that these features are great for server administrators, but many can’t take advantage of them because they refuse to use Windows Server 2012 with the Metro UI included.

Metro-ed Out

It’s OK to not like the Metro look. I agree with many of the complaints about the Windows 8 UI, including multitasking with Metro apps and the lack of a windowed mode. What with Windows 8.1 adding the ability to boot directly to the desktop, between the use of the taskbar and Windows search you hardly need to see it. There are many features in Windows 8 that work great without ever launching a Metro app.

Still, credit must be given to the Windows 8 team for the improvements to the UI in 8.1. The addition of a single wallpaper for the desktop and start menu really go a long way to unify the Windows 8 UI with the rest of the OS.  The new variable tile sizes make the Windows 8.1 Start Menu that much better for quick access to information and organizing commonly used apps.

Windows 8.1 Start Menu

The updated wallpaper and tile size options on the Windows 8.1 Start Menu.

It’s not perfect, but the updates in Windows 8.1 are a step in the right direction. I’ve given up the old Start Menu for good.

Thanks for reading. What do you think about the new features in Windows 8.1?

Microsoft’s Xbox One DRM: How It Could Have Been Done

The reaction of the public to the now former DRM policies of the Xbox One has been confusing to say the least. Microsoft’s announcements of the policies in the PR nightmare that followed the initial reveal of the Xbox One were received about as well as Frankenstein’s monster to a torch-and-pitchfork-armed angry mob. The gaming community argued their points of view all through the weeks leading up to E3 2013, which spanned both sides of the argument, but left the perceived consensus that the public was against the policies of Xbox One. Despite delivering a more core gamer focused media briefing at E3 than they had in past years, Microsoft found themselves overshadowed by the announcement that Sony’s PlayStation 4 would not require an online connection at any time.

At the risk of losing ground to Sony in the upcoming console generation, Microsoft reversed its decisions on the Xbox One DRM. Not just on the 24 hour limitation, but on all of the Xbox One’s new online features. The reaction of the gaming community toward Xbox One’s policies had seemed to change in an instant from anger and alienation to the disappointment and regret that consumers would not be able to take advantage of those features that were beneficial to consumers. I can only imagine that members of the Xbox One team at Microsoft were left stunned by the reaction.

Deciphering the Viewpoint

We can interpret this series of events in a variety of ways. We could assume that the more vocal members of the community were only heard when their side of the argument was at stake. This is probably somewhat likely, but deeming it the sole reason leaves us with having learned nothing. We could also consider the spread of information on the Xbox One policies was not handled well by Microsoft. This is also probably likely, but puts Microsoft in a position of trying to improve its message over its product. I would argue that the truth is actually a combination of these two ideas, with one addition. The possibility is, and stay with me here, that perhaps the gaming community wanted some of the Xbox One’s features, but not all of them.

Could it have been done?

I’ll argue that it could have been done with full acceptance from the public. I’ll even argue that Microsoft could have been the one to do it. I’ve heard the arguments that this generation was the wrong time, and that Microsoft was ahead of itself with these policies. I disagree. Microsoft’s attitude that this was the generation to separate the Xbox One from the competition was not flawed in itself, but rather the execution was at fault. Here’s how I think Microsoft could have gotten the community on its side with Xbox One:

The Example

The Steam community has raved about the potential of using a set top box or console with the service for quite some time now. Steam recently introduced Big Picture mode, a UI designed specifically for use with a television set and controller, all while rumblings of a Steam box have been turning in the rumor mill. Anyone who says that consumers have not wanted a Steam-like experience on a console would have to be in denial. However, it’s no secret that Steam suffered its own growing pains in the beginning. In the design of the Xbox One, Microsoft could have taken advantage of what Valve had learned through the evolution of Steam. With this understood, the Xbox One’s 24 hour check-in is baffling. It is the one policy introduced by Microsoft that seemed to be panned from both sides. Why introduce a problem that the competition has already solved?

Controlling the Message

To the outside consumer looking in, it almost seems as if Microsoft believed that the restrictions involved with the Xbox One would just be glanced over and ignored, like every other Terms of Service agreement. It is also possible that the policies were still being finalized up until the console reveal and were still not well understood even internally at Microsoft. Unfortunately, what Microsoft saw fit to release in an unfinished state, the gaming community saw as a potential deal breaker.

I believe that there are circumstances under which the gaming community would have accepted the policies of Xbox One (with the exception of the 24 hour check-in). Microsoft’s own preparedness to speak to the policies and inform the consumer is one of them. The customer needed to see that Microsoft was taking the changes seriously and understood both sides of the argument. The problem with the message following the Xbox One reveal is that the it seemed to be all restriction with no benefit to the consumer. It wasn’t until nearer to E3 when these benefits, such as the family share plan, were announced and by then the damage had been done. If the benefits to the consumer outweigh the restrictions of the policies, then the community will see them ultimately as a win for them.

An Olive Branch

The ultimate benefit to consumers in an all digital gaming platform is a reduction in the price of games. Since publishers and developers gain the previously lost sales due to used games, they can afford to offer new games at a reduced price. This argument is made in favor of the Xbox One, but seems to be arising from using Steam as an example for the all digital model. The problem is that the digital game sales on Xbox 360 have developed the reputation of maintaining the launch price for games long after other retailers have reduced the price for disc based versions. This begs an important question regarding Steam sales. Does Steam provide reduced pricing because they have competition for digital sales on PC, or because there is no space for used sales?

I believe that had Microsoft made a commitment to Steam-like sales on digital games through Xbox 360 prior to announcing the new policies of Xbox One, the gaming community would have been much more accepting of the lack of trading or used game sales. There is no competition for Microsoft in digital game sales; you can only purchase digital games for Xbox from Xbox Live. Microsoft should have recognized this as a concern for the consumer and offered sales on the current generation as an olive branch.

Conclusion

An argument that continues to be thrown around by those in support of Xbox One’s DRM is that it is not the fault of publishers and developers to want to not lose used game sales to GameStop and other re-sellers. I think it’s important to understand that despite the events surrounding the Xbox One, the gaming community does not hold an opinion against that idea. Gamers want to support the industry and the creators, and we understand that used game sales are ultimately a detriment to that. We can remove used games from the market entirely AND do it with gamer support, but the platform needs to remain as accessible as it is today.

It’s easy to point out all of the ways that the Xbox One announcement went wrong after the fact. It is much more difficult to anticipate these problems ahead of time. These features will be available on consoles sooner than later, probably even in the upcoming generation, despite how things have shaken out so far.

Thanks for reading. Please leave a comment or get in touch with me on Twitter.

Managing an SQLite database on an Android Virtual Device

Mobile database development is often an unfamiliar when coming from the world of web development. Many database administrators are used to managing their databases through a management tool such as SQL Server Management Studio, phpMyAdmin or MySQL Workbench. They can feel a bit out of place when they find themselves creating SQLite databases by writing queries in Java or Objective-C code. Sometimes having a visual representation of the data just helps with understanding a system and can speed up development.

So, how can I directly manage an SQLite file?

When running an Android application on an actual device, we always have access to the file system over USB, so we can just download the SQLite database to our machine and manage it from there. In addition, there are many SQLite browser applications available for Android, such as SQLite Manager and SQLite Viewer, that allow you to browse the contents of an SQLite database directly from your device.

Note: The SQLite database for your application will always be found in the data -> data -> {application package name} -> databases folder on the Android file system.

The problem is that many developers do not develop on an actual Android device, at least not in the early stages. Instead, they run their application on the Android Virtual Device through the Android Developer Tools or Eclipse. While it is a bit more complicated, you can also download your application’s SQLite database from a virtual device. Here’s how it’s done:

Before following the steps below, make sure that your Android Virtual Device is running and connected to Android Developer Tools. Also, make sure that your application has successfully created an SQLite database on the file system.

1. Open the DDMS perspective in ADT by clicking the DDMS button in the top right hand corner of the application. You may only see the “Java” and “Debug” perspectives initially. If that is the case, you will need to click the open perspective button and choose “Other…” from the menu. From the next screen, choose DDMS and click OK.

perspective

The “Open Perspective” button in ADT.

The "Open Perspective" dialog in ADT with DDMS highlighted.

The “Open Perspective” dialog in ADT with DDMS highlighted.

2. You should see your AVD information in the left hand pane. In the right hand pane, choose the File Explorer tab.

3. From the file tree, expand to the data -> data -> {application package name} -> databases folder where you should see your SQLite database.

4. Select the database file and click the “Pull a file from the device” button in the top right hand corner of the File Explorer pane. A save dialog should appear.

The DDMS File Browser with the "Pull a file from the device" button shown.

The DDMS File Browser with the “Pull a file from the device” button shown.

5. Choose a location to save the file on your local machine.

Once the files is on your local machine, you can use any SQLite management tool to browse and modify your database. SQLite Explorer is a great free, open-source option for those looking for a recommendation.

There is also a plug-in for Eclipse available that will handle the process of downloading and opening the database for you. It allows you to manage the database directly from Eclipse. You can download it here.

If you need to make a change to the database, you can do it through your management software, and use the “Push a file onto the device” button from the File Explorer to push the updated database to the virtual device.

This is a great method of seeing exactly what is going on with your database every step of the way. While unit testing is still a crucial part of making sure your application functions correctly, visualizing the data can help to quickly resolve obvious bugs.

Thanks for reading. Feel free to leave any questions or comments.

BitTorrent Sync and the Future of Peer-to-peer

In recent years, Peer-to-peer networks have matured greatly.  They have most commonly been used as a means to transfer files indirectly without needing a centralized host, but peer-to-peer networks are increasingly being used for more intensive and private processes.  They are many services that use peer-to-peer networks to stream media content.  Spotify uses them to assist their servers to stream music to their users and Skype uses them for video chat.  However, Bitcoin has attracted the most attention to the peer-to-peer evolution.  It’s changing the way we think about currency and the capabilities of secure peer-to-peer data transfers.

The newest addition to the crowd is BitTorrent Sync, a solution for securely sharing and updating files across multiple devices.  BitTorrent Sync places a focus on security; all data transfer is encrypted with a 256-bit AES encryption key, so your files are kept private.  If you want to send files to another user, there is a public key-like process available.  This process relies on keys called “secrets” that are directly linked to the permissions that can be performed by a user on the synced files.  You can provide users with full control, write or read-only access using a “secret” and BitTorrent Sync allows the proper level of control.  You can also

BitTorrent Sync is not a replacement for Dropbox, Google Drive or any other cloud storage.  It only syncs files across your devices; it does not back them up to the cloud.  If you upload a file to cloud storage, it is available whether the devices that you are using are connected or not.  With BitTorrent Sync, the file you need to retrieve would not be available on your laptop if your main PC is shutdown, unless you have it synced to another device.  Still, BitTorrent Sync is a great way to create an automatic offsite backup or sync large files.  It may at some point even rival single use, expiration based file sharing services such as YouSendIt.  Best of all, it won’t cost you or your company a dime.

BitTorrent Sync is currently available on Windows, OS X  and Linux.  One could speculate that iOS and Android versions are likely in the pipeline as well.

Using jQuery 2.0 and supporting IE 8?

jQuery 2 has been released and the most talked about addition is actually the removal of a feature.  Notably, support for Internet Explorer versions 6, 7 and 8.  The jQuery blog notes that Android 2.x browsers are the next on the chopping block.  You may think that the new features in jQuery 2.0 would have to be substantial to encourage developers to use it and leave IE 8 behind, but at this point the APIs of jQuery 1.9 and 2.0 are identical.  In other words, they provide the exact same set of features, they just support different browsers.  In addition, both the 1.x and 2.x versions of jQuery will continue to be supported side-by-side for the foreseeable future.  jQuery 1.10 is will be released in the coming months with bug fixes from the 2.0 cycle.

The only noted benefit of the change to jQuery 2.0 is a decrease in size of the JavaScript file from 93kb to 83kb.  Some developers may see this change as negligible and continue to use jQuery 1.9, where those who support systems with much higher traffic may see a benefit in the reduced file size.  Why choose when you can serve the larger file to the browsers that need it and save the bandwidth for those that do not?

How To

Through the use of conditional comments, a site can use jQuery 1.9 to support just the IE 8 and lower users, and use jQuery 2.0 for all others, taking full advantage of the bandwidth savings when possible.  Conditional comments are commonly used to create IE-only stylesheets for those pesky quirks that only seem to occur in Internet Explorer.  However, there is nothing preventing them from being used for JavaScript as well.  See the following code example:

<!--[if lt IE 9]><!-->
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!--<![endif]-->
<!--[if gte IE 9]><!-->
<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script>
<!--<![endif]-->

The first line checks to see if the requesting browser is lower than IE 9.  If it is, then we load jQuery 1.9.  The second line checks if it is greater than or equal to IE 9.  If it is, then we load jQuery 2.0.  Since the 1.9 and 2.0 APIs are identical, the rest of the calls to jQuery on the page will work properly with no additional changes required.  Take note that there are some additional comment tags included to make these checks visible to non-IE browsers such as Chrome or Firefox.

Conclusion

Many developers considered jQuery’s support for a wide range of browsers to be a significant benefit for choosing it over other alternatives.  Often a project’s targeted audience or the client themselves will determine what browsers need to be supported, leaving the developer out of the decision entirely.  With the newest version shifting from that support, the door may be left open for a competitor product to gain usage in the developer community.  At this point, there is no cause for alarm since the jQuery 1.x line will continue to be supported in the future.  However, if jQuery 2.0 begins to add features that are not available in 1, developers may demand a version of jQuery 2 with support for older browsers, or just move on to something new.  Only time will tell.