Archive for the ‘Ubuntu’ category

How to watch a log file in realtime in Ubuntu Linux

November 13th, 2011

There are times when I’m debugging code on a linux box that I want to see what’s being logged by a Web Site or Web Application. What I used to have to do was do something on the website, then open up a terminal in Ubuntu (or any other linux distro for that matter) and view the logfile with either vim, nano, cat | less or gvim.

How I used text editors to do it
I use VIM as my default text editor on Ubuntu or any other linux distros (such as redhat, centos, debian, linux mint) that I work on.

A few weeks from now I used to use vim to open the log file, then the :e (edit) command to reload the new log entries.

Based on the entry, I make adjustments as required, then try again.  Back to vim, issue the edit command, review the changes, then run the script again. So on and so forth.

Now this is kind of did what I wanted it to do, but what I really wanted it to do was display the log in realtime so that I can just keep going back to the terminal and see what’s wrong without having to do the additional second step of running the edit command.

The way of opening up a log file in a text editor, then reloading the log file in the editor was very cumbersome. I needed a way of seeing the log file in realtime so that I did not have to keep reloading.

» Read more: How to watch a log file in realtime in Ubuntu Linux

How to fix things when Ubuntu Unity Dock Gets Stuck

November 6th, 2011

Upgraded to Ubuntu 11.x yet? I have, and while I was not a big fan of 11.04 (believe me, I was looking for alternatives), when 11.10 came and I’m back on the Ubuntu fanboy bandwagon!

They smoothed out the UX something severe! Unity was a lot smoother and less clunky and it felt a lot more natural working with it than it did with 11.04 – I can’t pinpoint what the difference is exactly, but, generally speaking, the definition: “smoother” encompasses the experience with 11.10 in comparison the “clunky” with 11.04.

One thing that still happens from time to time though is the Unity Dock gets stuck!

I can’t remember if this is default behaviour or not, but my preference is to have my dock auto hide when it “collides” with the active windows that are either maximised or within the collision range of the Dock and man, working with a 17 inch screen, I want that extra real estate.

» Read more: How to fix things when Ubuntu Unity Dock Gets Stuck

How to Use Dia in One Window

October 22nd, 2011

Dia is a fantastic Diagram tool that runs natively on linux. With it you can create some very pretty and logical diagrams very quick – if you know what you’re doing. To be honest though, when I had first started it, I hated the fact that it had floating panes everywhere. So I would instead use umbrello since it was a little more polished and was a UML tool.

There were times though that I would like to draw other diagrams:

  • Data flow diagrams
  • Entity Relationship Diagram
  • Flow charts
  • Random ad-hoc diagrams
For this, dia was the perfect tool. But then again I was faced with those floating panes again. I was bothered enough to do a google search and search for the possibility of having a single windowed interface for dia the diagraming tool for the job save for those f*cking floating panes!

Modify Multiple Directories or Files with find exec

October 17th, 2011

So I’ve been setting up my ReadyNas for some storage of photographs and I wanted to make it so that the latest addition directories inside my photos directory was 0755. It just so happened that the archive I tarred from my drive had saved them as 0700. I had several directories inside this parent / container directory and so for those directories to be visible, I needed to traverse through each directory and change the permissions to 0755.

Obviously, I could not just do a blanket ‘chmod 0755 -R .’ as it will make the images within the directories executable also.  Which were, at the time, stored with 0600. I needed to change these to 0644.

The Mission

  • Convert all permissions in directory ‘sgs-photos’ which were currently 0700 to 0755.
  • Convert all permissions in directory ‘sgs-photos’ which were currently 0600 to 0644.

How to fix phpmyadmin error: “Connection for controluser as defined in your configuration failed”

January 3rd, 2011

“Connection for controluser as defined in your configuration failed” It’s one of those small, annoying messages that appear out of the way on your screen, but still catches your eye once in a while especially when you’re deep in thought about how to building a multi-join query in the SQL tab of phpmyadmin.

Well, it annoyed me today so much that I finally decided to do something about it and finally take a look. I opened up the PHPMyAdmin config file located at /etc/phpmyadmin/config-db.php  on Ubuntu Maverick Meerkat. There’s a default username and password in $dbuser and $dbpass variables.

Now my knee jerk reaction to this would have been “no problem I’ll just change that to my root username and password.” which will work by the way, but I decided against it since the control user for PHPMyAdmin did not really need to have access to all the other databases in my local cluster.

» Read more: How to fix phpmyadmin error: “Connection for controluser as defined in your configuration failed”