Centroid.EU Blog

(this blog is mostly encrypted - adults only)
  

Previous Page


2 letter .de domains

October 17th, 2009

On October 23rd starting at 9AM CEST, DENIC will open registrations for two letter .de domains. Other than saving bandwidth and being rare there is nothing special about 2 letter .de domains. There is 676 of them if you exclude numbers. Here is the story (in german) about this at heise.de.

Joker.com has pre-registrations on the 19th of October.

0 comments

No Hackepedia this week (again)

October 16th, 2009

The header says it all.

0 comments

Sphere.C

October 6th, 2009

Yesterday I came across some formulas which I haven't used in more than a decade and I made a program out of them, here is what the input and output looks like:

setebos$ ./sphere 1737 # moon         
Sphere with radius of 1737.000000
AREA   = 37914863.86
VOLUME = 21952706175.03
setebos$ ./sphere 3396 # mars         
Sphere with radius of 3396.000000
AREA   = 144925640.08
VOLUME = 164055824574.20
setebos$ ./sphere 71492 # jupiter     
Sphere with radius of 71492.000000
AREA   = 64228053049.52
VOLUME = 1530597322872156.00

And here is the source code including the formula for area and volume of a sphere:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int
main(int argc, char *argv[])
{
        double volume, radius;
        double area;

        if (argc != 2) {
                fprintf(stderr, "usage: ./sphere [radius]\n");
                exit(1);
        }

        radius = atof(argv[1]);

        volume = (4 * M_PI * (pow(radius, 3))) / 3;
        area = 4 * M_PI * (pow(radius, 2));

        printf("Sphere with radius of %f\n", radius);
        printf("AREA   = %.2f\n", area);
        printf("VOLUME = %.2f\n", volume);

        exit(0);
}

0 comments

Compiling and debugging a program

October 6th, 2009

Occasionally I'll post a small C program on this blog. This is how you can compile it on a UNIX-based computer. Also I add the (-g) compile option which includes the symbols in the file to make debugging easier. I'm using this on the program sphere.c which is below, here goes:


setebos$ ls sphere.c
sphere.c
setebos$ cc -g -o sphere sphere.c
/tmp//ccnSRGuU.o(.text+0x66): In function `main':
/usr/home/pjp/src/math/sphere.c:18: undefined reference to `pow'
/tmp//ccnSRGuU.o(.text+0x93):/usr/home/pjp/src/math/sphere.c:19: undefined reference to `pow'
collect2: ld returned 1 exit status
setebos$ cc -g -o sphere sphere.c -lm
setebos$ gdb -silent ./sphere
(gdb) list
2       #include <stdlib.h>
3       #include <math.h>
4
5       int
6       main(int argc, char *argv[])
7       {
8               double volume, radius;
9               double area;
10
11              if (argc != 2) {
(gdb) just press enter here
12                      fprintf(stderr, "usage: ./sphere [radius]\n");
13                      exit(1);
14              }
15
16              radius = atof(argv[1]);
17
18              volume = (4 * M_PI * (pow(radius, 3))) / 3;
19              area = 4 * M_PI * (pow(radius, 2));
20
21              printf("Sphere with radius of %f\n", radius);
(gdb) break 17
Breakpoint 1 at 0x1c0007df: file sphere.c, line 17.
(gdb) run 10
Starting program: /usr/home/pjp/src/math/sphere 10

Breakpoint 1, main (argc=2, argv=0xcfbfb9bc) at sphere.c:18
18              volume = (4 * M_PI * (pow(radius, 3))) / 3;
(gdb) print radius
$1 = 10
(gdb) n
19              area = 4 * M_PI * (pow(radius, 2));
(gdb) print volume
$2 = 4188.7902047863909
(gdb) n
21              printf("Sphere with radius of %f\n", radius);
(gdb) print area
$3 = 1256.6370614359173
(gdb) continue
Continuing.
Sphere with radius of 10.000000
AREA   = 1256.64
VOLUME = 4188.79

Program exited normally.
(gdb) quit
setebos$ 

0 comments

Alphabetical Countup

September 28th, 2009

Someone on IRC needed a program that counts the alphabetical characters in words and adds their value. So the value of A would be 1, the value of B would be 2 and "AB" would be 3 (1 + 2). I wrote this program for him:

#include <stdio.h>
#include <ctype.h>

int
main(int argc, char *argv[])
{
        int i;
        char *p;

        if (argc != 2) {
                fprintf(stderr, "usage: name [name]\n");
                exit(1);
        }
        p = argv[1];
        i = 0;
        while (*p) {
                i += (tolower(*p) - 'a') + 1;
                p++;
        }
        printf("the number of name %s is %d\n", argv[1], i);
        exit(0);
}

With counting up names and words one can see which ones are similar in value. Here are some examples:

Peter J. Philipp - Bermuda T. Triangle
Peter - daemonic, Titan, Zion, Yahoo, angelical
pbug - Pete, hacker, airhead, Bobby
centroid - demihuman, demonlike
solarscale - equinox, bridgekeeper, clockroom

I made a file called num2words.txt on the public download that has 234,000 words or so sorted to their respective alphabetic countup. The processing time it took on my home computer was roughly 2 hours. Because I didn't make the program efficient it took this long.

Here is a super quick awk statement that makes creating the wordlist super fast:

awk 'BEGIN { for (i = 65; i < 91; ++i) { c = sprintf("%c", i);  h[c] = \
h[tolower(c)] =  i - 64 } } { tot = 0; for (i = 1; i <= length(); ++i) \
tot += h[substr($0, i, 1)]; print tot, $0 }' /usr/share/dict/words | \
sort -n
Thanks goes to Figz for making this.

0 comments

Random Hackepedia

September 26th, 2009

Hackepedia is down so I'm going give you a link to BSS on my hackepedia backups.

0 comments

Nominum's statements

September 23rd, 2009

As some of you may know I'm the author of the Wildcard DNS server. I read the following words from Nominum: "Open Source DNS a Recipe for Problems". And I have to disagree to this somewhat. But when looking at my own meagre DNS server, there is a few areas of concern. First, my server wasn't meant to be put on the Internet when I first wrote it close to four years ago, but it's functionality allowed it to be run as an authoritative nameserver. I have been serving the centroid.eu zone with it and continually studying the logs of it and I'm happy to report that my server was never killed from remote, I never had to restart the server. I'm surprised that it works out to be fairly stable.

Wildcard DNS was and is a research project and while I'm at it I'm sharing the source of it. Whoever wants to use it should know the license. The license (BSD license) protects me as the author of the program from being sued by someone who may get damaged by using this DNS server. There is some risk using this software, but I personally am pretty happy. Writing a DNS server isn't easy, but when you do you learn a lot. How the DNS protocol is utterly broken (by using 16 bit ID's), for example. Nominum can't get around the 16 bit ID problem, it's a protocol problem.

So anyhow, I'm in the process of adding new functionality to Wildcard DNS that no other open source nameserver has, and I'm looking forward in seeing it run and experiment with it. When it turns out to work pretty well the functionality can be put into other nameservers at their will.

If you ask me Nominum just wants a bigger chunk of the monopoly that BIND used to have and now are on a warpath to be the dominant dns server. Good for them, and good luck.

0 comments

Happy Equinox

September 22nd, 2009

Today is the equinox. The sun sets at the North Pole and rises at the South Pole. Also night should be as long as day.

0 comments

Random Hackepedia

September 19th, 2009

A process covers the entire address space for the size of a pointer (32 bit in 32 bit architectures, 64 bit for 64 bit architectures). Since virtual memory is being used not all areas of a process has real memory assigned to it and only some parts (access to parts that have no memory results in a SIGSEGV signal and the process is killed)...

To read more about heap, click on link.

0 comments

Equinox in a few days

September 17th, 2009

The last equinox of this year is in a few days, 5.

0 comments

Next Page

Search

RSS Feed

Click here for RSS

On this day in

Other links

Have feedback?

By clicking on the header of an article you will be served a cookie. If you do not agree to this do not click on the header. Thanks!

Using a text-based webbrowser?

... such as lynx? Welcome back it's working again for the time being.

Older Blog Entries


Powered by BCHS