Z037
NAVIGATION
 ZOEL'S ARCHIVE
Several options are available to browse the archive. Pull down the menu to access the options. You can also stack and unstack thoughts, increase or decrease Text Size. It could improve your browsing experience, or not.
Browsing by Date (Oldest First)
hack a day
stack thought
1920 days ago

As mentioned earlier, I subscribed to Makezine. I highly recommend it. However if you don’t want to spend the money, (or if don’t like paper in general), there’s hackaday.com It’s as good as MAKE, if not better.

Elegant Web Application, PART2
stack thought
1932 days ago

This is the 2nd of a multi-part series describing, in details, how
to create an elegant web application using php and mysql. I say ‘elegant’ because… yadda yadda) In this second part, I will explain how to design your web application so that the end result is flexible, robust and secure. Flexible because you’ll want to add features down the line and want your web app to be able to adapt to accomodate the new requirements. Robust because you want your web app to handle requests reliably. Secure because getting hacked isn’t fun.

///////////////
Use cases
//////////////
Use cases are useful but not necessary. If you already have a clear understanding of the problem you’re solving, you probably don’t need them. Here’s a good introduction to use cases and part two found at the excellent A List Apart. Use cases help a developer design an application.

///////////////////////////////////////////
Object Oriented (OO) design in PHP
//////////////////////////////////////////
OO design helps us achieve the 3 goals mentioned above (flexibility, security and robustness) but also, gives us code cleanliness, one of php’s weak points. For those new to OO design and programming, think of an object as being an entity within your program. This entity has distinct properties that makes it unique, and it has a distinct set of functions that makes it unique. Many scenarios can be represented using an OO approach.

A web app usually is a set of forms which allow a user to input information. After input, the web app processes/stores the information in a database, and allows other users to search and access portions/all of the information.

A good example of a web app is a survey form which is filled out by voluntary participants. As an example, we’re going to use an object oriented approach to represent this web app. In this case, we would have a survey object, a participant object and an administrator object. I usually also have my tried and tested common objects, which I use across projects. Since these common objects are “independant”, I can simply reuse the code across projects. The common objects I use are the xhtml object and a database object.

All the objects mentioned above have attributes and functions. For instance, the participant object probably has the following attributes: participant name, participant email, participant password, etc etc. In addition to attributes, objects also have a specific way of processing information (functions). These are the base functions I usually create for all objects: a Get function, a Save function, a SaveNew function, a Delete function.

//////////////////////////////////////////////////////////////////
Keep code, content and design as separate as possible.
/////////////////////////////////////////////////////////////////
This is one of the coolest part of designing an elegant web application. Creating an elegant web app means working doubly hard during the design phase of the application, rather than working hard later on. Once you’ve designed a great framework for your application, the code part of your application can remain untouched for a long time. Realistically though, clients will always push for more functionality, but because your code will be clean and separate from the content and design, you’ll be able to pull off the changes quite fast. The content part of your application will be in your database and will not get mixed up with how your application works. It’s extremly easy for the design part to get mixed up with the other 2. Separating out the design part of the website is a very cool thing to achieve but requires a lot of hard work. A good way of achieving this is through the use of a template engine. I’ve recently participated in a project where we created our own templating engine. I hope I’m able to give an example of how to achieve this in Part 3 or Part 4 (if there is one).

In Elegant Web Application PART3, I will recode an online classifieds website into OO architecture. There’ll also be less talk, and more downloadable code, a base project which you can use as a starting point to your own.

Elegant Web Application PART1 [3]
stack thought
1943 days ago

This is the 1st of a multi-part series describing, in details, how
to create an elegant web application using php and mysql. I say ‘elegant’ because there are many ways to create a web app in php, many of which are ‘hackish’.

In this first part, I will explain how to set up all the tools you’ll need to create a proper development enviroment on your computer. This tutorial assumes that you have medium-high level of familiarity with concepts related to databases and programming languages.

To illustrate this tutorial, I will use a real-world example; an old web application I created when I first started programming in php. (more on this later on.) I will use knowledge and
experience acquired since then to recode from scratch the web app and come up with a solution which is more flexible, robust and elegant. These are the 3 criteria I will use at the end of this tutorial to assess whether of not this project has been successful.

/////////////////
Assumptions
////////////////
I will also assume you are running Windows XP pro or better. If you are running something else, such as OS X or Linux, then, I will assume that you are capable of installing php and mysql without any further instruction.

These are the things you’ll need to set up:

1. IIS
2. PHP
3. MySQL
4. PHP Editor

//////
IIS
/////
IIS may already be running on your computer. To check, go to Control Panel -> Administrative Tools -> Internet Information Services). If you can’t find IIS, you’ll need to install it by going here: Control Panel -> Add/Remove Programs -> Add/Remove Windows Components -> Internet Information Services.

//////////
MySQL
//////////
Download MySQL (Windows Essentials)
Download MySQL Administrator

Install MySQL, using all the default settings in the installer.
Install MySQL administrator using the default settings as well.

After both have been installed, try to use MySQL administrator to connect to MySQL, create a database user, create a database, and assign all permissions for the database to that user.

///////
PHP
//////
Download PHP (PHP 5 installer)
Download phpMyAdmin

1.Install PHP using the default settings in the installer.
2.Create a folder in C:inetputwwwroot called “phpmyadmin” and extract all the phpMyAdmin files there.
3.In IIS, create a new virtual directory called phpmyadmin and point it to that folder.
4.Edit your php.ini file (in C:Windows) by making the following changes:

a) configure the path to your extension folder
b) enable the mysql extension.

5. Edit the phpMyAdmin config file so that it can connect to your database. (Fill in your mysql host, username and password)

////////////////////////////////
Post-Installation checkllist
///////////////////////////////
Here are some things you should check before you read “Elegant Web Application PART2

1. Check that your local web server and php are running. To do so, place a php file with phpinfo() in the home directory for IIS and try to access it. You should see information related to your PHP installation.

2. Make sure you can connect/insert/remove data to the database through phpMyAdmin

End of part 1.

A beginner's guide to SEO
stack thought
1951 days ago

A free PDF presentation that gives some insights on Search Engine Optimization. A good beginner’s guide, in my opinion.

tiggggger [1]
stack thought
1959 days ago

I installed Tiger a few hrs ago. Spotlight and Dashboard are indeed pretty good….

But my favorite feature is an rss screensaver which displays excerpts from feeds onto the screen.

I made a video of how PA’s feed looks like.

Get it here (approx. 30 MB)

fire
stack thought
1962 days ago

Make fire using a can of coke and a chocolate bar. It might save your life one day. Really. Found via Make blog.

How to start a start-up
stack thought
1964 days ago

Article about how to start a start-up.

HowTo: Website optimization
stack thought
1974 days ago

Optimizing your website is an easy way to differentiate yourself from the other guys out there, aka the competition. If your website loads faster, you’re giving the end-user a better experience.

Here are a few basic things I do on the front-end side when I am asked to optimize a website:

1. (Re)write the website using XHTML and CSS. CSS decreases the overall code size, making the page load quicker in browsers.
2. Compress any JavaScript using free online tools such as JavaScript optimizer.
3. Compress the CSS using free online tools such as CSS Optimizer.
4. Use the ever-popular web page analyzer to gather important information about where the bottlenecks might be.

"G" is for Growth
stack thought
1978 days ago

The folks at Google really mean it when they say they’ll keep increasing Gmail’s storage space. It’s now over 2066MB and growing.

HD Enclosures [1]
stack thought
1978 days ago

Though they’ve been among us for quite a while now, I’ve only recently been introduced to, and realized the usefulness of HD enclosures: the cheap alternative to overpriced external hard drives.

Basically a hard drive enclosure wraps around your ordinary hard drive and allows you to carry it around easily. It has USB and/or Fire wire connectors.

We use this one at work. and I heard it got some good reviews.



previous  next
EMF Financial Products Canadian Drugs