Archive for the ‘Programming’ Category

What type of CMS is best?

Friday, October 30th, 2009

Joomla, WordPress, and Drupal seem to be gaining more and more momentum as of late, but I can’t help but wonder if those tools are the best solution for the problem or role they need to be playing. Just the other day I came accross an article by Jason Lengstorf (and part 2 of the article) discussing how to create a your own CMS. I wont say making your own CMS is the simplest task, but more often than not, I’m finding that developing a custom CMS is a better fitting solution for a client than one of the previously mentioned, more popular, ones.

I am currently working with a client who needed a CMS for her cafe. She did not say she needed a CMS, I decided that. She just requested that I help her develop a website that would suit her small cafe, and be easy for her to maintain. Knowing she wanted to maintain the site, meant immediately to me, that she would want to update it. The bulk of the site is nothing more than a bit of news about the cafe, and an up-to-date menu.

Could I use WordPress or one of the other CMS’ out there? Sure. Did I want to? No. Hearing the requests of the client and understanding how the website should funtion made me realize a small custom CMS would be optimal. As mentioned in Jason’s articles above, all that is truly required to meet the requirements of my client is that she can update her menu and news. In web developer jargon that means she needs to be able to modify a database.

Now I don’t want to guess how to start the task in WordPress, but to me I heard the request and my technological thought process was as follows:

She will need a database which she can update. It will have two tables (menu and news). I will need to develop an administration section for the client to access and modify the database. I will need to create a front end which connects to the database and displays the data in the correct manner.

To conclude the lesson I’ve learned is not what “what tools can I use?” but rather “what tool or tools best solve this problem?” Clients come in all shapes in sizes, as do their requests and problems. Some days WordPress or Joomla may be a perfect fit for your client, other days… Well you may need to bust out your favorite code editor and make your own CMS. That’s just how it is.

Posted in Programming | No Comments »

Should I embrace CSS3?

Wednesday, October 28th, 2009

I would love to but…

I’ve noticed a few designers I very much respect “namedropping” CSS3 as of late. Unless something changed, or what current web browsers support has suddenly been turned on sideways, many cool things that I would love to do in CSS using CSS3 just wont do me any good for about 70% of my visitors across the board. This may be a bit of a tirade, but let’s look at which browsers currently play nice with CSS3, and what the browser penetration rate is for those lucky enough to see the effects of CSS3.

Here’s a opening bit of text I found on http://www.css3.info/preview/

Many exciting new functions and features are being thought up for CSS3. We will try and showcase some of them on this page, when they get implemented in either Firefox, Konqueror, Opera or Safari/Webkit.

Where is IE in this bit? According to w3schools, IE still has is the browser of choice for about 40% of their users, and Mashable reports that 25% of users still use IE6. I’d love to see 70% of the browser use on Firefox or Safari with the other 30% on Oprah or IE, but that is just not the case.

Ok, let me digress a bit, I’m not saying that CSS3 wont make things easier for a web dev trying to make his own life easier, I’m simply saying that until the world no longer acknowledges the existence of browsers like IE6, and all CSS layouts are displayed equal, CSS3 is just as useful to me as a CSS conditional statement for IE6.

Also, as I have a love for newer technology don’t harass me if i decide to take on a few tutorials or examples using CSS in the coming weeks or months, I think I’ve just come to the conclusion so far that until CSS3 plays nice with IE for the majority of my IE users I’m just better off finding other ways to accomplish things.

Sources:
http://www.css3.info
http://www.webdevout.net/browser-support-css
http://westciv.com/iphonetests/

Posted in Programming | 2 Comments »

Use JSON to connect Flash to a Database

Monday, October 19th, 2009

I’ve worked through a few samples of JSON AS3 code so that I can hopefully create a simple example that readers may take away and expand for their needs. In a nutshell, I’ve used PHP to encode content into JSON which can then be decoded in AS3 to allow you to query a database in AS3 and get your results in Flash. I’ve shown all my PHP code in this post, however for the AS3 code download my zip file and run it in Flash. Note: I created this using CS4. I’m trying not to get out of this easy, but I feel the best way to understand the code is just download it, and look at how it works. Any questions, leave a comment!

Why add a database to Flash

Because you don’t want static content! By adding a database to your Flash files you allow for all sorts a possibilities. You can query a database, allow users to filter their data, add data to the database, and just make your page much more interesting!

Use PHP To Make the Database Connection

I use ADOdb Lite to make sure I have a secure database connection. You can check it out at the ADOdb sourceforge site. I’ll include the ADOdb files with the source code at the end of this post.

Get data from your database to your Flash file

I’ve created a file called query.php which acts as an intermediary between the database and Flash. query.php will receive a $_GET value named “name” which it will use to query the database. The first two are sample cases in the switch statement are just there to test that the query.php file is working. So if you go to query.php?name=car you should some output and likewise for query.php?name=truck.


< ?php
require_once 'config.php';
$name = $_GET['name'];
switch($name)
{
case "car":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "Mustang";
$pp -> vehicle_year = "2009";
$arr = array($pp);
echo json_encode($arr);
break;
case "truck":
$pp -> vehicle_make = "Ford";
$pp -> vehicle_model = "F-150";
$pp -> vehicle_year = "2000";
$arr = array($pp);
echo json_encode($arr);
break;
case "get all":
$dbResult = $qdb->Execute("SELECT * FROM work");
$results = $dbResult->GetAll();
$strippedResults = array();
foreach($results as &$result)
{
$strippedResults []= array(
'title' => stripcslashes($result['title']),
'description' => stripcslashes($result['description']),
'image' => stripcslashes($result['image'])
);
}
print_r(json_encode($strippedResults));
break;
default:
$pp -> results = "no valid information";
$arr = array($pp);
echo json_encode($arr);
break;
}
?>

Moving onto the AS3 Code

First thing’s first, make sure you have your required files to make sure Flash and AS3 can make sense of the JSON code.

import com.adobe.serialization.json.JSON;

I’ve zipped up a sql dump and all of the files for this project into a folder. Unzip the files, start up MAMP or the server of your choice, add the database, make sure the config.php file is configured correctly and you should be in action! Holler at me if you have any questions. If this post is popular I may go a bit more in depth into how to use this method of accessing a database to add data to a site and create a few examples.

Zipped Files here
final result

Posted in Programming, Tutorials | 1 Comment »

Adding Wiimote to Macbook Pro running Mac OSX

Saturday, June 13th, 2009

My current task i’m trying to undertake is to use WiiFlashServerJ to connect a Wiimote to my Macbook Pro. I’m running OSX Version 10.5.7.

Current Unresolved Issue:  Upon starting WiiFlashServerJ Application I get the following error:

“Cannot launch Java application.  Uncaught exception in main method: java.lang.IllegalStateException: Bluetooth failed to initialize.  There is probably a problem with your local Bluetooth stack or API.”

Posted in Programming | 4 Comments »