Tag: Linux

Fixing Kate’s Instance Behavior

August 27, 2010 » Geek

I’ve been a KDE user for a long time now, and I love all the new changes (except the Aero snap thing, you can turn that off though). One thing I love is Kate. I usually have two or three Kate sessions open at once, borrowing code across projects or changing things in different modules.

My problem is that Kate now defaults to only one instance, so if I call Kate from the command line with a file name, it gets added to a running instance, not a new one. If I use the KRunner to start a session, it loads in place of the current session in a running instance. I understand the reasoning here, but I want to use it the way I always have.

Easy fix! Just always make sure it is called with kate -n

You can do this with a BASH alias,

alias kate='/usr/bin/kate -n'

or more thoroughly with a wrapper script like this one from a forum post:

#!/bin/bash
/usr/bin/kate -n [email protected] &> /dev/null &

Easy fix!

Tags: , , ,

Making Panoramas With Hugin

August 17, 2010 » Consume, Geek, Life

We recently got back from a visit to Colorado and I had taken a few sets of photos that I intended to stitch into panoramas. This was new to me, but I figured it couldn’t be too hard, right?

With the help of Hugin, I figured right.

There is all sorts of cool tweaks you can do with Hugin, but I’m just going to touch on the basic process. There is a much more complete set of tutorials here.

The process boils down to these steps:

  1. Load Images
  2. Match Points
  3. Tweak Exposure (if you want)
  4. Render

Matching Points

Matching points is just a matter of clicking on a recognizable spot in one photo and then the matching spot on the next photo. You don’t have to be spot on, it will guess the right spot for you. Pretty cool. I did about four per photo pair.

Matching Points

Tweak Exposure

I used auto-exposure on my photos and, as a bonus, took a few pictures with direct sunlight. Not good for clean overlaps. Here’s my initial preview image.

Preview

Yuck, it’s all washed out and ugly. No problem, we can do some tweaking on the exposure tab and it should be all better.

Exposures

Render

Once everything is set up, rendering is a snap, it just takes a while.

Rendering

Enjoy

Once it’s done (not more than a few minutes) you should have your panorama. It’s going to be big though, my un-cropped panorama was 14587×2416 and weighed in at a hefty 19 megs as a high quality JPEG. Wow.

Completed

Overall Hugin is a super-easy and fun way to make awesome panoramic photos with any digital camera.

Review: Canon Pixma MX320

July 14, 2010 » Consume, Geek

A Pixma MX320A week or two ago I bought this mutli-function to replace the loathsome Lexmark I’d had for several years. I didn’t have a chance to try it out until today. Since I’m home sick I drug it into the bedroom (yes, it is big and heavy) and tinkered from the comfort of bed.

All around it’s a nice machine. It copies fine without a computer attached, and it works like a dream with Kubuntu; scans and prints. It even shows up as an image source in Gimp. Nice.

For those you wanting to get it going on Linux, don’t bother looking for the drivers on the US support site, you have to hit the Europe one. Don’t ask me why, just go here: http://software.canon-europe.com/products/0010697.asp. They offer deb’s, rpm’s and source, so it should work pretty universally on a modern system. The debs went in flawlessly for me, and poof, the thing worked.

Print quality is good, crisp and clean. Scanning is another matter. I ran through some prints I got back the other day, and there is grain everywhere. It’s not unbearable, but check the next post to see what I mean.

All in all and good Linux compatible printer/scanner, for only $49 at Wal-Mart (oh the shame)

Also it has this weird thing called a “fax”. I’ve yet to figure out what that is or why you would want one.

MongoDB + node.js On WebFaction

June 18, 2010 » Geek

Following a suggestion from Kloanor on a Hacker News article I got a WebFaction account to play around with node.js on.

tl;dr It’s not too hard to set up.

Getting Ready

All of this software will be installed in my home directory, so there are a few things we need to do. First, I created a sources directory so that I would have my hands on exact copies of the installed software in the future, as well as a clean place to unpack and build them.

[[email protected] ~]$ mkdir sources
[[email protected] ~]$

Second, we need to create two custom applications for MongoDB and node.js using the WebFaction control panel.

This is pretty easy, just go to “Domains/Websites > Applications > Add New“. Now give it a name (I used mongodb_master) and select “Custom app (listening on port)” as the App Type.

Creating The Custom Application

Hit create and write down the port number it provides. Do this again for node.js. You can also take a moment to map these applications to a website and domain.

The Custom Applications

MongoDB

MongoDB is actually supported to some extent, with install instructions provided in the WebFaction Doc’s. I did this slightly different, so I’ll detail my version here.

Acquiring MongoDB

You can get MongoDB at http://www.mongodb.org/display/DOCS/Downloads. You’ll need the 32-Bit Linux version. At the time of this writing the most current stable release was 1.4.3.

[[email protected] ~]$ cd sources
[[email protected] sources]$ wget  http://downloads.mongodb.org/linux/mongodb-linux-i686-1.4.3.tgz
--2010-06-18 18:43:29--  http://downloads.mongodb.org/linux/mongodb-linux-i686-1.4.3.tgz
Resolving downloads.mongodb.org... 72.21.202.134
Connecting to downloads.mongodb.org|72.21.202.134|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 23709740 (23M) [application/x-tar]
Saving to: “mongodb-linux-i686-1.4.3.tgz”

100%[==============>] 23,709,740   202K/s   in 1m 55s

2010-06-18 18:45:29 (201 KB/s) - “mongodb-linux-i686-1.4.3.tgz” saved [23709740/23709740]

[[email protected] sources]$

Installing MongoDB

MongoDB comes pre-compiled, so installing it is as easy as unpacking and moving some directories.

[[email protected] sources]$ tar -zxf mongodb-linux-i686-1.4.3.tgz
[[email protected] sources]$ cd mongodb-linux-i686-1.4.3/
[[email protected] mongodb-linux-i686-1.4.3]$ ls
bin  GNU-AGPL-3.0  include  lib  README  THIRD-PARTY-NOTICES
[[email protected] mongodb-linux-i686-1.4.3]$ mv bin ~/
[[email protected] mongodb-linux-i686-1.4.3]$ mv lib ~/
[[email protected] mongodb-linux-i686-1.4.3]$ mv include ~/

Configuring MongoDB

In this case, MongoDB is configured at run time. But it will need a data directory. I chose to put this at ~/var/mongo/master/. You don’t have to do anything special, just make sure the directory exists, and is empty.

That’s it! MongoDB is installed. We’ll come back and fire it up after we get node.js installed.

Installing node.js

node.js is almost as easy as MongoDB. And while not documented anywhere, it does run just fine. The major point of contact here is a forum topic that details how to get it running. Again, I’m going to deviate a bit, but I’ll end up in roughly the same place.

Acquiring node.js

You can get node.js at http://nodejs.org/#download. It’s distributed as source, so there is nothing to pick and choose from. At the time of this writing the most current version was 0.1.98.

[[email protected] ~]$ cd sources
[[email protected] sources]$ wget http://nodejs.org/dist/node-v0.1.98.tar.gz
--2010-06-18 18:57:14--  http://nodejs.org/dist/node-v0.1.98.tar.gz
Resolving nodejs.org... 97.107.132.72
Connecting to nodejs.org|97.107.132.72|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3770749 (3.6M) [application/octet-stream]
Saving to: “node-v0.1.98.tar.gz”

100%[===========>] 3,770,749    151K/s   in 25s

2010-06-18 18:57:39 (147 KB/s) - “node-v0.1.98.tar.gz” saved [3770749/3770749]

[[email protected] sources]$

Easier done than said.

Installing node.js

You have to compile node.js, but this went perfectly clean for me. Just make sure you set the prefix when you configure, or you’ll have to do it all again.

[[email protected] sources]$ tar -zxf node-v0.1.98.tar.gz
[[email protected] sources]$ cd node-v0.1.98/
[[email protected] node-v0.1.98]$ ./configure --prefix=$HOME
Checking for program g++ or c++          : /usr/bin/g++                                                            
...snip...
Checking for fdatasync(2) with c++       : yes
'configure' finished successfully (5.495s)
[[email protected] node-v0.1.98]$ make
Waf: Entering directory `/home/littlef/sources/node-v0.1.98/build'                                                         
DEST_OS: linux                                                                                                     
...snip...
Waf: Leaving directory `/home/littlef/sources/node-v0.1.98/build'
'build' finished successfully (5m33.731s)
[[email protected] node-v0.1.98]$ make install

Configuring node.js

Nothing to configure! It should be ready, like, right now.

Running Your New Software

Okay, everything is installed. Let’s get stuff running.

Running MongoDB

Running MongoDB should only take two options. --dbpath and --port.

Go ahead and fire it up, then shut it down with ctrl-c.

[[email protected] ~]$ mongod --dbpath ~/var/mongo/master/ --port 39381
Fri Jun 18 19:11:24 Mongo DB : starting : pid = 3293 port = 39361 dbpath = ~/var/mongo/master master = 0 slave = 0  32-bit

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations for more

Fri Jun 18 11:11:24 db version v1.2.2, pdfile version 4.5
Fri Jun 18 11:11:24 git version: nogitversion
Fri Jun 18 11:11:24 sys info: Linux biber 2.6.26-2-amd64 #1 SMP Thu Feb 11 00:59:32 UTC 2010 i686 BOOST_LIB_VERSION=1_40
Fri Jun 18 11:11:24 waiting for connections on port 39361
^CFri Jun 18 11:11:27 got kill or ctrl c signal 2 (Interrupt), will terminate after current cmd ends
Fri Jun 18 11:11:27 now exiting
Fri Jun 18 11:11:27  dbexit:
Fri Jun 18 11:11:27      shutdown: going to flush oplog...
Fri Jun 18 11:11:27      shutdown: going to close sockets...
Fri Jun 18 11:11:27      shutdown: waiting for fs...
Fri Jun 18 11:11:27      shutdown: closing all files...
Fri Jun 18 11:11:27      closeAllFiles() finished
Fri Jun 18 11:11:27      shutdown: removing fs lock...
Fri Jun 18 11:11:27  dbexit: really exiting now
[[email protected] ~]

That’s great, but we can’t just stay logged in to SSH all the time. Let’s nohup it, background it and forget about it.

[[email protected] ~]$ nohup mongod --dbpath ~/var/mongo/master/ --port 39381 &
[1] 3299
nohup: ignoring input and appending output to `nohup.out
[[email protected] ~]$

Now we can query it by setting the port on mongo

[[email protected] ~]$ mongo --port 39381 noderegator
MongoDB shell version: 1.2.2
url: noderegator
connecting to: 127.0.0.1:39381/noderegator
type "exit" to exit
type "help" for help
> show collections
> exit
bye
[[email protected] ~]$ 

Running node.js

Before we can actually run node.js, we need to write a little application. In my case this will go in ~/webapps/noderegator_nodejs/app.js. Place yours wherever you set up your custom application for node.

Be sure to change the port number to the one issued to your application by WebFaction.

var http = require( 'http' ),
     sys = require( 'sys' );

http.createServer(
  function( request, response ) {
    sys.puts( 'Request!' );
    response.writeHead( 200, { 'Content-Type': 'text/plain' } );
    response.end( 'Hello World\n');
  }
).listen( 35408 );
sys.puts( 'Server running on port 35408' );

Now let’s fire that up and see it in the browser. ctrl-c to quit.

[[email protected] ~]$ cd webapps/noderegator_nodejs/
[[email protected] noderegator_nodejs]$ node app.js
Server running on port 35408
Request!
Request!
^C
[[email protected] noderegator_nodejs]$ 

If you got an nginx 503 error when you tried to visit the site, check that your port numbers are set up correctly.

All Done

That’s it, that’s all you need to know. Enjoy MongoDB and node.js on WebFaction. I hope it all goes well for you.

Clean Prism Install on Sidux

January 26, 2010 » Geek

Mozilla PrismPrism is a sandboxed web-app tool, essentially it is Firefox for one application at a time. It’s been a while since I played with it, so I’m taking another look.

This should work on any Debian based system really, but I did it on Sidux. Here’s how I installed the latest version on my machine.

# wget http://prism.mozilla.com/downloads/1.0b1/prism-1.0b1.en-US.linux-i686.tar.bz2
--2010-01-26 16:01:08--  http://prism.mozilla.com/downloads/1.0b1/prism-1.0b1.en-US.linux-i686.tar.bz2
Resolving prism.mozilla.com... 63.245.208.216
Connecting to prism.mozilla.com|63.245.208.216|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9101612 (8.7M) [application/x-bzip2]
Saving to: “prism-1.0b1.en-US.linux-i686.tar.bz2”

100%[==========================================================================================================================================================================================================>] 9,101,612    212K/s   in 42s

2010-01-26 16:01:55 (213 KB/s) - “prism-1.0b1.en-US.linux-i686.tar.bz2” saved [9101612/9101612]

# mv prism /opt/prism-1.0b1
# ln -s /opt/prism-1.0b1/prism /usr/bin

At that point it should be in your path and ready to invoke!