BozoSort

yet another CS blog

Browsing Posts in Linux

Software is never “finished”, everybody knows that. Updates are pushed, design changes come and go, newer versions are released, all in the interest of the pursuit of a transcendent product. Or better profit margins. Either way, rarely are changes introduced which reduce functionality. Real people (excluding software developers, seemingly) always want more. More meat on subway sandwiches, more channels to watch on T.V., more ways to customize everything we own.

So why then, I ask, does it seem the Nautilus developers wish to reduce their very widely used file manager down to something which resembles a product of the Windows 95 era? The most prominent answer lies of course in the wild goose chase of simplicity in the use of software. Take a look at Macs, for example. They have become popular largely in part due to their simplicity and ease of use. But there in lies the problem with Nautilus. In their quest for “simple”, the developers (and self- proclaimed experts in user interface design, apparently) are mistaking “simple” for fewest buttons on the screen as possible.

Now would be a good time to read this blogpost by Garrett LaSage, which puts forward some of the proposed design changes being complained about here. I’d like to analyze some of the new ideas, and explain why I think they are all bad. Throughout this article, it’s important to realize that I am largely concerned with default settings. Most file managers in one way or another support a common set of features. It’s how those features are presented to users is what makes the difference in usability.

This is the current default layout for Nautilus (at least how it appears by default on Ubuntu 10.04, the most popular Linux distribution according to distrowatch).


The Default Layout for the Nautilus File Manager

There are two important things to notice right away. First, there are obvious buttons across the top toobar which enable the user to execute commands quickly using nothing but a mouse. In fact, I would venture to say that most programs on all platforms follow this basic design. Web browsers, Office suits, Email clients, Image editors, etc. Normal people like to use the mouse. They like to click buttons without sifting through menus. They like not having to type. Now let’s take a look at one of the proposed layout changes.

Nautilus File manager prototype

Now the only button available is a magnifying glass, which I assume is an alternative to hitting the “enter” key after you finish typing in your keywords into the search bar. So no more “up the hierarchy” button. No more list view button. No more refresh button. There isn’t even a file menu up top to go and change the default settings! Most annoyingly however, and this is my second observation from the previous paragraph, is the complete lack of a “Places” side bar. So now how is one supposed to move around between usb-drives, hard-drives, camera cards, and various other directories which would normally be conveniently listed in a panel? Are we supposed to search our flash drives by typing in UUID numbers or something?

Of course there are other proposed layouts, and none of them have been deemed final, but the general trend of Nautilus is undeniably heading towards: “reduce clutter by hiding or eliminating features.” Some have commented that the new Nautilus is looking quite a bit like Apples “Finder”, which I disagree. Here is Apples file manager:

Apple Finder

And here is Explorer from Windows 3.1:

Windows 3.1 Explorer

If I didn’t know any better, I would say the new Nautilus was trying to be a Windows 3.1 clone, but with more than 16 colors. I have no leverage in the Nautilus design process whatsoever, but I do wish for a simple, yet powerful window manager. The fact that one of the objectives of the new Nautilius is to ” remove ‘filesystem’ in the UI ” just baffles me. The whole point of the file manager is to manage my file system!! How the hell else am I going to move files around? The command line? If the objective of Nautilus is to make using my computer simple, just what kind of craptastic job is it doing if I have to resort all the way down to the command line?

Also in the queue for removal is, “Everything in the sidebar other than Places: including Tree, History, Emblems and Notes.” Yep, as I addressed before, that extremely convenient window pane on the left with links to your removable media, commonly used folders, folders on other computers, etc. is being removed. Wiped out. Gone. Bye-bye. Now you get to use the revolutionary new search tool, where you can resort to your using keyboard and typing in things you remember about the directories that you want to visit. Because that’s so much more advanced than just navigating with the command line. **cough** find / -name keywords **cough**.

The comments on LeSarge’s blog are of mixed reaction. Some people seem to love the idea of achieving simplicity through reduced functionality, some are in favor so long as features X and Y are not removed, while others (like me) think the idea is the product of poor judgment on the real world target audiance of Gnome/ Nautilus. Let’s face it. The target audience of this file manager (if you can even call it that anymore) is undeniably skewed towards power users. Power users who could, if need be, default to utilizing the command line, but would rather use a modern and effective graphical user interface.

I like Ubuntu. I like Chrome. I like being able to middle click my mouse wheel to scroll webpages. Unfortunately, Google decided that such a combination of nice things was just too great for the world. Fortuantely, there’s an extension to remedy this called AutoScroll. It is available in this hidden little corner of the internet: AutoScroll for Google Chrome – Works on Linux!

Proper, consistent indentation of source code is a crucial component to keep from going insane when staring at lines of text for hours on end. Most people adhere to a single favored style, be it K&R, ANSI, GNU, or whatever*, which for the most part is acceptable because they aren’t all that different from one another, and most modern IDE’s are capable of understanding different coding styles and adapting auto indentation settings to the wants of the programmer. However, there is also a tool included (or at least available for) *nix systems, called indent which can actually manipulate C/C++ source code to modify it’s indentation style.

Take for example this extremely lazy solution to projecteuler.net problem #3 It has many levels of indentation, comments, and is nice and short, which will help emphasize the major differences between coding styles in my examples. My personal favorite coding style follows the ANSI standard, which is good for distinguishing code blocks, but takes up a lot more vertical space than other styles.

//* Euler Three */
#include <iostream>
using std::cout;
using std::endl;

#include <cmath>
using std::sqrt;

bool isPrime(unsigned long long);

int main()
{
  unsigned long long NUM = 600851475143; // as provided by projecteuler   problem #3
  for (unsigned long long i = NUM / 2; i >= 2; i--)
    {
    // The following for-loop is going to do something relavent
    for (unsigned long long t = i; t >= 2; t--)
    {
      if ((t * i) == NUM)
      {
        if (isPrime(t))
        {
            cout << "PFF: " << t << endl;
         }
       }
     }
   }
  return 0;
}

bool isPrime(unsigned long long n)
{
  bool prime = true;
  for (unsigned long long i = 3; i <= sqrt(n); i += 2)
  {
    if (n % i == 0)
    {
      prime = false;
      break;
    }
  }
  if ((n % 2 != 0 && prime && n > 2) || n == 2)
  {
    return true;
  }
  else
  {
    return false;
   }
}



Now, let’s use indent to change to the more common K&R style:
$ indent -kr Three.cpp


The resulting source file:

/* Euler Three */

#include <iostream>
using std::cout;
using std::endl;

#include <cmath>
using std::sqrt;

bool isPrime(unsigned long long);

int main()
{

    unsigned long long NUM = 600851475143;	// as provided by projecteuler problem #3
    for (unsigned long long i = NUM / 2; i >= 2; i--) {
	// The following for-loop is going to do something relavent
	for (unsigned long long t = i; t >= 2; t--) {
	    if ((t * i) == NUM) {
		if (isPrime(t)) {
		    cout << "PFF: " << t << endl;
		}
	    }
	}
}
return 0;
}

/*
	The follwing function was copied and pasted from somewhere on the internets
	and should probably have some sort of credit to the author or something
*/
bool isPrime(unsigned long long n)
{
    bool prime = true;

    for (unsigned long long i = 3; i <= sqrt(n); i += 2) {
	if (n % i == 0) {
	    prime = false;
	    break;
	}
    }
    if ((n % 2 != 0 && prime && n > 2) || n == 2) {
	return true;
    } else {
	return false;
    }
}

The style is changed, and all I had to do was invoke a command with a single switch and the file name as the parameter. There are other switches available, of course, including:
-bad (force blank lines after declarations)
-bap (force blank lines after function bodies)
-bl (format according to the Pascal standard)
-bf (forces braces on if statements)
-bls (put braces on the line after struct declaration lines)
-kr (format to the Kernighan & Ritchie coding style)
-orig (format to Berkeley coding style)
-st (send to standard output )
-bbo (break after boolean operators)
-bc (break after commas)
… and a bazillion more options, all available in the man pages :p

* for more reading on indentation styles, check out the wiki entry

Wordpress 2.8.5 and 2.8.6 as packaged with Ubuntu are broken. Using the admin pages gives the error:
Warning: constant() [function.constant]: Couldn't find constant WP_CORE_UPDATE in /usr/share/wordpress/wp-admin/includes/update.php on line 33

A bug report addressing* this problem can be found here.

I have a simple/ghetto workaround for this issue. Open:
/usr/share/wordpress/wp-admin/includes/update.php
and comment out the two lines:
if ( !constant('WP_CORE_UPDATE') )
return false;

!! You will need to edit this file with root permissions. If you are running a full desktop, you can do:
sudo gedit /usr/share/wordpress/wp-admin/includes/update.php &

If you are running a headless server as I am, you can open the file for editing using vim, nano, emacs, etc. ie:
sudo nano /usr/share/wordpress/wp-admin/includes/update.php

The error will no longer appear, and the blog will continue to function 100%. There are absolutely better ways to deal with this issue, but that is up for the Ubuntu package maintainers to .. maintain.

The following screen-shot shows exactly where to add comment notation:

update.php

* “addressing” might be too strong of a word considering the progress being made on this issue. Two versions of wordpress to go through the package maintainers and it’s still broken? In fact, the report is still considered “New”.

UPDATE 12-24-2009
Turns out the Wordpress 2.9-1 update still has this issue…

Wordpress Update 2.9-1 still broken

If you use Webmin to manage your server, you will eventually come across upgrades which will seem to ‘break’ your install. After upgrading, you’ll lose the ability to log in, and it seems as though the whole thing is just borked. In reality, you just need to restart the webmin daemon. Since this only happens when you reboot or start it manually, you’ll need to either reboot or start it manually.

At the command line, type (as root):

# /etc/webmin/start

After logging in you can verify the upgrade was successful and make sure that webmin starts upon system boot, just in case.

There are existing instructions on how to connect an Ubuntu (or any Gnome-Network Manager) machine to the University of Texas restricted campus wifi, but they are several years out of date. The interface has changed quite a bit over the past few years, and now no longer provides some default settings that the UT instructions relied on previously.

Here are the proper settings for the “updated” Network Manager:

Wireless Security: WPA & WPA2 Enterprise
Authentication: Tunneled TLS
Anonymous Identity: anonymous
CA Certificate: [the one you downloaded]
Inner Authentication: MSCHAPV2
Username: [your UT EID]
Password: [your corresponding password]

Network Manager UT WiFi

There are also instructions on the UT Helpdesk site for using wpa_supplicant to get yourself connected, but I strongly recommend not using that. I also don’t recommend using KDE’s network manager, as it sucks. hard. I have never tried to use Wicd, but I imagine if you use the same settings it will work just as well.

This guide is intended to help users who are trying to set up a printer on a linux machine, and then be able to print to that printer from a different linux machine

Whoever designed cupsys (Apple) must be pretty bad at making easy to use interfaces. By default, the cups web portal blocks.. everybody from accessing it, which makes setting up and using your printers over the network quite difficult. I mean really, how useful is a “403 Forbidden” anyway? The least they could do is give some better instructions on how to set the stupid thing up, but apparently the brief summaries provided in the man pages are enough to set everything up without any confusion what-so-ever.

So, if you’re in a position where you just installed cups daemon on your server, and you can’t even get to the configuration pages, I highly suggest taking a look at this configuration file.

But wait.. what’s so different about this config file and what do I need to do to make it work for me?

This particular cupsd.conf turns of every “safety feature” that is enabled by default in the standard cupsd.conf file. With this file, all you need to do is navigate to the print server on port 631 using your favorite web browser to setup your printer and drivers, among other things. To make it work for you, you need to edit every  Allow 192.168.1.0/24 so that it matches your own little dhcp world. Actually, if you’re using a Linksys router, or many of the other common routers, this file will probably work of the box for you. (If you’re thinking, “wait, my router is 192.168.1.1, so do I need to adjust?” Then the answer is no, you do not. The /24 takes care of that for you.)

Tip: before editing the file, I strongly suggest making a backup first. That way, if you really buggar things up, you can start with a fresh file rather than having to uninstall and reinstall cupsys altogether. To make a quick and easy backup, run the command:
sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original
In the event of catastrophic failure, restore the file with:
sudo cp /etc/cups/cupsd.conf.original /etc/cups/cupsd.conf

After you fix the cupsd.conf, you need to make the changes take effect by restarting the cupsd daemon. This is done easily by running the command:
sudo /etc/init.d/cupsys restart
If you see any errors, you probably made a typo in the config file. Fix them before moving on..

Now, navigate to the setup page by putting the local address of the host machine followed by :631 .
For example, my particular server is at 192.168.1.112, so to get to the setup pages I would navigate to http://192.168.1.112:631 . Hopefully you don’t have any issues with drivers for your particular printer. I did, but fortunately Brother (the best printer company in the history of the world) posts all of their linux drivers online with easy to follow install instructions. (Just involves using the dkpg tool for debian based systems, or the rpm equivalent for distros that use rpms).

If you can print the Test Page from the web-portal, you’re almost there. We also need to add the printer on the machine we plan to use on a daily basis and send print jobs from. Here’s the catch: on this mid – October day in 2009, it is not possible to use graphical tools in GNOME to make this happen. The “Add Printer” tools are extremely misleading in this aspect. If you look in the attached picture, you can see that I can see the network printer from the built in GUI tools, and even change its settings, but I cannot actually set that as a printer to print to(!).


So Close, Yet So Useless

So Close, Yet So Useless


So instead, on our own local machine, we need to edit /etc/cups/client.conf and tell it the address of the print server. All we need to do is add the line: ServerName 192.168.1.112 , adjusting the address to the assigned address of your own server of course. For a one-liner command to accomplish this:
sudo cat "ServerName 192.168.1.112" > /etc/cups/client.conf
If that command doesn’t work, just open it with vim or nano or emacs and add the line by hand..

I’m not exactly sure which service needs to be restarted to make the changes to this file take effect, so I just rebooted my own computer which worked perfectly :p .

If you still have trouble, leave a comment with a good description of your setup and I’ll at least try to help, but no promises! The forums of your respective distro are probably going to be the most helpful, or maybe LinuxQuestions.org.

**Bonus**
Setting up a windows machine (assuming Vista or 7) to use your linux hosted printer is actually super easy. Click Start -> Control Panel -> Hardware and Sound -> Add Printer -> Network Printer -> The printer I want isn’t listed
Then, copy and paste the URL for your printer into the “Select shared printer by name” box. (Click through the picture to see a larger version)


Windows Printer Forms

Windows Makes it Easy


WordPress Appliance - Powered by TurnKey Linux