Opensource PHP Wysiwyg online editor

February 8th, 2009 by admin | Permalink

I recently programmed a MiniCMS for a customer.
To make it easier for the customer to edit content, I looked for a opensource wysiwyg editor and I found spaw2.
Spaw2 has really everything you expect from a wysiwyg editor including fileupload.
It’s really easy to integrate.
Just include the library in you php file, start a new instant of the class and show the editor.

include("spaw2/spaw.inc.php");
$spaw = new SpawEditor("content", $content);

$spaw->show();


That’s it!

Search and Replace on command-line for several files

January 7th, 2009 by admin | Permalink

Here is a little helper which can be used to search and replace Words in several files at one time.
For this we use perl on the command-line.
perl -p -i.bak -e "~s|search|replace|" file1.txt file2.txt file3.txt
The system will add a .bak file for each file so you have the old stuff too.

Getting Mac OS X in Standby with Shell Command

January 7th, 2009 by admin | Permalink

Sometimes you leave the house and you Mac has to run for a little while, but then you want it in standby.
Here is a easy way to do this with a shell command.

sleep 900 && osascript -e 'tell app "Finder" to sleep'

This sets a 900 seconds (15 minutes) waiting time before putting the Mac into the sleep mode.

problem with permalinks in wordpress on plesk – strato virtual server

August 12th, 2008 by admin | Permalink

This took me a while!
We installed a wordpress on the strato virtual machine and changed the permalink structure, but it didn’t work.
My first thought was that there must be something wrong with mod_rewrite. Seems like apache is not reporting if a module isn’t loaded but tried to use.
As Plesk is doing a good job with it’s user interface, they are not using a standard apache installation with mods-enabled & mods-availible.
After searching for a while I found a file called /etc/sysconfig/apache2.

In my case it’s line 84:

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5 perl python suexec"

This is telling the apache which modules have to loaded, as you can see there is nothing like rewrite.
Edit this line:

APACHE_MODULES="rewrite actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5 perl python suexec"

Restart apache with:
/etc/init.d/apache2 restart
And it works.

MySQL stoped accepting connections.

August 7th, 2008 by admin | Permalink

Strange things are going on.

Actually, today one of my most frequented servers, running lighttpd, stopped serving php files after working for months.
After searching for a while in the lighttpd logs and php logs we figured out, that lighttpd still serves plain html files. So the problem seemed to come from the fast-cgi php. After swichting to apache for about 30 minutes, apache stopped too.
So we figured out that there must be something with the db server, which is an external machine.
Connection local worked fine. Connecting via socket didn’t!
We looked at the processes with:

mysql>show processlist;

The result was a lot of these:

| 108160 | unauthenticated user | 10.0.0.1:3449 | NULL | Connect | NULL | login | NULL

So we figured out that there is a problem with the authentification. First we thougt it is a switch or some kind of hardware problem. Nothing.
After looking around, we found out that MySQL is using reverse lookup at socket connections.
We added the machines in /etc/hosts and everything works fine for now.

What happend?
We are not using our own DNS for lookups. So what I think is that there was actually an entry for 10.0.0.1 in the dns server we use. This dns server served some domain name. Definitly not for our server, but it was a dns record. Mysql just checks and says yes or no. Someone must have updated the dns server and deleted this record so our system stopped.
Strange thing!
I think there is no good reason why mysql should do a reverse lookup. Do you have one?

OpenX: Link banner to campaign is not availible.

August 4th, 2008 by admin | Permalink

This normally happens, if you forget to give the right size with the banner. OpenX not always recognizes the right size of a banner. Simple edit the banner and add the width and height.

Never seen a webanalytics software like Woopra before.

May 20th, 2008 by admin | Permalink

First of all I have to give the guys from woopra two thumbs up.
I use webanalytics software for some years now. I worked with Indextools and like nearly everyone with Google Analytics.
As Indextools has been sold to Yahoo, Yahoo decided to change the business model of Indextools.
Indextools was not free of charge and hugh application for small sites. So Indextools is more a enterprise tracking system.

Google Analytics is free of charge. On big problem for commercial sites is that the collected data is owned by Google and the “terms and conditions” can be change quickly to use these data for their own needs.

Okay back to the main topic. A friend of mine told me about Woopra and I decided to sign up for the beta test. Woopra is free of charge right now. After the signup you’ll have to wait until the guys from Woopra decided to give you access. In my case, this took two weeks.
After you’re enabled for Woopra, you have to install a javascript in your website.
The cool thing behind Woopra is the Java application you can download from their page. Sadly you’ll need java 1.6 which kicks out nearly all the Mac OS X guys, because Java 1.6 is only availible to 64bit users, which means only Mac Pro users are supported.
After installing the java application you have a wonderful, flash look-like, interface.
Woopra Screenshot
The best thing, you can see your users in real time. You can see, which site they are looking at, how long they have been there, where they came from (website and city/country) and a lot more.
The killer feature here is that woopra enables you to chat to current visitors on your website.
You can choose a user, click on “talk to this user” and get a chat window to talk to them.

At the end, Woopra is nice for small sites and blogs. I guess big business sites will not get the data they need and should use things like Indextools.

Btw. I think Woopra ROCKS!

Hey Novell, SuSE SLES 10 sucks!

April 8th, 2008 by admin | Permalink

Normally I’m a total Debian guy, but for one of my projects I needed a certified linux os to the bought hardware.
So I decided to look at the market and there are just two systems I can use.
Redhat & SuSE SLES10
As this makes no different for me, I decided to give SuSE another shot.
The last version I worked with, was 7.1 or something like that.
I thought SuSE / Novell decided to change their update service and configuration tool YAST.
But what a surprise. NOTHING CHANGED.
It’s the same crap then 5 years ago. Big shot guys!

The update service costs a lot of money per year. Money YOU pay for opensource software packages!!! In times where datatransfer costs only cents, this could not be the reason.
Then I tried to install some basic packages.
And guess what, there are only basic-basic packages in yast.

One example is subversion. subversion is MISSING.
They don’t have to subversion in SUSE SLES 10 as RPM Package.
There is this old big brother cvs, but no svn.
Hello, good morning at SUSE. Every normal software development company is using svn. This is more than a standard package.
But, hey there is something good. You can download the package from Novell. Guess how you can get it? With svn!

MySQL Performance is more than just using the query cache

February 29th, 2008 by admin | Permalink

I’m working on a project with a huge MySQL database and for that reason, I was looking out for some mysql performance tips.
One information I found in nearly every blog was using the slow_query function from mysql.

Put that in your my.cnf:

log-slow-queries=/tmp/slow_queries.log
long_query_time=10


After that you will see all querys that take longer than 10 sec. in the /tmp/slow_queries.log.
To see what you can optimize at this point, you can use EXPLAIN.

So that’s something you find everywhere. Something else you can see everywhere is to activate the query cache. If you are using mysql 5 > this should be enabled by default.

But there are these simple and little optimization points you should use everyday to bring you database on the speedway.

  • Use only the datatypes you really need. Numbers should be saved as int. And text should be saved in the right type.
  • If you’re working with numbers always use only the number no quotes around it. select * from bla where id = 123. Otherwise the server will have to cast the number and will work with a string.
  • Don’t use rand()

Beat me! It’s a html game

February 23rd, 2008 by admin | Permalink

Beat me! This is a funny geek game. So, let’s show me your highscore.

43