Installing Spotify on Mint 17

I was really excited to see that Spotify has put out a “Linux Preview,” which means I can install Spotify on Linux without messing with Wine. When I was researching putting Spotify on my system, I can across an official blog entry that announced Spotify for Linux. I was a bit worried because the blog said that because they hadn’t gotten the ads to work, it was only available for paid subscriptions. However, I found that my free account would work as they have fixed the no-ads problem.

When first installing, I tried to follow the instructions listed on Spotify’s website. Unfortunately, this didn’t work at all. I tried a few times, each time getting an error that I couldn’t connect to the repo. I ended up having to do quite a bit of research and try a few different things. I finally got it to work on Linux Mint 17 MATE, and here’s how:

First, I added Spotify’s repo to my software sources. I went to the “Software Sources” program, under Administration in the Menu. From here I went to “Additional Repositories.”

In Additional Repositories, I clicked “+ Add a new repository…” and entered
deb http://repository.spotify.com stable non-free like this:

Once Spotify’s repo is added, the “Additional Repositories” tab of “Software Sources” should look like this:

After Spotify’s repo has been added, I entered a couple commands to install the software. The first command enters the repository’s key to unlock it. I entered this into the terminal:
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 94558F59
Make sure you use the key 94558F59, there was another key but it was changed. This is the correct key as of this post.

Now that I was connected to the unlocked repo, I was able to install Spotify for Linux. I put this command in the terminal:
sudo apt-get update && sudo apt-get install spotify-client
Make sure to install spotify-client and not just spotify, this seems to be a spot that causes hang-ups.

After Spotify is installed, it should be stored under “Sound & Video” in the Menu. You have to log into your account, but a free account is fine. As you can see, the ads work fine.

I much prefer using a Linux program whenever possible instead of using Wine. It makes sense to support Linux by promoting programs for it. The more we ask for and use software like this, the more companies will make. Spotify’s Linux Preview works really well, I’m really not sure why they’re still calling it a “preview” as it’s very polished and smooth. After getting it to install, the program is easy to use. I prefer Banshee for listening to my library, but I like the radio stations I make and getting to listen to albums I haven’t (yet) bought.

If you’re using these instructions to install Spotify, be aware that I’ve only tried this on Mint 17 MATE. I’d assume it’d be the same for all the versions of Mint, except LMDE, which might be different. I think MATE, Cinnamon, KDE and Xfce pretty much use the same commands, but the look of the Software Sources program might be different.

Advertisements
Posted in Experiences, Trails & Errors | Tagged , , , , | Leave a comment

Drake Equation Calculator

I’ve been mentally working on new program for a week or two. What I wanted this program to do is to calculate the Drake Equation based on whatever variable I put in. I could try different values and see how that effects the total number. Sort of like this.

The Drake Equation is an equation that helps us think about how rare or prolific aliens who could communicate with us might be. The results of the Drake Equation aren’t really considered an accurate estimate of the occurrence of intelligent life, because every variable is an estimate. These estimates vary greatly based on a person’s opinion or philosophy, as well as what scientists have learned. While I don’t think anyone should put too much stock in the equation’s results, I find it really interesting how two different people can have such vastly different numbers.

Needing to practice Ruby more, I thought programming a Drake Equation calculator would be a good exercise. It allows me to use different values each time I run the program, plus I can add on more variables if I want to.

For my program, I wrote two methods: one that will allow the user to put in each variable and one that will multiply an array of variables. The program then calls the variable method to get values for each variable. After getting all the variables, they’re fed into an array, which gets fed into a method that multiplies them together. Other that all of the strings (text) that explains what the variables are, it’s a very short program. (The line numbers are so high because of all my notes at the top defining what the Drake Equation variables are :P)

I ended up having to look up a few things to make this program. First, I had to look up the Drake Equation. I needed to know exactly what each variable stands for and how to describe them. I decided to keep the Drake Equation’s original variable names because it seemed an easier way to keep them straight.

I also had to look up how to do a couple things in Ruby. First, I needed to convert a string to a float. I should’ve been able to guess that it would be .to_f, simply because I already knew that to convert an integer to a string I use .to_s. I also had to look up how to multiply all the floats in my “milkyway” array together. I used .inject(:*) to multiply my array values together.

I double checked how my program calculates, and it seems to work just fine. I’ve run it a few times with different values for the variables, getting wildly different answers. I also expanded the program out to include all of the galaxies we know about, not just the Milky Way.

I’m actually pleasantly surprised at how easy it was to make this program. With getting back into programming, the parts I’ve had trouble with are keeping my variables straight and organizing the objects. Really thinking out how I wanted the program to work and how to achieve that in logical steps helped make the programming itself go quick, without hiccups. I think drawing out a mind map would help me work like this in future projects.

Posted in Coding, Programs | Tagged , , , , , | 2 Comments

Morrowind On Mint

Getting Morrowind to install on Linux Mint was surprisingly easy. Morrowind is my favorite game of all time. The story is so expansive that there’s no way I could get bored of it.

Through the software manager, I was able to install both Wine and Play on Linux.

Wine is a program that lets me install Windows software onto my Linux system. Play On Linux is a GUI that will install the software and any additional components the software needs, like DirectX.

Setting up Morrowind using Play on Linux was super easy. Since Morrowind is one of the games someone else has set up, I simply had to choose Morrowind from the Install Menu. By choosing this instead of a manual install, I don’t have to figure out how to configure Wine or which components I need to run the software.

I simply chose the option for “The Elder Scrolls III: Morrowind,” inserted my game disk, and followed the instructions for installation. I didn’t run into any problems during installation.

Once the game is installed, to play it I put in my disk, open Play on Linux, and choose to run Morrowind.

The game runs really well. The graphics & speed is much better than it was when I was using Vista or XP. It’s very smooth feeling, I don’t really have to wait for loading like I used to.

Some of the games I want to add aren’t listed in Play On Linux’s install menu. To get these games to play, I’ll have to manually install them, configuring Wine myself and choosing which components I need. I’m hoping this won’t be too difficult, I’d like to put all my Windows games on my Mint system if I can.

This is very important to me, as it turns out my other PC, which is running Windows 8.1, isn’t compatible with at least half of my games. This is a huge disappointment: that PC was specifically purchased for gaming. Also, while I use a computer for lots of things, the rest of my household mainly use PCs for games. It’s looking like I’ll have to do a lot of work to get my games to play on my Windows PC. I’ll either have to try using an XP emulator for Windows, or dual boot with Linux and use Wine. But it really seems to me that if I’m having to put in as much (if not more) work to get a program to run on Windows, why keep it? I might as well do the work running Linux and get the added benefits of security, performance and control.

Posted in Experiences, Programs | Tagged , , , , , , , | Leave a comment

Regular Expressions

Regular expressions (or regex) are a bit confusing. I read the chapter in the Rute User’s Tutorial on regex, but found that I didn’t quite get it. So I watched Nixie Pixel’s video on regex and re-read the chapter while testing out the commands. I think what was confusing me is that the different symbols change meaning depending on where you’re using them. It’s going to take a bit of practice using regex before I will remember which symbols mean what in which circumstances.

To practice, I followed Nixie’s example instead of the Rute User’s Tutorial’s. Instead of trying it out using one of my documents, I used the dictionary that came with Mint (/usr/share/dict/words). However, I tried out the commands listed in the Rute User’s Tutorial, as they had a lot more explanation. I then tried out some of my own.

Both Rute and Nixie only used regex with the grep command. I’m not sure if this is the only thing regex is used for in the terminal, or just the most common way to use it. Basically, the grep command finds strings in documents. The egrep command (or grep -E) extends grep to allow ors (this is or: |), so I can search for this|that. There’s also fgrep, which searches for strings but doesn’t use regular expressions, so you don’t have to escape (\) for special characters.

While having a reference in front of me that tells me what all the symbols are, using regex in grep isn’t that difficult. The command:
grep ‘b[a-f]*’ /usr/share/dict/words
will pull up words from my dictionary that contain a string that has the letter ‘b’ followed by any combination or number of the letters ‘a’ through ‘f’. In practice, this would search for all the words that contain the letter ‘b’, as any can mean none. So I get results like bad, zebra and visibly.

I can narrow my search by searching for whole words instead of strings. To do this, I add the argument -w. It will now search for words that contain only ‘b[a-f]*’ which would include beefed and bad, but not wombat. The command with the -w argument added looks like this:
grep -w ‘b[a-f]*’ /usr/share/dict/words

I can also search for a limited number of letters. If I wanted to find a four letter word that began with ‘j’, I would enter:
grep -w ‘j…’ /usr/share/dict/words
The period (.) is a wildcard that means exactly one letter. My results would include jive and jump, but not jammed or inject.

I can also search for strings that begin or end with certain letters. The carrot symbol (^) means begins with, the dollar sign ($) means ends with. If I wanted to search for four letter words that began with ‘j’ and ended with ‘t’ I would enter:
grep ‘^j..t$’ /usr/share/dict/words
For the results, I only get jest, jilt, jolt and just. I didn’t need to add the -w argument because I was searching for something very exact, with every letter defined.

I can also exclude letters from my search. When a carrot is inside brackets, it means not. So, the command:
grep ‘^j[^a-f]*t$’ /usr/share/dict/words
will give me results that start with ‘j’, contain any number of letter except ‘a’ through ‘f’ and ends with ‘t’. My results include jot, jolt and jumpsuit, but not jest. To me, this is the hardest part of regex: remembering when symbols have the different meanings.

There is one more type of search I wanted to share. The egrep command allows me to use or (|) in my searches. To search for words that begin with either ‘th’ or ‘sh’, are followed by any number of letters ‘a’ through ‘f’ and end with ‘t’, I would use the command:
egrep ‘^(th|sh)[a-f]*t$’ /usr/share/dict/words
My results would include shaft, that and theft, but not throat or shift.

This isn’t everything that was covered in the Rute User’s Tutorial, and it looks like there’s another section on regex later in the book. I can see a lot of potential uses for this: a scrabble helper as Nixie Pixel suggested, to look up employees in a database, to look up specific names of things if you can only remember part of what you’re looking for, etc. It might also be very helpful if I’m looking for typos or spelling errors in my own programming code. I don’t think this tool will be something I use on an everyday basis right now, but I think continuing to practice using regex will help me later.

Posted in Coding, Command, Experiences | Tagged , , , , , | 1 Comment

Basic Commands

I have successfully tackled the “Basic Commands” chapter in Rute User’s Tutorial. This chapter had a TON of useful information on the command line. There’s sections on the different error codes, file types, wildcards, man pages and commands. The really common commands get explained more in-depth. It’s pretty much everything a person needs to know to get started using the terminal.

The first thing that seemed really important for me was the explanation of glob expressions. I already knew about the wildcards: * matching any number of characters, ? matching one letter. These are great for finding files, ls *.pdf will list just my PDF files. Globs work the same way, but let me restrict the parameters to specific characters. Thus, ls [a-f]*.pdf will only list PDFs that begin with “a” through “f”.

Globbing would be especially helpful if I followed the author’s advice in file naming. The book suggests that I make up my own extensions to use on my files. The example the book gives is to name all letters person’s_name.letter. By doing this, I can search for all of my letters by searching for *.letter. I could search for all of my letters to my various aunts by searching for aunt*.letter. This seems like a genius file naming system. It seems like it would be especially useful for pictures. Setting up image file names with the pattern activity/pose/description.subject would allow me to search for selfie.* or *.val. It would also be great for music files: song_name.artist.

The second part of the chapter I found really useful was the list of commands. It’s a rather long list for a beginner, but each command has a description. The most useful of the new-to-me commands is clear, which just clears off my terminal screen. I also really enjoyed following the author’s suggestion for the calendar command: cal 9 1752. This month is crazy looking, the book says “the pope had a few days scrapped to compensate for round-off error.” I also tried the commands head and tail, but the results were not what I was expecting. I assume since the file I tried it on was a PDF, the information displayed was for formatting the document.

A lot of the commands listed are for manipulating the contents of a file. These commands don’t seem to always work on the documents I usually use, PDFs, spreadsheets, etc. So I might have to make up some .txt documents so I can play with these commands.

The author also recommends installing Midnight Commander, a file manager that will let me move around files more quickly. I haven’t installed it yet, but it’s definitely something I’m going to look into.

Posted in Coding, Experiences | Tagged , , , , , | Leave a comment

New Faves

I have a new favorite Linux book: Linux: Rute User’s Tutorial and Exposition by Paul Sheer. It can be read online, or can be downloaded. The PDF is laid out inconveniently for an e-reader, but the fabulous content more than makes up for it.

This book has been awesome so far. It is comprehensive yet concise. The writing is much clearer than most of the other books I’ve been reading. The language is casual and conversational, with little asides. It doesn’t feel stiff. While it does use jargon, all the jargon is adequately explained. Since it is easier to read than the other Linux books I’ve seen, I’m having a much easier time actually remembering the information presented.

I’ve only been reading the Rute User’s Tutorial for a couple days, but already I feel like I’ve learned a lot. I just finished chapter 3, and so far it’s covered a lot of the basics of computers, such as the different number systems and computer parts. Comparing just the computer parts section to another book, one of Comptia’s A+ certification books, the information presented is exactly what is needed. No more, no less. The A+ certification book I’ve been reading gives overly detailed information on the computer parts: it gave a huge list of ALL the different kinds of each part, like who manufactured it, various specs, why it was replaced with this different part 30 years ago, etc. If I was working on a computer and needed to know some spec of a piece of hardware, I wouldn’t go on memory, I’d look it up to be sure. Instead of giving me a bunch of information that I won’t use, Rute gives me exactly what I need to know to get things to work and to find more detailed information if I need it. It tells me how a piece of hardware works, why it works that way; it doesn’t bog me down with numbers and specs.

The Rute User’s Tutorial seems like it’s going to cover everything I’ll need to know to be able to work with Linux. It covers shell scripts (from beginner to advanced), the Linux file system (with explanations of  what each system folder is actually for), networking, some C, servers, etc. It also has sections on each of the Linux certification tests. The progression from simple to complex seems to be well laid out so that I can comfortably advance.

Out of the ten computer-related books I’ve been reading over the past couple months, the Rute User’s Tutorial and Learn to Program are the only two I’ve actually enjoyed. The former is my favorite, and I’m really glad I found it.


My other new favorite is Nixie Pixel’s OS-Alt YouTube Channel. I found her while browsing around and she’s great! She’s funny & smart. I have yet to watch all her old videos, but the ones I’ve watched have been both entertaining and informative. She has a lot of videos on security that I really want to watch. I’ve watched a couple of her episodes comparing different products and found them very useful. There are also a number of tutorials on Linux.

I also like Nixie because I like to see women represented in the computer world. Sometimes it feels like a lot of the computer or gaming community is surprised that I’m reading their webpage with asides like “if a girl ever reads this page.” We use computers just as much as men and we play games as much as men. I feel that the only way we’ll see ourselves represented in the products we’re purchasing is if we step up and say we’re using this stuff too. So I admire Nixie Pixel for having the guts to do something I won’t do: put herself out there in videos open to the trolls of YouTube.

Posted in Helpful Sites | Tagged , , , , , | Leave a comment

DOSBox Games

A couple of days ago I was in the mood to play some of my old Windows games. I had no idea what it would involve, but I was determined to get it working. Since these are old Windows games, I couldn’t just run them on my Linux laptop as-is. I had to use a program called DOSBox. This program emulates an old Windows computer. When you open the program, it looks like DOS, which I have barely any experience with. So I couldn’t just download the program & know which commands to use to run my games.

To find out how to play my games, I did a little searching and found a guide that walks through the process of getting your games to play with one click. It was especially nice that the writer was using Mint, everything looked familiar to me.

Following this guide, I was able to run both of my games (without sound) using the following commands while in DOSBox:
mount c /home/myusername/dosgames
c:
cd gamedirectory
gamefile

These commands navigate to the directory where a game is stored and then loads up the game. The game plays from here, but doesn’t have sound.

To get the game to play with one click, I created a new configuration file that would have the above commands in it. I did this by copying the standard .conf file and adding the commands at the bottom. The next step was to create a launcher in the menu that would run DOSBox with my game configuration file. This is where I ran into problems.

The terminal command I used in the launcher was this:
/usr/bin/dosbox -conf /home/myusername/.dosbox/game.conf

When I ran the launcher I made, instead of my game loading like in the tutorial, I got an error message saying doxbox doesn’t exist. This made me double and triple check my spelling, thinking that maybe I typed doxbox instead of dosbox. I rechecked my paths and the .conf file I made, but couldn’t find where I made a problem. The next thing I tried was to type the above command directly into the terminal instead of using the launcher. Typing in the command directly worked! It was great that I had a shorter way of starting up my game. However it was tedious, especially for multiple games. Moreover, I still had no sound.

To make it easier to run multiple games, I ended up downloading a GUI front-end for DOSBox called DBGL. This program allowed me to put in the info for each game: the .exe file and the setup file (for sound YAY!). It also fetched all the game details from an online database. It’s pretty easy to use, there’s a wizard to use to create a new profile, which makes set up a snap. After I get the profile finished and configured how I like, I can either double click the game or there’s a play button. This in particular is very handy as it allows other family members to play the games after I have them set up. The hardest part of using DBGL is figuring out which file is the setup file that allows me to play sound.

I think my next gaming task will be to find a way to play my middle-aged Windows games on my Linux laptop. The first step, as always, will be to find them again. Maybe in a few months I’ll restart Morrowind, my all-time favorite. I think I can do it using Wine. I’m currently thinking the problem will be finding my original cases for the access codes!

Posted in Experiences, Helpful Sites, Programs, Trails & Errors | Tagged , , , , , | Leave a comment