knightly

Blog Archives

NSD unknown key/algorithm

As i was trying to get ready to convert my SVN repository into a GIT repository. I noticed one of my DNS slave servers wasn’t responding. A look at the log files showed something was wrong.

The master server showed:

[1289693117] nsd[6899]: error: query tsig unknown key/algorithm

While the slave displayed the following message

[883615032] nsd[6624]: error: xfrd: zone [ domain ] received error code REFUSED from [ ip address ]

After an hour of searching Google and not hitting any useful result. I rebooted the machine. And was presented by forced hard disk check. The damn thing seemed to be out of sync. And when rebooted. The date was off by a few centuries.

So after resetting the date and restarting NSD. The problem was resolved.

$ date -s ’14 NOV 2010 01:37:00′
$ /usr/sbin/nsdc update > /dev/nul 2>%1
$ /usr/sbin/nsdc patch > /dev/nul 2>%1
$ /usr/sbin/nsdc rebuild > /dev/nul 2>%1
$ /usr/sbin/nsdc reload > /dev/nul 2>%1
$ /usr/sbin/nsdc notify > /dev/nul 2>%1

Google mod_pagespeed continued

Last week i toyed with mod_pagespeed a bit. But just couldn’t get the hang of it. So the last two days permitted me to play some more with this great Apache module. Only this time i choose to build from source and ignore the binaries for a while.

For me the main problem was. As soon as i enabled the module. It was active for all sites running on this server. And that should not be a problem. But some of these sites are WordPress monsters. That are ready to take any server down with a bit of high load.

So after a bit of trail and error. I figured out i could just disable mod_pagespeed globally by altering the main config file. After Apache reloaded mod_pagespeed was not active for the running sites.

in /etc/apache2/mods-available/pagespeed.conf make sure ModPagespeed is set to ‘off’

ModPagespeed off

So now i can simply enable settings i need on a per vhost basis. For this site end some other sites i used the following config section in my vhost.

# MOD-pagespeed

SetOutputFilter MOD_PAGESPEED_OUTPUT_FILTER
ModPagespeed on

ModPagespeedUrlPrefix “http://lenss.nl”

ModPagespeedFileCachePath “/var/mod_pagespeed/cache/”
ModPagespeedGeneratedFilePrefix “/var/mod_pagespeed/files/”

#ModPagespeedRewriteLevel CoreFilters
ModPagespeedRewriteLevel PassThrough

ModPagespeedEnableFilters add_head
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters elide_attributes
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters rewrite_css
ModPagespeedEnableFilters rewrite_javascript
ModPagespeedEnableFilters move_css_to_head

First of we enable mod_pagespeed of course. And then we set the current domain for this instance. After that we set the file paths for the altered and cached files. And we use ‘PassThrough’ instead of ‘CoreFilters’. So we can decide our self’s what filters we will be using.

This had a much better result then my previous attempts. The server was still happily serving pages. And the load was OK. So let’s check the sites if mod_pagespeed is actually running.

$ wget -O /dev/null –server-response http://lenss.nl 2>&1| grep -i ‘X-Mod-Pagespeed’
X-Mod-Pagespeed: 0.9.0.0-172

Well that looks good. So now it’s time to do some testing. And this leaves me with a bit of a pickle. As i don’t have the required wget v 1.12 (i have a small patch for wget v1.11). Besides that i have some other problems running the tests

TEST: 404s are served and properly recorded.
wget -O /dev/null http://lenss.nl/mod_pagespeed/ic.a.bad.css 2>&1| grep -q ’404 Not Found’
wget -q -O – –save-headers http://localhost:80/mod_pagespeed_statistics | grep -q ‘resource_404_count: 1′
FAIL.

This fails because the statistics page requested is not available because this site uses rewrites. And i haven’t found a way to go around this yet besides disabling them in .htaccess with mod_rewrite. So shortly disabling this made it possible to run the biggest part of the test suite without problems.

resource_fetches: 2
total_page_load_ms: 0
page_load_count: 0
cache_extensions: 0
not_cacheable: 0
css_file_count_reduction: 0
css_filter_files_minified: 13
css_filter_minified_bytes_saved: 5082
css_filter_parse_failures: 0
css_elements: 0
image_inline: 0
image_rewrite_saved_bytes: 0
image_rewrites: 0
javascript_blocks_minified: 15
javascript_bytes_saved: 380
javascript_minification_failures: 0
javascript_total_blocks: 15
resource_url_domain_rejections: 0
url_trims: 0
url_trim_saved_bytes: 0
resource_404_count: 2
slurp_404_count: 0
serf_fetch_request_count: 0
serf_fetch_bytes_count: 0
serf_fetch_time_duration_ms: 0
serf_fetch_cancel_count: 0

It fails on the image compression part and that’s fine. Because i will leave that for later. So let’s run the site through the pagespeed browser extension with mod_pagespeed disabled:

load time without : 2.193
firebug/pagespeed score : 68

Now the same thing but with mod_pagespeed enabled:

Load time with : 1.284
firebug/pagespeed score : 90

That looks pretty good. And the other sites i have tested preform way better with the mod_pagespeed module enabled.

I still have some Javascript issues. Some things need further inspection because i have seen error like these coming along:

Permission denied for to call method Location.toString on .

Besides that. This morning my site was down due to Apache spitting segfaults. I disabled the ‘rewrite_javascript’ filter for now. And it seems to run a bit more stable.

[Thu Nov 11 07:38:24 2010] [notice] child pid 23608 exit signal Segmentation fault (11)

So besides it being a beta i am pretty impressed by the current state of this module. And after running it for a couple of weeks the statistics are pretty impressive.

Manuel Lemos also wrote a nice article about mod_pagespeed which is worth reading.

Compiling PHP v1.0.8

Today Rasmus posted on twitter that he just compiled PHP v 1.0.8. And it actually worked. Is that great? :) He was in need of this for his upcoming talk this week in Paris. But i couldn’t resist and try to compile this ancient piece of work ;)

$ wget http://museum.php.net/php1/php-108.tar.gz
$ tar xfvz php-108.tar.gz
$ cd php

If you need to change any config setting do it now. And hit make!

$ vi config.h
$ make

This creates a few .cgi files. So it actually does still build

phpf.cgi
phpl.cgi
phplmon.cgi
phplview.cgi

Let’s copy that to my cgi-bin and run it through Apache.

Just something funny

I cam across this page today and it made me laugh :) With thanks to the GNU jokes archive.

How the way people code “Hello World” varies depending on their age and job:

High School/Jr. High

10 PRINT "HELLO WORLD"
 20 END

First year in College

program Hello(input, output)
begin
writeln(‘Hello World’)
end.

Senior year in College

(defun hello
(print
(cons ‘Hello (list ‘World))))

New professional

#include <stdio.h>

 void main(void)
 {
  char *message[] = {"Hello ", "World"};
  int i;
  for(i = 0; i < 2; ++i)
  printf("%s", message[i]);
  printf("\n");
 }

Seasoned professional

#include <iostream.h>
 #include <string.h>
 class string
 {
  private:
   int size;
   char *ptr;
  public:
   string() : size(0), ptr(new char('\0')) {}
   string(const string &s) : size(s.size)
   {
     ptr = new char[size + 1];
     strcpy(ptr, s.ptr);
   }
   ~string()
   {
     delete [] ptr;
   }
   friend ostream &operator <<(ostream &, const string &);
   string &operator=(const char *);
 };

 ostream &operator<<(ostream &stream, const string &s)
 {
   return(stream << s.ptr);
 }
 string &string::operator=(const char *chrs)
 {
   if (this != &chrs)
   {
     delete [] ptr;
     size = strlen(chrs);
     ptr = new char[size + 1];
     strcpy(ptr, chrs);
   }
   return(*this);
 }
 int main()
 {
   string str;
   str = "Hello World";
   cout << str << endl;
   return(0);
 }

System Administrator

#include <stdio.h>
 #include <stdlib.h>
 main()
 {
  char *tmp;
  int i=0;
  /* on y va bourin */
  tmp=(char *)malloc(1024*sizeof(char));
  while (tmp[i]="Hello Wolrd"[i++]);
  /* Ooopps y'a une infusion ! */
  i=(int)tmp[8];
  tmp[8]=tmp[9];
  tmp[9]=(char)i;
  printf("%s\n",tmp);
 }

Apprentice Hacker

#!/usr/local/bin/perl
 $msg="Hello, world.\n";
 if ($#ARGV >= 0) {
     while(defined($arg=shift(@ARGV))) {
	 $outfilename = $arg;
	 open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
	 print (FILE $msg);
	 close(FILE) || die "Can't close $arg: $!\n";
     }
 } else {
     print ($msg);
 }
 1;

Experienced Hacker

 #include <stdio.h>
 #include <string.h>
 #define S "Hello, World\n"
 main(){exit(printf(S) == strlen(S) ? 0 : 1);}

Seasoned Hacker

 % cc -o a.out ~/src/misc/hw/hw.c
 % a.out
 Hello, world.

Guru Hacker

% cat
Hello, world.

New Manager (do you remember?)

 10 PRINT "HELLO WORLD"
 20 END

Middle Manager

 mail -s "Hello, world." bob@b12
 Bob, could you please write me a program that prints "Hello, world."?
 I need it by tomorrow.
 ^D

Senior Manager

 % zmail jim
 I need a "Hello, world." program by this afternoon.

Chief Executive

% letter
 letter: Command not found.
 % mail
 To: ^X ^F ^C
 % help mail
 help: Command not found.
 % damn!
 !: Event unrecognized
 % logout

Research Scientist

PROGRAM HELLO
PRINT *, 'Hello World'
END

Older research Scientist

WRITE (6, 100)
100 FORMAT (1H ,11HHELLO WORLD)
CALL EXIT
END

New elePHPant :)

After purchasing a new batch of the friendly blue guys. Damien Seguy was so friendly to send me an early Christmas present :)

I have some small versions left by the way. So if you are one of those people looking. Drop me a line or leave a comment.

Nerdiness

Ok so i had nothing todo for a few minutes and found a link to this page. I am never really into this stuff. But it looked funny and i had nothing to do. So i walked through the questions… and the result :)

Supreme Nerd. Apply for a professorship at MIT now!!!.


I am nerdier than 91% of all people. Are you a nerd? Click here to take the Nerd Test, get nerdy images and jokes, and write on the nerd forum!

Another nerdy thing i picked up was that Ilia Alshanetsky’s scalar type hints patch has been merged with the PHP trunk. Great stuff. Have been waiting for this for a while.

A new look for lenss.nl

This long Easter weekend gave me some time to create a new theme for this blog. So after a day of work this is the result. I was a bit tired of the dark unreadable format. At the moment i am still tweaking here and there but it looks fine!

end year notice

Have been working hard this week on kremermakelaars.nl. And managed to finish it right before the end of this year. The old website was one of those left overs from the early 90′s. The only thing missing was a spinning @ sign. But i think i managed to give it a nice visual boost. For the back-end i created s nice CMS to manage all objects and page content. The whole thing is build with ZF, Mysql, and some javascript libraries.

The customer is happy. I’m happy. Now it’s time for some fun!

So that’s all for 2009. I wish everybody a good and happy new year.

A new hobby

A few months ago i got stranded on adda’s website. This stuff looks so interesting. But thinking about building my own gives me sweaty hands. I love to build computers from scratch. But building a motherboard… i don’t see me doing that anytime soon. Even though i have null knowledge of the subject. I decided to give it shot anyway. And ordered the Russian Tube Clock. It arrived pretty fast. But occupied some closet space for at least 3 weeks. I however managed to push my self into building this thing. So here goes.

When you unpack the whole thing and lay it out on a table it looks pretty impressive. And at this point i got the feeling i would never get this to work. But thank god for the internet. I quickly found some nice hand held guides to guide me through it.

IMG_0550

I will not bother you with all specifics. because i can’t :) And for that you should read here and here Or just order the kit and give it a shot. it’s great. So after burning my self i managed to get the first set of components mounted properly on top of the PCB.

IMG_0555

The only problem i encountered (and it spoiled most of the project) was the soldering iron. Which was a mess to start of with. And it was way to big for this delicate work. The result was my soldering didn’t look that proper as you can see in the image below.

IMG_0557

The hardest part was to get the tube mounted correctly. One end of the tube is a spring of wires that need to be attached to a jack on the smaller PCB. It’s a time consuming and tedious job to do. But i think i managed. Although not all wires are as straight as they should have been.

img_0611

It finally starts to look like something. After hooking it up to some power and running some tests. I was ready to build the outer casing.

img_0609

The outer casing is a simple design. Done in Plexiglas. It looks simple. But it was a struggle to get the thing assembled.

IMG_0563

After my struggle with the casing i switched the tube on. And was greeted by a nice blue/greenish color and a beep. The color is a bit different from what is shown on the main site. But that has something to do with the tubes i read. The brightness is adjustable so that’s no problem. As you can see i still miss one time delimiter. And the menu is still not function 100%. But the clock works. And i can set the alarm.

img_0608

I had so much fun building this thing. that i ordered a new soldering iron. And will be doing a new attempt soon!

A new adventure part II

This post is a recap of a post i made earlier this month. Normally i would leave it as it is. But i wasn’t really happy with the outcome. And it didn’t really reflect the current situation. So here goes.

As the technological challenge in my current day to day job started to decline. I started to think this was not the right position for me. So i decided it was time to search for something new. And at that time i could not find anything interesting that didn’t include relocating my self to an other part of this world. This left me with a hard choice to make. But i left AddMissions anyway. With a good feeling though. I had have a great year there. Now was just time for a change.

All that was about two months ago. And for the past time i have been doing some freelance projects to pay my bills. And although i enjoyed the time working from home. I feel it is time again to go and search for a new opportunity. I learned a lot from the past two months but freelance work is not something i tend to do full time. I need people around me. Even though i don’t talk that much while i work :)

I have some things cooking at the moment. Let’s see what the new year has to offer.

Stop ACTA