March 23, 2006

Red Hat Fedora 5

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:39 am

BuilderAU reports that Red Hat released its Fedora Core 5 version of Linux Monday, giving enthusiasts new graphics and virtualisation abilities, as well as some desktop utilities based on a software framework from Microsoft.

I am interested to see what sort of features it has against its other rivals.  I am still not convinced on a particular Operating System for my Laptop project.

Visit the Fedora Project Page.

Basic Image Text Generation in View

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:30 am

Often we come across a situation where the Designer has decided to use a unique non-web font in a beautifully rendered title. Often forgetting the fact that the content in that font is dynamic and content managed.

So placed in this situation we can handle it a couple of ways. Complain to the designer about their lack of recognition of this, or deal with it by generating the image with the dynamic content.

The purpose of this article is to discuss the way we go about implementing a simple challenge like this.

For our solution to work well, we would need to be able to produce something that:
- Generates a replica image using the font used by the designer
- Follow good programming techniques and make it reusable
- Make it very flexible
- Cache the generated file and serve when required

For this solution we could use PHP and make ourselves a Smarty function that can be used again in the future.

We first need to make ourselves a PHP function. I prefer to do these typically as functions of a class that can be called statically using GraphicUtils::createImage(), but as we will be creating a smarty function we don’t want the dependency on other classes.

First code our function createImage() accepting two parameters, the first is a text string, and the second is an array of parameters. We will be passing all of the configuration options into this function as an array that will allow us to centralize the configuration options and a quick flexible way of accepting a growing list of configuration options (as we extend).

The kind of configuration options that would be good to support is
- Font (size, weight, colour etc)
- Background (image, transparent, offset, colour etc)
- Text Offset and Canvas Size
- Text Transformation (Uppercase, lowercase etc)

For our caching to work correctly we also need:
- Cache Directory (available to the apache web server)

We will need to be able to identify when the configuration options have changed for a given text. A way that we can do this is to save the configuration parameters into the filename. To do this we can use a resultant of a MD5 call on the serialized configuration parameters with the given text.

$filename = md5($text . serialize($parameters)) . ‘.png’;

Once we change the configuration parameters or text, we will result with a new filename. If we pass in the same configuration parameters and text in we will have the same resultant filename. This will be a suitable way for us to setup caching.

NOTE: To do correct caching we would want to be able to determine an expiry timestamp. Probably most suitable would be to store the file in the database with a relevant timestamp. We can then perform garbage collection removing all files with a timestamp. For this we will accept a simple caching scheme with no need for garbage collection.

When the function is invoked we will immediately generate our filename and check the cache to see if we have performed the task before. If not, we must generate our file based on the given text and configuration parameters and save it to our filename.

Our createImage function can generate the images from image magick or GD. For this sort of task I have found better support for GD on hosting services and heaps of documentation.

Our method should return the filename string, and we will use this to link to the file resource.

To integrate into Smarty we could produce a smarty plug-in function called “function.create_image_png.php”. We will use this plug-in to invoke our method, generating our filename to link to from our source.

An invocation could be therefore as easy as:

< img xsrc=”{create_image_png text=”Hello World” params=$imageConfig.header}” alt=”Hello World” />

Once the framework is implemented successfully you can easily extend it to your other image needs, such as creating a thumbnail or basic image manipulation. Your caching mechanism will have to be updated to incorporate a timestamp on your source file or similar.

Considerations: For this to be implemented correctly we need to be able to separate the View from the controller (As the controller shouldn’t be concerned with the presentation). Open for discussion.

March 22, 2006

Blog Top Sites

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 1:41 pm

Technology Blog Top Sites

Google Mars

You will find other articles relevant to this document in these sections:
Richard Lee @ 9:08 am

Google has now taken it’s Google “Earth” project to Mars!

Google Mars has been put together in collaboration with NASA researchers at Arizona State University. “We’ve created some of the most detailed scientific maps of Mars ever made” - Google spokesperson.

There are a number of viewing options within the Google Mars interface;

Elevation - a colour coded relief map generated with data from the Mars Orbiter Laser Altimeter (MOLA) on NASA’s Mars Global Surveyor spacecraft,

Visible - a mosaic of images taken by the Mars Orbiter Camera (MOC) on NASA’s Mars Global Surveyor spacecraft (what you would actually see if you orbited Mars) and,

Infrared - A mosaic of infrared images taken by the Thermal Emission Imaging System (THEMIS) on NASA’s Mars Odyssey spacecraft. Warmer areas appear brighter, and colder areas are darker.

For more info see www.google.com/mars

March 21, 2006

TheAge reports: Hackers get windows XP on Apple computers

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:42 am

View the article.

“As expected, hackers have found a way to run Microsoft Corp.’s Windows XP operating system on new Macintosh computers, winning an ad hoc contest and a $US13,854 cash prize to boot.”Or, make that dual-boot - the way to make a computer switch between two operating systems.

Definately as expected. Now that the boundaries between the architecture are being over turned, we should all be happily at control of our environment for our workstations. I don’t think this scenario is quite a good as MAC on PC. But a lot of Studios force junior web developers to work on Mac’s because of their sleek presentation and they often can’t get the benefit our of the Mac OS X environment, often crying for thier PC back. Maybe this will allow both parties to be happy?

March 20, 2006

PNG Alpha for MSIE

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 5:02 pm

PNG Alpha Transparency is something really cool. But not supported by current version of MSIE.

What I like about this capability is having nice fluffy edges on your icons, and being able to lay them on different background cell colours, that may infact change with a mouse over etc.

I found a little reference to a way of getting around it. It appears that MSIE will display the transparency if it is placed through a SPAN rather than standard IMG. So we could simply create a function that allows us identify the browser and render the HTML depending on their compatibility. The SPAN output would be similar to:

< span style="position: relative; height: 100px; width: 100px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='ouricon.png', sizingMethod='scale');" />

In PHP you could simply determine the width using GD (for automatic) or instruct your function how to display. To determine if a user is using MSIE a simple check could be checked through a strisstr check for MSIE on the HTTP_USER_AGENT. Depending on your View handler this could be written as a plugin for reusability.

The trick is placing it in the style. So we could even factor this back into our normal IMG tag:

< img width="100" height="100" alt="home" xsrc="ouricon.png" mce_src="ouricon.png" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='ouricon.png', sizingMethod='scale');" />

Therefore when we are dealing with MSIE we need to specify our additional styles inline and we “should” be right to go.

Micorosoft attempts to undermine IBM

You will find other articles relevant to this document in these sections:
Richard Lee @ 9:56 am

In recent news Microsoft CEO Steve Ballmer talks about plans of spending $US500 Million this year alone to promote the company’s new Microsoft Office and Windows Mobile computer systems. This is a bold move by MS to persuade businesses to use their software instead of hiring IBM consultants. “Getting the most out of their people is on the mind of every business leader I speak with,” Mr Ballmer said. “(We) are passionate about the idea that the right software can provide the tools to empower workers to become the drivers of business success.”. Essentially the new software will mean companies will
be able to handball more tasks onto employees than outsource to IBM.
Source: http://australianit.news.com.au/articles/0,7204,18498104%5E15306%5E%5Enbv%5E,00.html

Makes you wonder whether you will be justified in asking for a pay raise if your boss starts passing on work the business once outsourced to a specialised consultant…

Online Resources – Your safari bookshelf

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:31 am

The internet is a great resource for our programming needs, with hundreds of scripts and tutorials to achieve almost anything. For some time this has been more appealing that purchasing a dedicated technical book on a topic. It is almost a luxury to purchase a $100+ book.

Technical books typically are structure in a couple of different formats. Usually there are introductory books, teaching you every concept about a given topic without requiring any prior knowledge, a “learn by example” book and a “cookbook” style containing tasks common to many programmers.

On the internet we often find content similar to what is contained in the “learn by example” or “cookbook” style books. You can summon all the scripts in the world with a quick google on a topic.

One of the main concerns I have using the internet as your only resource is that we often have to sort through a lot of examples poorly written by anyone that knows how to publish a webpage. Books on the other hand are usually complete; a snippet of code is usually a result of prior discussions or examples, written by well respected industry professionals with the support of a publishing company.

I have been using an online resource for reading books online. It allows me to search over thousands of books and have a dream technical library of resources online. If there is a new programming topic or something I need to learn, I know that I will have a great selection to read at my pace online – and I can access it anywhere.

The online resource is called Safari Bookshelf and it has been around for many years now. I first learnt about the resource about 5 years ago and ever since then it has been growing adding all the books I need. It is run by O’reilly publishing and has all the good books. So does having thousands of books in your library mean that you need to pay thousands of dollars? No.

An Safari bookshelf subscription costs you around what you would pay to buy 1-2 technical books a year. By ensuring that you are have the resources from both online and from books you can be safe to say you will have all the correct resources you need if you need to learn about a topic. You can get a free month trial aswell.

Safari Bookshelf

March 17, 2006

TheAge reports: Intel plots new course with Viiv

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:58 am

View the article.

“Viiv-branded PCs from a number of hardware suppliers will be appearing in Australian stores anytime from now, offering remote-control access to on-demand games, movies, music and other content and services through local partnerships.

“Six local partners have so far been announced in Australia, but Intel promises more are in the works. Adobe, Destra Music, Muvee, Telstra BigPond, Quickflix and Ubisoft will provide a patchwork of content and services to Australian Viiv users, and Intel said its role was to ensure that all of their services functioned seamlessly on the new platform.

Access Control Lists (ACL)

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:51 am

Access control lists are a way of adding more flexibility to your authentication (or access control as it should be referred to). It allows you to create roles/groups and restricts access to particular resources or functions. Its implementation means that your ACL’s can be managed seperately to your Source Code (in your database), and therefore caneasily create and grant with new roles to resources etc without having to add new lines of checks to your web application

Although the traditional if/switch checks work when you are working with polarised groups (normal user vs administrator) it quickly becomes too difficult to maintain when you introduce a third group, such as “public” or “developer”.The best way to comprehend Access Control Lists is in 2D tables, having each column the resource that they wish to access, and each row as the particular role. For each cell in this table you can configure whether to allow or deny a role the ability to access a resource.

In your application your checks can now be more centralised to a leaner concise check: acl_check($resource, $group);

Depending on your implementation of your webdesign this can then be placed on every page, or as more practical and better design: through a gateway or preprocess function (in MVC Struts design we would see these checks generically placed in our RequestProcessor processPreprocess()).

By moving to this design we can get rid of dozens of lines of checks and simply check access to a particular resource by calling acl_check(). You Access to particular resources is now centralised to your access control lists and can be managed externally, granting access for a new system “role” without visiting any of your source code again.

« Previous PageNext Page »