Steve’s Ubuntu Weblog

Mainly (but not only) about Ubuntu

Configuring tftp in Ubuntu

I am trying to upgrade an old FNS1000 NAS to be a LAMP server, which I will describe here if I am successful. One thing I needed was to be able to communicate with the NAS via tftp and I had a real hard time setting up the tftp server on my Ubuntu system. I have finally got it working and so I will explain how I did it here.

First you need to download and install tftp tftpd and xinetd using Synaptic or with

sudo apt-get install tftp tftpd xinetd

Using your favourite editor write the following text file and save it as /etc/xinetd.d/tftp

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = -s var/lib/tftpboot
disable = no
}

I found that the directory /var/lib/tftpboot was already in my /var/lib folder. I’m not sure where it came from but if you have it use it and if not make it with

sudo mkdir /var/lib/tftpboot

Then change it’s permissions and ownership with

sudo chmod -R 777 /var/lib/tftpboot
sudo chown -R nobody /var/lib/tftpboot

Then start tftpd through xinetd. You have to use re-start and not start

sudo /etc/init.d/xinetd restart

That’s the configuration. Now to test the server.

Place a test file test.txt in the /var/lib/tftpboot and then give it 777 permissions with

chmod 777 /var/lib/tftpboot/test.txt

cd into the /var/lib/tftpboot directory and start tftp with the ip address of your PC. On the tftp> type “put test.txt” and if everything works you will get the Sent message like below.

cd /var/lib/tftpboot
tftp 192.168.0.10
tftp> put test.txt
Sent 722 bytes in 0.0 seconds
tftp> quit

Good luck

8 October, 2009 Posted by steveyoung | Uncategorized | | No Comments Yet

Microwave Link Engineering Tool proving popular in Poland

This is a special welcome to all of the new MLET users from Poland, I hope that you are happy with the tool. You can leave any comments or suggestions for improvement below.

There has been a big increase of MLET users from Poland over the last few weeks and I was wondering what the reason for this increase is. Was there an article written about the tool or was it word of mouth? I would appreciate any feedback on this.

One more thing, please click on any interesting Google Ads links on the page. This is the only way I get anything for my efforts.

Do widzenia

8 October, 2009 Posted by steveyoung | Uncategorized | | 2 Comments

Forum for General Microwave Discussions

Because of the general queries I have received in response to my online microwave tools I have decided to initiate a general microwave communications engineering discussion forum. I am hoping that this forum will enable the many knowledgeable microwave engineers out there and myself (with more than 25 years microwave planning experience) to answer any questions regarding microwave communications engineering you might have and at the same time build up a useful knowledge base.

By the way the tools can be found here:
Microwave Link Engineering Tool, MLET
Microwave Line-of-Sight Tool, MLOST

11 April, 2009 Posted by steveyoung | Gmaps | , , , , , , | 1 Comment

Microwave Online Tools Forum

I have initiated a forum in order to enable discussions regarding my online microwave tools. I will answer any questions about the tools and act upon suggestions if possible.

The tools can be found here:
Microwave Link Engineering Tool, MLET
Microwave Line-of-Sight Tool, MLOST

11 April, 2009 Posted by steveyoung | Gmaps | , , , , , , , | No Comments Yet

Deleting root’s trash

Time again I manage to delete the root trash but next time I’ve forgotten how to do it. So this time I’ll write it down.

open a root nautilus window with

gksu nautilus /root/.Trash/

now highlight the files you want to delete and then press Shift-delete.

Do not “move to trash” as they will just pop up again :-)

26 March, 2009 Posted by steveyoung | Uncategorized | | No Comments Yet

Microwave Planning Tool for Your Website

Imagine this microwave planning tool on your company webpage with your companies look and feel! Imagine how that would impress your customers!

The LOS part can be seen here and the microwave calculation part here.

I am prepared  to sell the source code together with  documentation  and assistance in adapting it to your needs.

I could also include a new php script I have written which enables the free NASA SRTM3 height data to be installed and read from your own server.

If you are interested leave a short comment below and I will contact you by email.

28 February, 2009 Posted by steveyoung | Gmaps | | 11 Comments

Nautilus “Open as root” script and “gksudo nautilus” not working.

I recently tried my “open as root” script and it didn’t work so I tried “gksudo nautilus” from the terminal and got the following error:

steve@x-desktop:~$ sudo nautilus
[sudo] password for steve:
seahorse nautilus module initialized
Initializing nautilus-share extension

(nautilus:6653): GLib-GIO-CRITICAL **: g_simple_async_result_set_from_error: assertion `error != NULL' failed

(nautilus:6653): GLib-CRITICAL **: g_error_free: assertion `error != NULL' failed

(nautilus:6653): GLib-GIO-CRITICAL **: g_simple_async_result_set_from_error: assertion `error != NULL' failed

(nautilus:6653): GLib-GIO-WARNING **: (/build/buildd/glib2.0-2.16.6/gio/gfile.c:5249):IA__g_file_load_partial_contents_finish: runtime check failed: (g_simple_async_result_get_source_tag (simple) == g_file_load_contents_async)
Segmentation fault

The problem was that I had a blank CD in the  drive. After I removed the CD everything was back to normal.

1 January, 2009 Posted by steveyoung | Uncategorized | | 1 Comment

I have made a currency convertor which uses the daily updated European Central Banks exchange rates. You can convert between 35 different currencies.

The converter can be found here.

The previous post shows how I download and upload the ECB XML file.

9 November, 2008 Posted by steveyoung | Uncategorized | | No Comments Yet

Using the ECB Currency XML with Javascript

The European Central Bank make available daily an XML file with the exchange rate of the Euro to 34 currencies. This can be found at http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml

To use this in javascript I faced two problems:

1) How to get around the inter-domain problem. The easiest way to do this is with PHP/Curl but my ISP does not support php! I solved this by downloading the file and uploading it to my webserver. First I GET the file from the CEB website.

<?php
function get_file1($file, $local_path, $newfilename) {
$out = fopen($newfilename, 'wb');
if ($out == FALSE){
print "File not opened<br>";
exit;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_FILE, $out);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $file);
curl_exec($ch);
curl_close($ch);
}

and the I PUT the file onto my server.

$url = "ftp://my.server.at/ECBRates.xml";
$localfile = "/var/www/ECBRates";
$fp = fopen ($localfile, "r");
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);
curl_close($ch);
fclose($fp);
print $http_code;
print "<br /><br />$http_result";
if ($error) {
print "<br /><br />$error";
}
?>

Copy these into a single document and name it xmlgetandput.php and run it using curl:

curl localhost/xmlgetandput.php

If for whatever reason you are unable to do this yourself I can upload the file (or any other file) to your webserver daily for fee of €5 per month. Just make a comment with the title “upload” and I will contact you via email with details.

2) Loading and parsing an XML file is different for DOM compliant browsers and for Internet Explorer. I found this simple for the DOM complient browsers but it took me over a week of googling to get the IE working. The problem was further compounded by the fact that the ECB Currency XML has a strange hierarchy. But I got it working with the following javascript code.

var doc
function load() {
if (document.implementation &&document.implementation.createDocument){
doc = document.implementation.createDocument("", "", null);
doc.load('CEBrates.xml');
doc.onload = createTableMoz;
}
else if (window.ActiveXObject){
var doc1 = new ActiveXObject('Msxml2.DOMDocument.3.0');
function loadXML(xmlFile){
doc1.async=false;
doc1.load(xmlFile);
doc1.setProperty("SelectionLanguage", "XPath");
var nsMappings = "xmlns:gesmes='http://www.gesmes.org/xml/2002-08-01' " + "xmlns:default='http://www.ecb.int/vocabulary/2002-08-01/eurofxref'";
doc1.setProperty("SelectionNamespaces", nsMappings);
var xpath = "/gesmes:Envelope/default:Cube/default:Cube";
var cubeMain = doc1.selectNodes(xpath)
var dateRate = cubeMain[0].getAttribute('time');
var dateRateSplit = dateRate.split('-');
xpath = "/gesmes:Envelope/default:Cube/default:Cube/default:Cube";
var cubes = doc1.selectNodes(xpath);
for (var i = 2; i < cubes.length; i++){
var currency = cubes[i].getAttribute('currency');
var rate = cubes[i].getAttribute('rate');
rateObject[currency] = rate;
}
document.getElementById('boldStuff').innerHTML = dateRateSplit[2] + "." + dateRateSplit[1] + "." + dateRateSplit[0];
document.getElementById("currency").value = "GBP";
getRates();
}
loadXML('CEBrates.xml');
}
else {
alert('ActiveX must be enabled for this feature');
return;
}
}
function createTableMoz() {
var cubes = doc.getElementsByTagNameNS('http://www.ecb.int/vocabulary/2002-08-01/eurofxref','Cube');
var dateRate = cubes[1].getAttribute('time');
var dateRateSplit = dateRate.split('-');
for (var i = 2; i < cubes.length; i++){
var currency = cubes[i].getAttribute('currency');
var rate = cubes[i].getAttribute('rate');
rateObject[currency] = rate;
}
document.getElementById('boldStuff').innerHTML = dateRateSplit[2] + "." + dateRateSplit[1] + "." + dateRateSplit[0];
document.getElementById("currency").value = "GBP";
getRates();
};
var rateObject = {};
function getRates() {
var curr= document.getElementById("currency").value;
var currRate = rateObject[curr];
var currStatement= "1 EUR = " + currRate + " " + curr ;
document.getElementById("rate").value=currStatement;
var currRev=1/currRate;
currRevFix=currRev.toFixed(5);
var currRevStatement= "1 " + curr +"= " + currRevFix + " EUR";
document.getElementById("rateRev").value=currRevStatement;
};

Here is a link to the finished product http://members.chello.at/stephen.joung/indexCC.html . You might find the currency converter useful.

8 November, 2008 Posted by steveyoung | Uncategorized | , , , , , , , , , , | 3 Comments

Ubuntu 8.04 Gnome logout hangs system

After the upgrade from 7.10 to 8.04 I have hit the first small bug. I couldn’t use the “System – Quit” or the Log Out Button in Gnome to logout as they caused the session to hang. Also “gnome-session-save –kill” in a terminal caused the same fault. The only way out was a Control-Alt-Backspace. The forum is down today so I have struggled to find a solution and I have succeeded. Here it is:

Go to “System – Preferences – Sessions” and either activate or add and activate “gnome-power-manager”. and restart Gnome. That’s it, the usual logout box now appears as soon as you click the Log Out Button.

21 September, 2008 Posted by steveyoung | Ubuntu | | 1 Comment