Archive for September, 2008

Linux: Executable PHP Files

24/09/2008

Another nice thing about Linux is that you don’t need to use a program command to execute a PHP script, if you have the PHP-CLI version installed.

On Windows and for a while on Linux, I used:

php -f myscript.php

This is perfectly fine, but this executable file method is best for simple tool-scripts that you want to run manually on your system.

All you need to do is include this line on the very first line of your PHP file:

#!/usr/bin/php

Note that you still need to use the <?php ?> tags, but they go after that line.

Once you edited your script, you make it executable:

chmod +x myscript.php

And to run it you go to your script’s path and use this:

./myscript.php
Advertisements

Ubuntu & LAMPP: How to share MySQL

22/09/2008

Being used to using XAMPP for Windows, when I migrated to Ubuntu, I installed XAMPP for Linux (LAMPP). The only draw-back is that programs that need MySQL and don’t allow you to locate the sock file manually (like AmaroK) will complain and not let you use MySQL as a storage alternative.

For this, I learned about symlinks (symbolic links). But, since the fake mysqld directory always gets deleted by the time I log back in, I had to create a bash script that will run on boot and won’t require me to use sudo or put my password, it runs as root.

First, we create the script:

gedit mysql_link.sh

Then, our script is extremely simple:

#!/bin/bash
mkdir /var/run/mysqld
ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Now we make it executable and we move it to the init.d directory:

chmod +x mysql_link.sh
sudo mv mysql_link.sh /etc/init.d

And, now, we add it to be executed on boot time:

sudo update-rc.d mysql_link.sh defaults

Note that we didn’t add the full path to it.

Anyway, we can even do the same to start LAMPP on startup (in the same script or a different one, depending on your particular needs.)

Ubuntu & LAMPP: How to share MySQL

22/09/2008

Being used to using XAMPP for Windows, when I migrated to Ubuntu, I installed XAMPP for Linux (LAMPP). The only draw-back is that programs that need MySQL and don’t allow you to locate the sock file manually (like AmaroK) will complain and not let you use MySQL as a storage alternative.

For this, I learned about symlinks (symbolic links). But, since the fake mysqld directory always gets deleted by the time I log back in, I had to create a bash script that will run on boot and won’t require me to use sudo or put my password, it runs as root.

First, we create the script:

gedit mysql_link.sh

Then, our script is extremely simple:

#!/bin/bash
mkdir /var/run/mysqld
ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Now we make it executable and we move it to the init.d directory:

chmod +x mysql_link.sh
sudo mv mysql_link.sh /etc/init.d

And, now, we add it to be executed on boot time:

sudo update-rc.d mysql_link.sh defaults

Note that we didn’t add the full path to it.

Anyway, we can even do the same to start LAMPP on startup (in the same script or a different one, depending on your particular needs.)

Linux: Promising yWriter4 alternative

21/09/2008

It’s still in progress, but WWMKR (Writer’s World Maker) is a program that lets you write novels, and has a very rich character editor, with a questionnaire (which allows you to give your character personality), a full name generator, etc.

It seems to be aimed especially for fantasy stories, as it has several specific fields in the character bio window.

It’s still beta software, and several features are still not bug-free or completely available, so you’ll have to wait a while to fully enjoy this program.

Source: WWMKR website

Regarding my Messenger Plus! Live scripts

20/09/2008

The development of theRand Lives (the would-be new version of theRand, my first full script), theLaunch, theLaunch Lite, MessLoad, PolyManager and WLM Launcher will all be halted, probably forever.

I’m no longer using Microsoft software, I’ve migrated to Linux nearly a month ago, and I’m not going back to Windows any time soon. Because of this, there is little point in me continuing to code scripts for a program I don’t use (since all my scripts were made to solve my particular needs).

So, I’m lifting the no-modification ban on my scripts, and anyone who wants and finds an old copy, can continue their development.

Firefox: Manage your Live Bookmarks with Brief

13/09/2008

Brief is the perfect Firefox extension for those who use Live Bookmarks. It adds a feed reader interface to your browser (I keep it in a frozen tab). The good thing about it is that you don’t need to store anything online. For password-protected feeds (for example, to read Friends-Only feeds in LiveJournal), it’s the best solution.

It lets you view Unread items, you can “star” items, etc. Pretty much like a local Google Reader.

Get it now!

Linux programs for NaNoWriMo writers

13/09/2008

UPDATE: For a more up-to-date list, check the new section NaNoWriMo Software Picks.

yWriter4

While it’s a Windows-only freeware, it can run fine on WINE.

You must add the following libraries so it can run without problems: riched20, riched32, and oleaut32. To do this you go to Applications > WINE > Configure WINE > Libraries tab or run it from the Terminal: winecfg

KnowIt

For outlining, I tried a bunch of programs, but I must say KnowIt wins. It’s a note-taking program that lets you organize your notes in a tree structure. This is very useful for basic things like outlines, character descriptions, etc.

GRAMPS Genealogy System

Another wonderful tool for character organization is the GRAMPS Genealogy System, which is a genealogy (family tree) software. If you want to have your characters’ families well organized, this is the program for you.

BasKet

This one is like KnowIt on steroids. It offers a lot more customization than the previous. It lets you add media files (pictures, sounds, etc.) to your notes, you can assign colors to your notes, format the text, add backgrounds, etc. And you can export the final work as a HTML page.

This is great to add references and sources, character photos and things like that.

I haven’t tried Microsoft’s OneNote, but from what I’ve heard, this program is a good Linux alternative.

emesene: timestamps in IRC conversation theme

07/09/2008

A very interesting and simplistic Windows Live Messenger replacement is emesene, which is what MSN sounds like when said quickly in Spanish.

The best thing about it, in my opinion, is the option to change the conversation style. Instead of “Buddy 1 says:”, you can use a theme that displays “<Buddy 1> message”

The thing is that the IRC style doesn’t come with timestamps. But, it’s quite easy to change, if you know where to look and what to do. I searched their forums, but the support is… very questionable. People seem to believe everyone already knows where things are.

I’m using Ubuntu, Hardy Heron / 8.04. For me, the conversation themes are located in /usr/share/emesene/conversation_themes/. With that in mind:

sudo gedit /usr/share/emesene/conversation_themes/irc/theme

You’ll see something like this:

# This is an example theme
# Lines starting with a # are ignored

# Theme infos section
name=IRC layout
description=This is an IRC style conversation layout
author=Julien “Trapamoosch” Enche
website=http://trapamoosch.free.fr

# Layout
# Take care : space characters are not stripped between values and “=” and values must fit in one line
# Tips : you can do things like “outgoing=incoming” if you want the same layout for incoming and outgoing messages, for example
#
# Here’s the tags list :
# %nick% : displays the nick of the message sender
# %email% : displaus the email of the message sender
# %message% : displays the raw message (ie ignoring the format the user applied to it)
# %formattedmessage% : displays the formatted message
# %h% : hour of the message
# %m% : minute of the message
# %s% : second of the message
# and more to come…

incoming=&lt;%nick%&gt; %formattedmessage%<br/>

consecutive_incoming=incoming
offline_incoming=incoming
outgoing=incoming
consecutive_outgoing=incoming
information=<span style=”font-weight: bold;”>*** %message%</span><br/>
error=<span style=”font-weight: bold; color: #FF0000;”>*** %message%</span><br/>

I bolded what we want to change.

You can see that the structure is very simple. And in the commented section, we are told how to put a timestamp. The rest is by logic:

incoming=[%h%:%m%:%s%] &lt;%nick%&gt; %formattedmessage%<br/>

You can, of course, modify this to your liking. There are other conversation themes you can see in the conversation_themes directory.