Tuesday, May 24, 2011

It all starts with an idea

This piece is taken directly from my blog post over at goagri.com. It applies to game development as well and I thought it best to share it here again.

While I was studying IT back in 1997 one of the projects I had to do was to develop a software application for a subject of my choice. I chose to develop a dairy farming application. The reason why I chose farming was because I grew up on a farm and I saw a great need for such a type of software.

Coincidently someone else had also chosen to create a similar project and at the end of the day his project was marked before mine and as such I was told by the lecturer that I “copied” my idea from that person and as such I got lower marks.

Do you see the irony? I developed a complete Dairy software program and someone else did exactly the same. How can ideas that relates to the same subject be copied from each other? Each software product covers the following subjects:
•A Farm
•With Cows
•That eat food
•Lives on fields
•And deliver liters of milk
•To a supplier.

That was the last time I developed a complete product for farmers since I was totally devastated by my experience. That is until now. I have come full circle.

As time passed I always had the yearning to attempt such a project again using the knowledge I gathered during the years together with the technology of the day. But always I will think of that lecturer and it will discourage me because, “What if someone else also have the same ideas?”

Today I am a wiser man and I know that there will always be the same ideas out there. It’s called Simultaneous Invention. I quote:
“In any period, ideas are discovered at the same time. Even big ideas. This is true for the past, present, and in different culturess.”


This image is copyright by http://www.kk.org

Monday, April 4, 2011

Wika 2011 Video on Youtube

Over the weekend I uploaded my first video to youtube. Jay! :)

Video follows:

Monday, September 13, 2010

Joomla 1.5 - Created date to mySql

Joomla! allows you to set date values through the Joomla! framework whenever you want to save a date to the database.

To use a the current date/time in your JModel entended class, do the following.

In the store() method after the $row->bind() method, add:

//Get a JDate object
$createdate = &JFactory::getDate();
//Create a date in MySQL's datetime format
$row->created = $createdate->toMySQL();
//PS: make sure your table have a created field :)



Joomla!'s JDate also allows you to set custom Unix dates simply by passing in the date to JFactory::getDate() method. E.g.

$createdate =& JFactory::getDate(time());

Note that you wil override the date everytime you save to the database. See if you can modify the model to set the create date only on new saves. :)

See Joomla!'s API documentation for more on what JDate can do.

http://api.joomla.org/Joomla-Framework/Utilities/JDate.html

Monday, September 6, 2010

Joomla 1.5 Additional select tag values

This continues on my blog post on how to add a select tag through the Joomla! framework. The code that follows will show you how to add to the ObjectList for a Select tag. This is especially useful where you have to use a select tag in a search form.

I normally use a value of 0 to indicate a search of "All Values".

The first thing you do is create a class at the top of your page as follows:

<?php
class MySelectObject{
var $id;
var $name;
}
?>



Then to use it do the following:

<?php
$db = &JFactory::getDBO();
$query = "SELECT `id`,`name` FROM
#__town";

$db->setQuery($query);
$townlist = $db->loadObjectList();

/*Create an instance of MySelectObject*/
$mso = new MySelectObject();

/*Set values*/
$mso->id = 0;
$mso->name = 'Any Town';

/*Create an array for insertion*/
$tmpArr = array(0 => $mso);

/*Merge with array result from query. Add to the front of list*/
$selectList =
array_merge($tmpArr,$townlist);

/*Make MySelectObject the default selected*/
echo
JHTML::_('Select.genericlist',$selectList,'town',"","id","name",0);


?>

Wednesday, October 14, 2009

Joomla 1.5 - Creating RAW output for the front end

If you want your component to create RAW output on the front end, like xml data to be returned for an AJAX POST/GET, then this is what you have to do.

1. In your component's views/view/ folder, add a view.raw.php file. E.g. if your component has a view called smile your will add view.raw.php to your views/smile/ folder . i.e. com_mycomponent/views/smile/view.raw.php

2. Whenever you call your component via a url simply append format=raw to the url. E.g. index.php?option=com_mycomponent&format=raw

Notes: For the backend administrator side, you can just specify format=raw without having to add the view.raw.php file to your views folder.