vanutsteen.nl => nerds only » PHP http://v3.vanutsteen.nl A blog on rails, php, computing, my bass guitar and stuff Thu, 20 Sep 2012 06:26:30 +0000 en-US hourly 1 http://wordpress.org/?v=3.5 The continuing story of Zend Studio 5.5.1 (part 2) http://v3.vanutsteen.nl/2012/03/05/the-continuing-story-of-zend-studio-5-5-1-part-2/ http://v3.vanutsteen.nl/2012/03/05/the-continuing-story-of-zend-studio-5-5-1-part-2/#comments Mon, 05 Mar 2012 09:59:17 +0000 LeonB http://www.vanutsteen.nl/?p=655 Everytime I install a new version of Ubuntu / Linux I’m hoping Zend Studio (the old/good one) will still be working. This time with Ubuntu 12.04 I again had to do this but it didn’t take longer than a couple of minutes.

First I had to install the java executable (otherwise I got a “java: not found” error message. Because the Sun JRE isn’t available anymore for Ubuntu (12.04) I installed the default one (icedtea I believe). To my amazing that worked perfectly!

Then I had to install some (i386) libs and it worked! libxcursor is need or else you’ll get a really ugly cursor in Zend Studio 5.

sudo apt-get install default-jre
sudo apt-get install libc6-i386 libxp6:i386 libxtst6:i386 libxcursor1:i386
ln -s /lib32/libc.so.6 /lib/libc.so.6
]]>
http://v3.vanutsteen.nl/2012/03/05/the-continuing-story-of-zend-studio-5-5-1-part-2/feed/ 1
dump a Varien_Db_Select / Zend_Db_Select query http://v3.vanutsteen.nl/2012/02/13/dump-a-varien_db_select-zend_db_select-query/ http://v3.vanutsteen.nl/2012/02/13/dump-a-varien_db_select-zend_db_select-query/#comments Mon, 13 Feb 2012 09:26:06 +0000 LeonB http://www.vanutsteen.nl/?p=630 $query = $adapter->getProfiler()->getLastQueryProfile()->getQuery(); //print last executed query foreach ($adapter->getProfiler()->getLastQueryProfile()->getQueryParams() as $k => $v) { $query = $query = str_replace($k, "'{$v}'", $query); } var_dump($query);

A more complete example:


$adapter = Mage::getSingleton('core/resource')->getConnection('core_write');
$adapter->getProfiler()->setEnabled(true); //enable profiler

// Do database stuff

$number = 10;
$profiles = $adapter->getProfiler()->getQueryProfiles();
$profiles = array_slice($profiles, count($profiles)-$number, $number);

foreach ($profiles as $profile) {
$query = $profile->getQuery(); //print last executed query
foreach ($profile->getQueryParams() as $k => $v) {
$query = $query = str_replace($k, "'{$v}'", $query);
$query = preg_replace('/\?/', $v, $query);
}
var_dump($query);
}

]]>
http://v3.vanutsteen.nl/2012/02/13/dump-a-varien_db_select-zend_db_select-query/feed/ 0
Nginx + sabnzbd + sickbeard + couchpotato + spotweb on my pandaboard http://v3.vanutsteen.nl/2012/02/04/nginx-sabnzbd-sickbeard-couchpotato-spotweb-on-my-pandaboard/ http://v3.vanutsteen.nl/2012/02/04/nginx-sabnzbd-sickbeard-couchpotato-spotweb-on-my-pandaboard/#comments Sat, 04 Feb 2012 18:02:30 +0000 LeonB http://www.vanutsteen.nl/?p=605 I got Apache- (mpm-itk), sickbeard, sabnzbd, couchpotato and spotweb running on my pandaboard. But apache really used up a lot of resources. So I decided to replace it with nginx. Nginx would be a reverse proxy and communicate via fastcgi with php.

This post describes how to set up Nginx. Not how to install sabnzbd, sickbeard, couchpotato or spotweb on your machine. I assume you know how to do that.

Step 1: install nginx

leon@panda:~$ sudo apt-get install nginx-light

Step 2: proxy stuff

Add all the important proxy stuff in one file so it can be included later on.

leon@panda:~$ cat /etc/nginx/conf.d/proxy.conf

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

allow 192.168.1.0/24;
deny all;

Step 3: set up all the locations

Set up alle the locations (subdirectories on you http server) for sabnzbdplus, sickbeard, couchpotato and spotweb.

The important part from /etc/nginx/sites-enabled/default:

server {

location /sabnzbd {
include /etc/nginx/conf.d/proxy.conf;

proxy_pass http://localhost:9090;
}

location /sickbeard {
include /etc/nginx/conf.d/proxy.conf;

proxy_pass http://localhost:8081;
}

location /couchpotato {
include /etc/nginx/conf.d/proxy.conf;

proxy_pass http://localhost:5000/;
rewrite ^/couchpotato/?$ /couchpotato/movie/ permanent;
}

location /spotweb {
alias /home/leon/src/spotweb/spotweb.git; #not root directive

location ~* \.php$ {
fastcgi_pass localhost:9001; #defined in /etc/php5/fpm/pool.d/leon.conf
include fastcgi_params;
fastcgi_index index.php;
}
}

}

Sorry about the indentation… Anyone recomend a good code plugin for wordpress?

Step 4: setup php

Now we’re going to set up php for nginx with php5-fpm. This is a new module and isn’t available on older versions of ubuntu. I think it’s only available from ubuntu 10.10 and onwards.

leon@panda:~$ sudo apt-get install php5-fpm

Then edit /etc/php5/fpm/pool.d/leon.conf (in my case). I created another pool for my user (‘leon’) because I don’t want it to run under the user www-data or similar.

cat /etc/php5/fpm/pool.d/leon.conf


; Start a new pool named 'leon'.
[leon]
listen = 127.0.0.1:9001
user = leon
group = leon

pm = dynamic
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 4
pm.max_children = 4

Step 5: Restart everything and admire your work

leon@panda:~$ sudo service nginx restart
leon@panda:~$ sudo service php5-fmp restart

Footnotes:
I also tried to get it working with chroot = /home/leon in /etc/php5/fpm/pool.d/leon.conf but I couldn’t get spotweb working with mysql on port 3306. When chrooted you can’t access /var/run/mysqld/mysqld.sock. I’ll have to investigate that a bit more.

Also, you could remove /etc/php5/fpm/pool.d/www.conf if you don’t use it (like in my case):

cd /etc/php5/fpm/pool.d/
sudo mv www.conf www.conf.disabled
sudo service php5-fpm restart
]]>
http://v3.vanutsteen.nl/2012/02/04/nginx-sabnzbd-sickbeard-couchpotato-spotweb-on-my-pandaboard/feed/ 2
Sublime Text 2 http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/ http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/#comments Wed, 26 Oct 2011 21:36:30 +0000 LeonB http://www.vanutsteen.nl/?p=562 I installed sublime text on my Ubuntu 11.10 box but I had some troubled loading external python modules:

loaded 937 snippets
>>> import distutils
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named distutils

This is how I solved it:

Edited ~/.local/share/applications/sublime.desktop
Especially this line:

Exec="/home/leon/Software/bin/sublime" %U

/home/leon/Software/bin/sublime contains this:

#!/bin/bash
cd /usr/lib/python2.7
/home/leon/Software/SublimeText2/sublime_text

Then I installed some excellent plugins:

]]>
http://v3.vanutsteen.nl/2011/10/26/sublime-text-2/feed/ 0
The continuing story of Zend Studio 5.5.1 http://v3.vanutsteen.nl/2011/09/06/the-continuing-story-of-zend-studio-5-5-1/ http://v3.vanutsteen.nl/2011/09/06/the-continuing-story-of-zend-studio-5-5-1/#comments Tue, 06 Sep 2011 21:44:18 +0000 LeonB http://www.vanutsteen.nl/?p=550 Everytime I install a new version of Ubuntu / Linux I’m hoping Zend Studio (the old/good one) will still be working. So I installed Ubuntu 11.10 and also this time I had to install some stuff to get Zend Studio working.

sudo apt-get install libc6-i386 ia32-libs
ln -s /lib32/libc.so.6 /lib/libc.so.6

And it worked! Know I’m gonna try do update the JRE of the Zend Studio 5.5

]]>
http://v3.vanutsteen.nl/2011/09/06/the-continuing-story-of-zend-studio-5-5-1/feed/ 0
Install pcntl (pcntl_fork) on Ubuntu Hardy http://v3.vanutsteen.nl/2011/08/18/install-pcntl-pcntl_fork-on-ubuntu-hardy/ http://v3.vanutsteen.nl/2011/08/18/install-pcntl-pcntl_fork-on-ubuntu-hardy/#comments Thu, 18 Aug 2011 05:28:03 +0000 LeonB http://www.vanutsteen.nl/?p=531 No apt-getting on Hardy :(

cd ~/
mkdir php
cd php
apt-get source php5
cd php5-*/ext/pcntl
phpize
./configure
make
no=`phpize | grep "Zend Module Api No" | cut -d : -f2 | awk '{gsub(/^ +| +$/,"")}1'`
cp modules/pcntl.so /usr/lib/php5/$no/
echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
]]>
http://v3.vanutsteen.nl/2011/08/18/install-pcntl-pcntl_fork-on-ubuntu-hardy/feed/ 1
Zend_db http://v3.vanutsteen.nl/2010/09/26/zend_db/ http://v3.vanutsteen.nl/2010/09/26/zend_db/#comments Sun, 26 Sep 2010 21:31:02 +0000 LeonB http://www.vanutsteen.nl/?p=494 Zend Framework logoThe last few days I’ve been spending my time on creating a website with Zend Framework. A lot of it I liked but the Zend_db stuff is is a complicated piece of crap. I’ve worked with a lot of ORM’s and db api’s but the Zend_db stuff is really the most awfull I’ve had till now.

I really, really don’t want to work with it ever again and I regret that I chose ZF for this particular project just because of the db layer.

]]>
http://v3.vanutsteen.nl/2010/09/26/zend_db/feed/ 0
Nice guide to upgrading magento http://v3.vanutsteen.nl/2010/08/06/nice-guide-to-upgrading-magento/ http://v3.vanutsteen.nl/2010/08/06/nice-guide-to-upgrading-magento/#comments Fri, 06 Aug 2010 08:15:50 +0000 LeonB http://www.vanutsteen.nl/?p=486 http://www.nicksays.co.uk/2010/03/fool-proof-magento-upgrades/

./pear upgrade --force magento-core/Mage_All_Latest
]]>
http://v3.vanutsteen.nl/2010/08/06/nice-guide-to-upgrading-magento/feed/ 0
fixing a hacked site http://v3.vanutsteen.nl/2009/10/23/fixing-a-hacked-site/ http://v3.vanutsteen.nl/2009/10/23/fixing-a-hacked-site/#comments Fri, 23 Oct 2009 08:16:18 +0000 LeonB http://www.vanutsteen.nl/?p=426 One of our Joomla! sites was “hacked” with some stupid script and the fuckers put a iframe in every page :(

But with sed that was fixed in a matter of seconds:

find . -type f -print |xargs sed -i 's/<iframe.*iqdoza.ru.*<\/iframe>//g'

OR:

find . -type f -print |xargs sed -i 's/<iframe.*.ru.*<\/iframe>//g'

Searching for hacked sites:

egrep -lir "<iframe|hacked" /home/*/public_html/*index*

Drawback is that it doesn’t removed the inserted newline :S Because it isn’t the design of sed (wha-evah).
Also it doesn’t handle files with spaces in the filename. But that’s only minor because in my case I didn’t have any php or html files with spaces in them :)

script-kiddie

]]>
http://v3.vanutsteen.nl/2009/10/23/fixing-a-hacked-site/feed/ 0
Choosing a new editor: Emacs vs. Vim http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/ http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/#comments Thu, 15 Oct 2009 07:27:49 +0000 LeonB http://www.vanutsteen.nl/?p=393 For php I use Zend Studio for Linux. We have a license at work for it and it is in my opinion the best editor for php. It’s relatively fast and you can use it to quickfix php over an ftp connection.

For Ruby I use netbeans. I would also like to use it for php but it doesn’t allow to quicly open a file via ftp/scp or whatever. And it can sometimes be sloooooowwww. I’ve  seen netbeans used on a Windows platform and there it is much faster.

When I right-click on a project in netbeans for the first time, it takes 5 seconds (not lying!) to render the popup-menu. Come onm take forever!

And because I was now developing with Python I decided to try a new editor. Something more hardcore and lighter. Something nerdy :) So ofcourse I only have two decent options: Vim & Emacs.

I already had try them with Ruby. But I found good Ruby (& Rails) support rather lacking by both of them. I believe that the python comminity is more hardcore and therefore are using more arcane editors :) And maybe because they aren’t afraid to hack away in another language than their own (lisp, vimscript).

I think I have been comparing the two editors for nearly two weeks now. I have spent hours and hours comparing, trying and browsing for blog posts about the two. At the end, I really didn’t know which one to choose. I really suck at deciding something :) So I made a little list of what I find to be strong points of each editor:

VIM:

  • Better syntax highlighting/theming supprt (wombat ftw!!)
  • Faster/smaller
  • No weird handling of new buffers like with emacsclient
  • No daemon like: emacs –daemon
  • Better python integration
  • Easier to make extensions
  • Preview of docstrings when using omni completion

EMACS:

  • Better python-mode
  • No commandmode/normalmode
  • Directory browser/editor
  • Debugger (better integration with external tools)
  • easier to begin
  • Everyting is a buffer™

And now I have chosen to be the editor with which I am going to work is…… (drum roll please) …….:

Gedit!

No, it’s (g)Vim :)

And while writing this article I was looking for a WordPress/blog plugin for Vim and Emacs. At a glance it looked like the wordpress plugin for Emacs was a little bit better. So already I was doubting my decision… So it could be that I switch editor in the next few months :) But I’m first going to really use gvim to see if it fits with my workflow and is really useable for me.

As cherry on the pie, a nice screenshot of my gvim in action:

Vim with python-mode

[update]
I’ve installed Netneans 6.8m2 and it feels a lot faster than 6.7 but python completion is as bad as in 6.7.
[/update]

[update2]
Found out about Vim’s netrw. So Emacs no longer got “Directory browser/editor” as a strong point.
[/update2]

]]>
http://v3.vanutsteen.nl/2009/10/15/choosing-a-new-editor-emacs-vs-vim/feed/ 2
Zend and Compiz/visual effects http://v3.vanutsteen.nl/2009/10/13/zend-and-compizvisual-effects/ http://v3.vanutsteen.nl/2009/10/13/zend-and-compizvisual-effects/#comments Tue, 13 Oct 2009 07:37:44 +0000 LeonB http://www.vanutsteen.nl/?p=390 Zend logoWhen enabling Visual effects Zend wouldn’t maximize anymore. So after a bit of googling I found a nice tutorial to fix the problem with Zend.

]]>
http://v3.vanutsteen.nl/2009/10/13/zend-and-compizvisual-effects/feed/ 0
Problems with suexec/fastcgid and virtualmin http://v3.vanutsteen.nl/2009/09/11/problems-with-suexecfastcgid-and-virtualmin/ http://v3.vanutsteen.nl/2009/09/11/problems-with-suexecfastcgid-and-virtualmin/#comments Fri, 11 Sep 2009 07:50:45 +0000 LeonB http://www.vanutsteen.nl/?p=353 Since a few version of virtualmin I had some problems with checking the server configuration.

Virtualmin 3.72.gpl_webmin_error

The problem is that I have manually patched suexec and the php fcgid script is in /var/www and not /home.

I had this error for quite a while but last week I fixed it. It was quite simple. Just change this code in “/usr/share/webmin/virtual-server/feature-web.pl:

# Make sure home base is under base directory, or template CGI directory is
if ($tmpl->{'web_suexec'} && $suhome &&
!&same_file($suhome, $home_base) &&
!&is_under_directory($suhome, $home_base) &&
(!$cgibase || !&is_under_directory($suhome, $cgibase))) {
return &text('check_ewebsuexechome',
"<tt>$home_base</tt>", "<tt>$suhome</tt>");
}

<p style="text-align: left;">return undef;
}

To:

# Make sure home base is under base directory, or template CGI directory is
return undef;
if ($tmpl-&gt;{'web_suexec'} &amp;&amp; $suhome &amp;&amp;
!&amp;same_file($suhome, $home_base) &amp;&amp;
!&amp;is_under_directory($suhome, $home_base) &amp;&amp;
(!$cgibase || !&amp;is_under_directory($suhome, $cgibase))) {
return &amp;text('check_ewebsuexechome',
"&lt;tt&gt;$home_base&lt;/tt&gt;", "&lt;tt&gt;$suhome&lt;/tt&gt;");
}  return undef;
}

So just add “return undef;” to the top of that piece of code. Then it will step out of the function before the additional check is executed.

# Make sure home base is under base directory, or template CGI directory is
if ($tmpl->{‘web_suexec’} && $suhome &&
!&same_file($suhome, $home_base) &&
!&is_under_directory($suhome, $home_base) &&
(!$cgibase || !&is_under_directory($suhome, $cgibase))) {
return &text(‘check_ewebsuexechome’,
“<tt>$home_base</tt>”, “<tt>$suhome</tt>”);
}
return undef;
}
]]>
http://v3.vanutsteen.nl/2009/09/11/problems-with-suexecfastcgid-and-virtualmin/feed/ 0
Burning from the commandline http://v3.vanutsteen.nl/2008/12/19/burning-from-the-commandline/ http://v3.vanutsteen.nl/2008/12/19/burning-from-the-commandline/#comments Fri, 19 Dec 2008 08:58:26 +0000 LeonB http://www.vanutsteen.nl/?p=311 cdrecord logoI download a Debian Sid livecd on my home server/HTPC and there’s a cd burner in there. So I would like to burn the downloaded iso. There no X Server running (yet) on the box so I was searching for a nice commandline utility.

I found cdw and it really looked nice so I installed it:

aptitude install cdw

After running it with “cdw” it detected my cd-writer so no configuration needed: nice. Because I once tried mybashburn (or something like that) and that piece of software needed all kinds of configuration. And I don’t like that.

I wanted to burn the debian sid iso with cdw but I couldn’t find an option for doing so. After some searching I found out that I had to go to “preferences” and change the value of “Default image file”. WTF? That’s not very nice I thought. But I tried it. But a no-go. The path to my iso was to long to fit in the box. So I couldn’t even select it.

Don’t get me wrong: cdw IS nice for burning music cd’s or just some files to backup. But isos…. pfff

So I resorted to cdrecord. It’s got a bit of a “hacker” feeling to it but it did the job nicely:

cdrecord driveropts=burnfree /home/leon/debian-live-sid-amd64-xfce-desktop.iso

What I don’t understand is why I have to manually enable burnfree. I mean: the last 5 cdr drives I had, all had burnfree. I’m doubting if they even make cd recorders without burnfree. So why not make it the default? Because apparently “Maybe it causes problems with *some* drives withput burn-free support”. Hja, retards.

But there might be a solution to this problem. Cdrecord checks for “/etc/cdrecord.conf”. And there you can change the default cdrecord parameters. My “/etc/cdrecord.conf” now contains:

driveropts=burnfree

But if it’s correct of if it works: I don’t know. I haven’t yet tested it.

]]>
http://v3.vanutsteen.nl/2008/12/19/burning-from-the-commandline/feed/ 0
Phoogle: a _good_ fixed version http://v3.vanutsteen.nl/2008/11/28/phoogle-a-_good_-fixed-version/ http://v3.vanutsteen.nl/2008/11/28/phoogle-a-_good_-fixed-version/#comments Fri, 28 Nov 2008 09:55:13 +0000 LeonB http://www.vanutsteen.nl/?p=279 Recently phoogle broke because of some Google maps update. The original creators of Phoogle haven’t updated the code (yet). And when searching online for newer, fixed versions all that showed up were crappy hacked Phoogle files by people who don’t know what they’re doing.

So hereby I present to you: a fixed Phoogle files which is hacked decent.

]]>
http://v3.vanutsteen.nl/2008/11/28/phoogle-a-_good_-fixed-version/feed/ 0
Installing fcgid with suexec AND phusion passenger http://v3.vanutsteen.nl/2008/10/28/installing-fcgid-with-suexec-and-phusion-passenger/ http://v3.vanutsteen.nl/2008/10/28/installing-fcgid-with-suexec-and-phusion-passenger/#comments Tue, 28 Oct 2008 19:44:39 +0000 LeonB http://www.vanutsteen.nl/?p=250
It was a troublesome day today. All did not go as planned.

I had to install fcgid + suexec on one of our servers, I had delayed it too long. So I used my how-to and it still worked flawless. But I noticed I hadn’t mentioned what the right were of the suexec binary. So here it goes:

chown root:www-data suexec
chmod 4754 suexec

After the install I restarted Apache and looked at one of the sites. And it worked! I was baffled. That’s the first time I installed fcgid without hours long of searching where the flaw was.

But then I looked at our support system (Redmine) and it didn’t work too well :)

All controllers were being executed ‘n stuff. But the stylesheets, images and javascripts were not loaded. When requesting an image in the browser I got Rails 404-error page. Huh? Apache should have handled that request. At first I thought it was because of some changes I made to the virtualserver configuration of an other Rails site. But after some trial and error I couldn’t find anything that was wrong.

Then I removed the .htaccess from the public directory of Redmine. That once worked for one of my rails sites. But no cigar. Then I noticed that there were a lot of dispatch*example.rb’s in the public directory. And: after removing them, the stuff worked. So it seems like Rails or Phusion Passenger uses some kind of fuzzy matching when searching for a dispatch.rb. And it first just worked because fcgid was not installed. So I don’t know who’s to blame. But the problem is solved. Phew!

]]>
http://v3.vanutsteen.nl/2008/10/28/installing-fcgid-with-suexec-and-phusion-passenger/feed/ 0
Released github widget http://v3.vanutsteen.nl/2008/10/01/released-github-widget/ http://v3.vanutsteen.nl/2008/10/01/released-github-widget/#comments Wed, 01 Oct 2008 08:32:30 +0000 LeonB http://www.vanutsteen.nl/?p=241 I think you all noticed my fabulous new sidebar widget: My projects :P

It shows all of my github projects. I directly turned it into a plugin for you to enjoy. You can download and read the documentation in the wordpress plugin directory.

]]>
http://v3.vanutsteen.nl/2008/10/01/released-github-widget/feed/ 0
mime_magic errors with php4 http://v3.vanutsteen.nl/2008/06/28/mime_magic-errors-with-php4/ http://v3.vanutsteen.nl/2008/06/28/mime_magic-errors-with-php4/#comments Sat, 28 Jun 2008 08:36:01 +0000 LeonB http://www.vanutsteen.nl/?p=94 I went to a customer for our three-weekly sprint review, I opened my mail there and it was full with hundreds of failed cronjobs. Ah, shit! Another night at the datacenter? But it wasn’t that bad :)

The server had ran an update of php that night and it broke. When I ran php4 from the commandline I got these errors:

PHP Warning: mime_magic: type search/400 \\input text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type search/400 \\section text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type search/400 \\setlength text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type search/400 \\documentstyle text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type search/400 \\chapter text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type search/400 \\documentclass text/x-tex invalid in Unknown on line 0
PHP Warning: mime_magic: type regex [Cc]onstant[[:space:]]+[Ss]tory text/x-inform invalid in Unknown on line 0

Wait a minute… I know these errors! But, of course, I hadn’t documented the solution when I first fixed them. So after much searching I found the workarround again:

In the /usr/share/misc/magic.mime file, find the section that begins "# TeX documents, from Daniel Quinlan" and comment out the lines in that section.

# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
#0 search/400 \\input text/x-tex
#0 search/400 \\section text/x-tex
#0 search/400 \\setlength text/x-tex
#0 search/400 \\documentstyle text/x-tex
#0 search/400 \\chapter text/x-tex
#0 search/400 \\documentclass text/x-tex

# Type: Inform interactive fiction language
# URL: http://www.inform-fiction.org/
# From: Reuben Thomas
#0 regex [Cc]onstant[[:space:]]+[Ss]tory text/x-inform

NOTE: For Debian, it appears that this file is located at /usr/share/file/magic.mime!

]]>
http://v3.vanutsteen.nl/2008/06/28/mime_magic-errors-with-php4/feed/ 4
rubygems: updating to 1.2.0 http://v3.vanutsteen.nl/2008/06/25/rubygems-updating-to-120/ http://v3.vanutsteen.nl/2008/06/25/rubygems-updating-to-120/#comments Wed, 25 Jun 2008 05:42:16 +0000 LeonB http://www.vanutsteen.nl/?p=102 I’ve installed rubygems manually (no package manager) in my home directory. But since then “gem –version” reported that it could not it’s version. So now I’ve removed the previous installed version, downloaded the tar and reinstalled. I’ve used this command to install this time:

ruby setup.rb --destdir=~/.rubygems --prefix=/

And now it runs fine!

leon@polly:~$ gem1.8 --version
1.2.0

And I’ve installed ruby 1.8.7 (from Intrepid) on Ubuntu Hardy. But more on that in my next post.

]]>
http://v3.vanutsteen.nl/2008/06/25/rubygems-updating-to-120/feed/ 0
compiling suexec: the fast way (because your website is down) http://v3.vanutsteen.nl/2008/06/14/compiling-suexec-the-fast-way-because-your-website-is-down/ http://v3.vanutsteen.nl/2008/06/14/compiling-suexec-the-fast-way-because-your-website-is-down/#comments Sat, 14 Jun 2008 18:17:23 +0000 LeonB http://www.vanutsteen.nl/?p=79

At Tim_online we have several webservers and each of them have apache2 installed running php with fcgid (a fastcgi implementation). Why this configuration and not mod_php? Because it is reasonably fast (at leaster faster than plain cgi) an secure (because it doesn’t run under the apache user).

For it to run php scripts as the website owner, you need suexec.

Suexec is a mechanism supplied with Apache that allows to execute CGI scripts as the user they belong to, rather than Apache’s wwwrun user. This improves security in situations where multiple mutually distrusting users have the possibility to put CGI content on the server.

So when u visitor requests one of the webpages of one of my customers the proces looks like this:

request -> apache -> fastcgi -> suexec -> proxy -> php file

I don’t exactly know anymore why the proxy is required, but it is :)
Know the problem is: suexec (by default) can’t execute the proxy file, because it isn’t owned by the php file owner. So you have to hack suexec to make this work.

I did this. And everything worked. The webservers were happy to serve al these requests untill one day apache get updated. The automatic ubuntu updates push a new version of apache with a new suexec binary. Problem!

So when you come at work there are 16 “missed incoming calls” and you co-workers are going mad with all the dissapointed customers. You look at the apache logs: hmzzz, suexec is giving 120 errors… What could that be? !Ping! Suexec ofcourse. Let’s see, how did I solve this problem the last time. First let’s download the apache sources. ./configure. Yes. now where’s suexec.c? Ah, cd support. Now,  make suexec. Wait, missing headers. Let’s install those first. Make suexec. Arrgh. It doesn’t work! Suexec -v. Wait, forgot to adjust the ap_httpd_user, ow, and comment out the offending lines. Yes, this should work. Ok. Copy it to /usr/lib/apache2. Ok, it works!

But at that time, an hour has past. If you can find the right files at once. So I decided to write down the steps I took to download, configure and compile suexec the quickest and simplest way. Here we go:

sudo apt-get install apache2-threaded-dev
mkdir -p ~/src/suexec
cd ~/src/suexec
sudo apt-get install apache2-threaded-dev
wget http://svn.apache.org/repos/asf/httpd/httpd/trunk/support/suexec.c
wget http://svn.apache.org/repos/asf/httpd/httpd/trunk/support/suexec.h
wget http://www.vanutsteen.nl/wp-content/uploads/2008/06/suexecc.patch
patch suexec.c suexec.c.patch -o suexec.patched.c
gcc -DLOG_EXEC='"/var/log/apache2/suexec.log"' -DAP_HTTPD_USER='"www-data"' -DAP_DOC_ROOT='"/var/www"' -I/usr/include/apr-1.0 -I/usr/include/apache2  -o suexec suexec.patched.c

That’s it! Test it by doing: sudo ./suexec -V
That should output:

-D AP_DOC_ROOT="/var/www"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="www-data"
-D AP_LOG_EXEC="/var/log/apache2/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=100
-D AP_USERDIR_SUFFIX="public_html"

Basically what I did:

  1. I installed the necessary headers
  2. Got the latests suexec code from the apache svn repo
  3. Downloaded the suexec patch from my blog
  4. Patched suexec to disable the file owner check
  5. Compiled suexec with the default ubuntu options
]]>
http://v3.vanutsteen.nl/2008/06/14/compiling-suexec-the-fast-way-because-your-website-is-down/feed/ 3
Images & why you need com_resize http://v3.vanutsteen.nl/2008/05/24/images-why-you-need-com_resize/ http://v3.vanutsteen.nl/2008/05/24/images-why-you-need-com_resize/#comments Sat, 24 May 2008 21:37:18 +0000 LeonB http://www.vanutsteen.nl/?p=72 I the release post of com_resized there was asked the question why one should use com_resize. There are three reasons to use it:

  1. The generated images aren the size you want them to be. So they’re smaller of size than the original images.
  2. You won’t get any ugly resized images (see the example below).
  3. It works with remote images. So you can link to an image one someone else’s blog and they get resized to the size you want + cached. So that way they get loaded from your own server: so faster.

No more ugly resized images:

The one on the left is without com_resize. The one on the right is _with_ com_resize. If you don’t see any difference. Your browser is probably doing some fancy stuff with the image. In that case you don’t need com_resize. But maybe the readers of your blog do!

For the people who don’t see any difference (leave a comment with your OS + browser, please!) I have attached a screenshot. Made in IE6, so the font is ugly too :)

]]>
http://v3.vanutsteen.nl/2008/05/24/images-why-you-need-com_resize/feed/ 8
2.5.1 image uploader bug http://v3.vanutsteen.nl/2008/04/28/251-image-uploader-bug/ http://v3.vanutsteen.nl/2008/04/28/251-image-uploader-bug/#comments Mon, 28 Apr 2008 14:15:59 +0000 LeonB http://www.vanutsteen.nl/?p=51 I recently upgrade my WordPress installation to 2.5.1 and this annoying bug showed up. After some reading I installed the no-flash-uploader plugin. This plugin disables the faulty (flash) component and replaces it with a traditional uploader. So now I can upload my files again. But it is rather annoying. And I think more people would agree with me.

]]>
http://v3.vanutsteen.nl/2008/04/28/251-image-uploader-bug/feed/ 0
com_resize on wordpress plugins http://v3.vanutsteen.nl/2008/04/27/com_resize-on-wordpress-plugins/ http://v3.vanutsteen.nl/2008/04/27/com_resize-on-wordpress-plugins/#comments Sun, 27 Apr 2008 22:24:56 +0000 LeonB http://www.vanutsteen.nl/?p=48 Because I expect a huge, huge demand of my com_resize plugin, I have put it on the wordpress site :)

Now I hope it gets approved.

]]>
http://v3.vanutsteen.nl/2008/04/27/com_resize-on-wordpress-plugins/feed/ 6
Nice image resizer http://v3.vanutsteen.nl/2008/04/27/nice-image-resizer/ http://v3.vanutsteen.nl/2008/04/27/nice-image-resizer/#comments Sun, 27 Apr 2008 21:08:24 +0000 LeonB http://www.vanutsteen.nl/?p=46 You see all the nice (resized) images on my site? I’ve made a plugin for them to be generated. Want I wanted was to add an image in the wordpress editor. Give a height and/or width and that they would be resized automatically.

With proud I introduce my resize plugin: com_resize. Why the name? Because I’ve used the source code from on of my Joomla! mambots. Hence the name.

You can download it here. If you have any question: leave behind a comment.

For installing: just unpack it in the plugins folder and activate the plugin. Your server must have GD installed (or Imagemagick I believe). Maybe I’ll release a version with mod_rewrite supported images. But that’s only if I’m sore bored I don’t what to do else.

]]>
http://v3.vanutsteen.nl/2008/04/27/nice-image-resizer/feed/ 8
Joomla! vs. WordPress http://v3.vanutsteen.nl/2008/04/27/joomla-vs-wordpress/ http://v3.vanutsteen.nl/2008/04/27/joomla-vs-wordpress/#comments Sun, 27 Apr 2008 15:32:55 +0000 LeonB http://www.vanutsteen.nl/?p=44 I’ve been using WordPress for over two months now and I’ve already written 24 posts! I thinks that’s a nice average.

When I look at my old blog: v2.vanutsteen.nl, I think my average there is about two posts every month or so.

The difference is that I’m now using WordPress instead of Joomla! And WordPress is sooo much simpler for a blogsite then Joomla! You can use Joomla! for your blog. Even with comments and all. But the way WordPress is set up, every moron (as me) can just start blogging. They made it really simple. And they should keep it that way! No fancy stuff in the default wordpress installation. If you want to get fancy, just install all plugins.

I’ve got to plugins installed. One for generating google sitemaps and another for caching my pages. The first one is a bit slow and I really don’t like it. The caching plugin (wp-cache 2) is really nice. Install, activate and go. And my website flies instead of crawling like it first did.

I’m using Joomla! during the day at my job. So Joomla! is buying my bread and paying my house and I know Joomla! through and through. I make webshops, coporate sites, intranets, etc. with Joomla!. But I wouldn’t use it for a blog. WordPress is the way to go!

 

edit: I saw I haven’t added the sitemap to the above image. So here goes:

  • Red: WordPress
  • Blue: Joomla!
  • Yellow: Drupal
]]>
http://v3.vanutsteen.nl/2008/04/27/joomla-vs-wordpress/feed/ 0
Image resize script for wordpress http://v3.vanutsteen.nl/2008/04/24/image-resize-script-for-wordpress/ http://v3.vanutsteen.nl/2008/04/24/image-resize-script-for-wordpress/#comments Thu, 24 Apr 2008 13:12:41 +0000 LeonB http://www.vanutsteen.nl/?p=38 WordPress is a great blog application. It has some nice free templates and the default installation has everything I need without being bloated. I miss one thing: automatic resizing of images who are too big. So I plan on making it myself. Something like this but even simpler (as well in functionality as in configurability).

]]>
http://v3.vanutsteen.nl/2008/04/24/image-resize-script-for-wordpress/feed/ 0