Monday, November 17, 2014

Qute UI revamp and Deck Stats

A little over a week ago I posted about the first draft of my Qute MTG Stats tool. This past weekend I had some time between matches of magic to implement some new ideas I had for the project. These include:

  • Adding notes to events such as deck played and decks played against
  • See stats by deck for decks you've added to the event list
  • Export event/opponent lists to CSV files
  • Export full stats to clipboard/text file
  • Save edited data to a .qute file
  • Load data from a selected .qute file
  • Added prompts to let the user know when actions complete successfully
  • Added in application help prompt

I've also moved away from the original tabbed setup I started with to separate to allow the user to view information side by side:

For a full set of screenshots check here.

For those interested in giving this a try yourself, you can always download the latest Windows binary form here. For those using a superior operating system, simply install pyside, download the latest snapshot, and run the qutemtgstats.py

If you have any suggestions or feature ideas let me know with a comment below.

Cheers,
~Jeff Hoogland

Friday, November 7, 2014

Qute MTG Stats Tool

Late last year I wrote an Excel workbook that you could use to analyze your Magic the Gathering match history using VBA. While it was functional, being contained in an Excel workbook meant my tool was tied to closed source software and was limited by the bounds of Excel.

Today I would like to share the first draft of a new project of mine - Qute, a stand alone MTG Stats Tool:








For those interested in giving my tool a try, you can find install and usage instructions here.

The main thing I am looking for is suggestions on how to improve this tool. What information would be useful to provide that can be scrapped from the data provided in our DCI history? If you have any ideas or find any bugs drop a comment below or open up a ticket on GitHub!

Cheers,
~Jeff Hoogland

Wednesday, November 5, 2014

PyPair: A Python Library for Pairing Swiss Tournaments

Something I've spent a few hours on in the last month is a small python library, that I am calling PyPair, that allows you to easily manage a Swiss-System Tournament. For those unfamiliar with this concept:

"A Swiss-system tournament is a non-elimination tournament format. There are several rounds of competition, but considerably fewer rounds than in a round-robin tournament, so each competitor (team or individual) does not play every other competitor. Competitors meet one-to-one in each round and are paired using a predetermined set of rules designed to ensure that as far as possible a competitor plays competitors with the same current score, subject to not playing the same opponent more than once. The winner is the competitor with the highest aggregate points earned in all rounds."

A short example of using PyPair:
from pypair import Tournament

Players = { 1:"Tim",
            2:"Jeff",
            3:"Kristi",
            4:"Jacob",
            5:"Doug",
            6:"Karen",
            7:"David"}

to = Tournament()

for player in Players:
    to.addPlayer( player, Players[player] )

pairings1 = to.pairRound()

print pairings1
Yields the output:

{1: [1, 7], 2: [2, 6], 3: [3, 5]}

Which is a simple python dictionary where each key is a table number that corresponds to a list of the players playing at that table.

If you would like to see a more complex example see here.

If you are interested in the math behind the pairings, PyPair essentially does the following when you call the pairRound() function:

Group players by point totals
Starting with the group who has the most points:

  • Create a graph with all players in current point total
  • Connect players in the graph that have not played yet
  • Use a Blossom based algorithm to compute a maximal matching of the graph
  • Take any unpaired players and add them to the group with the next highest point total
Repeat until there are one/none unpaired players
If there is one unpaired player, assign a bye
Return a python dictionary of the pairings

The networks created by PyPair are implemented using the NetworkX library.

If you have any suggestions for improvement or find an issue feel free to open a ticket on GitHub or leave a comment below.

Cheers,
~Jeff Hoogland

Friday, October 17, 2014

Sager NP2740 Review - A Linux Powerhouse

When I buy a piece of hardware I generally use it until it becomes completely non-functional. Because of this, my old Sager laptop I bought five years ago was finally needing an upgrade so I set about doing research trying to find a replacement.

I was looking for something powerful to stream some games on, but also light enough that it was not going to feel like a brick next to my Chromebook. Since Linux is my OS of choice, having reasonable Linux support is also on my list of desires. Because of this I wanted to stay away from ATI graphics cards and nVidia cards with optimus.

The winner you ask? After a good deal of research it ended up being the Sager NP2740:


The Hardware

The NP2740 ended up being one of the few pieces of hardware out there that met all my specifications. At 4.2 pounds the NP2740 is just a small bit heavier than my HP14 Chromebook. When ordering from PowerNotebooks.com the hardware also came with a no-OS option.

One of the things that draws me to Sager laptops is how customizable they tend to be compared to other laptops. The few pieces of hardware on the NP2740 that have to stay as is are:

That leaves us the memory and storage space to customize. The memory comes stock at 8gigs, but for my system I opt'd to push the memory to the maximum 16gigs as I knew I would be running virtual machines on my system.

Storage space is the one place where the NP2740 really comes out ahead of other laptops in this form factor. In addition to have a standard 2.5" mobile drive, the NP2740 also has an mSATA slot that you can add an SSD to. Personally I have a 240gig, Intel 530 SSD in my unit.

The Performance

On a system this powerful I never expect a reasonable battery life, so I was fairly surprised with the NP2740. When under a constant heavy load (virtual machines running, code compiling, audio going) the battery in the NP2740 lasts for just under three hours. While doing light office work that life extends to around five hours.

In terms graphics performance I must say I have been thoroughly impressed with the Intel Iris 5200. For specifics on performance you should see the benchmarks here, but I will say this little card has handled everything I have thrown at it - including streaming some of those games using OBS.

Most importantly - the cooling on the laptop is excellent. I can use the device on my lap for hours without any discomfort from heat discharge.

The Linux Support

Starting with Ubuntu 14.04.1, all of the hardware on the Sager NP2740 is functional by default. If you are using an older Linux distro the RTL8723BE wireless chipset might give you some trouble, but there are workarounds. Because the graphics chip is Intel based you should have full 3D support with the open source drivers present on most Linux distros.

Best of all is that I was able to get the hardware with no OS pre-loaded, so I did not have to pay a premium to get a copy of Windows with my new laptop.

The Wrap Up and Price Point

I always do a lot of research before making a large purchase and I must say that even after days of research the NP2740 blows all the other competition away. Even with my wife's company discounts, other brands such as Dell, Toshiba, and Lenovo could not come close to the $1,300 I ended up paying for the NP2740. You can configure your own starting just under $1,000.

All in all I have been very happy with my Sager NP2740. If you are in the market for a Linux PC that is portable, but does not sacrifice performance - this might just be the laptop for you.

Cheers,
~Jeff Hoogland

Tuesday, October 14, 2014

Why Netflix support is a Win for Desktop Linux

I am what you could call a practical free software advocate. This means that while I love open source software and everything it stands for, at the end of the day I really just need a computer that works for the tasks I need accomplish. Most people in the world are exactly like me, except they don't care in the slightest about free software. They just want a computer that works.

That is why things like Netflix and Steam officially supporting Linux as a desktop operating system is so important. You will get a lot more users who are willing to try an alternative OS when it does not require them to give up using the services they love to do so.

So do me a favor - stop complaining. Every time I see one of these large services start supporting desktop Linux, the complainers come out of the wood work with something else to whine about. With Steam it was DRM in the games that now ran natively. With Netflix folks are complaining about it requiring the use of Google's branded Chrome browser.

The truth is, change is gradual, but it is coming. So the next time a major content creator/provider opts to add support for our operating system of choice - lets just say thank you instead of complaining about the way in which they are adding that support.

The "year of the Linux desktop" is not something that is just going to magically happen when the clock strikes twelve at midnight on January first. It is something that is going to happen slowly over years worth of time. The addition of services like Netflix and Steam are fantastic wins in this slow change.

Thursday, October 9, 2014

pyHook for Linux with pyxHook

Today I would like to share a simple solution to a problem I have wasted several hours on in the last week: Listening for key presses on Linux using Python. You see, on Windows you can simply use the pyHook library that has existed for years. On Linux no such library is as well documented.

After posting my question in several forums I finally was able to track down a reasonable, fairly simple solution. Contained in the Simple Python Keylogger is a pyxhook.py library that is desktop independent and GUI toolkit neutral.

To hopefully save future python developers some time in the future I've created a GitHub repository for just pyxhook and a simple example of how to utilize it:
#Libraries we need
import pyxhook
import time

#This function is called every time a key is presssed
def kbevent( event ):
    #print key info
    print event
    
    #If the ascii value matches spacebar, terminate the while loop
    if event.Ascii == 32:
        global running
        running = False

#Create hookmanager
hookman = pyxhook.HookManager()
#Define our callback to fire when a key is pressed down
hookman.KeyDown = kbevent
#Hook the keyboard
hookman.HookKeyboard()
#Start our listener
hookman.start()
    
#Create a loop to keep the application running
running = True
while running:
    time.sleep(0.1)

#Close the listener when we are done
hookman.cancel()

Friday, October 3, 2014

qAndora - A Cross Platform, FOSS, Pandora Radio Player

One of my goals for this year is to become proficient in a cross platform GUI tool kit. The toolkit I've chosen to get my hands dirty with is Qt because in addition to being cross platform it also has a fantastic amount of documentation.

I always find I learn programming easier when I am building some practical instead of going through various tutorials that you just throw away when you are done. So with that, my "learn Qt" project is something I'm calling qAndora:


qAndora is a cross platform, open source, Pandora Internet Radio client written in Python using Qt and VLC. If you would like to jump right to giving this little application a try you can find install instructions here. I have tested the player successfully on Ubuntu 14.04 and Windows 7, but it should work anywhere you can install VLC and run Python.

A few other random screenshots of the tool:




If you have any suggestions or feature requests please feel free to leave them in a comment below.

Cheers,
~Jeff Hoogland