Laconica with GoDaddy

FOSS, General Programming — Tags: , , , , — kdnewton @ 10:55 am

I may be jumping the gun here a little bit as I’ve only successfully managed to get Laconica talking to the database and have successfully registered my user. If for some reason not everything is up and working 100% then I’ll append a note to the end of this article. In the meantime, you’re probably here because you want to know if it’s possible to get Laconica, the micro-blogging utility that is the basis for which Identi.ca is built upon, working in a GoDaddy hosting account.

Yes you can. Here’s how.

The Laconica README says that the Laconica requires that it is the only process using any particular database, so go ahead and create one from your GoDaddy hosting account manager. I’ve chosen MySQL 5.x myself. It’ll take a few minutes while a (presumably) real human sets up the database and permissions for your user. When the technician is done setting up your database then it should, after a page-refresh, show “Open Manager” in the database manager screen.

There’s a particular piece of info you’ll need now, which is the address of the database (different, often-times, for each database you set up). So click the “pencil” icon in the “actions” column. If you hover over the pencil it should say “edit/view details”.

When the page opens you’re looking for the “Host Name” which is something like “pXXmysqlXXX.secureserver.net”. That’s the location of the server holding your database and you’ll need it later on. So make a note of it and let’s carry on.

The next step would be to actually have downloaded the Laconica software. A link to the latest version can usually be found on the http://laconi.ca/trac/ site. Currently it is version 0.6.2 which was released November 18 of 2008.

Download it, extract the archive (the zip, tar, etc) and then open your favorite FTP client and transfer to your webserver (or copy it over via command line FTP). Don’t expect it to work just yet. You need to edit a couple files.

First, find the laconica_0.6.2/config.php.sample wherever you extracted the archive and drop the .sample part of it. Now open up config.php in whatever text editor you prefer and change the following lines:

$config['site']['name'] = 'Just another Laconica microblog';
$config['site']['server'] = 'n3wt0n.com';
$config['site']['path'] = 'micro';

n3wt0n.com becomes whatever your URL is, but don’t include http:// or it’ll screw it up. Or do, and you’ll see for yourself. Also, change “micro” to the name of the directory that Laconica exists in on your server. If you just copied the extracted directory over then it may be called “laconica_0.6.2″ but I renamed mine to “micro”.

I also changed

#$config['site']['logfile'] = '/tmp/laconica.log';

to

$config['site']['logfile'] = 'laconica.log';

because I am hoping that the log file will be printed to the site-root (n3wt0n.com/) where I might be able to retrieve it some time, rather than the server’s /tmp/ directory where I cannot reach it. But that’s your call.

Last, but certainly not least, within the config.php file is the “db” configuration. Particular to working in a GoDaddy account, modify the following lines to suit your account.

$config['db']['database'] = 'mysql://DB_NAME:DB_PASSWORD@DB_LOCATION/DB_NAME';
$config['db']['ini_your_db_name'] = $config['db']['DB_NAME'].'/DB_NAME.ini';

Remember that with a GoDaddy account, the MySQL database username is the same as the database name. Thus “DB_NAME” is used for both. Change that to whatever you named your database. DB_LOCATION is that “pXXmysqlXXX.secureserver.net” thing we noted earlier.

That should cover the configuration, but there’s one more file we’ll need to change. Change the name of laconica_0.6.2/classes/laconica.ini to DB_NAME.ini (remember, DB_NAME is replaced with whatever you named your database). It should be noted that you may have to rename laconica.links.ini to DB_NAME.links.ini as well. I just haven’t played around long enough to know.

Now everything is set up for Laconica to work, all we need now is to import the database! That’s easy, too. Within the GoDaddy Hosting Contol Center, click “Open Manager” for your Laconica database and log in to the PHPMySQLAdmin interface. From the database drop down menu on the left, select the DB_NAME to bring up the database. Now on the right side of the screen click on the “import” tab.

The “Location of the text file” to import is the directory of the extracted Laconica archive/db/laconica.sql

Click “Go” at the bottom right of that screen and now you should be good to go with Laconica on your GoDaddy hosting account. And if it’s not GoDaddy then this was probably an easier task for you.

The best thing you can do for yourself to set up Laconica is to read the Laconica README.

Piksahl, sneak peek.

Game Dev — Tags: , , , , , — kdnewton @ 5:02 pm
Here's a look into the current state of Piksahl.

Here's a look into the current state of Piksahl.

I did have working images (photos as they are called in Perl-TK), but as a sacrifice for the photos working it ended up breaking something else. In the meantime, solid colours are being used with the canvas object createRectangle. But this is just a first look into Piksahl. I’ll get more in-depth later.

Yet Another Command-Line Twitter

FOSS, General Programming — Tags: , , , , — admin @ 2:35 pm

Recently this article made it to the front page of digg. It’s yet another article on how to update your Twitter status from the command line. It covers the bases of how to do it, but I still prefer Wayne’s way over at Fsckin.com

First, the script requires cURL to be installed. So install it if it’s not already on your system.

sudo apt-get update
sudo apt-get install curl

I made some minor revisions to the Fsckin way to do it after reading the cURL man page and finding that the –basic flag wasn’t required etc.

It boils down to this

curl --user "username:password" \
--data-ascii "status=`echo $@|tr ' ' '+'`" \
"http://twitter.com/statuses/update.xml"

Just copy the text into a file, I’ve called mine “tweet”, and change the username and password to your own information. Note, the text is there for anyone to see who has access to your computer. This is significant as your Twitter password is saved inside that file.

Change the file permission to make it executable:

chmod 755 tweet

And make a tweet on your Twitter profile

./tweet This message is what everyone will see.

which would post the message for everyone to see. You’ll end up getting some output from cURL. So long as it doesn’t come back with a short message which includes

<error>Could not authenticate you.</error>

then we can assume all went well.

Advanced Stuff

You might find that you want to be able to call the “tweet” utility from outside the directory it lives in. You can include the directory in your system path by adding the path to the bottom of your .bashrc

PATH=$PATH:$HOME/path/to/the/script
export PATH

So the next time you log in you can just type, from any directory,

tweet whatever the message is

and your twitter profile will be updated.

Personally I like to keep my scripts in a hidden directory in my /home. Something like /home/myusername/.my_scripts (or shorthand: ~/.my_scripts)

Sonic Speeds in Game Design

Computer Science — Tags: , , , , , , — admin @ 12:39 pm

I’ve been playing a lot of BioWare’s latest game, Sonic Chronicles: The Dark Brotherhood, on the Nintendo DS. Some of the gameplay mechanics have really got me thinking. One component of the game’s turn-based battles stands out to me in particular.

Being that this is a Sonic the Hedgehog game, the essence of speed is vital. I got to wondering how a developer might convey the difference in speed between a character like Sonic (really fast) and someone like Big the Cat (who is relatively slow). To suit the purpose of this topic, let’s include Sonic’s sidekick, Tails, as the middle-ground between really fast and really slow.

Let’s recap:

Sonic => fast
Tails => average
Big => slow

But how can we determine that in a certain timeframe Sonic will get to perform many actions while Big’s speed is enough to perform only 1 action in the same timeframe? Let’s assume that each of the characters have an attribute which we will appropriately label “speed” (much like strength, dexterity, etc from any typical RPG). The higher the speed value the faster the character.

Let’s assign a speed rating for each of our characters.

Big->SetSpeed(1)
Tails->SetSpeed(3)
Sonic->SetSpeed(5)

But speed means nothing without time. Time in the game’s battle system is broken down into rounds where each round, I can only guess, has a defined timespan. For this example the timespan will simply be 1 unit.

Timespan => 1

Now the solution begins to present itself. Faster characters make actions more often while slower characters make few actions. Here’s how to represent that mathematically.

Timespan / Sonic->GetSpeed() = 0.20 ## because 1/5 = 0.20
Timespan / Tails->GetSpeed() = 0.33 ## 1/3 = 0.333...
Timespan / Big->GetSpeed() = 1.00   ## 1/1 = 1

With a simple calculation we now know the turn-order of actions within a round. We know it because within a timespan from 0.0 to 1.0 we can see when each character will take action.

Sonic gets an action at 0.20, 0.40, 0.60, 0.80 and 1.00

Tails gets an action at 0.33, 0.66 and 0.99

Big gets an action at 1.0

And when you put it all together the action sequence looks like

Time    Character
0.20    Sonic
0.33    Tails
0.40    Sonic
0.60    Sonic
0.66    Tails
0.80    Sonic
0.99    Tails
1.00    Sonic (because he's faster)
1.00    Big

Throw an enemy or two in there with their own speed value and you’ve got yourself a battle!

It’s worth stating that though I’ve assigned the timespan value as 1, we’re not limited to just that. We could set a minimum value for a character’s speed as 12 then we might define the timespan as that minimum value.

Sonic->SetSpeed(5)

would give Sonic a speed of 5 plus the minimum value. In this case, he’d now have a speed value of 17.

Tails->SetSpeed(3)
Big->SetSpeed(1)

results with Tails’ speed being 15 and Big’s being 13 (12+3 and 12+1 respectively).

The action timeline would play out as

Time    Character
0.71    Sonic
0.80    Tails
0.92    Big

which is very reasonable for the beginning of a roleplaying game where a player has not yet had the opportunity to improve on a character’s stats.

You’ll have noticed that the “Time” column is still within the range of 0.0 to 1.0. The “speed ratio” of a character will always be compared to 1. This identifies when the character gets an action relative to other characters, a method known as normalizing.

Next Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2008 n3wt0n! | powered by WordPress with Barecity