Archive for March, 2009

27Mar

This is somewhat based off of the articles found in the bakery at cakephp.org; however, I will be expanding on those tutorials a bit. First of all, everyone likes fancy loading bars or spinners so here is a good site that will handle creating that for you: http://www.ajaxload.info/

One of my main challenges today was trying to properly narrow the results in each page depending on the category within the site I am located. This was not quite obvious. Another problem I had was trying to get data from other models. The first was more easily solvable. The second required me to use a request action. I am looking for a more elegant solution, but until then this gets the job done.

My controller is simple:


function cat($catId){
//Configure::write('debug', '2');
if(!$this->RequestHandler->isAjax()) {

}

$this->set('cat',$this->Event->EventCategory->find('first',array('conditions'=>array('EventCategory.id'=>$catId),'fields'=>array('EventCategory.id','EventCategory.cat_name'))));
$this->set('catId',$catId);
$this->set('events', $this->paginate(null, array('Event.event_category_id' => $catId,'Event.event_date>=curdate()')));

if($this->RequestHandler->isAjax()) {
$this->viewPath = 'elements'.DS.'events';
$this->render('paging');
}
}

The important line is where I set events with the call to paginate. This allows me to limit the results in the same why I would use find. Unfortunatly, unlike find it will not retrieve associated results.

View for cat


echo $javascript->link("prototype",false);
echo $javascript->link("scriptaculous/scriptaculous.js",false);
echo $javascript->link("columns/matching_columns",false);
//$paginator->options(array('update' => 'CatPaging', 'indicator' => 'LoadingDiv'));
?>
<div id="LoadingDiv" style="display: none;">
image('ajax-loader.gif'); ?></div>
<div id="CatPaging">
renderElement('events/paging'); ?></div>

elements/events/paging.ctp


$paginator->options(
array('update'=>'CatPaging',
'url'=>array('controller'=>'Events', 'action'=>'cat'),
'indicator' => 'LoadingDiv'));
?>
<div style="width: 100%; position: relative; float: left;">

// stuff here

</div>
<div style="margin: 15px 0pt; width: 100%; position: relative; text-align: center; float: left;">
prev('<<',array('url'=>$this->params['pass'])); ?> .
numbers(array('separator'=>' . ','url'=>$this->params['pass'])); ?> .
next('>>',array('url'=>$this->params['pass'])); ?></div>

I had to use the ‘url’ option and use $this->params[‘pass’] so that my url including the parameter transfered over to the pagination. Now I can use pagination within the categories of my events model! Not too bad.

I hope this helps someone! I was tweaking it for a few hours today. I hope it saves someone a little time.

Here it is in action: http://www.letswoosh.com/events/cat/1 (of course this is assuming I have at least 7events posted, right now there are 7. So tomorrow it may look like nothing is happening 🙁 )

Enjoy!

Share/Save
26Mar

This is the last video of usable footage. Sorry for the shaky camera at times. We have some of the “Show offs.” My favorite is the emotive headset examples.

24Mar

These 2 videos are pretty cool. In the first video I show you a clip from the 2nd keynote (on Thursday 19th). This was the same keynote where IE 8 was announced. Then we ask the infamous question, “what is web 2.0” to a project lead at Twitter (we were at TAO night club at the venitian).

The 2nd video we have Andy discovering a mysterious man known as Dijkstra, a brief clip of me singing testify at the rock band tournament (woo we made it to a finals), a nice discussion with head engineer of Penny Arcade, and finally asking some playboy bunnies what web 2.0 is (we were not trying to embarrass them in any way shape or form, they seemed like pretty intelligent individuals!). They honestly gave the most honest answer out of everyone :).

Enjoy! (One more rockin’ episode coming your way)

19Mar

Sooooooo I was invited to Mix 09 via the game development club and my school. I was fortunate enough to see the keynote yesterday, and I video taped some of it. Thus far the most awesome thing i saw was Super Preview (in my first video below). This program allows you to preview your website as you create sort of like a WYSIWYG; however, it uses your native web browsers to assist you. It does not stop there though! It will let you view your application in many different browsers, and if you don’t have that browser installed on your computer super preview will look up the browser in question from the internet and determine how it should look from the cloud. Also they have onion skin mode. Onion skin mode lets you overlay your comp over your html to see the difference. They have a trial version available now! Click here to start the download.

The next thing that I really loved was the new optimizations in silverlight. We now have GPU access (video below)! This is one thing which may covert me from Flash to Silverlight. Sorry flash I am a graphics programmer I need my GPU. The one optimization that they didn’t make was that pixel shaders are still handled on the CPU. That is a huge disappointment if you ask me, but they said it was for security reasons (aka we don’t want to make the JAVA part of the crowd angry). Silverlight Beta Download.

Next, I saw sketchflow/blend. Sketchflow is a feature in Blend 3 which will let you generate a simple mock up of your website and make it look sketched out and slightly sloppy (even though you try to draw normally). This feature may not sound useful in text; however, think of the implications. It will draw attention away from graphics and more toward layout and concept. Not only that you can animate and actually make a working application in this way. You may then send it off to your clients and have the write feed back and draw on that same page. For me, I thought blend was similar to torque in it’s control scheme. That is you can set gravity, animations through behaviors, and you can also have triggers that function like action listener type events. Blend 3 Preview Download.