Powered By Blogger

Donnerstag, 23. Februar 2012

Shortest URLs of the Internet

Some TLD operators have DNS entries of type "A" directly on their DNS, so these are the shortest possible URLs in the Internet. I wrote a small program in just ten minutes that finds all of them using a list from IANA:

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace TldDns
{
class Program
{
static void Main(string[] args)
{
WebClient wc = new WebClient();
string TldList = "http://data.iana.org/TLD/tlds-alpha-by-domain.txt";
string[] allTlds;
using (StreamReader sr = new StreamReader(wc.OpenRead(TldList)))
{
allTlds = sr.ReadToEnd().Split('\n');
}
int cnt = 0;
IPAddress[] addresses;
foreach (string tld in allTlds)
{
if (cnt > 0)
{
try
{
addresses = Dns.GetHostAddresses(tld + ".");
if (addresses.Length > 0)
{
Console.WriteLine("Entries for {0}", tld);
foreach (IPAddress address in addresses)
{
Console.WriteLine(" " + address.ToString());
}
}
}
catch (Exception ex)
{
Console.WriteLine("Quering host entry for {0} caused an error.", tld);
}
}
cnt++;
}
Console.WriteLine("\nFinished.");
Console.ReadKey(true);
}
}
}

Unfortunately, if a domain has no A entry, Dns.GetHostAddresses throws an exception which slows execution down dramatically. The programs needs about 15 minutes (!) on my PC to run.

Here are the TLDs I found and if a web site is available too (having an A entry doesn't necessarly mean that a web server runs on that address):

http://ac/
http://ai/
cm (points to 195.24.205.60, no web site available)
http://dk/
gg (points to 87.117.196.80, no web site available)
http://io/
je (points to 193.223.78.212, no web site available)
kh (points to 203.223.32.21, no web site available)
ph (points to 203.119.4.7, no web site available)
http://pn/ (404?)
http://sh/ (forwards to http://www.nic.sh/)
tk (points to 217.119.57.22, no web site available)
http://tm/
to (points to 216.74.32.107, no web site available)
http://uz/
vi (points to 193.0.0.198, no web site available)
http://ws/ (forwards to http://www.website.ws/)
XN--O3CW4H (that's a IDN in some non-ASCII coding)

Interesting, isn't it? :-)

Mittwoch, 15. Februar 2012

Grazer Hauptbahnhof Februar 2012

Heute habe ich vom 10. OG des Bauamts aus Fotos vom Grazer Hauptbahnhof gemacht und vorgestern und gestern vor dem neuen Bahnhofvorplatz.


Blick vom 10 OG des Bauamts auf die Straßenbahnunterführung und den neuen Bahnhofvorplatz (15.02.2012)



Blick zur Baustelle von ca. 1 OG des Bauamts (14.02.2012)


Blick auf die Baustelle vom nordseitigen Ausgang aus (13.02.2012)


Blick auf die Baustelle von der temporären Bushaltestelle der Linien 58/58E/63 aus

Samstag, 11. Februar 2012

Thank god there is convmv

Some years ago, a stupid error happend to me: As I found in some tutorials, I mounted a Windows share from my Windows 2000 Server on my Ubuntu machine with "mount -t cifs" and so on, and moved a lot of pictures files from the Windows server to my Ubuntu server. Some weeks later I discovered that a lot of filenames got srambled. In detail, it was some umlauts and the "ß" (we use these letters in German) and some "é" and "è" from french descriptions that were replaced by some strange characters. Today, I searched the web for a solution and found it: convmv! Just do a "apt-get install convmv" to get that small program and call it like this:

convmv -r -f cp850 -t utf-8 *

If would show you for every file in your folder and its subfolders, if there would be something to do. If you are happy with the results, you put a "--notest" at the end, so it reads like this:

convmv -r -f cp850 -t utf-8 * --notest

And your file names are fixed. :-)

Hint: It's quite more intelligent to leave file names as they are (for example, my digital camera gives them names like DSCN0305.JPG) and save remarks and descriptions in the EXIF metadata or the like. In previous times (before 2009) I used to rename photos and I found out that's it's a bad idea, not only because of encoding problems when transferring or archiving those files, but also because it's the default setting of almost every file system browser like Windows Explorer, Nautilus, Thunar and so on to sort files alphabetically. If you leave the default names from your camera, your sorting is always in the same order as you have taken the pictures (sorting by EXIF data is possible too for example in Windows Explorer, but this forces the file system browser to look up the EXIF data in every file which takes much longer than sorting by file name on current systems).

Ist das am Nordpol oder in Leoben?

-12 °C haben's in sich... *bibber*

Google Toolbar in Firefox 10

Recently, Mozilla has released Firefox 10 and at the first start, the Google Toolbar disappeared. I did the trick I have reported about some weeks ago and voilà, Google Toolbar is here again. :-)