Archive for the ‘Computers’ Category

Man trodde ju dom skulle lära sig av varandra…

Thursday, November 6th, 2008

Nu har D-Link också gjort det… Vad kan man säga mer än att historien upprepar sig. För nästan precis fem år sen sålde Belkin en router som gjorde om slumpmässiga dns-uppslag (eller om den “bara” kapade vissa HTTP-sesssioner) för att göra reklam för en ny funktion i deras router. Nu har tydligen D-Link fått för sig att göra samma sak. Man upphör aldrig att förvånas!

daemontools and ucspi-tcp on Hardy Heron

Thursday, September 11th, 2008

I was about to install daemontools and ucspi-tcp on Hardy Heron (Ubuntu 8.04) when I found that the packages build-daemontools et al was not in the archive anymore! Instead of digging about what happened I found out that Intrepid Ibex[1] has some packages.

So what I did was download the packages daemontools, daemontools-run and ucspi-tcp, and then install them. A bit of a problem with that too, but the following steps did the trick for me.

# touch /etc/inittab
# dpkg -i daemontools
# dpkg -i daemontools-run
# dpkg -i ucspi-tcp
# echo “start on runlevel-1
start on runlevel-2
start on runlevel-3
start on runlevel-4
start on runlevel-5
start on runlevel-6

stop on shutdown

respawn

exec /usr/bin/svscanboot” > /etc/event.d/svscan
# initctl start svscan

And that’s it! Have fun folks!

[1] http://packages.ubuntu.com/search?keywords=daemontools&searc…

Private methods in PHP programming - response

Saturday, August 23rd, 2008

Felix over at Debuggable wrote an interesting article about private methods. He thinks it’s not a very good thing to use, but, kudos to him, doesn’t rule out the possibility. He argues that he doesn’t have any formal education in programming and development, but I don’t think that matters much at all since he seems to have quite a bit of programming experience.

But what I think is that, of course, you alwas can write private-method-free code, but sometimes it’s not very good. When you need to duplicate code time after another, you might begin to see the need for another method (refactoring) or for that matter class. What that method does or returns maybe, just maybe, isn’t that good for the rest of the world (read application) to access directly rather than through your other, more high level methods.

CakePHP itself is has lots of private methods. Could we do without them all? Of course we could. Would it make the code easier to read? Maybe. Would it make the code easier to maintain? I think not.

With that said, you always need to make an active decission whether you choose to make a method public, private or protected. Chances are, if you only write public because you are used to it, you might be making a mistake that could compromise stability or security of your application if another developer makes use of that method…

Power consumption on office switches

Friday, August 22nd, 2008

Russel Coker wrote about switches and cables, and thinks putting a “dumb switch” on every desk is a good solution for office networking. He’s got a couple of valid points, for example that it’s possible to use less cables from the patch room, no (or less) dependency on network gurus and so on.

What he doesn’t talk about is that

  • Power consumption goes up. Each office switch typically uses between 5W and 10W depending on how good the AC/DC-adaptor is. (example of WRT54 power consumption)
  • You get many more SPOF. Okay, most switches actually works quite good, but office support will have to answer a great many calls of “Internet is down” etc.
  • Configuration of a “real” switch isn’t that complicated, draws less power and usually gives _many_ more possibilities than the dumb table-top switch (ie VLAN, bridging, QoS, …)

xen 3.02 on Debian Etch / AMD64

Friday, July 18th, 2008

A quick walk-through of installation of Xen 3.02 on Debian Etch (AMD64):

KERNELS=”linux-2.6-xen0 linux-2.6-xenU” make -j7 world
make install
make linux-2.6-xen0-config CONFIGMODE=menuconfig
make -j7 linux-2.6-xen0-build
make linux-2.6-xen0-install
make linux-2.6-xenU-config CONFIGMODE=menuconfig
make -j7 linux-2.6-xenU-build
make linux-2.6-xenU-install

vim /boot/grub/menu.lst

title Xen 3.0.2 / Debian GNU/Linux, kernel 2.6.16
root (hd0,0)
kernel /xen.gz dom0_mem=131072
module /vmlinuz-2.6-xen0 root=/dev/sda2 ro console=tty0
savedefault

Install xen-tools, xen-shell etc

update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20

No 404 page when using a static front page

Friday, April 4th, 2008

I was setting up a wordpress blog (latest version, 2.5) a couple of days ago, and added the great plugin Google XML Sitemaps. I wanted a static frontpage with a couple of blog posts below it, so I modified the Kubrick theme a bit (added another template to use for that page, no biggie).

When taking a look at Google Sitemaps (somewhere under Google Webmaster Tools) I found that Wordpress didn’t respond to non-existing pages with a 404 not found, but all my pages after each other, rather like the posts on a dynamic front page.

Again I thought - no biggie! I modified the 404.php template to begin with the following:

<?php
ob_start();
header("HTTP/1.1 404 Not Found");
header("Status: 404 Not Found");
...

Still, no luck. Then I saw that Wordpress didn’t even read the 404.php page! I tried turning off the static front page and voilà, 404 works okay again.

I’ve searched a bit for this in the Wordpress forums, but I’ll report a bug ticket for them. Hopefully it will work in the next release :)

Newsflash:

It only works this way if you haven’t chosen a “Posts page”. Maybe it’s just an undocumented feature?

Symfony development with XAMPP on Windows

Tuesday, April 1st, 2008

This is how I set up my windows laptop for development with Apache/MySQL/PHP/Symfony (XAMPP with Symfony).

  1. Download XAMPP Installer package.
  2. Install XAMPP - this is really just a case of next -> next -> okay.
  3. Since I’m not only using my laptop for development I chose not to start any services except for XAMPP when windows starts.
  4. Start (from XAMPP Control Panel) Apache and MySQL (and whatever other services you need).
  5. Add PHP to your PATH.
    1. Right-click “This Computer”, choose properties.
    2. Advanced tab -> Systam variables (not sure, my system is in Swedish ;) )
    3. Add C:\xampp\php;C:\xampp\mysql\bin (if installed in default location) to the PATH variable.
  6. Upgrade Pear - pear upgrade pear
  7. Find Symfony - pear channel-discover pear.symfony-project.com
  8. Install Symfony - pear install symfony/symfony
  9. Done! Start playing around…

Greylisting, (anti)spam, etc

Tuesday, February 5th, 2008

I’ve been working way too much lately, but at least I’ve taken the time to install a new spam filter on my mail server. It was actually only a very small patch to the qmail source that was needed to get it to filter mail through policyd. Policyd is primarily made for Postfix, but seems to work great with qmail too. That puts an end to my own greylisting project, which only greylisted on source-IP/24. The “greysmtpd” app was working as it should but there were too many spammers in the world to make it effective enough.

qmail-spp

Thursday, November 8th, 2007

Puppet

Sunday, September 30th, 2007

Puppet är ett system för att administrera några till _många_ maskiner från en central punkt. Ungefär som CFEngine, men bättre.