Programming

So you want to tether your brand spanking new Android phone (Google G1 or HTC Hero or alike) but you don’t want to bother with rooting your phone. Bad news: you can’t (wireless), sort of – read on.

Well technically you can but it requires a USB cable connection to make the phone act like a modem device which Windows (or Linux) can then use to ‘dial’ to the world wide web. The HTC Hero comes with this functionality built in (it just requires some HTC drivers which even works on Windows 7, albeit with separate installation of the drivers as the setup fails), for the G1 and others you can install PdaNet on your Android phone to do the same.

So in fact you can tether your 3G connection to your computer using an Android phone, but you can’t do it wireless. Bluetooth is incomplete and as such wont give you a DUN device so no dice there. And for the wifi tethering tool, you really really need root access. Why? Because it switches your wifi card in your phone from normal to router mode. This allows other devices to connect to it and use the 3G device as a gateway.

So why shouldn’t you root your phone (besides risking to brick your phone)? You can’t buy paid applications from the Android Market anymore. For some no reason to hack their phone, I prefer to have the option to keep using paid applications. Perhaps in the future I’ll try to root my HTC Hero and I will post my findings.

Update: I rooted my phone after a year or so and I was able to by and install paid applications just fine. I forgot where I 'learned' this tidbit of information but it seems to be rubbish - rooting does not mess up your phone.

Last Updated ( Friday, 04 March 2011 23:17 )

 

After stumbling upon Gravatar, a site serving your avatar globally, I looked for an easy way to add this functionality to Joomla!. After ditching Gravatar/Avatar for needing some other plugin to work in the first place, I installed gAvatar.

This plugin worked without dependencies and gAvatar is dead simple to set up. Just enable the plugin, change the rendering mode and you are done.

The only thing that can go wrong (and did for me) was the fact that you can choose for a floating avatar (which ended up floating in the text), a table avatar (using the default Joomla header style - which this site doesn't use) or advanced templating.

That last option seemed like a good solution except that nowhere was described what it did or how it worked. A quick dive in the source showed me everything I needed to know: gAvatar adds a 'avatar' parameter to the article object. To use it, find the classes generating the article layouts and modify those.

To find those class files, I used the following in the template folder:

fgrep "article->text" * -R

And add the following (for example) to insert the avatar:

<?php if (isset($this->article->avatar)) : ?>
    <div style="float: right"><?php echo $this->article->avatar; ?></div>
<?php endif; ?>

Last Updated ( Sunday, 07 June 2009 13:40 )

 

I write a lot of code, most of it unsuitable for release to the public but this little gem is worth a public release.

After using Bacula to backup all my servers (both Windows and Linux) for some time, the large number of mailings you get when using it on a small server park drove me insane. Even when using filters to sort out new mail, it is hard to see if everything is going as it should be.

Enter Bacula Reports: a mail aggregator for Bacula 2.x and 3.x.

Bacula Reports consists of a faux mail command (which does not send out reports by mail but rather analyses and stores them) and a report generator which aggregates all the stored reports into one mailing with an overview and some HTML styling to make it more readable (if you don't want HTML, modify the template to generate plain text).

By integrating the scripts into the Bacula configuration at 2 points (a mail command used for sending out reports and a job to send out the combined report), the storm of daily mails changes into one neat report at the end of the backup cycle.

Normal error messages and operator messages are unaffected and will be delivered as they used to be, only the backup reports per job are redirected to Bacula Reports.

Requirements:

  • A linux server (32 or 64 bit, tested on CentOS 5.2 and Gentoo 2008)
  • A working Bacula 2.x or 3.x installation
  • PHP as a command line interpreter (run ‘php –v’ to see if you have it)
  • 10 minutes of your time to set everything up

The cool thing of the scripts is that they require only 2 small changes in the director configuration to reroute the status mailings and if you don’t like it or run into trouble, reverting is normally a matter of simply commenting out the modified lines and restoring the old ones.

One drawback for some people: it requires PHP on the command line (as stated before). The reason for this is very simple: I want to use the same code in the future for a web GUI and my unix-scripting skills are virtually non-existing compared to PHP or Java.

Even though its PHP, the scripts have a small footprint and run very fast – they should be easy to add to any existing Bacula environment.

Bacula Reports Version:0.9
First public release of Bacula Reports version 0.9 - a tool to aggregate Bacula report mails into one daily overview.
 GNU/GPL  2009-04-22   English   Linux  0 B 342
Bacula Reports Readme Version:0.9
Release notes for Bacula Reports 0.9 including installation instructions and other information. Also included in the full download.
 GNU/GPL  2009-04-22   English   Linux  7.08 KB 348

Last Updated ( Wednesday, 22 April 2009 00:32 )

 

I just started playing with QtScript in Amarok 2.0.1.1 and so far the documentation has been a big let down. A lot of things are documented for C++ but the conversion into JavaScript is a lot trickier then it looked.

This is ofcourse because the whole QtScript engine is all new and this will become better over time. In this posting I will show what the TrackInfo object holds, which is returned by Amarok.Engine.currentTrack();

destroyed(QObject*): function () { [native] }
destroyed(): function () { [native] }
deleteLater(): function () { [native] }
objectName: 
title: Hotaka (radio edit)
sampleRate: 44100
bitrate: 192
score: 49.5
rating: 0
inCollection: true
type: mp3
length: 215
fileSize: 5195160
trackNumber: 1
discNumber: 0
playCount: 1
playable: true
album: Hotaka
artist: Juno Reactor
composer: 
genre: Electronic
year: 2002
comment: DHA's Music Archive
path: /mnt/music/Mp3/Albums2/Juno Reactor/Juno Reactor - Hotaka/01 Hotaka (radio edit).mp3
isValid: true
isEditable: true
lyrics: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Juno Reactor Hotaka (radio edit) lyrics</title>

</head>

<body><h3><a href='http://lyricwiki.org/Juno_Reactor:Hotaka_%28radio_edit%29'>Hotaka (radio edit)</a> by <a href='http://lyricwiki.org/Juno_Reactor'>Juno Reactor</a></h3>
<pre>
Not found</pre><hr/>Additional Info:
<ul>
<li><strong>url: </strong><a href='http://lyricwiki.org/index.php?title=Juno_Reactor:Hotaka&amp;action=edit' title='url'>http://lyricwiki.org/index.php?title=Juno_Reactor:Hotaka&amp;action=edit</a>
</li>
</ul>
</body>
</html>
So the next time you need some information about the currently playing track you know exactly which fields are available.

On a side note: the isValid boolean tells you if the track info you are parsing is in fact a running track. If Amarok is not playing all fields will be empty or zero. Check isValid before you start processing an empty data object...

Last Updated ( Tuesday, 27 January 2009 15:09 )

 
<< Start < Prev 1 2 3 Next > End >>

Page 1 of 3