Saturday, September 29, 2007 11:32:28 AM
PHP, general
Microsoft's ASP.NET has a lot of useful features, things you might want to have in PHP too.
But you can't run PHP as a .NET language because Microsoft already has ASP.NET... or can you?
It appears that some Czech programmers came up with this idea few years ago and they made a PHP compiler for .NET,
Phalanger, which compiles PHP code into
MSIL which is understood by the .NET Framework.
Read more...
Thursday, September 27, 2007 9:18:52 AM
programming, general
The other day I thought about using
MacGyver as an example when talking about programming.
Why MacGyver?
In the TV series, he builds clever tools from common everyday things. I think this is why MacGyver is a very good programming analogy - in both good and bad.
Read more...
Tuesday, September 25, 2007 12:16:05 PM
security, web
Cross-site scripting attacks, also known as XSS attacks, are a type of vulnerability found in some web sites.
For example, if your blog comment box allows users to write JavaScript snippets that aren't escaped in any way by the server and are ran, it's most likely vulnerable to an XSS attack.
It's not just a problem with small, less known sites - Recently, even Google had an XSS vulnerability.
XSS attacks are, however, quite easy to prevent if you know how.
Read more...
Sunday, September 23, 2007 1:09:00 PM
web, Flash, web applications
I've been working with Flash lately, or more precisely, Flex 2. Flex is like Flash for programmers (more on that later in this post)
Not so long ago, I also tried Flash Lite, which is a lightweight version of Flash for mobile devices.
What started as a tool to create annoying animations and unusable interfaces has gone a long way, and is now a quite serious contender for creating content.
Read more...
Friday, September 21, 2007 1:37:04 PM
web
Nope, it's not a bug in the internet, it's something else.
A web bug is something on a web page (or in HTML email or such) that performs some task when the user's browser loads it. They are usually invisible to the user, perhaps a transparent 1x1 image or an iframe.
Read more...
Wednesday, September 19, 2007 1:25:59 PM
Zend Framework, PHP
Continuing on posts related to
making a CMS with the Zend Framework, todays topic is Zend_Controller_Router_Route, Zend_Controller_Router and customizing the routing in Zend Framework.
The default routing scheme is like this: site.com/module/controller/action. While this works just fine for "normal" sites, it doesn't work very well for a CMS. This is because you would need to create copies of controllers if you wanted to have many similar pages or having longer URLs with the page name as a parameter in the end.
I wanted a better URL scheme for my CMS: site.com/module/page/action where module and action are optional. As you can see, there is no variable for the controller, so how do we tell the framework which controller the request needs to be routed to?
Read more...
Monday, September 17, 2007 9:13:19 AM
design patterns, programming
Why use
Singleton over Static classes?
If you want a simple class that's accessible from everywhere in your code, you could easily use a static class to achieve this.
In PHP, you can use :: to access classes statically: MyClass::doSomething(), in C# you can declare a class static and so on. It's much simpler to create and access static classes than singleton classes, too.
The singleton does have some advantages though...
Read more...
Saturday, September 15, 2007 8:40:04 AM
Opera, general
Did you know Opera's way of handling tabs is amazing? You know how it goes back to the previous tab you had active when you close the current one, instead of the one that's immediately next to it like it does in Firefox?
Well, apparently the folks who develop
the Camino browser thought it's an amazing feature enough to market their browser and even created a buzzword for it: Tab jumpback.
This is a direct quote from their features page:
Camino’s legendary tabbed browsing is even better in version 1.5.
[...snip...]
With “tab jumpback”, when a site opens a new tab, you can “jump back” to the page you were viewing simply by closing the new tab.
Kind of funny how they mention something trivial like that on their features page. Makes me think there aren't enough "real" features in their browser. I think it is the only correct way to handle it though - I'm always bothered by the way Firefox does it if I use it.
Friday, September 14, 2007 7:31:40 AM
PHP, Zend Framework
Note: this post is very outdated. Unless you're into archeology, I suggest
using Zend_Layout.
When working with views in the Zend Framework, you normally have a view for each action in your controllers. Each of the views run a view script, which then include header and footer views in them. This may lead to some repetitive code and may cause a problem if you want to modify the way the header and footer are included in your views.
A better approach could be to use a "layout". A layour is a master view, perhaps similar to the master page in ASP.NET - it has the header, footer and all other code except the content. It effectively replaces the header and footer and is used to include the content (the action view script) inside itself instead of the action view script including the header and footer.
Read more...
Wednesday, September 12, 2007 12:15:57 PM
PHP, programming, web applications
I've been working on a Content Management System (CMS) for my personal use and for experimenting. Since I like the Zend Framework so much, using it as a base for the CMS was a natural choice.
While at first it might seem that using ZF adds many restrictions, it actually isn't like that. Thanks to the modularity of the framework, you can easily replace certain functinality with classes of your own to change the way it works.
There are also many other things to consider when making a CMS.
Read more...