Download Firefox -  a safer, easier to use web browser. Return to iribbit.net - Leap into the online experience! Return to iribbit.net - Leap into the online experience! iribbit.net - Leap into the online experience!

Project News :.

The latest project to launch was the site for Gorilla Offroad Company. Aside from their main site, a social media strategy was develop to launch the company into various industry specific automobile enthusist discussion board communities as well as popular social media fronts like Facebook, Pinterest, and Twitter.


Valid XHTML 1.0 Transitional

Valid CSS!

Section 508 Compliant

powered by: Macromedia ColdFusion MX

made with: Macromedia Dreamweaver MX

What is RSS

XML - often denotes RSS Feed information.

Macromedia - ColdFusion Programming
white horizontal rule

ColdFusion News :.

To bring a little life to my site, I've pulled a couple What is RSS Feeds into this page. You can currently choose between the technology related news stories from the following news sources:



You are currently viewing and RSS Feed from coldfusionbloggers.org.



What I Learned Today: AJAX saves IE's ass yet again...
Today's installment of "Why IE Sucks" goes as follows: A form has an electronic signature capability. The eSign form opens in a popup window via window.open(). The form has server side code that checks for a valid referring page via CGI.HTTP_REFERER. If a proper referring page is found, display the form. If not, block access. Easy and simple. And IE won't allow it to work. Unlike all other browsers tested, IE doesn't pass the parent window's URL in the HTTP_REFERER value. It passes nothing. Why? No idea. But this required a new solution to the problem. AJAX to the rescue. JavaScript has no problems getting the URL of the parent window via window.opener.location.href. So here are the changes made.
  1. Everything inside the BODY tag of the eSign form is pulled from the form page. This leaves a skeleton HTML file in place when the page is opened.
  2. On the page load, jQuery makes an AJAX call to a remote function, and passes along the value of window.opener.location.href in a POST.
  3. The remote function has server-side code that can compare the passed referring URL to a list of accepted access points. If one is found, the HTML of the form (taken from the eSign form) is sent back. If not, an access denied message is sent back.
  4. The success call of the AJAX function writes the returned HTML to the BODY tag.
This is cross-browser, and secure in that people have no access to the list of accepted access points since it's all server side. Makes hacking this difficult at best. Suck on it, IE. Some example snippets below. Electronic Signature Form $(document).ready(function(){ // AJAX global setup options $.ajaxSetup({ cache: false, dataType: "json" }); // get the form $.ajax({ async: false, type: "POST", url: "components/remote.cfc?method=geteSignForm&returnformat=json", data: { referer: window.opener.location.href }, success: function(response){ $('body.popup').html(response.responseText); }, error:function(xhr,err){ alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status); alert("responseText: "+xhr.responseText); } }); }); [eSign form HTML here]
(Thu, 24 Apr 2014 18:01:04 GMT)
[view article in new window]

Keeping up with Cordova and PhoneGap

How do developers keep up with the latest updates from the Apache Cordova and PhoneGap projects?

The first resource I'd consider is the Cordova blog. Not technically a separate site from the main home page, the News link acts like a blog and is a handy way to get notified about recent changes. There is an RSS feed (http://cordova.apache.org/rss.xml) you could add to your favorite reader or consider using an IFTT RSS to Email recipe (like I am adding myself right now!).

On the PhoneGap side, check their blog as well. By default, they aggregate posts from the community as well as write their own content. So if you already follow folks in the community and want to focus on "official" PhoneGap news, view just the PhoneGap news here: http://phonegap.com/blog/phonegap and Build news here: http://phonegap.com/blog/phonegap-build.

While folks may debate the relative value of Twitter (I go back and forth between full on addiction and disgust), you can follow official accounts here: @phonegap, @apachecordova, and @phonegapbuild. There are - of course - various team members who use Twitter regularly but I'm not going to list them out by name. (Because I'm lazy. And I'm hoping someone has built an official list already!)

Another option is the Cordova developer mailing list. To be clear, this is not a support list. Rather, this is where the developers of Cordova discuss things. It is a pretty busy list. I'm subscribed, but generally focus on items that look important. So I'm less concerned about the discussion of API X but rather the end result so that I can help others with it in the future. But if you want to be in the know about changes even before they get released, this is where you want to be.

The PhoneGap project has a newsletter you can sign up for as well. It hasn't been updated in a few months, but I've been told that a new issue will be out soon. You can sample the last issue here.

That covers keeping up with the projects, and I hope this is helpful. While not directly related to the subject matter at hand, I want to point out the directory of PhoneGap Meetup groups. Thank you, Holly for reminding me of this. Also remember that you can find PhoneGap developers at the PhoneGap developer directory.


(Thu, 24 Apr 2014 18:01:02 GMT)
[view article in new window]

Practical Learning, Building a "Real" Application with Zend, Part 1

The Zend tutorial is certainly useful for getting your toes wet and figuring out the basics.  Alas, like most such tutorials, though, it deals with a very basic application - single table, only a few fields, with just a few crud functions. While my partner figures out some other stuff with the application we're building, I've been charged with continuing to learn Zend, so I'm doing what I started to do that made me hate CakePHP - try converting something I already have in Mach-II to PHP with Zend.  So I'm going to try making a version of the Movie Shelves area of my personal site.

Since I never finished the Cake example, I didn't post about it here.  We'll see how well I do with this one :-)  To start with, I popped the skeleton application into my site root, per the manual. I did it via downloading the ZIP, unpacking, uploading then running the composer commands. For some reason, the composer commands failed today when they worked fine yesterday.  The skeleton is still working, though, so I for now I'm just continuing on. 

For this area of the site, I have five tables.

Since everything really revolves around the movies table, and none of the individual elements are "independent", from my understanding this means I have one module, which I will call "MovieShelves".  Under that, within the src, I'll have five components (or whatever they are called), one for each table.  Hopefully, I understood the tutorial stuff correctly.  For now, my initial directory structure and empty files look something like this.

After doing the really basic stuff (i.e. setting up the DB), it was time to start with the formats section. So first I made the Module.php under MovieShelves (since I knew I would be editing it anyway, I did the parts from both the Modules and the DB section of the tutorial at once).

<?php
	namespace MovieShelves;
	
	use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
 	use Zend\ModuleManager\Feature\ConfigProviderInterface;
	use Zend\Db\ResultSet\ResultSet;
	use Zend\Db\TableGateway\TableGateway;
	use MovieShelves\Formats\Model\Formats;
	use MovieShelves\Formats\Model\FormatsTable;
	
	class Module implements AutoloaderProviderInterface, ConfigProviderInterface {
		public function getAutoloaderConfig() {
			return array(
				'Zend\Loader\ClassMapAutoloader' => array(
						__DIR__ . '/autoload_classmap.php',
					),
				'Zend\Loader\StandardAutoloader' => array(
					'namespaces' => array(
						__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
					),
				),
			);
		}
		
		public function getConfig() {
			return include __DIR__ . '/config/module.config.php';
		}
		
		public function getServiceConfig() {
			return array(
				'factories' => array(
					'MovieShelves\Formats\Model\FormatsTable' =>  function($sm) {
						$tableGateway = $sm->get('FormatsTableGateway');
						$table = new FormatsTable($tableGateway);
						return $table;
					},
					'FormatsTableGateway' => function ($sm) {
						$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
						$resultSetPrototype = new ResultSet();
						$resultSetPrototype->setArrayObjectPrototype(new Formats());
						return new TableGateway('formats', $dbAdapter, null, $resultSetPrototype);
					},
				),
			);
		}
	}
?>

Then I created my module.config.php under MovieShelves/config with my basic configuration as well as the router

<?php
	return array(
		'controllers' => array(
			'invokables' => array(
				'Formats\Controller\Formats' => 'Formats\Controller\FormatsController',
			),
		),
		'router' => array(
			'routes' => array(
				'formats' => array(
					'type' => 'segment',
					'options' =>  array(
						'route'		=> '/formats[/][:action][/:id]',
						'constraints'	=> array(
							'action'	=> '[a-zA-Z][a-zA-Z0-9_-]*',
                         		'id' 	=> '[0-9]+',
						),
						'defaults' =>  array(
							'controller' 	=>  'Formats\Controller\Formats',
							'action' 		=>  'index',
						),
					),
				),
			),
		),
		'view_manager' => array(
			'template_path_stack' => array(
				'formats' => __DIR__ . '/../view',
			),
		),
	);
?>

I added my new module, MovieShelves, to the application.config.php under the main config folder, then made the very basic "blah" controller.

<?php
	namespace Formats\Controller;
	
	use Zend\Mvc\Controller\AbstractActionController;
 	use Zend\View\Model\ViewModel;
	
	class FormatsController extends AbstractActionController {
		public function indexAction() {
		}
		
		public function addAction() {
		}
		
		public function editAction() {
		}
		
		public function deleteAction() {
		}
	}
?>

With that done, I threw in a simple line of "If I had content, I would show you the available formats!" in the index.phtml file then tried testing my new routes, specifically the formats/index route where I had my little message.  But I got a fatal error instead:

Fatal error: Class 'Formats\Controller\FormatsController' not found in /usr/local/zend/var/libraries/Zend_Framework_2/2.3.1/library/Zend/ServiceManager/AbstractPluginManager.php on line 170

Hmmm...okay.  After reading the docs some more and getting a little aggravated by the lack of better explanation on what some of the stuff it has you do is doing, I found this helpful post from Rob Allen on how to change the directory structure around from the "traditional" one (which is what I'm doing here). That helped me figure out the changes I needed to make to get things to work.  So in my FormatsController, I had to change the namespace to put it under it's parent properly:

namespace Formats\Controller;  →  namespace MovieShelves\Formats\Controller;

In Module.php, I had to change one line to correct my namespace/path pair format:

__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,   →  __NAMESPACE__ => __DIR__ . '/src/,

And finally in module.config.php, I had to change the invoking aliasing to reflect these changes,

'Formats\Controller\Formats' => 'Formats\Controller\FormatsController',  →  'MovieShelves\Controller\Formats' => 'MovieShelves\Formats\Controller\FormatsController',

And then further below, the use of the reference has to be switched as well to match what we have in the invokes.

'controller' => 'Formats\Controller\Formats',  →  'controller' => 'MovieShelves\Controller\Formats',

With those changes, Zend was able to find my controller in my modified controller.  I honestly don't entirely understand the what/whys behind those changes, but they worked.  No more fatal error.  I get a proper page, still using the Zend skeleton template of course, displaying a Zend error message.

Okay. So it can't find my views.  For some reason, it's doing movie-shelves/formats, instead of what I expected which would have been formats/formats.  This is where the tutorial example on the Zend site is really aggravating.  They made their module name Album, but they also made a folder called Album containing the controller, forms, etc for an Album.  To me this makes no sense at all and it makes it much harder to figure out when Album is referring to the module/namespace and when it's referring to something else.  And if it is also supposed to be something like Album/src/Album, or A/src/A, then what's the point of the second A folder?

Anyway, this one was harder to figure out. After a lot of Googling, skimming various sections of the Zend docs, etc, I could not figure out how Zend was deciding where to look for the views or how to tell it "no no, go here".  I presume it's the ViewManager or ViewResolver, but I couldn't figure out how to reconfigure it. I did find that it basically looks for the template name as "module/controller/action" with the names made all lower case and words separated by dashes. So I was able to fix it by changing my view folder structure to add a movie-shelves folder, then moving the individual folders, i.e. formats, genres, etc under it. It did let me eliminate the redundant double folders at least.

I could also have changed the config to manually list every view, but that would add excessive overhead and greatly increase the likelihood of human error coming into play.  With that change, we have success!

Yay!!!   Now to make our model files. Again, following the Zend tutorial (the Album one), I first made the Formats.php

<?php
	namespace MovieShelves\Formats\Model;
	
	class Formats {
		public $formatid;
		public $formatlabel;
		
		public function exchangeArray($data) {
			$this->formatid = (!empty($data['formatid'])) ? $data['formatid'] : null;
			$this->formatlabel = (!empty($data['formatlabel'])) ? $data['formatlabel'] : null;
		}
	}
?>

And then FormatsTables.php

<?php
	namespace MovieShelves\Formats\Model;
	
	use Zend\Db\TableGateway\TableGateway;

	class FormatsTable {
		protected $tableGateway;
		
		public function __construct(TableGateway $tableGateway) {
			$this->tableGateway = $tableGateway;
		}
		
		public function fetchAll() {
			$resultSet = $this->tableGateway->select();
			return $resultSet;
		}	
		public function getFormats($id) {
			$id  = (int) $id;
			$rowset = $this->tableGateway->select(array('formatid' => $id));
			$row = $rowset->current();
			if (!$row) {
				throw new \Exception("Could not find row $id");
			}
			return $row;
		}
		
		public function saveFormats(Formats $formats) {
			$data = array(
				'formatlabel' => $formats->formatlabel,
				);
			
			$id = (int) $formats->id;
			if ($id == 0) {
				$this->tableGateway->insert($data);
			} else {
				if ($this->getFormats($id)) {
					$this->tableGateway->update($data, array('formatid' => $id));
				} else {
					throw new \Exception('Format ID does not exist');
				}
			}
		}
		
		public function deleteFormats($id) {
			$this->tableGateway->delete(array('formatid' => (int) $id));
		}
	}
?>

Again, both are really basic for now, just to get them going. The one difference from the tutorial way versus mine is that I had to change the namespaces to add the MovieShelves so it could find everything.  Until I did that, it was unable to instantiate the FormatsTable. So I ran that and got a new error.

This one at least I instantly knew the problem - Zend was presuming the table's name was "formats", so I had to figure out how to tell it to use the table name movieshelves_formats.  That was also easy to figure out after looking at the TableGateway docs.  I just had to change one line in Module.php

return new TableGateway(formats', $dbAdapter, null, $resultSetPrototype);  →  return new TableGateway('movieshelves_formats', $dbAdapter, null, $resultSetPrototype);

And finally, I threw the basic tutorial style format for showing the formats on the page in movie-shelves/formats/index.phtml.

<?php
	$title = 'Formats';
	$this->headTitle($title);
?>

<h1><?php echo $this->escapeHtml($title); ?></h1>
<p><a href="<?php echo $this->url('formats', array('action'=>'add'));?>">Add new format</a></p>

<table class="table">
<thead>
	<tr>
		<th>ID</th>
		<th>Label</th>
		<th> </th>
	</tr>
</thead>
<tbody>
	<?php foreach ($formats as $format) : ?>
	<tr>
		<td><?php echo $this->escapeHtml($format->formatid);?></td>
		<td><?php echo $this->escapeHtml($format->formatlabel);?></td>
		<td>
			<a href="<?php echo $this->url('formats', array('action'=>'edit', 'formatid' => $format->formatid));?>">Edit</a> ~ 
			<a href="<?php echo $this->url('formats', array('action'=>'delete', 'formatid' => $format->formatid));?>">Delete</a>
		</td>
	</tr>
	<?php endforeach; ?>
</tbody>
</table>

And when I run it...

Yippee!!  A successful page load while using the organization structure we are leaning towards and without having to follow some crazy rigid DB schema - instead I was able to just use the schema done to our conventions. 

Since this is a fairly long post, I'll cut here.  In part 2, I'll be working on redoing the layout template to my own design, then finish up the formats views.


(Thu, 24 Apr 2014 14:00:34 GMT)
[view article in new window]

Aborting AJAX Requests Using $http And AngularJS
Ben Nadel demonstrates how to abort AJAX requests in AngularJS using the timeout property of the $http service method....
(Thu, 24 Apr 2014 10:00:55 GMT)
[view article in new window]

Computer Know How - Sponsors ITB

We are very excited to announce that Computer Know Howwill be sponsoring Into The Box this May! We have been partners with CKH for several years now and they are an amazing web application crew. If you want something done, they do it fast and awesomely!



CKH was born in 1997. Our talented and experienced team of 11 has a combined total of 67 years of experience in computer repair, network monitoring and maintenance, website design, and website development.

(Thu, 24 Apr 2014 10:00:49 GMT)
[view article in new window]

CFDUMP, and how I'm a bit thick
G'day:
This isn't even a case of me not RTFMing and then discovering something I didn't know. I knew this already. But am just a bit dense.

I'm perennially doing this sort of thing:

private function logArgs(required struct args, required string from){
savecontent variable="local.dump" {
writeDump(var=args, label=from);
}
fileWrite(getDirectoryFromPath(getCurrentTemplatePath()) & "dump_#from#.html", local.dump);

(As case in point being: I just wrote that code for a new blog article that I should have done and dusted by this evening)

However I don't need to do that. I can just do this:

private function logArgs(required struct args, required string from){
var dumpFile = getDirectoryFromPath(getCurrentTemplatePath()) & "dump_#from#.html";
if (fileExists(dumpFile)){
fileDelete(dumpFile);
}
writeDump(var=args, label=from, output=dumpFile, format="html");
}

I'm so accustomed to only every using the var argument, and occasionally the label one, I tend to forget there's a bunch of other options on <cfdump> / writeDump() as well (from the docs):

AttributeReq/OptDefaultDescription
varRequiredVariable to display. Enclose a variable name in number signs. These kinds of variables yield meaningful cfdump output
expandOptionalyes
  • yes: in Internet Explorer and Mozilla, expands views.
  • no: contracts expanded views.
formatOptionaltextUse with the output attribute to specify whether to save the results of a cfdump to a file in text or HTML format.
hideOptionalallFor a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys.
If you specify a structure element that doesn't exist, ColdFusion ignores it and does not generate an error.
keysOptional9999For a structure, the number of keys to display.
labelOptionalA string; header for the dump output. Ignored if the value of the var attribute is a simple types.
metainfoOptionalyes for query
no for persistence CFCs
For use with queries and persistence CFCs. Includes information about the query in the cfdump results, including whether the query was cached, the execution time, and the SQL. Specify metainfo="no" to exclude this information from the query result. For persistence CFCs, if metainfo="yes", returns property attributes such as getters and setters.
outputOptionalbrowserWhere to send the results of cfdump. The following values are valid:
  • browser
  • console
  • filename
    The filename must include the full pathname of the file. You can specify an absolute path, or a path that is relative to the ColdFusion temporary directory. You can use the GetTempDirectory() function to determine the ColdFusion temporary directory.
showOptionalallFor a query, this is a column name or a comma-delimited list of column names. For a structure, this is a key or a comma-delimited list of keys.
showUDFsOptionalyes
  • yes: includes UDFs, with the methods collapsed.
  • no: excludes UDFs.
topOptional9999The number of rows to display. For a structure, this is the number of nested levels to display.
abortOptionalfalseIf this attribute is set to "true", it stops processing the current page at the tag location.

Perhaps everyone else in the world remembers all this stuff and uses it all the time. I'm simply not that clever.

--
Adam
(Thu, 24 Apr 2014 08:25:24 GMT)
[view article in new window]

My new favourite SQL function SUBSTRING_INDEX
So I needed a quick way to convert a list of authors from “Joe A. Bloggs” into “Bloggs, Joe A.” –  i.e, not separated out into firstname and lastname fields, just one field called ‘name’. I then needed another field to return a single column with the first letter of the lastname for display purposes. […]
(Thu, 24 Apr 2014 06:41:24 GMT)
[view article in new window]

Creating CFMobile Application using AngularJS
In my previous blog articles I had explained how to create CFMobile applications using JQuery, Bootstrap/JQueryMobile. Here are links to sample (CFMobileExpenseTracker) applications using the two UI frameworks - CFMoibleEpenseTracker using Bootstrap . Blog article. CFMobileExpenseTracker using JQueryMobile. Blog article. I wanted to … Continue reading
(Thu, 24 Apr 2014 04:01:02 GMT)
[view article in new window]

Varnish with Apache and WordPress on Centos
Reading time: 12 – 20 minutes Varnish is wicked! It works on your webserver as a reverse proxy to cache HTTP requests. According to their website: Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 – 1000x, depending on your architecture I have only just installed it on […]
(Wed, 23 Apr 2014 18:01:03 GMT)
[view article in new window]

Logs from Open PhoneGap Session
Thank you to everyone (especially the PhoneGap team!) who showed up to the open session that Holly and I ran today. We had a great size crowd and a very interesting set of questions. Between Holly and I and other PhoneGap members we were able to co...
(Wed, 23 Apr 2014 18:01:03 GMT)
[view article in new window]


© The connection to the CFBLOGGERS_FEED's RSS feed has timed out - please try again later. We are sorry for any inconvenience this may have caused.