Dynamically Load a Model – CakePHP
Occassionally, I need to load an unrealted model into a controller. There are a number of ways to do this but some are better than others. The following is taken from reply by gwoo to a discussion thread.
Occassionally, I need to load an unrealted model into a controller. There are a number of ways to do this but some are better than others. The following is taken from reply by gwoo to a discussion thread.
I have thrown together a simple proof of concept (POC) in cakePHP for displaying cloud words. What are cloud words? Word frequencies displayed in a cloud similar to a tag cloud. A tag cloud may be found on right column of this blog site. The POC may be tested here.
Cloud Words allows for the upload and analysis of plain text and MS Word files. MS Word files are converted to plain text for the analysis. The analysis simply does a count total for each word in the file. A simple word count is actually not very useful since the most common words will dominate the count list. The most common words are generally not very useful for understanding the contents of a document. “THE” is the single word found most often in documents.
Last week, I was working on updating some old PHP code from 1999 and 2000. Now this is working code in PHP4 but was not quite up to todays standards. As an example it used the PHP code start tag of <? instead of the much better <?php. Also needed to make certain that all of my variables were declared and that no global or unsanitized variables were used. Overall not a big deal just a good use for grep or sed.
A WinXP laptop is my where I write most of my code and the files are then uploaded to a FreeBSD server. I do not and have never owned a Mac. Usually for this type of action, I would run grep or sed on my FreeBSD server but instead decided to try Windows Grep. I ran Windows Grep with the proper regular expressions and voila, my PHP start tags were updated. Next, the files were uploaded to a new server for testing. ERRORS, errors everywhere.
About half of the updated files were kicking out errors or failing completely. The failed files were rather random and the code looked just fine in the editor. What was going on?
I regularly develop GPL open source plugins, modules, and widgets for Joomla and WordPress. On ocassion, a users has asked if a donation would help support this development. The comment alone is a great compliment and incentive. Cash is always greatly appreciated but in this case, if you find one of my plugins useful please make a donation to one of these great organizations instead.
American Red Cross in Southeastern Wisconsin – Provides relief to victims of disasters and helps people prevent, prepare for, and respond to emergencies in Dodge, Kenosha, Milwaukee, Ozaukee, Racine, Walworth, and Waukesha Counties.
Milwaukee Achiever Literacy Services – Inspires and empowers adult learners to gain the skills necessary to enrich their lives through education and training in an atmosphere of mutual acceptance and respect.
New plugin for Wordpress developed. It should be available on the their site shortly. In the meantime, it will be available for download here.
If you have any comments or questions, please add them here.
A 1.5 native plugin enabling you to display section or category descriptions within content. This is a very simple, single purpose plugin that does only and exactly what it claims. On occassion, an article may wish to include the description from a section or category. Copying that description means it may need to be updated in multiple places if changes are made. With this plugin, just update the section/category description and all of the articles remain current.
Module ggis-tabnews is a module developed for Joomla 1.5. Basically, it takes all articles in a category or section and outputs them to a tabbed box. It depends on the Joomla Works Tabs & Slides plugin for the tabbing javascript. A future release may remove that dependency.
This is currently not a public release but if you are interested in it, please drop a comment on this article.
This module was developed for a very specific usage and has not been developed or tested beyond that. I do however, see a wide variety of applications for this module. A client wished to display offsite class locations by county in a tabbed box. Additionally; the person editing the locations, while familiar with the basic editor interface on the front-end, was not expected to handle much complexity in layout.
(more…)
Recently, I have started backing up my servers to Amazon S3 (Simple Storage Service) using Duplicity. So far, I am pleased with the process and the costs involved. I still do regular disk dumps to my own backup server but may slowly phase down the frequency of these dumps.
Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. The service aims to maximize benefits of scale and to pass those benefits on to developers.
Duplicity backs up directories by producing encrypted tar-format volumes and uploading them to a remote or local file server. Because duplicity uses librsync, the incremental archives are space efficient and only record the parts of files that have changed since the last backup. Because duplicity uses GnuPG to encrypt and/or sign these archives, they will be safe from spying and/or modification by the server.
ggis Iframe gives authors an easy way to insert an iframe into a Joomla content item.
Using ggis_iframe is a very simple matter of performing a short setup and then inserting a simple code in your article.
The subscription form may be inserted on a post, page, or text widget by including the following code in your text.
{ggis_iframe %param0="val" %param1="val"}
http://iframe.url{/ggis_iframe}
The insert tag starts with {ggis_iframe} and ends with {/ggis_iframe}. A number of parameters may be set in the openning tag. The URL of the iframe to insert goes between the tags.
Another example with all parameters set:
{ggis_iframe id="mine" width="100%" height="650"
frameborder="0" allowtransparency="true"
scrolling="auto"}http://mydomain.com/page{/ggis_iframe}
ggis Subscribe gives authors an easy way to insert a form that performs emailing list subscription management.
Using ggisSubscribe is a very simple matter of performing a short setup and then inserting a simple code in your post.
The subscription form may be inserted on a post, page, or text widget by including the following code in your text.
[-%ggis-subscribe %formtype "%listname"-]
Here is an explanation of the fields:
See the demonstration forms.
A subscription form may be placed into the standard text widget using the methods above. For widget use, I suggest using only formtype=1, the short form.
Interesting presentation on what makes a web site more than compelling for viewers. Link to ‘Discover is the New Cocaine‘.
In development work, you must always test your functions or expressions for proper results. For credit cards, there are some numbers that are NOT REAL numbers but will verify properly in developmental tests.
| Card Type | Card Number |
|---|---|
| Master Card (16 Digits) | 5105105105105100 |
| Master Card (16 Digits) | 5555555555554444 |
| Visa (13 Digits) | 4222222222222 |
| Visa (16 Digits) | 4111111111111111 |
| Visa (16 Digits) | 4012888888881881 |
| American Express (15 Digits) | 378282246310005 |
| American Express (15 Digits) | 371449635398431 |
| Amex Corporate (15 Digits) | 378734493671000 |
| Dinners Club (14 Digits) | 38520000023237 |
| Dinners Club (14 Digits) | 30569309025904 |
| Discover (16 Digits) | 6011111111111117 |
| Discover (16 Digits) | 6011000990139424 |
| JCB (16 Digits) | 3530111333300000 |
| JCB (16 Digits) | 3566002020360505 |
* Thanks to http://www.crazysquirrel.com/finance/test-cc.jspx