Thursday, January 17, 2013

Installing Minecraft on Ubuntu

UPDATE: As of Minecraft 1.6 these instructions no longer work. I have posted updated instructions at Installing Minecraft 1.6 on Ubuntu.

This post is for anyone who wants to install Minecraft on Ubuntu and have it feel like any other game installed via the Ubuntu Software Center. It assumes you have already purchased Minecraft and provides full Unity integration, though Unity is not needed for this to work. In fact, I suspect it should work for any Linux distribution that has a desktop environment.

We are going to do this via the command-line because copy-and-pasting commands from this tutorial is easier and more fool-proof than following a long list of screen shots. It's also easier for me to write it that way as there are fewer steps.

First we need to install Java. The website claims it needs Sun Java, but the open source Java in the Ubuntu repos works just fine in my experience.
sudo apt-get install openjdk-7-jre
Now we need the actual game
sudo wget https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft.jar -o /usr/games/minecraft.jar
sudo chown root:games /usr/games/minecraft.jar
sudo chmod 755 /usr/games/minecraft.jar
Change the vi part in the next section to gedit if you want a graphical text editor.
sudo vi /usr/games/minecraft
The file contents should be as follows.
java -Xmx1024M -Xms512M -cp /usr/games/minecraft.jar net.minecraft.LauncherFrame
And then set the proper permissions on the file
sudo chown root:games /usr/games/minecraft
sudo chmod 755 minecraft
Again, change vi with something else if that is easier for you.
sudo vi /usr/share/applications/minecraft.desktop
And put this in the file.
[Desktop Entry]
Name=Minecraft
Comment=Build your own world
Exec=minecraft
Icon=minecraft
Terminal=false
Type=Application
Categories=GNOME;Applications;Game
Keywords=minecraft;Game
StartupNotify=true
The last piece we need is an icon. There are many good Minecraft icons at http://www.rw-designer.com/icon-detail/5547 I like http://www.rw-designer.com/icon-image/5547-256x256x32.png as it gives us the highest resolution available. Replace the URL of the icon you prefer to use in the following command.
sudo wget http://www.rw-designer.com/icon-image/5547-256x256x32.png -o /usr/share/pixmaps/minecraft.png
Now you should be able to play Minecraft by simply typing minecraft in the command-line, in the Unity dash, the KDE prompt, or by browsing to the games menu in the applications menu in your desktop environment of choice. It is also available to all users of your desktop.

You also do not need to do anything to update. Minecraft updates itself each time you start it.

BONUS

I've got one more neat trick up my sleeve. If a CraftBuntu spin sounds good to you, here's how you can setup Ubuntu to just run Minecraft when you sign in. It assumes you have already done the above.
sudo cp /usr/share/applications/minecraft.desktop /usr/share/xsessions/
Now Minecraft is an available option when you select your desktop environment. This works best if you set Fullscreen in the Minecraft options.

You could do a number of things with this setup. You could setup a minimal Ubuntu installation that has no desktop environment, or other desktop-related software installed. You could also allow guests to play Minecraft without touching any of your stuff by them selecting the Ubuntu guest account and setting Minecraft for the login. I have even found that on my struggling laptop this setup allows Minecraft to run more smoothly as there is no other desktop cruft running in the background.

Tuesday, May 29, 2012

ssdownloader

I recently purchased some electronic media from Simon & Schuster.

Apparently the technology guys at Simon & Schuster believe in "Java Over Functionality." Unlike most companies that sell DRM-free digital media, I was not given a link to download zip file containing the contents of my purchase.

Instead, I was given a JNLP file, which is nothing more than an XML file. A little Googling revealed that these files should be openable by javaws, a Java Web Starter application. After getting the file to successfully run, I was greeted with a custom download manager. This is great because why offer a simple download that will be managed with my browser's download manager when I can have some half-rate, custom download manager to fudge things up?

So the download manager asked me where I would like to save the file, downloaded each file individually for about twenty minutes, and then told me it was done. There was a big problem, my files where not in the location I specified. In fact, a hard drive search revealed they didn't exist anywhere on my machine.

I tried again, no dice.

So, if Mother Necessity if the driver of invention, then welcome her new baby, ssdownloader. I wrote this Python app up in a little over an hour. It was a good chance to strengthen my weak command of Python, and to actually get the stuff I paid for.

It simply parses the JNLP file to find the other XML file that defines where the actual downloads are. It then loops through that file, grabbing each file and saving it locally. If anyone out there gets frustrated trying to make good on their Simon & Schuster purchases, feel free to use this to make your life happy.

Tuesday, May 1, 2012

500-Mile May

This month I'm going to try to really push myself physically and travel 500-hundred miles on foot or bicycle. To accomplish this goal I will need to travel an average of 16.13 miles per day.

A bicycle ride to work gets me 10 miles each way, giving me a potential 20 mile each workday. Except, on Fridays I go to Bread and Roses after work, which is a 6 mile ride. This gives me 19 non-Friday weekdays, and 4 Fridays, so 19 * 20 + 4 * 16 = 444 miles on bicycle.

That gives me only 56 miles to find elsewhere. In my one-hour lunch-break I can fit a 2-mile walk or a 4-mile run. In practice, presently, I can only run about 2 miles. With 23 work-days, that comes out to 46.  444 + 46 = 490 miles. Now I've only got 10 miles left to make up. This can be done over the weekend, or by walking the dogs after work.

As always, a big factor here is the reality of life. Last weekend Kim came down with a surprise case of appendicitis. That has put the task of transporting the kids before and after work on me for now. So today, the first day of my challenge, I did not ride to work and will not be riding home. I did get a 2.17 mile run in, but that's a far cry from the 16.13 miles I need each day, and not a good start.

I've also got a conference with Athena's teacher on May 8th, so I will not be riding to work that day, but can still ride home. May 10th I will be participating in Aurora's field trip to Saint Augustine. The walking may make up some of those miles though.

I can only assume other life-events will show up, and will have to take them as they come. As strange as it may seem, I don't believe I will actually be able to make my goal. However, I'm going to give it my all and see how it goes.

I will be keeping my activities updated at http://www.google.com/fusiontables/DataSource?snapid=S478383Gdyj

You can also see all of my recorded activities on Runkeeper at http://runkeeper.com/user/maxolasersquad/activity/


Monday, April 16, 2012

GPS navigation with Osmand+



On Friday I went down to Deland, Fl to get my grandfather who was on a fishing trip down there.

When I was first asked about going down there to get him I viewed the map in OpenStreetMap and made some corrections to the fish camp he was staying at there, and made all the appropriate tags.

In the past I have tried to use Osmand+ to route me places and have found it to be all but useless for getting directions.  Since I didn't have any time frame I needed to make it down there I decided I would try the latest version to see how it would perform.

Everything seemed to go very smoothly, thought I am very sure that the route it took me was not the best.  It had me get off after Gainseville, drive east of town, and then head South.  I took its advice since I like taking back-roads when I'm not pressed for time.

About two miles from my destination it tried to take me down a road that ran into a private government area that was blocked off by a fence.  I tried Google Maps and it was doing the exact same thing.

I drove just a few hundred feet past that wrong turn and it rerouted me the correct way.
At my destination I fixed the OSM mapping and filed a bug with Google Maps.  I also walked around the fish camp and made updates based off of observations that could not be easily made from satellite imagery.

I was very happy with the capabilities of Osmand's offline routing mode.  The most recent version of the offline maps for Florida did not have the fixes I had made for the fish camp the previous week, but that was alright as prioprietary maps can take years to have updates and receiving the updates can be costly.


Monday, March 26, 2012

Beginning NE Tallahassee

I have reviewed and/or mapped, in Tallahassee, all roads east of Monroe Street, North & West of Capital Circle Southeast, and south of Tennessee Street. Last weekend I began moving north of Tennessee Street, where I will focus on everything South and West of Capital Circle, and East of Monroe Street.

My ultimate goal is to have all streets within the Capital Circle cup and South of the Interstate reviewed and mapped. The idea is that within Tallahassee, the maps should by 99.999% reliable. Once this area has been mapped I'll begin seriously moving outside of that circle and getting areas like Buck Head and Killearn. I will also begin an attempt at getting all buildings and POIs marked within the circle.

I've added some building and businesses in areas I frequent, such as around Apalachee Parkway.

Tuesday, January 10, 2012

Copy and paste from the system clipboard with vim

Often, when using vim, highlighting text in the terminal to copy-and-paste it around is plausible.  This is definitely true when on a true terminal.  I use the rnu option so that I have relative line numbers on each line.  So copying multiple lines with the mouse grabs the line number with unwanted indentation.  When I need to move code around it is annoying to have to manually remove the numbers.

To understand how to get vim's clipboard to match your system's you need to understand vim registers.  On a computer we usually only get one clipboard.  Every time we ctrl-c, the contents of the clipboard are discarded and replaced with whatever is highlighted.  We don't have any option to copy multiple objects and then paste them around.  However vim has multiple "registers" where text can be copied and pasted from.  To see the registers type :reg in command mode.

The register that we are interested in is register +.  To test it out, copy some text from another application then run :reg and see the contents displayed in register +.

So now we just need to know how to access the contents of register +.  Register access is done with ".  To paste from they keyboard we type "+p  To copy, for example an entire line, into the system clipboard we type "+yy  To delete the current line and store it in the system clipboard we type "+dd

We can also use registers with visual mode.  If we wanted to copy the line underneath the cursor we would type V"+y  We could copy the next three lines into the system clipboard by typing Vjj"+y

To sum it up, to use the system clipboard to copy and paste in vim simply do what you would usually do in vim, then prepend "+ to your y (yank) or p (paste) command.

Update:
Depending on the version of vim you are using, the register for the clipboard may work differently. In some cases the * and + registers are the same register. If you want to find out which register is for your system clipboard, simply copy some text from anywhere into your clipboard, then run :reg. Whichever register has the text you copied is the register that holds the contents of your clipboard.

Changing priorities for a bit.

I'm going to cease work on beefing up the Tallahassee map and fixing MapDust bug in Florida to start addressing area that the OSM Inspector shows needs to be addressed before the licensing change.  Given that this is time sensitive it will be my new effort up until April 1.

Thursday, December 15, 2011

Finding duplicate MapDust bugs.


One big issue that the MapQuest app seems to have is that it sometimes will report a single button multiple times at the exact same lat/long. Often one of the duplicates will have the description the user entered, if one was entered at all, and the other bugs will have seemingly random Types, with the default text for that type in the bug report.

In my effort to squash all reported in Florida, sometimes I just go looking for invalid bugs so that when I'm in the mood to do some real fixing its easier to find actual problems. In that spirit I have whipped up a quick way to find duplicate bugs so that the dupes can easily be marked invalid so that the original can later be individually verified.

To find duplicate bugs, first download the latest MySQL database extract from http://www.mapdust.com/dumps/latest_mapdust.sql.tar.gz Unzip the database file in the tarball to wherever is convenient for you.

Install MySQL on your system and then run the following command:
CREATE DATABASE mapdust

Now edit the database extract and add the following to the first line. 
use mapdust;

Now, while in the same directory as the extract file run the following command
mysql -u root -ppassword < latest_mapdust.sql

Replace the word password above with your root password, being careful to not put a space between -p and your password.

Now we are ready to query our new database for duplicates.
use mapdust;
SELECT id,
    latitude,
    longitude,
    bug_count

    FROM
    (
        select latitude, 
            longitude, 
            count(*) bug_count 
            FROM osmexportbug 
            GROUP BY latitude, 
                longitude 
    ) foo
        JOIN osmexportbug 
            USING (latitude, longitude)
    WHERE bug_count > 1
        ORDER BY bug_count, 
            id;

You should now have the bug number and lat/long of the duplicates. The ones that belong together are easy to spot because they are sequentially together. I use the following query to only find duplicates in Florida.
SELECT id,
    latitude,
    longitude,
    bug_count
    FROM     ( 
        select latitude, 
            longitude, 
            count(*) bug_count 
            FROM osmexportbug 
            WHERE administrative_area = 'Florida' 
            GROUP BY latitude, 
                longitude 
    ) foo 
        JOIN osmexportbug 
            USING (latitude, longitude) 
    WHERE bug_count > 1 
    ORDER BY bug_count, 
        id;

After locating a strand of duplicate bugs I go through and mark all but the lowest numbered bug as a duplicate. I use language like the following:
Duplicate of bug 85064.
http://www.mapdust.com/detail/85064


Later when I come across the original bug, I'll only have the one to verify and squash, not a bunch after it to go through and tediously mark invalid.

I hope this helps any other bug squashers out there looking to address the bugs the awesome MapQuest users are out there reporting for us.

Sunday, December 11, 2011

Out of town mapping

This weekend I went down to the West Palm Beach area to celebrate my sister-in-laws graduation from FAU. My father-in-law noticed that his son's neighborhood was not completely mapped in either Bing or on Google. Bing is missing some streets, and Google is missing some street names. I pulled up OSM and the situation was even worse. No streets where mapped at all. Apparently this place was only built around two years ago.

Like a good OSMer, I began tracing the missing streets using the areal imagery. When I was done with that I downloaded the area into JOSM, loaded the kids into the car, and drove around, marking the names of the streets as we campused the neighborhood. When we got back we uploaded the edit, and now OSM has the only 100% mapping of the area.

I mapped some other missing streets, but there is no chance of me getting the chance to visit the areas to get street names, mostly because of time issues, but also, these are gated communities where I wouldn't be allowed in to anyways.

Thursday, November 10, 2011

Steve Jobs was wrong on Flash

With Adobe's recent announcement that they will discontinue supporting Flash on mobile devices, a lot of people are declaring that Jobs was right on Flash. I say he was wrong and here's why.
Before we really start, lets set the record straight about Flash. Flash allowed web developers to do things that where impossible in HTML. This was good, but many developers got carried away and created monstrosities, building websites void of HTML and completely annoying to use. This gave Flash a bad name amongst real web developers who saw it as a cop-out for developers. However it allowed games and videos to exist in a space where it would have otherwise to deliver such content. As HTML5 has been rolled out amongst every major browser web developers have been looking forward to the death of Flash.
I fall in the "death to Flash" camp, but I still believe Jobs was wrong. Computing is a user-centric experience. If the computer isn't doing what the user wants, then the computer isn't really doing its job. Designers of software are in a position where they have to balance making everything excessively configurable, such that a user try to set settings becomes confused, and making decisions for the user. This is a pretty delicate balance, and one that is fraught with inevitably some minority of users becoming upset at the choices that are made.
The direction Apple has chosen with the iPhone is to be the ultimate gate keeper, keeping their users behind a walled garden where Apple dictates what will be allowed, and how what is allowed will behave. Break Apple's rules and you get the boot, or are not even let in in the first place. This is a fundamental design decision Apple has made that has driven their product every step of the way. Because Apple holds the key they keep the bad stuff out and only allow in what they deem to be good enough for their users. Before the iPhone users have had a chance to speak their voice, Apple has decided if a voice will even be allowed in the first place. This is what Apple did with Flash. They declared Flash on mobile to be a dead end, and didn't allow their users to choose for themselves if Flash on their iPhone was good or bad. Jobs, and through him Apple, may have been right that Flash on mobile devices isn't a good idea. They where wrong, however, to not allow Flash on the iPhone. If users didn't like it, nobody had to make them use it. If nobody used it then no harm-no foul.
We can only hope that over time Flash goes the way of Shockwave, but in the meantime, lets let those purchase computing devices make that decision, not the manufacturers of those devices. It is my inherent freedom, as the purchaser of a device, to use it in any lawful way I choose. It is unethical for the makers of that device to micro-manage those choices for me, barring me from the decision making process.