Wednesday, January 13, 2016

The Sower and the Seeds

The Sower and the Seeds
And when a great crowd gathered around him, he told them a parable. "A farmer went out to saw his seed. As he sowed some fell along the path, and some dick cam along and troded on it. Another dick came and devoured it." And one of his disciples said, "Yeah, but the farmer was being careless and throwing it on the street. He probably got some in the rocks and in the thorns too. Wasn't the guy kind of asking for it?" As he said this, he called out, "No, just don't be a dick. It's pretty simple. There's just no excuse."

The Pharisee and the Publican
He also told them the parable, "Two men went in the temple to pray, a Pharisee and a tax collector. The Pharisee stood praying, "Thank you God that I'm not like these other low life's. They are ugly, and stink." The tax collector said, "God have mercy on me, I've been a dick." Then Jesus' said, if you are a dick, recognize it and ask for forgiveness. What a dick that pharisee is.

Paying Taxes
Then the Pharisee said, "Teacher, we know you are a man of integrity. Should I pay taxes or not?" And Jesus replied, "You have a nice house. Your wife and kids are well fed, wear nice clothes, and all have iPhones. Don't be a dick about it and just pay your taxes." "But what if they go to someone who is just going to buy drugs with it or waste it on booze.", they replied. "Yeah, that's not ideal, butit represents such a small amount of the taxes you pay. Stop being a dick."

Monday, December 14, 2015

Compiling Mame on Ubuntu 14.04 Trusty Tahr

This is an update from How to compile mame in Ubuntu 10.04 Lucid Lynx. Using the following instructions you should be able to compile Mame on Ubuntu 14.04 Trusty Tahr, though it should also work in most any other version of Ubuntu too.
  1. Install dependencies.
    sudo apt-get install git build-essential libgtk2.0-dev libgnome2-dev libsdl1.2-dev libsdl-ttf2.0-dev libsdl2-ttf-dev libqt4-*
  2. The version of gcc and g++ that comes with Ubuntu 14.04 will not compile the latest Mame code. Fortunately, there is a PPA to get a newer version. This step is not needed on versions of Ubuntu beyond 14.04 as they come with versions 4.9 or above of gcc and g++.
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.9 g++-4.9
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
  3. Get the latest code from github.
    git clone https://github.com/mamedev/mame.git
  4. Finally, lets get to building it. This will take a very long time, perhaps even hours. This may be a good time to take a nap, watch some Star Trek, or visit the park with the family you've been neglecting trying to get all of this to work.
    cd mamemake
  5. On 32-bit systems the resulting binary file will be called mame and on 64-bit systems it will be mame64. We want to make this binary executable by everyone on the system so we need to put it in the correct directly.
    sudo cp mame64 /usr/local/bin/mame
    sudo chown root:root /usr/local/bin/mame
    sudo chmod 755 /usr/local/bin/mame
  6. Mame has a hierarchy of places it will look for a config file. The easiest, and best route is to place it in our home folder.
    mkdir ~/.mame
    cd ~/.mame
    mame -createconfig
  7. Let's setup a rom folder and get some roms.
    mkdir roms
    cd roms
    wget http://mamedev.org/roms/sidetrac/sidetrac.zip --user-agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"
  8. Now that we have legally obtained an arcade ROM, let's play it!
    mame sidetrac
There is a reasonably good chance that some unnecessary libraries are installed via this guide, and if someone knows of a library that can be safely omitted, please let ma know below in the comments.

There are several points of possible confusion when trying to run an arcade rom.

  • mame -showusage will output what we would normally expect with a --help switch.
  • A rom must be in the proper rom folder as defined in mame ini file. If you have the rom dkong.zip in the current folder and run mame dkong.zip, mame will not look at the file in the present directory and try to load it. If dkong.zip is in the rom directory, and you run mame dkong then it will be able to run the rom. Mame is sensitive to the name of the zip file. If you rename the file DonkeyKong.zip then Mame will not know where to find the rom and will give you an error.
  • Unlike most emulators, mame has specific code to support each rom. It doesn't just arbitrarily run rom code. The format of many roms has evolved over time. Many roms found on the Internet are in an old format and are missing files that Mame needs to accurately emulate the game. Trying to execute these roms will result in an error about missing files. Since Mame developers actively discourage the use of Mame for the purpose of piracy they will be very unsympathetic to your plight and will not help you.
  • Some roms are a "clone" over another rom and require its parent rom to run. Which roms these are, and what parent rom they need is not well documented (that I know of) and will looks just like an old rom that is missing files required by the latest Mame.
  • Just running the Mame binary will provide you with an interface that will list all available roms in your collection. It is not necessary to specify the rom to load when executing Mame.
  • I am not very sympathetic to copyright owners that do not provide meaningful ways to legally obtain their copyrighted materials. I would very much like a way to purchase roms that will play on Mame from the companies that own the IP. However, I will not provide you with any help or resources on obtaining roms illegally. You are on your own.
More information on Mame roms can be found at http://wiki.mamedev.org/index.php/FAQ:ROMs

Once you know what libraries to install, compiling Mame from source is quite easy in Ubuntu. Drop me a line in the comments if this is helpful, or if you run into any problems or have any suggestions.

Tuesday, October 27, 2015

So You Want to Develop Web Apps?

- "I want to develop web applications. Where should I start?"
First learn HTML

- "Ok, I got that, but my web pages look very bland. What am I missing?"
Now you need to learn CSS.

- "Now my pages look great, but they don't do anything."
You need to learn Javascript to be able to program your web page. Make sure to read Douglas Crawford's book to learn how to avoid the many pitfalls of Javascript.

- "Now I know HTML, CSS, and Javascript. What else do I need?"
To make applications you need server-side code. You could learn Java, C#, Python, Ruby, PHP or a host of other languages. I would recommend Python.

- "Now how do I wire up my Python code to my web page."
Oh, you need a framework to do that. Again, there are many to pick from. Try Django.

- "Ok, I have Django down. Am I ready?"
You will need to learn databases to be able to persist data between visits to your page. Mysql is a free and powerful database. Don't forget to understand how to normalize your database into third-normal form, but also how and when to denormalize your database for performance.

- "Now that I understand databases, how do I tie it into my application?"
Django has a powerful ORM that will map your Python objects to database tables. Oh, you did learn Object Oriented Programming when learning Python, right?

- "I have learned object-oriented programming, and Django's ORM. I'm ready to build web applications now, right."
Well, you want to do it right I presume. Now you need to learn how to do asset management, how to write RESTful APIs, and how to use virtualenv to manage your Python libraries.

- "Fine, I can manager all of my application resources effectively and write APIs. Am I ready now?"
All that code needs to run somewhere. You can't serve it up from your development machine using the dev tools. You need to learn Linux. I prefer Ubuntu. You will need to learn how to install software with apt, write bash scripts, and generally get around using the command line. This will include using a terminal-based text editor like vim.
You will need a production-ready web server software like nginx. You will need to know how to install, configure, and maintain it.

- "Certainly I'm ready now."
You need to learn jQuery to make your Javascript easier. Also, since you started HTML5 has come out, which contains addition to not only HTML, but also to CSS and Javascript. ECMA Script 6 is also on the horizon. You will want to read up on that, and use something like Babel to convert it for you. You also need to learn node and NPM to help better maintain your Javascript libraries. You need to know React so that your front-end code doesn't require a complete page reload after every click, and also so that you don't need a bunch of complicated listeners to refresh every element whenever something happens. Web sockets will allow you to push changes from the server to your web page without having to make expensive polls every few seconds.

- "Okay, okay, okay. I've got all of that down. I'm ready to start building."
You can't just write code. You need something to maintain that code. You now need to learn git so that you can keep versions of your code and share it with anyone else working with you. It's important that you can fork, commit, branch, stash, and rebase.

- "Okay. I'm ready for whatever insanity you still have to throw at me."
One last thing. Since you don't have a computer science degree or any professional experience, you now have to convince someone to hire you based only on your interviewing skills. You do know how to sell yourself, right.

Friday, October 2, 2015

Installing Kill Bill on Ubuntu 14.04 with Tomcat 7.

I'm not a Java guy, and the guides out there seem to assume knowledge of deploying Java apps, so this took me a some time to get right, so I'm going to document the steps I took here.

sudo apt-get install mysql-server mysql-client default-jdk tomcat7 tomcat7-common tomcat7-admin libmysql-java

Kill Bill uses odd minor numbers for developing new features and even minor numbers for production releases. The download page http://killbill.io/downloads/. Hold off downloading anything until the instructions call for it.

First we need to initialize the mysql database. We need a user and database for the killbill application. The following assumes that the root mysql user's password is foobar, that the database will be named killbill, and that the username and password for the application will be killbill:killbill. All of these are fine defaults with the exception of the passwords. Change as needed.

mysql -u root -pfoobar
mysql> create database killbill;
mysql> create user 'killbill'@'localhost' identified by 'killbill';
mysql> grant all on killbill.* to 'killbill'@'localhost';
mysql> exit

Now we need to initialize the database with the tables. At the download page, download the corresponding ddl.sql for your version of Kill Bill.

wget http://docs.killbill.io/0.14/ddl.sql
mysql -u root -pfoobar --database=killbill < ddl.sql

Now that our database is setup we can configure Tomcat. First we need to setup credentials for the admin page. As root, open /etc/tomcat7/tomcat-users.xml and replace the contents to look like this, replacing the username and password fields with what you want to use.


<tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="tomcat"/>
  <user password="tomcat" roles="tomcat,manager-gui" username="tomcat"/>
</tomcat-users>

Next, we need to set the maximum upload to a sane value that will be sufficient for uploading the WAR file. As root, open up /usr/share/tomcat7-admin/manager/WEB-INF/web.xml and find the key max-file-size. Set the lines as follows.

    <multipart-config>
      <max-file-size>524288000</max-file-size>
      <max-request-size>524288000</max-request-size>
      <file-size-threshold>0</file-size-threshold>
    </multipart-config>

Finally we need to configure Tomcat to connect to the killbill database. As root, open up /etc/tomcat7/catalina.properties and append the following to the end of the file, changing any values as appropriate for your setup.

# Kill Bill properties
org.killbill.dao.url=jdbc:mysql://127.0.0.1:3306/killbill
org.killbill.dao.user=killbill
org.killbill.dao.password=killbill
ANTLR_USE_DIRECT_CLASS_LOADING=true

Now that everything is configured we need to restart tomcat.

sudo service tomcat7 restart

On your local machine download the WAR file from the download page and save it somewhere so we can upload it to the server in the next step.

On port 8080 of your server running tomcat browse to /manager/html/ In the section labeled "WAR file to deploy" click the "Choose File" button, select the WAR file you downloaded and then click the "Deploy" button.

When the upload is complete the page will refresh and you should see it listed in the Applications section. Finally, click the Start button next to the killbill application and you should be in business.

If the application will not start go over this guide to make sure you followed all the steps correctly. You can also look at the log files in /var/log/tomcat7/ to troubleshoot.

As of Ubuntu 15.04 the tomcat8 and openjdk-8 packages are available to install. Both of these packages should be more performant, but it is up to you to try them out if you so desire.

Sunday, August 17, 2014

New Ubuntu Install Essentials

This is a live document I am keeping for myself of everything I need to do when I setup a new machine with Ubuntu. It is not intended to necessarily be useful for anyone else.

PPAs

ppa:libreoffice/ppa
ppa:git-core/ppa
ppa:jtaylor/keepass
ppa:byobu/ppa
ppa:dlech/keepass2-plugins



sudo add-apt-repository ppa:libreoffice/ppa

sudo add-apt-repository ppa:git-core/ppa
sudo add-apt-repository ppa:jtaylor/keepass
sudo add-apt-repository ppa:byobu/ppa
sudo add-apt-repository ppa:dlech/keepass2-pluginssudo add-apt-repository ppa:openjdk-r/ppa

Programs To Install

zsh
oh-my-zsh
byobu
Google Chrome
keepass2
git
gitgssh
unity-webapps-gmail
unity-webapps-googlecalendar
unity-webapps-googleplus
unity-webapps-pandora
unity-webapps-youtube
Owncloud
keepass2-plugin-application-indicator
keepass2-plugin-application-menu
keepass2-plugin-keepasshttp
gnucash
openjdk-8-jre
wine

sudo apt-get install zsh byobu keepass2 git gitk gitg ssh unity-webapps-gmail unity-webapps-googlecalendar unity-webapps-googleplus unity-webapps-pandora unity-webapps-youtube keepass2-plugin-application-indicator keepass2-plugin-application-menu keepass2-plugin-keepasshttp gnucash openjdk-8-jre wine
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud-client.list"
wget http://download.opensuse.org/repositories/isv:ownCloud:desktop/xUbuntu_14.04/Release.key

sudo apt-key add - < Release.key
rm Release.key
sudo apt-get update
sudo apt-get install owncloud-client
ssh-keygen -t rsa -C "maxolasersquad@gmail.com"
# This then needs to be added to https://github.com/settings/ssh
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
cd ~/.oh-my-zsh/
git remote add maxolasersquad git@github.com:maxolasersquad/oh-my-zsh.git
git pull maxolasersquad master
git push maxolasersquad master
byobu-enable

Firefox Plugins

https://addons.mozilla.org/en-us/firefox/addon/uacontrol/
This needs to be configured as follows.
Site: www.netflix.com
Custom: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/31.0

Weather Indicator

sudo add-apt-repository ppa:pywapi-devel/ppa
sudo add-apt-repository ppa:weather-indicator-team/ppa

Next, these entries need to be changed from 'trusty' to 'saucy'.

sudo apt-get update
sudo apt-get install indicator-weather

Tuesday, August 12, 2014

Facebook Messenger Controversy Explained

I have seen a number of people on Facebook reposting a "news" articles explaining the privacy violations of Facebook's Messenger application. A number of people have declared that they have uninstalled Facebook from their phone completely. Even the reviews featured on the application's page on the Google Play Store are all complaining about the privacy invasion.


The article, which I am not linking to here (you can Google it), set off a lot of red flags. I have never written an application for Android, though I have followed their developer's tutorials a few times. I'm not an expert on Android development, but I have a rough understanding of the basics.

When writing applications for a desktop computer (PC, Mac, etc.) applications have a lot of access to the computer hardware. Mobile devices are much more restrictive. Android locks out key functionality of the hardware from the applications that are installed. Before an application can have access to these parts of the system the application must first "request" permission. This is done by declaring in a file what permissions you need for your application. This includes permission to make and receive calls, access to the contact list, use the microphone, GPS, etc. This allows users to review and approve an application's access before installing it.

However, if an application needs any access to one of these resources it can either always have access to that resource or never have access. This can make some applications look more scary than they are. For example, an application that shows you the weather based on the city you are in will need access to your GPS and the Internet. Granting these permission could allow this application to surreptitiously spy on you without your knowledge and report that back to some database, but it does not necessarily follow that it is actually spying on you.

This is how the Messenger scare is working. For example, there is a feature that allows you to record an audio clip and then send it to a friend to listen to whenever they have the chance. To provide this functionality the application has to require access to the microphone. With this access the application could be listening in on you. However, the mere fact of the application having this permission is very, very different than proof  that it is spying on you. In fact, it is not evidence at all. Fortunately it actually is possible to know if the application is using this permission for these purposes, but I'll get to that later.

There is a great deal of irony in seeing people complain on Facebook about the privacy implications of their messenger application. It is hard to imagine how the privacy concerns of Facebook itself can be acceptable, but the possible implications of the Messenger applications are not. There are much better ways to protect your privacy than uninstalling a single application.

One way I protect myself is by running an aftermarket version of Android called Cyanogenmod. It is based on the Android Open Source Project and is fully open source. The version of Android that carriers ship contain a lot of proprietary code that they have written to customize the experience. In the past some carriers have been shown to spy on their users in ways that where very embarrassing to the companies, and they where forced to remove it. However, there is no guarantee that many devices are not reporting on their users in ways that users would not agree with. In a post Snowden-world this is more than paranoia, but actually very likely.

A nice feature of Cyanogenmod is that it provides much more fine-grained control over an applications privacy settings. Usually if you do not trust an application to have a permission it is requesting, your only recourse is to not install the application at all. Privacy guard allows the users to turn off any feature, or put it on "always ask." It also reports how often an application has used a permission and when it did it last. This allows us to peer into what an application is actually doing with the access it is requesting.

What follows is a very long list of all of Messenger's permissions and reports on its use.

Click to enlarge
So let's talk a little about what is going on here. As you can see, Messenger has to ask me before it can know my location. The only time it ever actually does that is when I message somebody. and that's only because I checked the "New messages include your location by default" box in Settings. It has never attempted to read my call log, calendar, SMS (text message) database or send or a text message, record audio, or make a phone call. In fact almost everything in here is looking pretty legit. Almost.

You may notice the "Read Contacts" section. I have it set to Deny. Why? Look at the subtext. "Allowed 1854 times, denied 429 times." I had set this to Ask for a little while. I noticed that whenever I made or received a phone call or text message that the Messenger app was trying to read my contacts. I can imagine some semi-legitimate reasons why it might be doing this. For example, it may be trying to gauge who are the friends I contact the most so that it can then prioritize their posts on Facebook.

However, this is too creepy. I do not want Facebook knowing this level of detail about my life. I do not want them knowing every time I send or receive a phone call or text message and who I was communicating with. I think that there is an actual new story behind this and would be worth someone's time to grill Facebook on and educate the public.

And that's the real point. There are legitimate privacy implications of these portable computing devices we are carrying around in our pocket. People need to be more informed on what those implications are and have the education necessary to make informed decisions on how to manage these privacy concerns. Yellow-journalism articles that spread half-truths, getting people riled up about nothing-much are more hurtful than they are good.

Friday, January 17, 2014

It May Be Time to Abandon Artificial Sweeteners

I have never been a fan of artificially sweetened food products. At first I just wanted things that are delicious, but as I get older I am thinking more and more about my health, and so these decisions are becoming more important. However, I feel that if I am going to put trash in my body, it should at least be delicious.

I find artificial sweeteners to be disgusting. I can pick them out too. When my wife buys something artificially sweetened, sometime on accident, I notice the flavor immediately. Many people claim that they cannot tell the difference in the taste, but I can definitely tell the difference. The worst part, for me, is the horrible aftertaste that artificial sweeteners leave on my tongue.

So when I want to be healthy I consume things that are both healthy and delicious. I can enjoy a glass of water, a plate of broccoli, or use a carrot as a snack with no problem. A lot of more recent research, though, is suggesting that choosing food products sweetened with real sugar may be more healthy than their low-calorie, artificially sweetened counterparts.

In Trends in Endocrinology & Metabolism, researcher Susan Swithers publishes "Artificial sweeteners produce the counterintuitive effect of inducing metabolic derangements" findings that show artificial sweeteners may be messing up our body's ability to properly process real sugar, which she discussed on NPR's Science Friday.

According to Swithers, when our brain detects sugar from smell or taste it tells your digestion system to get ready to start processing the sugar very soon. As most of us know, our bodies ability to properly process sugar is vital to our health. When it cannot process sugar right it can lead to diabetes. When we train our bodies that the sensation of sweet does not equate to the consumption of sugar, our bodies gets tired of your nose and tongue crying wolf and stops directing our digestion system appropriately. When we really do consume sugar our bodies stop processing sugar like it should and, according to Swithers, could be leading to an increased risk of diabetes.

There is also evidence found by researchers at John Hopkins University that those who consume foods using artificial sweeteners may also be making up for the lost calories by consuming them in higher quantities in other foods. There are many reasons why this may be true, but the overall result may not be quite what dieters are looking for.

At the end of the day, if we want to be healthy we need to stop consuming unhealthy foods and switch to more healthy foods. Tea and coffee can be healthy zero-calorie drinks in moderation, for those who simply find moving to drinking more water to be too hard.

Thursday, October 3, 2013

Install KeePassHTTP on Ubuntu

First, of course, we need keepass, and we'll grab git while we are at it. Git is optional here, it just allows for easier updating.
sudo apt-get install keepass2 git-core
Where to put KeePass plugins is non-obvious, but fortunately some Googling reveals it to be at /usr/lib/keepass/plugins. Lets go there and create a directory for KeePassHTTP.
cd /usr/lib/keepass2/
sudo mkdir plugins
cd plugins
Great, now we just need to download the plugin. As I alluded to at the beginning we can grab the plugin via git for easier updating. The project is maintained at https://github.com/pfn/keepasshttp, but we can just grab the one plugin file we need. In fact, if we checkout the entire repository then KeePass will throw some errors as the plugin is there twice in two different formats and it can only load the plugin one time.
sudo git clone -n https://github.com/pfn/keepasshttp.git --depth 1
cd keepasshttp
sudo git checkout HEAD KeePassHttp.plgx
Now you can update the plugin at any time by running the following from the /usr/lib/keepass/plugins/keepasshttp directory.
git pull
If you are only interested in downloading the file once and not worrying about updates you can simply download the extension file.
wget https://raw.github.com/pfn/keepasshttp/master/KeePassHttp.plgx
Now you can restart KeePass2 and the plugin will be loaded.

Congress Shall Make No Law

It seems that a lot of people are very confused about the Bill of Rights and what it legally affords the citizens of the United States. I'm not referring to confusions what the right to bear arms mean, or what speech is free speech. I am referring to who the Bill of Rights is designed to protect citizens from. This misunderstanding became prominent in both the Chick-Fil-A brouhaha over marriage equality, and Starbucks and their policies about guns in their stores.

So in these debates people are referencing the constitution to make it known what their rights are, accusing those who disagree with them of denying them their rights. This would be laughably wrong if the accusations where not so widespread, large in numbers, and coming from every side of the issue.

Here is what the Constitution says about your rights in these situations. If I own a business, and it is truly MY business, I can use the money made from that business and spend it on any political, social, or ethical type of causes within the limits of the laws that govern such things.

So I have the right to do that with my business. But it is a two-way street, consumers can choose to not shop at my store for any reason they want. It could be the color or fashion of my tie. It could be my race, gender, ethnicity, socio-economic upbringing. Oh yeah, it can also be for my politics or the way I use the profits generated from my business. And in response I can do nothing, pretend to do something, or actually change my practices. That is my right. But the constitution does not restrict how I can run my business, and it does not say that anyone has to ever purchase my products, ever. This is how things work in a free society. In fact, this is how capitalism is supposed to work. People boycotting CFA over the gay rights issue is capitalism in action. CFA can change their behavior in response to the boycotts, do nothing, or choose any other option they want.

So this takes us to Starbucks where the coin is flipped over a little bit. Gun rights activists took Starbucks establishments by storm in states that have open-carry laws, buying coffee at Starbucks while carrying a weapon on their person. Shortly after Starbucks changed their policy to "ask" customers carrying a weapon in an open-carry state to leave their weapon in their car. Customers where still allowed to actually carry a weapon on them, the new policy just stated that they would be asked not to. This got gun-rights activists upset so they started boycotting Starbucks. To be clear there where some very uncivil responses leaving some Starbucks cafes with smashed windows. However, the boycott alone is just capitalism at work in a free society. It is the right of Starbucks to have whatever policy they want regarding weapons in their store, and it is the right of open-carry supporter to note buy a Starbucks. Neither the policy nor the boycott are a violation of anyone's rights.

I ran into this same issue again when someone on Facebook posted "Will someone just take one for the team already and shoot Obama???" I decided to take this person to task on their remark and received the response "Freedom of speech. If you don't like it delete me" Putting aside the issue of whether or not saying someone should be murdered really is freedom of speech, there is a more important issue here. If I disagree with something you say, that is not a violation of your freedom of speech. It is in fact a dialogue. It seems that many believe anything outside of an echo chamber is a violation of their freedom of speech.

We need to stop muddying the waters of freedom. You don't get to do and say anything you like and expect nobody to respond with dissent. Dissent is how we get stuff done. It is how we grow us both individuals and collectively as a society. We disagree, we make our disagreements known, we work them out with those that we are disagreeing with. We move on and grow. People need to get over themselves and their opinions and realize if you have something you care about there is someone out there who is going to disagree with them. Get over it. If you can't think of a better argument than hiding behind rights you don't have then it may be a good time to reexamine your values.

The freedoms granted to us in the constitution, freedom of speech and religion, "the right of the people to keep and bear Arms", etc. are there to keep congress from passing laws infringing on those rights. They are not there to keep other citizens from disagreeing with you, and taking actions against your point of view.


Sunday, September 29, 2013

Compiling Snes9x on Ubuntu

After looking into the various SNES emulators available for Linux it looks like Snes9x is the only one that is of high quality and currently maintained. ZSNES seems to work pretty well, but it won't compile on 64-bit, giving you a very old emulator running as a 32-bit binary for the foreseeable future.

I used these instructions on a 64-bit Ubuntu 12.04 machine and a 32-bit Ubuntu 13.10 machine. There are two sets of instructions here. One is for compiling the Unix version of Snes9x and the other is for install the GTK3 version. Theses instructions worked perfectly on 12.04 but on 13.10 the GTK3 version segfaults. I don't know if the issue is with 13.10 or perhaps an incompatibility with my laptop's hardware and Snes9x GTK.

The currently maintained codebase of Snes9x is hosted up on github so we will need to install git. We'll get all the tools required to build the source code while we are at it.
sudo apt-get install git build-essential
Now we can check out the codebase.
git clone https://github.com/snes9xgit/snes9x.git
cd snes9x

Part 1 - Building the Unix version of Snes9x
The Unix version does not contain any sort of interface save for the running game itself. It supports a number of command-line switches. Unfortunately it does not seem to provide any way of running in fullscreen mode.

First we need the dependent libraries.
sudo apt-get install zlib1g-dev libpng12-dev xorg-dev
Now we can compile.
cd unix
autoconf
./configure --enable-netplay
make
sudo cp snes9x /usr/bin/
sudo chown root:root /usr/bin/snes9x
Now we have an executable binary named snes9x. You can go ahead and execute it passing in a SNES rom as the first argument or with no arguments for a list of acceptable options.

To create an entry in our desktop menu create the following file and save it as /usr/share/applications/snes9x.desktop
[Desktop Entry]
Version=1.0
Name=Snes9x
Comment=A portable, freeware Super Nintendo Entertainment System (SNES) emulator.
GenericName=Snes9x
Keywords=Games
Exec=snes9x
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/share/pixmaps/snes9x.png
Categories=Game
StartupWMClass=Snes9x
StartupNotify=true
Finally, find an icon you want to use and save it as /usr/share/pixmaps/snes9x.png You can get a good icon to use here.
sudo wget http://maxolasersquad.com/snes9x.png -O /usr/share/pixmaps/snes9x.png

Part 2 - Building the GTK3 version of Snes9x
The GTK3 version includes a nice GTK interface with all sorts of configurable options, including fullscreen.

First we need to get the dependent libraries.
sudo apt-get install intltool autoconf automake libglib2.0-dev gawk libgtk-3-dev libxml2-dev libxv-dev libsdl1.2-dev libpulse-dev libportaudio-dev 
As of Ubuntu 15.10, instead of libportaudio-dev you need to install portaudio19-dev.
If you want a GTK2 build then install libgtk2.0-dev and you can leave out libgtk-3-dev.
Now we can generate the install scripts and compile.
cd gtk
./autogen.sh
./configure --with-gtk3
make

sudo cp snes9x-gtk /usr/bin/
sudo chown root:root /usr/bin/snes9x-gtk
You can leave out --with-gtk3 if you want a gtk2 build instead.

Now we have an executable binary named snes9x-gtk.

To create an entry in our desktop menu create the following file and save it as /usr/share/applications/snes9x.desktop
[Desktop Entry]
Version=1.0
Name=Snes9x GTK
Comment=A portable, freeware Super Nintendo Entertainment System (SNES) emulator.
GenericName=Snes9x GTK
Keywords=Games
Exec=snes9x-gtk
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/usr/share/pixmaps/snes9x.png
Categories=Game
StartupWMClass=Snes9x
StartupNotify=true
Finally, find an icon you want to use and save it as /usr/share/pixmaps/snes9x.png You can get a good icon to use here.
sudo wget http://maxolasersquad.com/snes9x.png -O /usr/share/pixmaps/snes9x.png