Dec 28, 2008

Why your TYPO3 web site can be slow

Today I discovered a reason why one my TYPO3 web sites were slower than it could be. The reason comes from Apache, or, more precisely from the Apache configuration.

Dec 3, 2008

Zend debugger goes 64 bit on Mac OS X

Finally Zend debugger is available as native 64 bit binary on Mac OS X.

Today Gadi Goldbarg (QA manager for Zend Studio) announced that Zend starts testing 64 bit version. I tested this version and it works great. It even works a little faster than 32 bit version to my taste (no benchmarks though).

The problem with absence of 64 bit debugger was that you had to run PHP command line also in the 32 bit mode ("arch -i386 php"), which is trully annoying if you run PHP often from shell. If you do not run PHP in 32 bit mode with old Zend debugger installed, you get warnings and cannot debug. Now it is all in history (thanks to Zend!)

There is an issue if you already use Zend debugger with Apache. It means that your Apache runs in 32 bit mode. So if you get 64 bit binary, put a path to it in the /etc/php.ini and relaunch Apache, you will see in phpinfo() that Zend debugger is loaded. No problems in /var/log/apache2/error_log either. But debugging will not work (as if the debugger is not present).

The solution is to switch Apache back to 64 bit mode. Depending on the method you used to make Apache 32 bit, you may either need to restore original Apache binary (/usr/sbin/httpd) or edit /System/Library/LaunchDaemons/org.apache.httpd.plist to get rid of the "arch -i386" in this file.

Notice that this is not a final official release. Zend is still testing it.

Zend did it great again. Thanks, Zend!

Dec 2, 2008

How to enable Memcached cache in TYPO3 4.3

Yesterday evening I committed a fix for the Memcached cache backend to TYPO3 4.3. If you work with current trunk version of TYPO3, you can enable this backend and enjoy speed improvements.

Types of caches in TYPO3

There are three different caches in TYPO3 4.3:
  • cache_hash
    This cache saves data produced by some TYPO3 functions, mainly by substituteMarkerArrayCached. This cache can be very large, it is used only if page is not cached and it does not make sense to enable Memcached for this cache. Database or file will work best.
  • cache_pagesection
    This cache stores parsed TypoScript templates. It can be stored in Memcached but database is my personal preference for this cache.
  • cache_pages
    This cache stores pages. This is what needs to be as fast as possible. So Memcached will be the best candidate for this cache.

Nov 28, 2008

My Mozilla Thunderbird add-on

I read TYPO3 mailing lists many times a day. I always use threaded view because it keeps conversations organized. There are lots of messages in he mailing lists and sometimes locating answers to old questions is not easy. Switching to "Threads with unread" view helps but doing it several times a day becomes annoyng because it requires at least three clicks in the Thunderbird menu.

I searched for the Thunderbord add–on that will let me to make such switch quickly. I found a very old add–on named nntpthreads, which worked for Thunderbird 1.5 (but not on Mac OS X). I tried to fix it but it still did not work.

So I just made my own add–on. It was easy when I found a tutorial about it on Mozilla Wiki. Now I use my own add–on to quickly switch between thread views. Here is how my Thunderbird toolbar looks now:

Nov 23, 2008

Never rush

There is one rule I started to follow recently. I found it to be universally usable and useful. It applies to any area of the life: programming, shopping, reading, repairing your house.

The rule is simple: never rush.

Rushing means you miss possibly more optimal alternatives. These could be alternative ways of doing the current task or alternatives to the task itself. In 100% of cases I find that waiting for a couple of hours either presents a much better solution or eleminates the problem completely. So even if something needs urgent fixing—never rush. Think first. Look outside the window. Never rush. You will see that your first obvious way of doing things was wrong.

Be calm. Thunk. Never rush.

Nov 14, 2008

TYPO3 certification launched

Today I got news about TYPO3 certification. Certification team seems to come with the first simple certification programme named "TYPO3 integrator".

The programme will certify people who build web sites using TYPO3. It does not cover physical file installation on the disk using *nix shell but it does cover the Install tool in 1-2-3 and normal modes, which is a good thing to certify. Many people lack knowledge of Install tool, which is essential when troubleshooting problems.

Also this certification is not for extension developers and it is specifically stated. To pass the exam, you do not need any extension programming knowledge but you must know TypoScript, TYPO3 access rights and other typical things that happen when you create a TYPO3–based web site. This is what certification team says:

Ghost item in mnoGoSearch configuration

Users, who tried to install and use mnoGoSearch TYPO3 extension could see two ghost items in the plugin's flexform configuration. Here is how it looks like:



I was sure that it is not a problem of the extension. So I took a deeper look and discovered a TYPO3 bug: TYPO3 will show ghost items in the multiple select control if that control has default values. However if you save the item, ghosts will magically materialize. Funny!

It is the first time I saw ghosts in TYPO3. Not very scary, heh?

Nov 13, 2008

Good VPN client for Mac

Sometimes when I work for the customer, I need to access their servers using VPN. Since I am on the Mac, my options were limited to two options:
  • Built–in Mac OS X VPN client, which does not work in many cases (it does not have OpenVPN support)
  • Tunnelblick, which is very unstable and often dies
Yesterday I discovered a very nice new VPN client for Mac named Viscosity. Viscosity has a very good user interface, it is rock stable and connects much faster than Tunnelblick.

Nov 11, 2008

Bad experience buying from PGP.com


I am usually concerned about security. When I heard that whole disk encryption is finally available for Macs, I went to pgp.com to buy it. I buy software regulary and it usually does not cause any problems. This time it was different.

When I entered all my usual information in the PGP web store (including credit card number), I was told that order was not authorized. This was strange. Typically it happens if there is a error in credit card data. So I tried again and got the same message. I gave up.

Next day I found that money are reserved twice on my credit card. I called european support. They had troubles finding orders. Finally they said they will forward it to another department. I asked to cancel one order and process another. Money are reserved, so why not to process the order?

Support promissed to process the order. PGP store conditions say that they resolve issues within 72 hours. I waited. I waited more than 72 hours. Money are still reserved, order status is still "on hold". I asked them if there are any problems and got "we are processing the order" response.

After a week of waiting I give up. I never had such problems before: PGP reserves money on the card and that's all, nothing moves. I cannot use the funds on the card. PGP does not process the order. PG does not send me the product. PGP does not tell what is going on. They keep my money locked and do not do anything.

I asked PGP to cancel the order. If they do not wish to have customers, they got one customer less now. I will never ever buy from PGP again.

Oct 31, 2008

Speed up your Internet access

From time to time my Internet provider has problems with the network. For this case I have a backup: a Vodafone modem. This modem gives me theoretical 256Kbps speed in my area (again: it is theoretical speed, actual is near 130Kbps). This is quite fast for emergency situations. The only bothering things is that every DNS lookup takes 3-10 seconds, which is obviously unacceptable.

When I got tired of these delays, I thought: "What can I do?" Firsts, I thought that I should probably have a local caching DNS server. I made a quick check and found that it is not necessary with Mac OS X because it already includes a lightweight caching daemon for DNS and many other queries. And it could not help me for new DNS queries anyway.

Next I remembered that I had similar problems with my main Internet provider. I solved those by using alternative DNS servers on my AirPort router. It worked well.

Oct 29, 2008

Patrick Gaumond reviews my TYPO3 extension programming book

Patrick Gaumond published detailed review of my TYPO3 extension programming book. Here is one quote from his review:

One of my first feelings once I started to read the book was that it will become the de-facto manual for Extension Development courses given by agencies all over the world. It’s really the kind of book you don’t want to skip a paragraph, fearing you’ll miss some good advice. Succinct is a quality.
All in all, it’s a very good book for starters; a very important book to hook some PHP newcomers into the TYPO3 world and a great step for better comprehension of this fabulous principle Kasper gave us 6 years ago when he presented the Extension Manager.

Thanks, Patrick!

Oct 28, 2008

"CMS most valuable people" – I am announced

Packt Publishing announced its annual CMSMVP ("CMS most valuable people" nominations. This year I became nominated as the TYPO3 most valuable person. I did not expect it really, so it is twice as pleasant and I am truly touched.

Here is what Packt Publishing says about the nomination:

The following list of names were put forward by members of the Content Management System's development team and community and represent the exceptional support, guidance, and sheer amount of time that the MVPs have given up to support the development and growth of the respective CMS.
CMSMVP is done by voting for the person. Anyone can propose anyone and people who get most votes in the end – win.

Thanks to everyone who voted for me. I am going to continue my extension development and support of the community in the mailing lists as before.

Thank you all again! I am glad to see that people like my work.

Oct 26, 2008

Mac OS X: PHP help in CHM format

When I used Windows, I really liked PHP manual in CHM format. It features table of contents, index and search. There are versions of the manual with comments that users leave on php.net. These comments are often very valuable because they provide additional pieces of information and users' experience.

When I migrated to Mac, I found that Mac does not have native support for viewing CHM files. I found a free xchm application that can open PHP files. The only problem was that this application does not open recent file on start up and does not have such option.

I missed this option very much. I use PHP manual often but I hate keeping programs open just because I may need them. So I open the program, look up something and close it if I do not use it for long. This behaviour is automatic for me.

But here comes the problem. If I open xchm, I have to go and choose my PHP manual. Loose of time. What do I do?

Oct 23, 2008

Oct 22, 2008

How do I use that extension?

From time to time I see a question: "How do I use this extension?"

The first thing to do if you have this question is to check doc/ folder inside the extension. If there is a manual.sxw file, you are in luck because you got the manual! You will need OpenOffice to read it.

If there no manual, push the developer hard and force him to write one!

Best TYPO3 blog of the year?

I accidentally found that there is a voting for the best TYPO3 blog of the year. I was even more surprised that my blog is on the second place. This is pleasant. Do people like my blog? I hope so. The information provided in this blog is usually unique. I do not copy news from other sites, I try to share things that I found useful myself. May be this is why people vote for my blog?

Missing cHash? Make plugin USER_INT!

Yesterday I encountered yet another unusual TYPO3 problem. An external web site had to link to pages on a TYPO3 site providing various parameters for an extension on one page. The extension is cacheable because it does certain network queries and it will be slow to do them for each request. So extension uses cHash for proper caching.

The problem was that the external site could not create cHash. cHash creation is not trivial and involves using site–specific encryption key. So the external site could not ptovide cHash and displayed content was wrong: it was like the page was called without any parameter.

What could I do?

Oct 21, 2008

Audio books at audible.com

I am a big fun of audiobooks. Everything has started from my wish to learn English (I learned English completely myself). I used to listen radio programs but they were usually boring. Then I accidentally found a collection of free audio books. This was it. I really enjoyed the books. In the beginning I could barely understand some words. But I picked up familiar books: about Sherlock Holmes, for example. Slowly my understanding skills improved. I started to listen non–adapted books.

One day I came across Jim Dale's performance of Harry Potter books. At that moment I fell in love with audio books. Probably you do not know but Jim Dale made a Guinness world record: he created 134 completely different voices for a single book! One hundred thirty four voices all pronounces by one man! It is simply amazing. And even more, Jim Dale speaks with different accents! For example, Professor McGonagall is speaking Scottish accent, Hagrid - Irish, Stan Shunpike - Cockney... I love everything perfect and Jim is perfect. He made me love audio books (listen to samples).

Audio books become one of my greatest interests in life. I enjoyed Jim Dale's reading so much that I started to hunt his recordings everywhere. This was not easy: autdio books on CDs cost a lot and delivery from UK, Germany or USA costs at least half the price of the book. But I still managed to get some recordings of Jim.

When I got my iPhone, I was very excited because iTunes store has lots of audio books and some of them are recorded by Jim Dale. Prices are not very cheap. And there are 4 or 5 of his books (excluding Harry Potter series, which I have all).

But accidentally I found audible.com. This resource offers one audio book a month for $14.95 (half–price for first three months). If you are willing to pay more, you can buy more books in a month. And prices are very good! Books are downloaded directly to iTunes and synced to iPhone.

I am really excited about audible.com. it is just great to have such possibility: get audio books in highest quality for a good price.

I am going to update my donation page to include a link to audible.com gift certificates. Now I prefer those to Amazon's.

Oct 18, 2008

Debugging JavaScript in the Internet Explorer

Most web developers know that it is extremely easy to debug JavaScript in FireFox—there are at least two great JavaScript debuggers (Venkman and FireBug). Developer can easily explore and change variables, set breakpoints, step in and out of any JavaScript function.

This is all good until the script works fine in FireFox but does not work in Microsoft Internet Explorer. Recently I hit an issue like that.

I passed array of objects to the function:

foo([{
id: 1, title: 'title1', message: 'message 1'
}, {
id: 2, title: 'title2', message: 'message 2'
}]);


Inside the function I did a very simple thing:

function foo(config) {
for (var i = 0; i < config.length; i++) {
bar(config[i].id, config[i].title, config[i].message);
}
}


That worked fine in FireFox but in Microsoft Internet Explorer I always got a very weird error: "config[i] is not an object" (the text was not exactly that but very close).

This was a mistery to me. Why wouldn't it work? The code is dead simple.

I went through the code in FireBug, all was perfect. But I could not do the same using Internet Explorer. I remembered that a tool named Microsoft Script Debugger existed when I was a student in 1990's but even at that time it was complete rubbish. I spent several hours trying to figure out how to debug JavaScript effectively in the Internet Explorer.

It turned out that Microsoft had several other options: Microsoft Script Editor, which comes with Microsoft Office and Visual InterDev, which comes with Visual Studio. Script Editor was evaluated as "crap not far from script debugger" by some people, so I decided not to waste my time on it. Visual InterDev was not an option either because I am not willing to spend $500 for Visual Studio to get a JavaScript debugging tool.

Fortunately one of my refined searches finally gave me the answer. I found Microsoft Web Developer 2008 Express Edition. This product cannot do just–in–time debugging (i.e. open debugging when Internet Explorer encounters a error) but if web site debugging is started from the Web Developer, all errors are caught and debugging is perfect (Microsoft debugging tools were always the best in the world).



So I got as copy of the product, answered many unrelated questions to get a free key and installed the Web Developer. As usual with Microsoft software it installed almost 2GB of various junk, which I will try to remove one by one later. However the debugging was truly perfect! I made a new web site project and lanuched it. A new instance of the Internet Explorer opened and Web Developer attached to it. Since my project in Web Developer was blank, I was directed to port 5011 and saw directory structure on the disk. I simply typed the address of the problematic web site and debugger immediately prompted me to debug JavaScript error on this site. Simple, isn't it?

I could not figure out why length attribute in the config variable from the code about was 3 in the Internet Explorer. There was nothing wrong with the variable except for its length attribute. I simply made check for existence if config[i].id and site worked fine.

The experience is very interesting for me. Though I did not understand the cause of the problem and did not cure the cause, I got a very good tool to work with: a proper JavaScript debugger for Microsoft Internet Explorer.

I hope my experience will be useful to other TYPO3 developers too.

Oct 12, 2008

iPhone as productivity tool

On Friday I got my new shiny black 16GB iPhone 3G. I really like this device. I saw many different SmartPhones but none were truly good. They were "not a bad phone" but quite bad in the rest. Normally they tried to emulate computers but they all have a very small screen and extremely small fonts without any anti–alias. Using these SmartPhones is a pain.

iPhone is different, it features good fonts, large letters, screens free of clattering, etc. And what is even better, applications can be added to it easily.

I am using OmniFocus for task management on my Mac. It is very convenient for anyone, who employs Getting Things Done technique for effective workload management. I am very used to OmniFocus. When I am at my Mac and I have a task or an idea, I just press Ctrl+Mac+Space, type task or idea in the small popup window, dismiss it and continue working without a need to memorize this idea. Next, when I have time, I process all such items, sort them into projects and set due dates if necessary.

Oct 6, 2008

My TYPO3 extension programming book is out!

Some people already know that my book about TYPO3 extension programming is out. If you want, you can order it now and get a discount from the cover price. Packt ships books for free, so it will be cheaper than if you buy in any other place. You can also get PDF version of the book even cheaper or a bundle (PDF+printed book) for a good price.

And now, the bonus to those, who reads more than cover page of my blog. You can get larger discount on the book if you use a discount code. Please, do not post this code anywhere or point to the page with the code directly. Point to this post instead. This will help to spread news about the book. I apologize to those who already bought the book but the code was just sent to me by Packt. Anyway you get a very good information about extension development. Here is the what a reader wrote in the TYPO3 mailing list:

At last I get it!.. well I'm very, very glad :) I've just previewed
it, but I can see that's more then was available in one place until
this time...
much more, great :)
good job Dmitry, Ingo and other people from Packt

Sep 23, 2008

Duplicate content with RealURL

Yesterday I checked one of my sites in the Google webmaster tools. It showed me warnings for many pages of the site beyond the home page. It looked like Google found pages two times: once with a normal URL (ending with a slash) and another without ending slash. It treated pages as separate and it thinks that I have double content on the site. Pretty bad as it lowers page rank.

Interestingly all links on the site end with slash. There are no links without ending slash at all. However if such link is requested, RealURL will recognise it and return proper page (duplicate for Google). This is caused by the use of "appendMissingSlash" RealURL configuration option. So if someone links to the page but omits slash in the end, he lowers your page rank. Not truly your (or my fault) but it happens. I have to repeat: this is not a fault of you, me or RealURL. It is created by a wrong linking from external sites.

I thought about a cure and implemented a new option in RealURL. Now "appendMissingSlash" accepts also "redirect" keyword. It means that RealURL will redirect to the proper address (with ending slash). It is possible also to specify the code for redirection ("redirect[301]") but RealURL uses 301 by default.

This version is not yet in TER. I am testing it on one site along with a bugfix #9412 for absRefPrefix. I just thought I announce it a bit earlier. For now you can check your sites in Google webmaster tools.

P.S. No, I cannot send you T3X with this version. But you can always checkout latest development version from TYPO3 SVN if you wish. But I am not responsible for the risk you take by doing it.

Sep 22, 2008

Testing is important

There was a man once. His surname was Murphy. Some believe he was a member of the crew of some American ship. Others believe he was a scientist. The thing is that there is a law of his name, the Murphy's law. It states:

If anything can go wrong, it does.

It does not sound very optimistic. But it explains everything what goes wrong. Especially well it applies to software development.

I always find that if I am lazy or forget to test something, it behaves wrong. For example, I implement five cases, test four, they are ok. I do not test the fifth hoping it is ok too and later I find it is not. It is always like that. If I post something to the mailing lists without checking it first, there is usually a mistake. As soon as I test it, it works ok. Why is that? I do not know. May it just Murphy's law in practice.

Why do I write about it? Testing is a very important part of software development. And testing should be done properly: everything should be tested with all variations. This ensures the quality of the product.

I wonder will be anything wrong with this article if I do not test it now in browser?

Sep 19, 2008

Do you need a page browser for your TYPO3 extension?

I have one for you! Yesterday I uploaded the first version of the "Universal page browser" extension into TER. This extension provides page browsing services to other extensions.

Currently extensions either use their own home made page browser or use default from tslib_pibase. Neither of these solutions is good. Home made page browsers requires time to create and also to maintain. It takes space in the code. The default one is hard to configure, it is not flexible for any modern application. In addition it is table–based, which is not how HTML code should be made these days.

Recently I had to write my own page browser three times in three different extensions and twice used the default one. All these times it was loss of time. If I had a "normal" page browser, I could save on development and debugging.

Armed with this idea I decided to make a page browser that I could use in any other project. I started developing it and then there came one of Netcreators projects, where I could finish this development.

As a result I made a new extension that any other extension case use to integrate a modern highly customizable CSS-based page browser. It is very easy to use. Here is the code:

Sep 16, 2008

Tag your TYPO3 releases in SVN

There are a lot of TYPO3 extensions in the Forge SVN repository but strangely very few of them use SVN tagging.

SVN normally have three directories for each project:
  • branches
    This directory is for separate development of the same product (for example, TYPO3 versions 4.1 and 4.2)
  • tags
    This directory holds snapshots of the project at a certain point in time
  • trunk
    This is the current development directory
Technically tags and branches are the same, it is just a convention that tags are not to be modified.

Sep 15, 2008

Table of content for my TYPO3 programming book

Packt Publishing gave me permission to publish the table of contents for my book about TYPO3 extension programming. Here it is:
  • About TYPO3 API
    This chapter gives an overview of TYPO3 API and tells about most important classes in TYPO3
  • Anatomy of TYPO3 Extension
    This chapters describes files in the TYPO3 extension, what role they play and how to use them
  • Planning Extension
    This chapter focuses on planning. Planning makes extension better. It makes the project successful. The cahpter is not as theoretical as you can expect
  • Generating Extension
    This chapter walks the reader through the process of extension generation. All options are explained, several issues are pointed out, useful tips provided
  • Frontend Plugins: In Depth Study
    This chapter focuses on the Frontend plugin theory. It also provides a lot of tips to make extension effective.
  • Programming Frontend Plugin
    This chapter is dedicated to a practical progamming. The reader will see how ti make list, search and single views, use AJAX from the Frontend plugin and create useful TypoScript for the plugin.
  • Programming Backend Module
    This chapter focuses on the Backend module programming.
  • Finalizing Extension
    This chapter describes how to write documentation for the extension and polish the code before releasing it to TER.
The book is highly practical, contains a lot of my own experience and it helps the reader to become extension programming from zero (PHP and TYPO3 knowledge as user is required).

Sep 14, 2008

Debugging symlinied TYPO3 directories with Komodo IDE on Mac

Update (Dec 03, 2011): this is not longer necessary. Just use PhpStorm IDE instead.

As some of the readers know, I recently switched from the Zend Studio to Komodo IDE for PHP programming and debugging. Recent versions of Zend Studio are slow, often hang, sometimes crash, ask stupid questions (for example, to select a file to debug with only one option) and extremely slow when debugging. Komodo IDE does not have any of these problems. It is not perfect, of course (for example, there are issues with autocomplete) but in general it is much better than Zend Studio.

The only problem that bothered me so far was the inability of Komodo IDE to debug symlinked files.

TYPO3 setup for PHP development

I have several TYPO3 versions checked out from the TYPO3 SVN. I often have to change versions to test extensions or patches in different versions. Therefore I set up my development directory as follows:

Aug 18, 2008

Should abbreviations be used in the code?

Two times in the past month I came to the same question: should abbreviations be used in the code or not? In this article I am trying to give my answer to the question.
DEFINTION

Wikipedia defines abbreviation as:
An abbreviation (from Latin brevis "short" is a shortened form of a word or phrase. Usually, but not always, it consists of a letter or group of letters taken from the word or phrase. For example, the word "abbreviation" can itself be represented by the abbreviation "abbr." or "abbrev."
So the question becomes: should code contain

$mySqlResultSet = $GLOBALS['TYPO3_DB']->exec_SELECTquery(...);

or can be as simple as

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(...);

Aug 13, 2008

RTE in TYPO3 sections: a nasty bug

I thought I should publish a little story how the bug #8232 was solved. It took me 11 hours to make a fix and the story may help other developers to solve similar problems.

But firsts I want to give you a little insight about sections and RTE in TYPO3.

TYPO3 AND SECTIONS

Sections in TYPO3 is a way to have repeating structured elements in forms. Mainly it is used by TemplaVoila and its Flexible Content Elements (FCEs).

For example, think that you have a product and a number of its characteristics. You want characteristics to be defined in the structured way. You want to have a title and a link to the page with details. You can do that all in RTE but then your data and presentation are bound together. If you have many products and want to change presentation for all of them, it becomes a problem.

Aug 9, 2008

Font is too large in the OpenOffice for Mac

OpenOffice finally decided to make its software run natively on Mac (previous versions required X11). It is still beta and runs slower than NeoOffice. But it has better revision handling than previous OpenOffice or current NeoOffice.

I tried OpenOffice 3 beta 2 recently and found that fonts are much larger than fonts in other Mac applications. Next I decided to try development version but the problem is still there.

I searched OpenOffice settings to revert font size to normal for Mac but could not find any. However there is an option to scale the whole OpenOffice. Setting this option to 88% makes interface the same size as normal Mac applications and similar to NeoOffice.

Here is what to do if you feel that OpenOffice fonts are too large:

Aug 3, 2008

"TYPO3 Extension programming" – my book

Packt Publishing has announced my book about TYPO3 extension development. It is expected in the end of September. I cannot yet tell you yet any details except those that you can read at Packt web site. But I can tell that book will be very interesting for both novice and experienced TYPO3 programmers. It guides readers from overview of the TYPO3 API through extension generation and programming to the writing documentation for the extension.

I worked hard on this book and tried to put every even smallest tip that I remember to the book. I tried to show some non-trivial but highly useful tips that I personally learned. I hope I can help people to write better extensions by using this book.

I am really excited about Packt's announcement! I waited for this moment for a long 8 months while working on the book. Every day I though about the book and how to transfer my experience to other people better. I hope I succeed. But it is up to you to decide, of course!

I hope you will love the book!

It is obvious, isn't it?

From "The Theory of Everything":

'Corse it's obvious!

Jul 29, 2008

Using an extension from another extension

From time to time I notice that many extensions duplicate certain functionality. For example, many extensions have a page browser. Some of them use page browser provided by pi_list_browseresults function from tslib_pibase class. Examples include mininews, indexed search and tt_news. That function is hard to customize, so almost everyone creates a new page browser.

I came across it again this week. While creating a new extension I had to use a page browser. I have several page browsers already (in comments and some other extensions). But I do not like copying the code. If error exists in the code I will have to update all places where I copied the code.

Next I thought: it would be great if an extension could provide certain functionality to other extensions. For example, if I make a universal page browser, it could be used from any other extension.

Jul 24, 2008

Do not ask more than you need

There is a very nice principle for designing web sites. It sound likes this: "Do not ask from user more than you really need".

I often remember this principle when I go to download sample chapters of free demos from web sites. Many of them ask for lots of data. Why, for example, they need to know my social security code or phone number? Or why do they need my e-mail if I want to download the sample chapter? Do they want to spam me?

I usually refuse to give such information because I do not see why they need it and how they will use it. I am not paranoid but I do not see a need to give my details to every unfamiliar person or company.

Why am I writing about it here?

Jul 23, 2008

ExtJS-based blog

Sometimes browsing the web brings something really revolutionary and amazing.

Everyone knows WordPress. Everyone knows how many themes it has.

Many developers know ExtJS, which is really good JavaScript framework for creating rich user interface. It provides various widgets, forms, calendars, panels, sliders, even windows.



Today I discovered a web site that uses ExtJS to create a WordPress theme. This is really amazing. ExtJS uses AJAX a lot and this blog too. All articles are loaded using AJAX and side bar uses Outlook-like sliding layout. Looks really unusual. Give it a try.



What do you think about this site and the idea? Will blogs become more dynamic in future? More web 2.0 like?

Jul 22, 2008

Howto: use Frontend data in a TYPO3 mail form

Today I had an interesting challenge. I had to create a contact form on the Intranet web site. This web site always has Frontend user logged in. I was going to use standard TYPO3 mailform. Typically such form contains fields for user name and e-mail. When I started to create the form, I immediately realized that it will be stupid to ask for this information if user is already logged it. I should find a way to insert this information automatically.

The obvious solution that come to the mind is to make an extension that will modify the form to include Frontend user data. Yes, it is possible.

Jul 21, 2008

Slides from productivity session

In July I had a session about personal productivity at TYPO3 user group in Holland. I planned to make video from these slides but I instead I decided another way to share slides. I put them to SlideShare. You can also vote for these slides to participate in the "World Best Presentation Contest' 08".

Enjoy!

Jul 15, 2008

Why subtituteMarkerArrayCached is bad

In the previous article we talked about TYPO3 template functions. I mentioned that substituteMarkerArrayCached is a function that developers should not use. In this article I am going to explain why.

As you remember there are four “substitute” functions for use with TYPO3 templates:
  • substituteMarker
    This function substitutes a single marker
  • substituteMarkerArray
    This function does the same as above but for many markers in the array
  • substituteSubpart
    Substitutes a single subpart
  • substituteMarkerArrayCached
    Our today's case.
The first two functions substitute marker and marker array. The third substitutes template subpart. The obvious missing function is the one to substitute subpart array.

How to fill RealURL cache with data

From time to time I see this question: how to fill RealURL cache with page addresses?

The answer is pretty simple. Make a new "hide in menu" page. Insert Sitemap there. Logout from Backend. Enter that new page address in the browser bar.

Notice that logging out is essential. RealURL will not cache anything if you are logged in to Backend.

This procedure will fill cache with page addresses. But it will not create cached entries for stuff like tt_news. So this tip is good if you have mostly pages.

Jul 11, 2008

Using templates in TYPO3 Frontend

Firsts, I wanted to write a warning article about the substituteMarkerArrayCached function. But then I understood that article is going to be about template functions in general and warning should be in the different article.

Let's have an overview of TYPO3 templates and functions to handle them.

TYPO3 template basics

Templates in TYPO3 are normal HTML files. These files contain special markers that TYPO3 can replace with data. Markers typically are words in CAPS surrounded by three hash marks. For example: ###LINK###.

There are two types of markers: single markers and subpart markers. Single markers is a single piece of data, it is replaced as is. Subpart markers surround parts of the HTML code. Here is an example:

<!-- ###LIST### begin -->
Repeating elements:
<ul>
  <!-- ###REPEATING### begin -->
  <li>Iteration ###NUMBER###</li>
  <!-- ###REPEATING### end -->
  </ul>
<!-- ###LIST### end -->

Here ###LIST### and ###REPEATING### are subpart markers. Extension can get a subpart and replace it as whole. Often it is used for repeating elements of for subparts that should be removed under certain conditions. “begin” and “end” are not necessary but conventional.

###NUMBER### is a single marker.

Jun 30, 2008

TYPO3 stdWrap explained

stdWrap is one of the most powerful and at the same time obscure TYPO3 functions. In these series of articles I am going to make this function more clear for both TypoScript and extension developers.

What is stdWrap?

stdWrap is a TYPO3 function that can alter data or replace it with completely another data if developer wishes so. stdWrap is incredibly powerful. It can do many transformations, check conditions, use content objects and many more. If there is no transformation that developer needs, it is always possible to extend stdWrap with a custom function.

A most simple example of stdWrap is:

temp.test = TEXT
temp.test {
  value = Hello, world!
  wrap = The boring phrase: "|"
}

This will produce the "Hello, world" prepended by "The boring phrase".

I am sure you used it wrap property a lot but have you realized that you actually used stdWrap?

Yet Another Feed Importer

On Friday I posted another extension to TER. It is called "Yet Another Feed Importer".

Why having "yet another"?

I needed an importer that will be easily customizable and extendable from the outside. In "yafi" (extension key for the new importer) I provide a framework and use plugin pattern to do imports. Take a look to the diagram:

How to kill TYPO3 performance from extension

Today I went to check buzz.typo3.org for new articles. I scanned through some when I came across the article named "Dynamic Caching in TYPO3". The article is interesting because it describes unusual techniques related to caching. But author does one "not-so-good" thing. He promotes the use of $TSFE->set_no_cache(). As I said many times, this is evil and should be avoided at all costs! Search for another solution, do whatever tricks but never ever use set_no_cache()! It will kill your web site under any serious load.

It is not a big problem for the particular case described in that article. In the article this function will be used only for a logged-in user who views his own card. But readers may learn about the function and start using it in extensions without realizing what they do. That's bad. We had a problem some time ago in commerce extension, which disabled caching for the whole web site and made the site extremely sloooooooow and created huge load on the server. Bad. Too bad. I wish all writers make a bold warning when mentioning this function: dangerous!

Last week I made a performance review of yet another web site and yet again (again and again!) I found problems caused by misuse of set_no_cache(). It was found in three extensions (download, link list and one proprietary). It is typically the set_no_cache-case when people ask why their site has such a bad performance. If it only were in my power, I would go to TER and remove all extensions that use set_no_cache().

Don't use this function! It is for core only! It is not for you! Avoid at all costs!

Jun 17, 2008

Why would you choose TYPO3 for you next web site?

"Why should I use TYPO3 and not some other CMS?" or "My boss wants to know why we should use TYPO3?" These questions appear in TYPO3 _mailing lists_ from time to time. It is no doubt that TYPO3 is a very powerful CMS. I would even say that it is the most powerful CMS in the world right now. But power alone is not a very big reason to use TYPO3. Even if TYPO3 is the most powerful, does it serve well? It serves many web sites on the Internet. But will it be able to serve ~your~ web site? Will it be able to server your web site ~better~ then other CMS? This is the first question you want to be answered. You would like to know if TYPO3 is the right choice specially for you and why it is the right choice specially for you.

Jun 12, 2008

What TYPO3 Backend do we need?

There were some discussions during T3DD08, in the mailing lists and by Skype that we need some changes in TYPO3 UI. I was fighting my points hard. One of my points is: change existing and stable things only if it is absolutely necessary because people are already used to them.

I am not talking about bug fixing here. Bug fixes usually do not force people to learn new things. I am talking about changing UI in the incompatible way.

One good (or bad, depending on your views) example is repositioning of "Exit" button" in TYPO3 4.2. It took me several minutes to find this button in the 4.2 Backend. I am not a newbie as you know. The button was placed in the zone, which (according to studies) is least seen by people. It was placed to top-right. It took over 20 minutes to some of my editors to find and they are not stupid!

Another example is the rush with "tabs everywhere" and "docheaders everywhere". It caused many people to complain: they have to make more clicks now. This problem was definitely was not well-thought by developers.

Jun 9, 2008

RealURL made easy: part 2

This a part two of the “RealURL made easy” series. In the first part we reviewed how url is constructed using RealURL and saw what are main configuration directives. This part will show practical steps to create a good RealURL configuration. The next (3rd) part will teach you some neat configuration tricks. But first we have to create the configuration.
From RealURL perspective all installations can be divided into to groups: single-domain tree and multi-domain tree. Single domain tree is the simplest and we already saw how to configure single domains for RealURL using _DEFAULT keyword.
Multi-domain configuration is more complex. Typically sites in a multi-domain setup share the same set of preVars and postVarSets. fixedPostVars (if used at all) are different because fixedPostVars should be specified for the specific page (this is covered in part 1). Therefore we will concentrate on this typical case here.
The steps for setting up multi-domain RealURL configuration are:
  • create a prototype for configuration
  • collect all domain names and root page id values
  • configure main domains
  • efficiently configure aliased domains

Jun 8, 2008

Health care software for programmers

Some time ago I come across two programs and I would like to share my experience with the TYPO3 community. These programs help computer specialists to keep better health and improve life quality.

Jun 5, 2008

Migrating a TYPO3 installation to a different server

This article tells how to migrate TYPO3 installation to another server. It assumes that you are in charge of the server. If you use shared hosting, it may be harder to migrate because you do not have anough control. In short migration consists from the following parts:
  • Migrating files
  • Transferring the database
  • Recreating directory structure
  • Updating the installation
Let's see these sections in details.

Jun 2, 2008

Installing TYPO3 with upgrades in mind

TYPO3 releases a new version every year or year and half. The system is not the smallest one and upgrading it may not the easiest task. In this article I want to show how to install TYPO3 with upgrades in mind.

Logically TYPO3 installation consists from two big parts: the core and site-specific files. The core is released by TYPO3 core team and it is not changing. Site-specific files is what web site owner creates in order to have a running web site under TYPO3 control. Inside the file system these parts should be seen as a single set of files.

The core is distributed as a compressed archive by TYPO3 core team. When new version is released, this part should be upgraded. However simply extracting files over existing installation is not the way to upgrade. Sometimes TYPO3 files change, so file can be removed, new files can appear. Extracting files to the existing location is not a good way to keep stable TYPO3 installation.

Ideally core files should stay as a package, separate from the site-specific files. Than core can be easily replaced independently from the rest of the site. But how to make the core separate and still keep the proper site structure?

May 31, 2008

New typo3.org design leaked

Well, it is not truly leaked but it is appeared on the Internet. To me it looks wonderful. I am really impressed with Jens Hoffman's work! TYPO3 wins a lot from talented people like Jens!

The only thing that bothers me is fading on the home page. There is no need for it at all.

May 30, 2008

RealURL made easy: part 1

People often complain that RealURL is hard to configure. In my opinion it happens because RealURL manual is written as a reference guide, not like a tutorial. Therefore there is nothing for beginner to start from. Recent RealURL versions include automatic configuration, which is good for simple web sites.

However it is not flexible enough. Manual configuration would always win over automatic one. This article provides a simple guide for manual RealURL configuration. It is not short, so reserve some time for reading it.

The whole guide is divided to several parts. The first part describes configuration in general. Other parts will describe details, tips&tricks and best practices.

Basics

This section covers general principles of RealURL functionality.

RealURLed URL

Before we start with configuration, it must be clear what parts RealURLed URLs can contain.
Typical RealURLed URL consists from several segments:

Segments are (in the order of appearance):

May 28, 2008

Eight performance tips for your TYPO3 web site

Increasing performance of a TYPO3 web site is a task that many large companies or freelancers face from time to time. TYPO3 is a great, flexible and powerful framework with amazing possibilities and unlimited expendability. But everything has its costs. TYPO3 may be slow if not configured properly. This article gives 8 tips to improve TYPO3 performance. It requires that you have administrator (root) access to the web server. If you use shared hosting, there is very little that you can do. Read on.

May 27, 2008

Do e-mail programs have brains?

For a long time I am looking for a good mail program for Mac. While doing the same search this evening I found a very nice looking web site.


It says that their e-mailprogram has brain. Others don't. Is that true? We will know soon. I am going to download and try it. I am going to replace Thunderbird with something for Mac-like (no, not Apple Mail, it does not support IMAP subscriptions, sorry) and this is one of candidates.

May 26, 2008

Check your 404 traffic!

Recently a problem was discovered with several web sites. I must say that the problem is not TYPO3-specific but will happen to any web site that uses <base> tag. We will solve it for TYPO3, of course.

The problem happens as follows. Some user agents seems to ignore the <base> tag and requests invalid URLs. For example, while viewing the page at domain.tld/hello/world/ such agents may seea reference to the image at typo3temp/pics/12345.gif . If user agents ignores <base> tag, it will request domain.tld/hello/world/typo3temp/pics/12345.gif. The result for such requests is obvious: page not found and 404 error.

Now look closely to the URL. It is a TYPO3 URL. It means that TYPO3's 404 handler willbe invoked. Now if that page contains link to typo3temp/pics/12345.gif the process will become recursive. This will cause huge amount of useless traffic for the web site.

The problem is pretty serious and important for many web sites already. How to solve it?

Patching files: try before apply

Here is a small tip that can be useful for developers.

Before you apply a patch, it is worth using --dry-run switch to see if it applies properly. However typing this switch all the time is not the best time spending. Fix it by creating an alias! Add the following to your ~/.bash_profile on Mac or to other known place on *nix systems:

alias "pdry=patch --dry-run"

Now you can use ptry -p0 < patchfile to try the patch before you apply it. Simple, isn't it?

Why didn't I add -p0 to the alias? Because not all patches are made over the right directory. So you may want to specify this option manually.

May 25, 2008

Why sometimes I do not buy books online

There is a reason why I do not buy online a book even if it looks good for me. The reason is: there is no sample chapter.

People like samples. Everyone tried garlic at least once in his life and made his/her personal opinion about it. This was a sample. Everyone tried coffee or chocolate. These were samples too. They either stayed as samples (if person did not like it and never tied it again) or become an enjoyed product.

Sample chapter tells user if the book is really what I'd like to buy, read and have in my library. This is especially important if book costs over 20€. Would this book be a good investment? Title sounds attractive but I do not want to loose money just to find that title is the only good thing.

Of course, people can read opinions of other readers of the book. But this is not a replacement for sample chapter. It is the same as above examples with garlic or coffee: everyone has its own taste.

Why I am writing about it? I have a note for myself to buy a good book about presentations. I found a post about such book on Mario Rimann's blog. Mario likes it. But would I like it? I do not know: there is nothing to sample...

Fortunately many books have sample chapters on the Internet. Recently I prefer to buy only books that I could sample. It helps to build a good library and save money.

So, if you are writing a book, put a sample chapter somewhere. It will help to increase your sales.

May 22, 2008

Linking properly in your TYPO3 code

Recently I often see that TYPO3 plugins do not create links properly. It seems that authors simply do not know how to make links properly in TYPO3. As a result links are not RealURL-compatible or cache issues happen.

This article shows how to use typoLink in Frontend plugin.

May 20, 2008

Amazon mistake

Amazon has a nice service called Amazon Prime. For $80 annual payment people can get faster deliveries and even free deliveries next day. So far, so good. But look to the attached picture at the bottom of this post. There are two color marking there.

The red one says I qualify for Amazon Prime. Sorry to disappoint you, Amazon, but I am not!I live outside UK, so I do not qualify for Amazon Prime. Don't tell me they do not know who I am. I just logged in to check status of my orders.

The green marking at top says that this item can be delivered in one day with Amazon Prime. But look to the bottom green marking. How are they going to deliver it within one day of it ships in 1-3 weeks? I ordered this item together with other items two weeks ago. Other items were sent, this one is still not sent. I am not sure about UK but in my country this is called "false advertisement" and prosecuted severily.

Yet another thing. I decided to see what will happen if I sign up for a "free trial" at Amazon Prime. Guess what? Clicking on the "Free trial" asks to confirm payment through credit card. I wonder why. Since when "free" requires payment?

Amazon is usually great but these small things do not add good points to Amazon. I already think I should search for another source of books. Slow and high-priced shipping + offers that lead to "sorry you are no elligable..." do not make me happy customer.

Magic roundabout

Are you a good driver? If you answer yes, think if you can easily drive the cross shown on the attached image. It is located in Swindon, England and called Magic Roundabout. It has one large roundaboud and each entry is a smaller roundabout (total five of them). I would not bet that I can pass it easily. Especially with right-side driving. If you look into the description and photos of this place in Wikipedia, you will notice that large roundabout has two ways of circling in it: inner circles moves in the opposite (to typical England) direction, outer moves in the right direction. I also read that only those who live in this area can quickly pass the place in the optimal way. Not sure if it is true or not.

For those, who liked the place: you can order a T-shirt with magic roundabout schema.

Music: again and again and again

Did you know that you can make your Mac working like a musical clip machine? No? Watch the video below. Just watch it! Full day of good mood guarantied!

Interview with the author.

May 16, 2008

RealURL vs CoolURI

Andreas Becker has a nice summary of how to configure CoolURI comparing to RealURL. Very nice and useful page for those who migrate from one extension to another and for newbies.

May 15, 2008

I forgot! Different hooks in tt_news!

Unlike computers, people do not have memory that fixes everything and keeps it fixed. People may forget all or some information. Today I forgot that tt_news has two different hooks for extra markers: one for news items (called in a loop, named extraItemMarkerProcessor) and another is for the compiled output (called just before final substitution of all markers, named extraGlobalMarkerHook).

Why am I writing it here? Because people can forget. By mentioning it here, I create additional bounding in my own memory and memory of my readers. So, less chances to forget.