Sunday, August 24, 2014

Galago UltraPro Update

    /u/kuro114 on Reddit asked me for an update on the Galago UltraPro a few months on, so I thought I'd organize my thoughts here instead of multiple Reddit comments. Again, ask me questions on this post, G+, or the post on Reddit if clarification is needed.

    I've had the Galago UltraPro for a little over 2 months now. The laptop has held up very well in that time, even the flimsy feeling display assembly. I haven't babied the laptop at all, but I've never been particularly rough with my electronics. The case is more resilient than I expected, it rarely even scratches when tools are laid directly on it. The clips on the strip of plastic above the keyboard have also help up well to multiple disassembles. I've been happy with the build quality of the plastic overall, but it remains to be seen how this will hold up over multiple years of use.

    My main concern with the laptop was the keyboard. After using it for a while though, it's fine. It's not great by any means, but it's not THAT much worse than the keyboard on a MacBook Pro. It doesn't feel as good as me the keyboard on my friend's ThinkPad, but it gets the job done. It isn't as good for typing as a MacBook Pro or ThinkPad, though I'm never hesitant to type on the Galago's keyboard, and I rarely even use my Logitech k360 with my laptop anymore. That being said, it is still a laptop keyboard, and I hope to get a mechanical keyboard soon to help with longer coding sessions. If you'll be typing for extended periods of time everyday, an external keyboard is still the way to go, but then again, I've always been partial to using my laptops with external mice and keyboards. My main use case is connecting the laptop to an external display, mouse, and keyboard, though that is changing now that I'm using my laptop on campus more. I still feel comfortable enough with this keyboard to work with the computer on my lap for extended periods of time at school.

    The clickpad is still fantastic in Linux, and performs well for me now in Windows after I've figured out the driver situation. It's very responsive and has a very satisfying click response, just a dream to use in Linux. Previously, it was almost unusable in Windows because the System76 provided drivers are crap, and Synaptic hasn't updated the general driver in a fairly long time (or even signed the newest generic driver). All of my Windows issues with the clickpad were resolved by switching to the Sager NP2740 Drivers. The clickpad performs almost as well as it does in Linux, but it only supports sections for left and right clicks. I've included a picture of the Dell XPS 13's touchpad for comparison, the clickpad on the Galago essentially works like this in Windows. In Linux, it essentially works like the clickpad on a MacBook Pro, just click anywhere, and click with two fingers for a right click. This is really my only problem with the Windows drivers at this point, I just don't like having to click in the bottom left corner, and the best Syanptic driver that I've found still don't have any options to change that behavior.

The touchpad on the Dell XPS 13 provides a good visual representation of how the Galgao's clickpad works in Windows.
    The display options included work very well for me. I've had no problems with the HDMI or mini displayport. They've both just worked for me in Ubuntu, Linux Mint, Arch, Fedora, and Windows. I've had very few issues with HDMI audio too, although I've actually had more issues on Ubuntu 14.04 using the System76 driver package (which specifically claims to address HDMI audio issues, among others) than I have had in Fedora without the drivers. I haven't had any problems with the card reader either, and the wireless card seems to be recognized from most every distro during install.

    I've recently switched to Fedora and I haven't missed the System76 drivers at all. I suppose I could build them from source, but everything works, I just don't see the need. I've actually noticed that the Crucial m500 mSATA drive I installed runs cooler in Fedora, possibly because of the newer kernel, I'm not sure. System76 recommends Ubuntu, and that's the only distro that they support, but I've actually had more luck away from Ubuntu derivatives. In distros with a 14.04 base, my mSATA drive idles at around 44C. In Fedora I've found that it's closer to the temp of my WD 2.5in drive, about 32-36C. My point with all this is that you don't have to stay with Ubuntu with System76 products, the hardware is all supported very well by Linux itself, almost nothing relies on the packaged drivers from System76. You can definitely use this laptop with any Linux distro of your choice, with very little resistance from the hardware.

    Overall, I'm really starting to love this machine. I've had a few issues with the Windows drivers from System76, their support, and some issues with stuck pixels on the LCD panel, but almost all of those issues have resolved themselves. I could have gotten a laptop with a better GPU for a little more money and been able to run more Steam titles, but I really like how light and thin the Galago is. I also like that I supported a company making Linux hardware, that was worth paying a premium for me. That may be different for you though ,and there are great offerings from Lenovo right now with its Y series, and even the System76 Bonobo if you want something bigger. I also would have considered a MacBook Pro running Linux if my budget was substantially bigger, but again, I'm more willing to pay a little more to support System76, I don't think I'm willing to pay more to support Apple. I haven't found the problems with the keyboard or lightbleed on the display to be too problematic either, but they might still be issues for some. I think the Galago is a very good product for programmers, sysadmins, IT technicians, or Linux enthusiast college students. This might not be the best product for people with different backgrounds, but for people from the backgrounds stated above, I feel confident in recommending the Galago UltraPro.

Tuesday, August 5, 2014

Linux Tool: Gpick

    Gpick is a color grabbing utility available in the default Ubuntu 14.04 Software Center. There's not much to this program, but it fills a need on the platform. Sometime while I'm working on a project, I just want a hex value for a color I like. In the past I've used the utility build into OS X or a website like This utility lets you hover over a color with the mouse, and add a color to the pallet by pressing the space bar. In fact, I recently updated the color scheme of this website using this tool to capture hex values of Sublime Test's default color scheme. I've found this utility to be incredibly handy recently, here's hoping this post bring it to someone's attention.

Featured on My Linux Rig

    I was just featured on the Linux blog My Linux Rig run by Steven Ovadia. The interview process couldn't have been more professional and painless. He found me on this blog because of the Galago UltraPro review that I posted on Reddit. I've started reading his blog since he contacted me, and I really enjoy seeing how others set up their Linux workstations. Give his blog a look if that sounds interesting to you.

Hip Hop Air Horn Reviewed

    My app Hip Hop Air Horn was reviewed over at Droid App of the Day. Give that site a look, great coverage for small developers.

Relational Database Basics Example 1: Part 1

    Relational Database Basics
Example 1: Part 1

    I'm going to start off my series of MySQL tutorials with a basic overview of a simple relational database model. This model was created in MySQL Workbench, but I will also plan to cover the same example in Jet Brain's new 0xDBE, and as a simple SQL script in separate posts. The start of this series will be very basic, and these tutorials are aimed at programmers who want a basic understanding of SQL languages and relational databases. With that in mind lets start with the entity relationship diagram for this example. This may be a little confusing to look at initially, but it will all make sense in time.

Term Definitions

    Before we start, we should go over some relational database terms. (You can also skip these, and come back to them when you need to. All terms are presented in bold throughout the article).
  • Entity - A table. Entities have attributes and usually represent a collection of a single object or concept, called entity instances. It may be useful to think of an entity as a Java object that is then instantiated with the data specific to each entity instance.
  • Attribute - a property that belongs to all members of an entity. Attributes have data types and are the columns of a table.
  • Entity Instance - A row in a table. An entity instance is a single member of the group that is the entity.
  • Schema - I think schema is best explained by this Stack Overflow answer.
    "A database schema is a way to logically group objects such as tables, views, stored procedures etc. Think of a schema as a container of objects.
    You can assign a user login permissions to a single schema so that the user can only access the objects they are authorized to access.
    Schemas can be created and altered in a database, and users can be granted access to a schema. A schema can be owned by any user, and schema ownership is transferable."
  • DDL - Data Definition Language, SQL used to define the structure of the database
  • DML - Data Manipulation Language, SQL used for managing data
  • Primary Key - An unique id for each row of a table. We use these to index data for a table, and they become foreign keys in other tables.
  • Foreign Key - a primary key from another table. We store these to connect entity instances between tables.
  • Relation/Relationship - a connection between two entities created with primary and foreign keys
  • Entity Relation Diagram - a graphical depiction of the relations between entities
  • Associative Entity - a table that exists to connect and store data between two other tables. Associative entities always have a one to many relation with both tables it is connected to.

MySQL Workbench Example

This is the overall ERD (entity relationship diagram). We will examine all of its components, and then put it all back together.
        In this example, we are selling customers service plans. The bill is a record of which customer has which service plan, and the address table is a list of all of the addresses associated with each customer. These table along with their relationships make up the foundation of our database. But we can strip this down even more to get a better understanding of each table and relation.

Our database without relations. Notice that some tables lost some attributes when we stripped them of their relations.
    Here we're starting with just the tables. These tell us all the information that we store about our business. We need: a name, a phone number, an email, an address, the name of a service plan, and the price that we charge the client for the service plan. In this example, the bill table doesn't have any data of its own, it is just a way to associate clients with service plans. Since we know that clients have addresses, we need to connect the tables to associate each client with their address(es).

The relation between client and address. Note that client_id is now in the address table as a foreign key.

    Now we have the client_id attribute in the address table. The line between the tables is done in Crow's Foot Notation. The notation on the line means that one client MUST have one to many addresses. In SQL we just have relationships involving 0, 1, or many. The double dash by client means that an address MUST belong to a client. If it was a single line with a 0 next to it, we could include addresses in the database that don't belong to a client. The dash and crows foot next to the address table means that a client must have an address, and that they can have more than one address. We could associate a client with a single address, and have both sides of the line would have two dashes. Bellow is what the relation looks like if we have clients who don't have addresses, but clients still can have multiple addresses.

This is what the relation looks like if we have clients without addresses.

    I put address in another table to make the client table look cleaner for the example, but we could just have the address information in the client table if we knew that all clients only had one address. Having addresses in another table is also useful to find all of the clients in a certain zip code or city, without searching through a large text field that stores addresses in the client table. That's all a bit of optimization that we'll deal with later.

Bill is an associative entity between client and service plan.

    Now let's look at the relation between client, bill, and service plan. Bill is an associative entity between client and service plan. If we had information to store that was relevant to the bill itself, something like a Boolean has_paid_yet, we would store it here. In our example bill merely keeps a record of which clients have which service plans. An associative entity is used because a client can have one to many service plans and a service plan can be purchased by one to many clients. 

Here's our completed database again.
    The service plan relation is particularly useful. We could store the service plan in the bill table, or even in the client table. If we did that though, we would have to look at the service plan column for every row of the table and then find everything matching "tier 1" in that column to find a list of all of the customers who have "tier 1" service. It is much easier to query, to store, and optimize this data if service plan is its own entity. Since service plan is just a statically sized table that contains all of service plan offerings, we can have a table with as many rows as we have service plans. If we store the data in the client table, we store as many service plans in VARCHAR and DECIMAL as we have clients. This is a fundamental benefit of proper database design. This means that we may have 5 service plans stored in a table, instead of storing those same 5 service plans duplicated in 100,000 clients. We just connect the two with an INT in the client table that acts as out foreign key. This is a more efficient way to store data, but it does initially make it harder to access the data again. We will cover joining the tables toget to look up a client and their address in the next part of this series.
    In the next part of this series, we will look at adding data to the tables and writing queries. Then I will do the same example in raw SQL without the diagrams. I also plan to show the creation of this example in MySQL Workbench and 0xDBE.

Monday, August 4, 2014

My Favorite Linux Tools and Installation Guide

    My two favorite Linux tools at the moment are xfce4-terminal and glances. The XFCE terminal is like most other Linux terminal clients in most respects, but what sets it apart for me is the drop down feature. I had just started using Guake, but did not find it entirely to my liking, so I started searching for a replacement. I found that replacement in a Web Upd8 article detailing how to use the XFCE terminal with the drop down feature in Ubuntu, and quickly fell in love with it. The terminal is in the default 14.04 repositories now, so installing it couldn't be easier, but this post just naturally turned into an install tutorial.

The install command for the XFCE terminal is listed bellow.

sudo apt-get install xfce4-terminal

    The next element to the setup is adding the keyboard shortcut. It generally works the same in most desktop environments, but I'm using Unity at the moment so that's what I'll demo. Navigate though the settings manager > keyboard > shortcuts, and find the custom shortcuts option at the bottom of the screen.

The command that we want to bind to a key is as follows:

xfce4-terminal --drop-down

I generally use F12 as the shortcut key, which is what Guake defaults to. If you are using XFCE, the terminal setup is complete. I have never set this up in KDE, but in Unity or Gnome, we aren't quite done setting everything up.

Unity settings manager.

Keyboard settings.

Keyboard shortcuts.

Custom shortcut dialog.
    The slight pain point that comes with the terminal setup in Unity or Gnome is that the settings pane for the terminal initially appears behind the terminal, and by default, clicking elsewhere on the screen will not hide the current drop down. You can still close the terminal, but this closes the settings pane too. The best workaround for this is to make sure that the move window keyboard shortcut is setup and easily accessible.

I prefer Shift + Alt + Z for my move window shortcut.
    Once you have that move window shortcut bound, click the settings pane window to give it focus. Use the keyboard shortcut to drag the settings pane below the terminal and uncheck the box that says "Use shortcut to focus visible window". Now the shortcut will drop down the terminal on command, and clicking outside of the terminal will hide it (the settings pane should also show up in front of the terminal by default now). Now you can also change the color scheme of the terminal (presets include the excelent solarized dark), change the width and transparency, and tweak the rest of the behavior to your liking. The terminal is also persistent, and supports tabs, which is where my next tool comes in.

Uncheck "Use shortcut to focus visible window".
    Glances is a cross platform system monitor written in Python that is less resource intensive than running a graphical resource monitor. Installation instructions for all platforms are listed here, but this is the command for Ubuntu 14.04:

sudo apt-get install glances

    The program can now be run by typing "glances" in an open terminal window. By default the XFCE terminal is setup to create a new tab with "Shift + Ctrl+ T", close a tab with "Shift + Ctrl + W", and switch tabs with "Ctrl + PgUp" or "Ctrl + PgDn". I usually open XFCE terminal at boot, run a glances window, then open a new tab to work in. I've also installed glances on my Digital Ocean server mostly just for fun, but the point is, it's a great tool for a desktop that can also run on a headless system.

A running glances instance.
    XFCE terminal and its drop down feature has dramatically improved my workflow. I no longer need a Unity or Gnome indicator to show system resource usage, and a great terminal experience is just a key press away. I especially love the ability to open an article like Digital Ocean's guide to installing a lamp stack on Ubuntu 14.04, click through the links to more documentation, and have a terminal window handy without spending time on window management or using "Alt + Tab" to move through windows. I hope this guide explained the install process well, or at least brought these great tools to your attention.

Hip Hop Air Horn

    My latest app is called Hip Hop Air Horn and was created for a GDG hackathon. The app has full Android Wear support, but it is mostly a simple app that plays an air horn sound. I did learn how to use a WearableListenerService as part of making the app, and I may do a detailed tutorial detailing how my app works.

    For now though, just enjoy some dumb fun.