The place for web

The place for simple tutorials, software reviews, and many things tech.

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.

Friday, April 12, 2013

Ubuntu 13.04 Beta Review ** April 12th, 2012

I am the average Joe Linux user. Ubuntu helped to ease me into the world of Linux gently before plunging into the world of commands and ttys. I have this nostalgic love for Ubuntu, and even if I don't agree with some of their latest goals (let me go on record by saying I do like their direction of mobile) I have always considered it a very friendly distribution. This was before I used 13.04 beta.
What's the ruckus?
Well, Ubuntu is that gateway Linux distribution that the newcomers will use to make the transition easy, right? Well, the latest Ubuntu is going to give them the idea that Linux is inheritly buggy, slow, and crash-prone which is not the case at all. Canonical has been working so hard on its mobile operating system, display server, startup manager, and all of its other pet projects that they forgot to make a good distribution. Whoops!

What is even worse is that this is a long term release. We will be stuck like this for a long time. Imagine if Windows Vista had become the de facto Windows computing environment  of the world. We'd all be on Linux if that were the case, and 13.04 makes me want to move to Windows.

The Problems
One of my biggest problems was the lack of improvement over 12.10, and even 12.04. 12.10 was a copy+paste of 12.04 with some features like shopping and web lenses with previews (which are very helpful, in my opinion) and some optimizations of both user experience and resource consumption. 13.04 is exactly that distribution with one or two minor features and some new icons. There was going to be a VERY desirable feature for lenses included, but they were dropped at the last minute like Wubi.

At one point I had the gnome-settings-manager crash, which also brought down compiz and gtk-window-decorator. This left my desktop in an unusable state where windows did not even reply to keyboard commands. I had to switch to a TTY and pkill lightdm to solve the trouble.

I have also had countless popups telling me there are "problems with the system", and a few of those notifications crash themselves and become unclosable, even after a pkill. I call them the kamikaze windows.

Another big problem is the lack of workspaces. Yes, they aren't included at all by default, folks. They can be enabled through compiz, but that's an unneccessary step, especially considering the option for workspace keyboard combinations are included in the settings manager. While we're talking about the settings manager, let me just warn you that every now and then keyboard shortcuts will decide not to work, so be ready for that.


The Verdict
Now that the venting is over, it is fair to say that this IS A BETA. It most certainly will get better with the final release, but for now it is in an almost unusable state. "Do not use on production machines" is a warning that Canonical gives that I would actually advise following.

Saturday, March 23, 2013

Opensuse 12.3 Review

Opensuse has recently released its newest version in its line of Linux operating systems. I have had a few run-ins with Suse in the past at much earlier release dates. 12.3 has gotten a lot of publicity for how well put together it is, which is one reason I was left so gravely disappointed after using it. In this review I am going to try to look at the good of Opensuse, since some of the problems I experienced only apply to those with certain hardware conditions, but there is also some bad to sift through.

The Desktop
One nice thing about OpenSuse is the KDE setup it comes with by default. They've put a lot of effort into making both the animations that are enabled and the themes that are applied visually pleasing (if you happen to like green). Although it is good looking, it is not as functional as you may want it to be. It ships with KDE 4.9, but that can be updated immediately by switching to Tumbleweed (the rolling release system for Opensuse). Similar effort is applied to the Gnome Opensuse flavor, but not to the XFCE, which was disappointing. Their XFCE .iso comes with some bland defaults with light branding. It's really nothing to right home about.

The Applications
The default applications are more-or-less standard. Libreoffice, your DE tools, Firefox, Vim (I was happy to see that) etc. Gimp is not included. One application that always gets coverage in Opensuse reviews is YaST (Yet Another System Tool). It truly is an amazing utility, with which you can graphically perform tasks that on any other distribution you would be doing by hand. Graphically changing hostnames, installing packages, changing kernel parameters, changing GRUB around, setting up a LDAP / Mail server, etc. It can all be done through YaST.

The Not-so-good
So far it is sounding like a very good distro, no? Well, there is one minor issue that you will run into. To enable networking, you have to select a check mark in the NetworkManager applet for whatever DE you're using. After it's selected you must reboot to start using networking. It's a minor annoyance for some, but it grows into bigger problems for others.

I have a hardware condition that disallows proper shutdown. Thanks to this networking problem I have absolutely no internet access whatsoever. This is an incredibly rare case, but it's bound to effect others out there. And even if it never effects your computer to this extent, it WILL happen to you.

On first run, packagekit will persistently run, causing you to either have to kill it or reboot. This has something to do with it checking for updates and crashing.

Would I use this distribution?
I really wanted to. I downloaded the .iso to move from Sabayon 11 to something a bit more Enterprise, but ran into some bugs that stopped me in my tracks. It is destined to become Ubuntu fodder.

Who would use this distribution?
Don't get this review wrong. Opensuse is one of the best Operating Systems for enterprise workstations and home desktops. It is an Operating System crafted specifically for desktop and laptop use, none of this touch-friendly nonsense that some companies have started introducing. If you are fine with some rough corners, use it. It is the best default KDE experience I have ever seen, even if it is an earlier version. I just think that they should have polished the distribution a tad bit more before releasing it.

Tuesday, January 22, 2013

Comparison of Linux Distributions


Desktop Linux is a thriving ecosystem, and this is also its downfall. Fragmentation has split the already drifting community into cultist tribes that claim their distribution to be king. This is a comparison of what the main Linux distributions offer over one another. There are more than I write about in this article, but it is only fair to right about what I have used for more than a day.


Ubuntu
http://www.omgubuntu.co.uk/wp-content/uploads/2012/10/farnza.jpgUbuntu is the third result in a google search for "Linux". It is usually the first stop in a young Linux User's journey for good reason. Tools like automatic update reminders, a very intuitive user interface (with an OS Xish feel) will be comfortable to use for a user migrating from another Operating System. For beginners there is no doubt in my mind. Ubuntu is king for integration and user experience. But for getting real work done after you're comfortable with Linux? Maybe not so much.

Ubuntu's Ubuntu One daemon and other applications like it tend to eat more RAM than a distribution without Ubuntu's "bloat". A variant such as Xubuntu would be better for seriously using Ubuntu on a production machine. The Ubuntu base is nice for those looking to get work done though, mainly because of the PPA system. PPA's are basically remote repositories you can subscribe to with add-apt-repository and pull packages from.


 Linux Mint

 Linux Mint takes Ubuntu and makes it sane again for normal desktop users. Unity is innovative, but it's definitely not for everybody; especially if the idea of how a desktop works (start menu, desktop shortcuts, etc) is well ingrained in your mind. Linux Mint maintains two desktop version, one with the lightweight Gnome 2 fork MATE and the other with Cinnamon, a fork of Gnome-shell. I haven't given Cinnamon the reviews it deserves. It's truly a great desktop environment, especially since the menu that launches applications and searches locations has improved in terms of relevance and speed.

Beginning users will find Linux Mint comfortable as it comes with tools that were designed to make Ubuntu, one of the easiest distros, even easier. Their update manager rates updates based on importance so you can delay serious updates until you're ready for them. Linux Mint is also compatible with Ubuntu's PPA system if you're using their Ubuntu edition, but Linux Mint: Debian Edition is not. Keep in mind that Linux Mint: Debian Edition is basically Debian with the Linux Mint tools on it, so later in this article when Debian is talked about think back to Linux Mint: Debian Edition.
                                                                                  
http://upload.wikimedia.org/wikipedia/commons/d/da/Debian_Desktop.pngDebian
Debian is a very popular Linux Operating System, but not necessarily for its use on Desktops. Some users find Debian Testing to be comfortable for desktop use, but even then packages and support tend to lack behind upstream. The main appeal of Debian is rather its viability in servers, as versions are supported for quite a long time and packages are vigorously tested for problems that could reduce uptime or performance by even a bit. One statistic read that 32% of all the world's servers used Debian. If you're deadset on using Debian, then Crunchbang, a Debian derivitive of Testing (like Ubuntu) that comes with the Openbox window manager and a dark theme may be for you. Crunchbang is so similar to Debian that it is not worth its own section, but it has a unique and active forum / irc community apart from Debian's.

Fedora
Fedora is the "testing" version of Red Hat Enterprise Linux, which is another huge competitor in the server market. Unlike its parent (daughter?) operating system Fedora is primarily used on the desktop. With the Gnome Shell and no modifications to upstream applications you will find there to be familiarity with Fedora and other distributions. Fedora offers an intuitive installer and the yum package management system, with a third party repository so large that it rivals the AUR. Arch and the AUR is mentioned next.

Arch Linux
Arch Linux is a distribution for advanced Linux users that basically want to configure their system from the ground up. The installation is very minimal (text only), and then the user can choose which packages to install to custom tailor their installation of Arch Linux. The selling point to Arch is that it's rolling release, so a user never has to reinstall (until they bork something), the package management (the largest repositories in existence exist for Arch and its fork, Manjaro.), and the KISS principles that another distribution, Chakra, follows even more closely. Chakra is like a preconfigured Arch Linux with KDE that only allows the installation of Qt packages with the option for certain bundles that allow GTK applications. By the way, there's no installer. Just some scripts and pacstrap.

Gentoo Linux
Gentoo is BY FAR the hardest distribution to install. Gentoo is basically Arch taken to a whole new level of minimalism. Gentoo must be compiled fully to be installed. There is no installer and no tools by the (wonderful) wiki to guide the user. This is not for Linux Experts, it's for the type of people with BSD toasters and a HUD in their bathroom mirror. Although it does provide a lot of flexibility and good source package management with USE flags, to truly reduce bloat. A fork of Gentoo, Sabayon, makes the installation far easier with Fedora's Anaconda and adds binary package management. No more wasted weeks spent compiling Libreoffice.

Conclusion
I find myself most comfortable using Ubuntu on desktop systems, Fedora on Laptops, and Debian on any servers. Arch and Gentoo are specialist distributions and should be used as such.