Recent twitter entries...

  •  

Seth Godin’s free eBook: What Matters Now

Posted by Nitai | Posted in Internet Zeitgeist | Posted on 16-12-2009

0

Seth Godin had a great idea by gathering the thoughts of over 70 people, each giving you ideas what to think about as we go into a new year. He publishes the book now for free.

Here is one of my favorite ones from Dave Balter:

A long time ago, starting a company that made software for computers was dumb. Microsoft and Apple may beg to differ. A company that manufactures cars: dumb. Putting a college yearbook online: dumb. Limiting updates to just 140 characters: dumb.

But what makes dumb, smart? The ability to look at the world through a different lens from everyone else. To ignore rules. To disregard the ‘why’s’ and ‘how’s’ and ‘never-succeeded-befores’. Then you need conviction, and the ability to stand by that conviction when other (smart) people look you in the eye and say, “no way, nuh uh.”

So, how do you tell a good dumb idea from a bad dumb one? Good dumb ideas create polarization. Some people will get it immediately and shower it with praise and affection. Others will say it’s ignorant and impossible and run for the hills. The fiercer the polarization, the smarter your dumb idea.

Of course, dumb can be just dumb. You just have to be smart to tell the difference.

Here’s what’s easy: to recognize a really smart new business concept as just that. What’s hard is recognizing that the idea you think is just plain dumb is really tomorrow’s huge breakthrough.

Solutions for Oracle ORA-28002 and ORA-27101

Posted by Nitai | Posted in Development, linux, open source | Posted on 11-12-2009

0

Running an Oracle database is great, because it is stable and just runs, but sometimes you are hit with unexpected errors when you restart your machine. Thought, I know Oracle quite well, I’m always surprised at some things. Here are two errors (and solution) I was just confronted with:

ORA-27101: shared memory realm does not exist

To be honest, I don’t know why I was confronted with this error, since we haven’t changed anything to the machine or to the environment variables. Metalink suggest to check that the ORACLE_HOME and ORACLE_SID are correct. Funny thing is that this system runs for over a year without a change to the path, nevertheless I checked the ORACLE_HOME path and sure enough I had trailing slash at the end.

So, the solution was to see that ORACLE_HOME does NOT have a trailing slash.

echo $ORACLE_HOME
/opt/oracle/product/11/ <--- WRONG!

echo $ORACLE_HOME
/opt/oracle/product/11 <--- CORRECT!

Remember to log out of your current shell session in order to reapply the new settings.

ORA-28002: the password has expired

Now, this error caught be even worse, because it happened right within a production environment. Also, here I was unaware of this setting. In any case, Oracle seams to want you to reset your password after one year or so. In case, you want to disable this on a user without changing the users password you need to issue the following commands in sqlplus:

alter profile {user} limit password_verify_function null;

This will set the verification for this user to null. If you want to do this for every user in your system you would use this (this is applied to the DEFAULT profile):

alter profile DEFAULT limit password_verify_function null;

Once done you can then reset the password for the user with the same password or with another one with:

alter user {user} identified by {password};

Exit sqlplus and your changes should have been applied.

Impression from Massive Attack Concert

Posted by Nitai | Posted in Personal | Posted on 26-11-2009

0

I just got home from a very impressive Massive Attack concert. I have to say that this show totally blew me away. The sound quality, the light show, the paragraphs on the LED wall, the band and all was an extremely uplifting experience. They played, among the older classic song, a couple of new ones from their Splitting the Atom EP and some very new ones. Some I never heard before, but they are simply amazing. More groovy then the older ones.

Also, the live versions of Teardrop and Angel are amazing and I really do wish that they make a live DVD of this tour. This is definitely a live band. I love when a band does not play the songs as on their records. I think just about every song at the concert was different then from the record. Psyche was very slow but at the same time you heard this underlining beat that made you want to move faster then her singing, if you know what I mean.

For this year, this was the last show. They are on tour again on February 8th. If you can, go see them, you won’t be disappointed. Here are some images from tonight and of their tour in general. Sorry, for the bad quality, but the iPhone does not have the best camera… (the images on the bottom are from their website). Update: This blog has some more high quality images.

ImageMagick and Ghostscript playing nice with web applications

Posted by Nitai | Posted in Development, linux, open source | Posted on 20-11-2009

1

I had to spent way too much time the last time to set up ImageMagick and Ghostscript together that I simply jump right in so you don’t have to waste time on this, like I did.

Creating thumbnails and images from a PDF is one of the most used features within Razuna. But the other day, when we run the normal convert command we were faced with an error message within our web application of:

Error: Uncaught exception ‘ImagickException’ with message ‘Postscript delegate failed....: No such file or directory

Of course, the first thing I did was to see if we have a error in the shell. Strangely, there was NO error when running the same command in the shell! Needless to say, I spent many hours looking for a solution, trying out different things from reinstalling ImageMagick and Ghostscript to looking all over the web for an answer.

In the end, it boiled down to that web applications (be it CFML, PHP, etc.), are looking for a different executable path then when you run command from the shell. Since Ghostscript installed the executable in the “/usr/local/bin/gs” path the web application could not find it. So the solution to “hours of pain” was to simply create a symbolic link to the “gs” library in the “/usr/bin” directory with:

ln -s /usr/local/bin/gs /usr/bin/gs

Hope this helps the next seeker!

SQL Paging with Oracle, MySQL and MS SQL

Posted by Nitai | Posted in Development | Posted on 15-11-2009

0

I have to admit, I love databases. To hold data in a central place and be able to hook up any application from wherever you are to it, is just convenient to say the least. But there are moments I wish that vendors would “follow” a standard. I guess, when it came down to paging, every vendor thought his way of doing it is the best. No wonder, paging is the one SQL syntax that differs the most. Thus I dedicate, this post to paging and outlining the difference, meaning the solution to achieve it with Oracle, MySQL and MS SQL.

Paging with Oracle

Oracle knows of the internal column “ROWNUM”. Thus with “rownum” we can page trough the records, but have to do this with subselects. Look at the example;

SELECT rn, columns
   FROM (
	SELECT ROWNUM AS rn, columns
		FROM (
			SELECT columns
			FROM table
			WHERE id = 1
			AND something = 2
			ORDER BY columns
			)
		WHERE ROWNUM <= 10
	)
WHERE rn > 0

In this example we select the first 10 records, if you want to select the next 10 records then you will need to increase the values for “ROWNUM” with 20 and for “rn” to 10.

Paging with MySQL

There is one thing I like MySQL, that is the “LIMIT” clause. Not only can you limit how many records to retrieve, but can also add a offset to the limit clause. Thus we can do very elegant paging with “LIMIT offset, number”. Again, we limit the query below to return us 10 records:

SELECT columns
FROM table
WHERE id = 1
AND something = 2
ORDER BY columns
LIMIT 0, 10

Now, this will return the first 10 records. So, what if we want to do a paging here? Actually, quite easy, all we have to do is to increase the offset by one. It is important to know, that the offset start with a “0″ (think of it as the FIRST page), thus if we want to retrieve the next 10 records we use the limit with “LIMIT 1, 10″. This will give us the next 10 records. Elegant, no?

Paging with MS SQL

Now paging with MS SQL took me some time to figure out, since some said that MS SQL know of “rownumber” as well, but honestly, I couldn’t get anything to work with it. So the most easy method to do paging in MS SQL is to use the TOP syntax combined with a NOT IN subselect. Makes sense, right? Here is the example;

SELECT TOP 10 columns
FROM table
WHERE xxxx
AND id NOT IN (
	SELECT TOP 0 id
	FROM table
	WHERE xxxx
	)

As in the Oracle example above, if you would like to retrieve the next 10 records you would have to increase the TOP values by 10 records, meaning the FIRST TOP would have a value of 20 and the inner select TOP a value of 10.

So here you have it. How paging works for Oracle, MySQL and MS SQL.

FFmpeg — here we go again

Posted by Nitai | Posted in CFML, Development, linux, open source | Posted on 12-11-2009

0

My two other posts on FFmpeg entitled “Installing ffmpeg on CentOS 5” and “SELinux with ffmpeg” already explained in deep how to get FFmpeg up and running.

Unfortunately, today one of our servers just reported a plain:

ffmpeg: error while loading shared libraries: libfaad.so.0: cannot open shared object file: No such file or directory

when trying to run any ffmpeg command. Now, what was that and foremost why? Especially, since it worked 2 days ago. I guess, “someone” must have done some update. In any case, it was a good lesson to reinstall ffmpeg and bring all libraries up to date.

So, since my last installation, some things must have obviously been changed behind the scenes, because when I tried to configure ffmpeg with the same commands I run into another error which was:

libx264 version must be >= 0.78

Even thought I installed x264 from the latest GIT repository it still showed me the above error! Looking around the Videolan.org website I saw that the nightly snapshots differ in size a lot. So, either their nightly script is broken or something else is going on. In any case, I went with the x264-snapshot-20091031-2245 one.

Configured and installed it. Then did a “ldconfig -v” (in order to see that it really took the latest one) and went on with the ffmpeg configuration (I took the latest code from SVN (Revision 20525)) and low and behold, everything compiled and installed without problem.

Important: Update your libraries after the installation of ffmpeg again with “ldconfig”! Else you will get the “ffmpeg: error while loading shared libraries: ….” error again.

Tomcat and directories

Posted by Nitai | Posted in CFML, Development, open source | Posted on 11-11-2009

0

I run into a nasty issue the other day with “alike” directories in my web application.

That is, I had a copy of a “WEB-INF” directory called “WEB-INF–”. While my web application did not bother with copy of the WEB-INF directory, Tomcat threw all kinds of errors in the catalina.out log file. Also, I had some issues with Tomcat restarting and strange Java error messages, like:

Java.lang.NullPointerException
com.nary.util.Localization.convertCharSetToCharEncoding(Unknown Source)
com.naryx.tagfusion.cfm.engine.cfEngine.getDefaultEncoding(Unknown Source)
com.naryx.tagfusion.cfm.engine.cfFormData.(Unknown Source)
com.naryx.tagfusion.cfm.engine.cfFormData.(Unknown Source)
com.naryx.tagfusion.cfm.engine.variableStore.(Unknown Source)
com.naryx.tagfusion.cfm.engine.cfSession.(Unknown Source)
com.naryx.tagfusion.cfm.engine.cfEngine.service(Unknown Source)
com.naryx.tagfusion.cfm.cfServlet.service(Unknown Source)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

After browsing the log files, I saw that Tomcat tried to read the directory and threw a bunch of critical errors while reading those copied directories. I guess, Tomcat got totally confused and tried to overload libraries.

Lesson learned; Never have any copy of the WEB-INF folder within the web application again.

Upgrade to most recent ImageMagick version on CentOS 5.x

Posted by Nitai | Posted in Development, linux, open source | Posted on 10-11-2009

1

My favorite choice for running a Linux Server is CentOS, since it is based on the RedHat distribution you can rest assured you will get a top notch enterprise offering and stability. As with all things “enterprise” the priority is on stability and security and not on the latest code releases. This works 99% of the time, but sometimes you still need some update.

In the case of ImageMagick, CentOS comes with version 6.2.8, it was a bug that was fixed with PSD conversion and thus I needed to get the latest version installed. So, here are the steps to install ImageMagick 6.5.7 on CentOS 5.x. Mind you, that you will loose the internal patch upgrading from yum, but all you need to install to the next version is just to follow these steps again.

Uninstall current version
Uninstall the current version with:

yum erase ImageMagick*

This will uninstall ImageMagick 6.2.8 and if you have any other versions installed, like the devel one.

Install the needed dependencies
ImageMagick depends on a couple of additional libraries to convert to different formats. Let us just make sure, that they are all installed with:

yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel

Download and extract latest ImageMagick version
You can always get the latest ImageMagick version directly from their website. Code below will download and extract the file.

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xcvf ImageMagick.tar.gz
cd ImageMagick-6.5.7-5

Configure and make ImageMagick
With the below configure command we are configuring ImageMagick with the most needed options. Feel free to adjust it to your needs. As always issue a “–help” to see all the available options.

configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes

Wait until configure has finished. At the end you will see all the enable options. When you think all went well issue:

make

Now is a good time to make yourself some coffee or continue coding your next big killer application because make will take some time to finish. When it’s done, issue:

make install

That’s it! You are done. Wasn’t so bad, was it? Check with:

convert --version

That ImageMagick is properly installed and that you got the current version up and running. If all went well you should see something similar to this:

Version: ImageMagick 6.5.7-5 2009-11-08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Oracle backup with RMAN

Posted by Nitai | Posted in Development | Posted on 16-10-2009

0

Deploying an Oracle database is one thing, but doing a good recovery backup plan is another matter. Good for us, Oracle comes with its own tool for doing backups called “RMAN”.

Sure, one can do backup with the Enterprise Manager, but with it you will need to shut down the database in order to do a backup. Not exactly, what is needed with a production database that is online 24/7 and can’t afford a shutdown. In order to do a “online backup” one needs to run a script for RMAN.

RMAN uses the same login settings as your SQLPLUS login and thus it should be rather easy to do so. In our case we have also configured a backup catalog within Oracle with its own tablespace. Once done a backup script can be run each night with crontab.

Here is how to setup the backup catalog:

sqlplus sys
SQL> create user rman identified by rman;
SQL> alter user rman default tablespace tools temporary tablespace temp;
SQL> alter user rman quota unlimited on tools;
SQL> grant connect, resource, recovery_catalog_owner to rman;
SQL> exit;

in case you don’t have a tablespace called “tools” you need to create it with:

create tablespace tools
logging
datafile '/dbf1/tools.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;

Now you can log in to RMAN create the catalog schema with:

rman catalog rman/rman
RMAN> create catalog tablespace tools;
RMAN> exit;

Then register the database with;

rman catalog rman/rman target sys/password@ORCL
RMAN> register database;

Make sure you connect to the database that you need to backup!

I then created a script that will keep my backup for 2 days. I also have a script that will compress the backup files and move them to another server. Here is my backup script:

CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/opt/oracle/backup/autobackup_control_file%F';
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
run {
ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK;
CROSSCHECK BACKUP;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT
'/opt/oracle/backup/databasefiles_%d_%u_%s_%T';
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT
'/opt/oracle/backup/archivelogs_%d_%u_%s_%T' DELETE INPUT;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT
'/opt/oracle/backup/controlfile_%d_%u_%s_%T';
CROSSCHECK BACKUP;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
RELEASE CHANNEL RMAN_BACK_CH01;
}
exit;

This will backup your control file, archive log and database. It will also compress the backup and will remove the old files.

In my case, I saved the above script as RMA_backup.txt and have a RMAN_script.sh with the following inside:

#!/bin/bash
rman target sys/password@ORCL @/opt/rman_backup.txt;

Troubleshooting
I have seen that sometimes we got errors running the above script with:

RMAN-06207: WARNING: 5 objects could not be deleted for DISK channel(s) due
RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects

With RMAN you can check your backup with the following commands:

CROSSCHECK backup of database;
CROSSCHECK backup of controlfile;
CROSSCHECK archivelog all;

If all goes well, you should not get any errors running these commands. Still we had the above errors, even thought I issued the command to delete obsolte control files with;

DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 2 DAYS;

The key to success was when I used the “FORCE” command as;

DELETE FORCE NOPROMPT OBSOLETE RECOVERY WINDOW OF 2 DAYS;

Hope this helps anybody. There is a good reference for backups over at the Oracle FAQ.

Why GPL

Posted by Nitai | Posted in open source | Posted on 14-10-2009

0

Matt Mullenweg of the famous Wordpress application talks in the below video about GPL and why Wordpress uses it. I recently had some discussions with some people why Razuna, our Open Source Media Management (Digital Asset Management) Solution, uses the AGPL and why we chose it. It think Matt brings it right to the point and I agree with him totally :-)