Speak by DHH
Just want to share this great presentation from DHH about "the secret of making money online"
Check it out: http://www.omnisio.com/startupschool08/david-heinemeier-hansson-at-startup-school-08
Just want to share this great presentation from DHH about "the secret of making money online"
Check it out: http://www.omnisio.com/startupschool08/david-heinemeier-hansson-at-startup-school-08
When doing OOP in PHP it can be a pain to include all the different class files. The code becomes really ugly with lots of require_once() function calls and you risk to include classes that are never used.
This is were object autoloading comes in handy. In PHP 5 it is now possible to define a functions called __autoload() which takes the name of the class as parameter. The function will be called when trying to use a class or an interface that has not been defined yet. The function could look like this
function __autoload($class_name){
require_once('/classes/'.$class_name.'.php');
}
$obj = new MyClass(); //will load MyClass from /classes/myclass.php
MyClass::getSomething() //will load MyClass from /classes/myclass.php
Thursday and Wednesday I attended the JAOO conference in Copenhagen. It was a pure Ruby conference with lots of exiting speakers, such as "Matz", Dave Thomas and Michael Koziarski. Unfortunately DHH wasn’t there. I don’t know why because it would have been very obvious, but there were some other guys from the Rails core team. Some of the most interesting speaks was about:
JAOO is really well organized and the speaks are at a high standard. Next conference is in Oslo and it is also a Ruby Fools conference. Check out the future events at www.jaoo.dk
After having spent a few hours trying to get an image uploading script to work in php on my mac, I found out that the GD Library is not pre-installed with PHP. Why is that? I thought that the GD lib was a standard module and I know it is installed in the XAMPP package for windows. I have not installed the lib yet, but I found this page which explains a how-to, but by looking at the comments it seems that it is not as simple as it should be. People are really having dififculties getting it to work. I will try to install it when I have some more time and post my result here.

I was pretty confused about the <base /> tag in HTML. If your base tag look like this:
<base href="http://somedomain.com" />
and your link looks like this:
<a href="page1.html">page1</a>
your link would point to http://somedomain.com/page1.html
If your base tag looked like:
<base href="http://somedomain.com/folder" /> *whithout a trailing slash*
your link would still point to http://somedomain.com/page1.html
If you add the slash -> <base href="http://somedomain.com/folder/" />
your link would now point to http://somedomain.com/folder/page1.html
Now, as I can see it. If you add a "/" in front of your link
<a href="/page1.html">page1</a>
and your base still looks like
<base href="http://somedomain.com/folder/" />
The link would point to http://somedomain.com/page1.html ignoring the /folder/
This page http://www.drostdesigns.com/base-href-tag/ tells people always to add a "/" in front of all the link, but then you are not able to put subdirectories in your base tag.
This page http://www.cs.tut.fi/~jkorpela/HTML3.2/5.7.html makes an example without the "/" in the link.
It makes more sense to me, not to add the "/" in front of all the links, making it easy to change the base href to whatever you want, but maybe I have missed something.