How to improve your JavaScript

Tags:

There’s a lot of resources on the internet related to coding JavaScript, but many of them are poor and out of date, which I believe is one of the reasons why a lot of people still can’t manage to write JavaScript code which works in all major browsers (IE, Firefox, Opera and Safari – where possible to test it)

Let’s check out some useful JavaScript resources to improve our skills, ranging from books to blogs and frameworks/libraries.

Read More

How to automatically escape template variables in Zend_View

Tags:

Escaping any data which comes from the server is important to escape, as it prevents XSS amongst other things.

The Zend Framework view component Zend_View let’s you escape template variables with $this->escape($this->variableName), but it doesn’t escape them by default. Wouldn’t it be much nicer if it did that by default, or at least provided you with a variable to turn it on/off?

Let’s find out how to do that!

Read More

Summing up Smarty and Zend View

Tags:

I’ve posted a couple of posts related to integrating Smarty with the Zend Framework:

  • Making a Smarty view class based on Zend_View
  • Integrating Zend View Helpers into Smarty

I’ve also posted some Zend_View related posts:

  • Using layouts with the Zend ViewRenderer helper
  • Creating a factory-object for building views

Let’s wrap up these in a summary of using them and what else could be done regarding these and the view solution in general.

Read More

Switching to WordPress

Tags:

I’m moving my blogging from My Opera to here at CodeUtopia.net for now at least.

I’ve installed WordPress here, and I must say it was quite painless to get it up and running. I had to do some digging through the documentation to find some features that I want to use, such as showing a small “teaser” of the posts on the front page for some posts.

I was working on my own simple blogging solution and a CMS until an unfortunate hard disk crash took out my server box and along went most of my programming projects. And don’t tell me to take backups! I’m a poor student, I don’t have money for things like extra hard disks for backing up stuff ;)

Also, I have other things to work on than the blog/cms project, so I kind of realized that it would take me forever to move my blog here, unless I used a ready-made solution like WordPress.

I’ve imported some of my old posts to this one, but it looks like that many of them look a bit bad, especially for the parts which include source code of some sorts. I’ve fixed a couple of them to behave a bit better, though.

Read More

Different PHP template engines

Tags:

Originally posted in my old blog at My Opera

While working on the Smarty View Helper solution I mentioned in the previous post, I went through a lot of Smarty's code and I also did some searching on their forums.

Smarty's code isn't very modification friendly and they had discussed associative array support for Smarty in their forums in 2003 – That's 4 years ago, and they still haven't got it in Smarty!

So, this got me thinking what alternative template engines are available. If Smarty hasn't got any real new features in a long time, others should have them. Right?

Here's a list of template engines I'll review and compare to Smarty, some more in depth than others: Blitz, patTemplate, vlibTemplate, SmartTemplate, Expose, Savant and PHPTAL.

Read More

The best Smarty + Zend View Helpers solution!

Tags:

Originally posted in my old blog at My Opera

Coming on again with the Smarty and Zend View related articles, let's this time take a look at how to get Zend's View Helpers running with Smarty.

Other examples for this that I have seen use a syntax like this: {helper helper=Url p='array(something)' p2=stuff}, which is kind of ugly and the array parsing is done with eval, and we know that Eval is Evil.

Wouldn't a more elegant solution let you use helpers just like you use Smarty plugins? In the style of just typing the name of the helper and simple parameters? Let's see how to make that happen!

Read More

Common Zend_Filter_Input problems

Tags:

Originally posted in my old blog at My Opera

Zend_Filter_Input, while a very useful component of the Zend Framwork, has some oddities that can cause a lot of headache if you can't figure it out right away.

  • Missing fields show up as valid even if they have validators that won't let empty values through
  • NULL values for existing fields

to name some.


Read More

Mozilla Prism: A fancy name for a technology as old as the browser

Tags:

Originally posted in my old blog at My Opera

Mozilla recently introduced Prism, which takes Widgetize to a whole new level.

Opera's Widgetize will turn your blog or RSS feed into a widget with some custom skins and stuff.
What Prism does is, it takes any website and turns that into a self-contained little browser.

While having GMail or such as a “stand-alone” application might sound nice, doesn't this remind you of something? Browsing without tabs.

You don't need a stand-alone application for this either. You could just use Opera to achieve a very very similar experience.


Read More

Simple and efficient spam prevention techniques

Tags:

Originally posted in my old blog at My Opera

I've previously outlined some alternative methods for CAPTCHA/spambot prevention in Different kinds of CAPTCHA.

Josh Clark recently posted Seven Habits of Highly Effective Spambot Hunters which gives even more good methods for preventing spam.

But with spambots gaining more and more features, what can we do to effectively prevent them, while still keeping our methods usable by most people and easy to code for us?


Read More