Run Linux apps on Windows or OS X with Lina

This month a California-based startup plans to release an application that will allow Windows, Mac, and Linux users to run Linux binaries without any modifications.  Lina is a Linux virtual machine that allows users to run applications with the native look of their host operating system.  It also lets you install applications with a mouse-click, no need to compile software from source code.

The idea is that developers will be able to create programs for one platform, and they’ll be able to run on three different operating systems.  This could both expand the market for open source Linux applications, and cut down work for developers.  Lina will be free for open source developers, while a licensing fee will apply to commercial developers.

Lina is still a work in progress, with no support for GTK+ or USB peripherals yet.  The virtual machine takes up less than 40MB when installed.

Cool!

StumbleUpon if you’re bored

When you get bored and need a break from your development or IT-related work, use StumbleUpon.  It’s a Firefox add-on that can – and will probably – renew your perception of the Internet. 

From StumbleUpon’s website: Channel surf the internet with the StumbleUpon toolbar to find great websites, videos, photos and more based on your interests. StumbleUpon learns what you like and makes better recommendations.

When you click the Stumble! button [on the StumbleUpon toolbar], it will route you to websites that are categorized under topics/interests you selected in your (StumbleUpon) account.  What’s cool about it also is that you can view and share websites that you (and your friends) rate.

Enjoy, but don’t forget to finish your work!  😉

Yum on RHEL4

First off, apologies for not have posting anything in the last few weeks.  I just got back from Manila, Philippines to visit my ill grandfather (read: father).  He made it, but is still weak.  I love you lolo!

Anyway, I personally run Red Hat Enterprise Linux 4 at work for any *nix tasks, and in this post I’ll show you how to install Yum for easier management.

According to Linux@DUKE: Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm.

So, without further adieu:

1.  Download yum-2.0.8-1.noarch.rpm from:

http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm

2. Install it with the following command:

rpm –i yum-2.0.8-1.noarch.rpm

3.  Configure your yum.conf [in /etc/yum.conf] like so:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

#base]
#ame=Red Hat Linux $releasever – $basearch – Base
#aseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat

/$releasever/$basearch/
[base]
name=CentOS-$releasever – Base
baseurl=http://mirror.centos.org/centos/4.4/os/i386/
gpgcheck=1

[updates]
name=Red Hat Linux $releasever – Updates
baseurl=http://mirror.centos.org/centos/4.4/os/i386/
gpgcheck=1

4.  Download the GPG key for CentOS RPM packages with:

wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4

5.  Import the key like:

rpm –import RPM-GPG-KEY-CentOS-4

6.  Run yum -y update, sit back, relax, and enjoy watching your system being updated.

That’s it!  Now you can use yum to install anything you wish.  Ciao!

Your personal regex coach and more

If you’ve worked on text parsing projects – or an app that needed it – then you know what regular expressions are. It truly has been a lifesaver for me on many, many occassions. If, however, you haven’t dealt with it before, here’s some background on it:

According to Wikipedia, in computing, a regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules.

For example, to capture the word Perl in the text below, you would use the following expression: .*(Perl).

Regular expressions are used by many text editors and utilities to search and manipulate bodies of text based on certain patterns. Many programming languages support regular expressions for string manipulation. For example, Perl and Tcl have a powerful regular expression engine built directly into their syntax.

How does it work?

  • . (dot) means match anything
  • * (asterisk) means match the previous character 0 or more times
  • (Perl) (open & close parenthesis) mean capture whatever’s in it

A tool that I personally use to learn, construct, and test regular expressions is called: The Regex Coach. This tool offers many views to show how the regex engine parses text, which garners you knowledge on how it works internally, so you can write more advanced expressions.

Here’s what the tool looks like:

The Regex Coach

To end this post, I highly recommend reading Master Regular Expressions by Jeffrey E. F. Freidl to learn how/when to use it and the text-processing power it offers. This book, in my opinion, reads like a novel and is the best book on regular expressions.Take care! =0)

Auto backup solution for your MySQL databases

I use MySQL as my database server, and thankfully, it’s been reliable and easy to use.  A qualm I have, however, is that it doesn’t include a daily backup feature, unlike Microsoft SQL Server.

The good thing is that the open source community has seen this problem and created a solution for it: AutoMySQLBackup.  (You can download it from here.)

According to the website on SourceForge.net:

A script to take daily, weekly and monthly backups of your MySQL databases using mysqldump. Features – Backup mutiple databases – Single backup file or to a seperate file for each DB – Compress backup files – Backup remote servers – E-mail logs – More..

Here are the quick-and-dirty set up steps (courtesy of debianhelp.co.uk):

1.  Download automysqlbackup.sh and place it into your /etc/cron.daily directory like so: cp /path-to-automysqlbackup/automysqlbackup.sh /etc/cron.daily/.

2.  Edit (at least) the following lines via vim automysqlbackup.sh:
USERNAME=dbuser
PASSWORD=password
DBNAMES=”DB1 DB2 DB3″

3.  Make the file executable by typing: chmod u+rwx automysqlbackup.sh.

4.  Create the following directory by typing: mkdir ./backups.

5.  That’s it!  You can either run the script via the command line: ./automysqlbackup.sh, or let it run its course since we’ve now put it in /etc/cron.daily; make sure the cron service is running, though.  ;0)

Peace. \m/