Sunday, June 2, 2013

How to install Google Chrome in Fedora 19

I had some trouble installing Google Chrome within firefox. It downloaded the .rpm file to /var/temp, but was unable to install it with gPackageKit due to "insufficient permissions". If you have this error, or just want an easier way to install Google Chrome, here is how:
Dependencies
I had an issue as well with my package manager not automatically finding one of the dependencies, but this problem could have been on my end. To be safe, install the "lsb" package from your package manager.

The Command
This one-stop-shop command (as root) will Download and install the x86 version of Google Chrome.

wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm && rpm -i google-chrome-stable_current_1386.rpm

For the x86_64 version:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && rpm -i google-crhome-stable_current_x86_64.rpm

Of course, both of these commands assume that you have read the license agreement here: http://pastebin.com/ExXM86Y1

Congratulations, you are now the proud owner of a Google Chrome browser.

Saturday, June 1, 2013

Fedora 19 Beta Review

The Red-Hat sponsored, community-driven Fedora project is gearing up to release its 19th installation of their Operating System; it is named Schrödinger's cat. In fact, there is a funny story regarding the name, and the first thing that this review will touch on. The name, containing the exotic ö unicode character, crashed the bug report system since it could not properly handle Unicode. It has yet to be seen whether or not this problem effects other software that will process the distribution's name, but it's impossible that the decision to put this character in the name will not cause any grief. It was silly to let something like a name cause technical uncertainty (they could have just as easily named it Schrodingers cat).

Now that that part of the review is out of the way, let's look at the meat and bones of the Fedora system.

If you do not already have the .iso, grab it here: http://fedoraproject.org/get-prerelease?anF19b. The .iso file is very large, coming in at 4.4 GiB (enough to fit on a DVD -- Barely. It will trim down a LOT after the release)

Installation
-----------------
I do not have pictures or video of the installation. In fact, this review is mostly text-based because of how little has changed from 18. The installer DID change in a positive way, however. My first impression was of a particularly weird boot with text that was semi-selected. I couldn't tell which option in the boot screen was selected, but I could tell if I was at the very top or bottom of the list, so it was enough information to boot the .iso.

The installer then presented the option to either install the system, or try and install the system. I chose installation. The installer is still similar to the installer from Fedora 18 (which caused a LOT of controversy for various reasons. Yes, it does still try to look pretty. Yes, the done buttons are in weird spots.) The installer felt snappy on my hardware, and it had some options I wouldn't have inspected, like installable software sources with really good developer support (like a patched Eclipse).

The disk partitioner didn't ask me what I wanted to do, but since I didn't have enough room to install the image (10 GiB for me when all was said and done) it dropped me into an advanced partitioning tool. In terms of aesthetics and ease-of-use, it was probably the easiest to use out of any of the major distros. Feature-wise it was lacking. I saw no option for full-disk encryption (but it may have it; I just didn't see it) and no option for BTRFS.

When the disks were set up, it began the installation with a slide-show down on the bottom of the screen like Ubuntu has. The slideshow's pictures were not antialiased, and the viewing window was unusually small, almost like an ad. Most of the screen space here was wasted, except for options to set the root password and set up users. The user setup was impressive, toting features like changing the username based on the real name in real-time. 

After-Installation
I installed the Gnome version, so if you went a different route that is where this guide will differ a bit from you. Later on it will converge, but I have to get a lot of Gnome stuff off my chest.

When you log into the desktop environment, there is a nice post-installation greeter (graphical) like (Arch|Crunch)bang's to let you move through some userland options. When all of that is done, it plays an annoying little Gnome video tutorial, which was unnecessary but helpful for people new to the system. Up to this point, all was going swimmingly. On the surface it was a good system, but Gnome had a way of ruining that.

Problems with Gnome
Why would I put this in the review? Well, Fedora is strongly tied to Gnome, therefore a majority of Fedora users will be running Gnome. I had a particular amount of trouble doing simple tasks, even logging out.

GNOME takes a weird approach when it concerns their users. GNOME believes that GNOME knows best, and that GNOME'S users are inherently stupid and need to be protected from their own idiocy. I have heard this grip from within the Linux community since 3.2, but it is only now in Gnome 3.8 that I have seen the effect full-on.

Problem 1: No Logout Button
Gnome has a policy now where it will not provide a logout button within the Desktop Environment unless more than one user exists. There's NO ESCAPE. Want to switch Desktop Environments? Nah, Gnome says you can get back to work in your crappy fisher-price diluted Environment that they give you. There are only a few ways to circumvent this, and more in-depth guides will come later. In short, running "sudo pkill gdm" in the terminal will terminate the display manager, which systemd will re-initialize, bringing you back to the login screen. This is a dangerous hack, but aside from adding a user it is the only way.

Warning: Technical
Installing Desktop Environments aside from GNOME is a whole other ordeal. Because of how gdm works, in some Desktop Environments X clients (windows) that are closed will remain drawn onto the screen. Completely changing the display manager is the only way I found to get around this. To do so, install one that you are comfortable with (lightdm is a good choice; I prefer lxdm) and then run "systemctl disable gdm.service && systemctl enable [your display manager].service" before rebooting. These are systemd commands that will disable gdm from booting and replace it with something else.

The Verdict
The Fedora Experience will vary judging by who is having it. Personally, I have very much liked the repositories, package manager, and some of the defaults that it came with, even if it was a pain for some reasons (i.e Chrome not being installed properly).

Technically this is not a production OS. TECHNICALLY. It is  strange, but I have had less usability and stability problems with Fedora 19 than I had with Fedora 18. Hats off to the volunteer developers and Red Hat backing for that one.

Fedora 19 could help Fedora regain its reputation after the crash that was 18.

Tuesday, May 21, 2013

How to Learn Haskell

For whatever reason, Haskell's curve of interest has been going up again. Haskell is a philosophy as much as a language, and a controversial one at that. Haskell is lazy and purely functional language. I will explain what each of those are at the bottom of this article. This is more specifically about how to set up a good Haskell learning environment.

Learning Material
For learning Haskell, look no further than http://learnyouahaskell.com/. Learn You a Haskell is written in a similar manor to Land of Lisp with its quirky prose and downright hilarious examples. Due to Haskell's lack of wide use, this book has a near monopoly on the task of learning Haskell; which is fine. The book covers everything very in-depth. If there is something in here, you will need it to use Haskell effectively, so do not skip around, especially when the problems gets harder (like the RPN calculator). Extra learning material and support can be found in the sidebar of http://www.reddit.com/r/haskell/






Development Tools
Haskell is nothing without a good text editor. There are some relatively advanced formatting standards within Haskell (especially with guards: see below). The best editor for Haskell is subjective, but I will cover the tools that I have used for Haskell development and try to take an unbiased look at each one. Before reading the recommendations I have to come clean; I use Emacs, so I may lean towards it a little bit and compare a lot of the tools to Emacs.

     Eclipse FP
Eclipse FP is a plugin for the Eclipse framework that provides Haskell project support. Extra goodies can be installed via cabal (the haskell "package manager"). If you can get it working on your system with all of the recommended goodies (scion for syntax highlighting, ghc-mod for ghci integration, etc) then this could be a very easy and welcoming development tool. Drawbacks are the chance that it will NOT work (it didn't for me, but this was the first tool I tried to use. It's probably very good) and having to install Java as well as Haskell (~128 MiB in total).

   Leksah
Leksah ("Leck - Sah", Haskell backwards) is  full-blown Haskell IDE written in yours truly (Haskell). It has some interesting features, like listing the type signature of a function when you type it (think: Javadoc lookup in other IDE's) and trying to compile the file on every keystroke, showing you (and underlining) when you make a mistake. It supports editing of Cabal files, project browsing, and graphical integration with the Haskell debugging tools. For serious Haskell users, consider Leksah. I found that it is too early in its development to be useful to me (I experienced several crashes without file saves, but this may not happen to you), but the amount of tools this brings into one project makes it enticing if you really want to get your hands wet with Haskell. Since this is a post about learning material, I don't think that this would be appealing. 

   Emacs
One many in my IRC channel said that Emacs is "Not an editor, but an operating system with a [censored] good editor". Emacs has been around for a long time and is very extensible, which means it has a lot of tools written for it. This is perfect, because Haskell matches this description very well. To make Emacs useful with Haskell, one first must install el-get  and then use el-get to install haskell-mode, ghc-mod, and scion. Be sure to add the appropriate code into your .emacs file. 

The benefits to using this is that C-c C-l will load a file into a ghci minibuffer, which is great for testing out programs on the fly as well as saving them for compilation later. Yes, Eclipse has features like this, and so does vim with the right plugins, but Emacs and these extensions happened to hit my sweet spot. Look around and see what is right for you. in this department. Emacs can also extend into an IRC client, so asking for help on #haskell on Freenode is very simple.

Learning Strategy
Haskell is overwhelming to many. If you do not know a functional language already, it may even be wise to learn a bit of Common Lisp before using Haskell. Haskell is purely functional. There are no loops or IO outside of the IO Monad, so it is a major forced paradigm shift. I would learn enough Haskell from "Learn You A Haskell" to be able to work on projects (pattern matching, functors, etc), work on some, and go back to where you left off to finish up your learning. Learn You A Haskell is a very in-depth book and without the context of some projects it will all get jumbled.

Wednesday, May 8, 2013

5 Great Linux command line Programs

Linux has withstood the test of time and gathered an interesting repertoire of software over the years. This is a list that moves from my most used to my least used software on my system. Some of the tools here are widely used and advanced, but if you aren't already using them they're worth a gander.

1. tmux
Ah, where would any of the experienced linux users be without tmux or GNU/Screen? Tmux is a terminal multiplexer, meaning that it can split a terminal session into multiple panes that can be navigated with the keyboard.  The panes can be resized and sent to windows (like graphical workspaces). The best feature is that this is client-server software, and if you close the window where you are running tmux it still won't die. For persistent ssh connections or IRC chats, tmux is king in the command line.

2. ssh
ssh is the secure version of telnet. It allows a user that is using openssh-server on their host machine to connect remotely from the command line to perform tasks on the host machine. If you are using X as your display server, you can even forward graphical applications over ssh or access the filesystem with sshfs.

3. git
Git is the version control programmed by Linus Torvalds, the same guy that wrote the Linux kernel. Git allows a user to keep snapshots of changes of a project on their computer. git is SCM and not very useful for binary data, but it works wonders for projects that need collaboration or just a very secure way to roll back changes. Git will use all available cores for compression, making it the fastest SCM in existence. Git is supported by websites like Google Code and Github.


4. vim
Vim is Vi-Imporoved. For readers who are unaware, vi is the standard Unix editor. If you have a Linux system, you have vi (this is even true for Android). Vim improves on vi extensively, adding syntax highlighting, improved navigation, and extensive plugin support. Even though graphically I prefer emacs, for remote sessions or quick edits nothing beats Vim. What sets vim apart from Emacs is modal editing, where the user has two modes to edit the file in.

5. mplayer
Last but not least we have mplayer. mplayer (and mplayer2) are tools for the command line that can play video and music of an incredible amount of formats. mplayer will use X to draw a window for a video, but it can play video in text completely with ASCII animations.






Using Maybe in Haskell

Haskell is a quirky language to say the least. I've been playing around with it for about a month now. Today somebody pointed out that I was "doing it wrong" with one of my functions. I had it defined as (roughly)

pos :: (Eq a) => [a] -> a -> Int
pos [] _ = 0
pos a@(x:xs) y
  | (y `notElem` a) = -1
  | x == y = 0
  | otherwise = 1 + (pos xs y)

The obvious problem with this is that if y is not a part of the list (and yeah, it will check every time, also bad) it returns -1. -1 is a hack in a lot of procedural languages that means "Woah there nelly, something went wrong". In Haskell it doesn't have to be this way.

What Maybe is
Maybe is a type with two type constructors (Just and Nothing). Just uses a type variable whereas nothing has no parameters. Either the thing is returned or it is not, end of story.

Here is a function that returns an int if the number parameter is less than 10, nothing otherwise.
test :: Int -> Maybe Int
test x
  | x < 10 = Just x
  | otherwise = Nothing

Remember that Just and Nothing are not types, but rather they are type constructors, which is why we can put them in the type signature under "Maybe".

How to use Maybe values
To "extract" a maybe value, you either have to make the function accept a maybe or extract the value beforehand.

Extracting the Maybe Value
Here is an extracting function that if it is a Maybe of a it will return the a, but otherwise unit (Won't actually work; just case in point)

extract :: Maybe a -> a
extract (Maybe a) = a
extact (Nothing) = ()

Make one of these extracting functions for whatever type you think you will be using.

To destructure a maybe within the function, just include the type constructor like was done in extract. This is what pattern matching was made for.


Monday, May 6, 2013

All about i3 - A tiling window manager review

i3 demo:


I have long been a user of tiling window managers. They provide a distractions-free environment, and as my work-load has been increasing, so has the number of distractions that the Linux desktop can throw at me. Sometimes it's a good thing to shut everything out and get to computing.

The number of frills that i3 comes with is SO low in fact, that it doesn't even offer a clock! When you log in you will see a minimalist interface kind of like this (minus the bar at the very bottom, that was my idea and I will cover that later)
I didn't know where to start. I couldn't do anything, and it is all my fault. I hadn't researched i3 at all. I hadn't the slightest clue how to open a terminal to "man i3" or use "google-chrome". Worse yet, I didn't even know how to exit the session, so I had to escape to a tty and pkill gdm. I was not liking i3.


It is very important to realize that i3 has a VERY steep learning curve that will gobble you up if you don't put in some effort. The end-all-be-all guide to i3 is http://i3wm.org/docs/userguide.html, the i3 user guide. It will instruct you on everything you could possibly want to do with i3. It explains the philosophy behind the window manager as well as how to use it, so poke in and read around even if you aren't an i3 user (yet).

The advantages of i3
i3 is peculiar. When you first start opening windows, you will notice that it doesn't do what you would expect from Awesome or dwm. It actually uses all of the screen evenly.
The user can resize windows with their mouse or with the keyboard. They can move windows and change the layout of the workspace. The layouts change the way the windows are presented. There are two ways to use all of the screen real-estate, and two ways to magnify only one window at a time. The ability to have one window open at a time and tab through the rest is surprisingly handy, or at least I thought it was a nice escape from the mess of windows I was making on my desktop.

This provides unparalleled customizability concerning the way that you, the user, arranges the windows. Think of i3 like you would think of GNU screen or tmux, just for X clients. The reason is that each of these "containers" can be further split and assigned splitting rules, so that a user can emulate the one-big-many-smaller paradigm from awesome or dwm.

A mess I made playing with i3

The disadvantages of i3
Disadvantages in i3 are PEBCAK. Everything can be solved in i3 with the well documented protocols and extensive configuration file. However, there are some really hard problems to solve that are not there out of the box. For instance, i3 does not come with a clock (although it does come with a system tray, thankfully!). To combat this I wrote a program that can be evoked that reads the time off (espeak piped into a C++ program using strftime) and put tint2 on an infinite loop (i3 will kill tint2). Are these solutions? No. There should be a textclock widget like in Awesome. But this, like the rest of i3's problems, can be solved with a bit of ingenuity and elbow-grease.

My opinion
As a control-freak, i3 is seemingly a nice tool to take full control of your window manager. There aren't any distractions, the key bindings are sane, the RAM usage is super low (< 5 MiB), and it is oh-so-configurable. It is a lot of effort, but if you are fed up with the glitz and glamour of the mainstream desktop environmnets, come and play on i3's jungle gym.

Saturday, April 27, 2013

How to install Google Chrome in Ubuntu (13.04)

There is a problem with Ubuntu 13.04 that disallows Google's Chrome web browser from being installed without making a fuss. In short, the problem is that google needs libudev0 (>= version 147), but that package is not available in the repositories.

The Solution
libudev0 may not be in the Ubuntu repositories, but it IS in the parent-distribution (Debian)'s repositories. We can go there and download libudev0, and then install the program.

1) Go to http://ftp.us.debian.org/debian/pool/main/u/udev/libudev0_175-7.1_amd64.deb and download the .deb

2) Install the file like you normally would (double click it in Files or use dpkg -i).

3) Download the Google Chrome package from https://www.google.com/intl/en/chrome/browser/thankyou.html?brand=CHMB

4) Install the Chrome .deb file however you comfortably do so.

Extra
If you messed up beforehand, you will want to run "sudo apt-get install -f" from the Terminal to clean any broken packages that apt tried to get.