Apr 2 / Phil

Personalized User Vanity Url’s in Codeigniter

This may seem an obvious solution, but after doing some digging, i didn’t find anyone else writing about it. 

What I tried to accomplish was personalized urls like http://www.site.com/philpalmieri.  First i tried to use a pre_controller hook, but the url was being interpreted to quickly…  So i came up with a simple solution – hopefully it can help someone else out.

First step is to create an ‘aliases’ controller (and module if you are using them)..  Create a method in the aliases controller – something like check()… This is what we will be passing the personalized url to to figure out what to do.

How this works is that we check for any modules or controllers that would normally be called in uri->segment(1).  Then, dynamically account for each one in your routes file….  finally, we route everything else to aliases/create/*

So.   for the code

add & customize the following to your routes file (before any other custom routes).

$handle = opendir(APPPATH."/modules");
while (false !== ($file = readdir($handle))) {
  if(is_dir(APPPATH."/modules/".$file)){
    $route[$file] = $file;
    $route[$file."/(.*)"] = $file."/$1";
  }
}
 
/*Your custom routes here*/
 
/*Wrap up, anything that isnt accounted for pushes to the alias check*/
$route['([a-z\-_\/]+)'] = "aliases/check/$1";
Jan 20 / Phil

Codeigniter Simpletest Modular Extensions Suite

Update…

I am still having issues with MB  - and apparently others are too view thread.  So, I am once again switching back to HMVC / Modular Extensions.. With that switch I am also converting the Simpletest module as well as my Tag and Template libraries over as well..

I’ll release them soon (this month…. really)

—-

So, I am primarily writing this pre-post as incentive for myself to have a deadline and accountability.

After reading Jaime Rumbelow’s post on Codeigniter and Simpletest I realized I needed a way to do TDD in my Matchbox modules without having to set everything up each time.

I have an almost ready matchbox simpletest module that scans other modules for tests and auto runs them.   Each module you want to build with TDD only needs to contain its tests (which can  run on their own by loading the simpletest lib from the simpletest module) or can be auto loaded in batch from the main simpletest module.

If you are interested in helping me beta test, let me know – i plan to release a beta somewhere around Feb 1.

Dec 13 / Phil

Moved to Mediatemple

As of today, this site is now hosted on MediaTemple’s GS!

I found a coupon code online for 20% for life, so now i’m only paying $16/month for all my personal hosting needs (up to 100 domains). The admin panel and server are surprisingly fast and easy to configure too.

I know a few people who weren’t happy with the GS when it first came out, but so far so good.

To migrate over this site, i just shelled in and rsynced my www folder (took about 1 minute – including my personal large uploads folder). Then, just turn on the database, tweak the wp-options and I was online.

If you are considering a new, inexpensive, reliable host, i would highly recommend them.

Oct 16 / Phil

CodeIgniter Textmate Bundle

I Know this is a few days old already, but its just too good of a tool to not post in as many places as possible.

There is now a CodeIgniter Textmate bundle avaialable! If you are like me, you have a bunch of snippets already available for common CodeIgniter code. Well, David Ferguson wrote a CodeIgniter Textmate bundle that has snippets and shortcuts for every helper and class available in 1.7.2

Sep 17 / Phil

jQuery Plugin/Widget Quick Screencasts

I have been toying with the idea of putting up a series of 5-10 minute screencasts.  To start I am going to focus on the default jQuery UI widgets, and then pick and choose the most commonly used plugins. Although the widgets are pretty self-explanatory the documentation may be confusing to a new jQuery user in regards to settings, effects, or anything beyond the default demo.

I am going to start with the simple defaults of Tabs or Dialog, then go in depth with effects, and different options and uses for the widget(s).

Which of these jQuery UI Plugins / Widgets would you be interested in seeing a screencast on?  (select as many as you would like, or add your own answer from a 3rd party plugin)








Sep 9 / Phil

Matchbox is Back! So Long Modular Extensions…

So, for once, my procrastination has paid off! A while back i was complaining, in the most polite way of course, about the lack of development of matchbox. A few days ago Zacharias released Matchbox RC1.  He completely re-wrote it from the ground up and has made it 100% compatible with the latest Codeigniter release.

I downloaded the release candidate from http://codeigniter.com/wiki/Matchbox/, dropped it into a new branch of some projects that use the old version, and was off and running.

As i play with it more i plan to release some of our code like the AMFPHP library as self contained modules that can be dropped into an application.

Thanks again to Zacharias for all your hard work.

Phil

Sep 7 / Phil

Snow Leopard / MAMP Pro mySQL woes

After wiping my computer and installing 10.6 from scratch, my local php/mysql would not work at all.  The biggest problem was that I was receiving an error when trying to connect to mySQL “Lost connection to MySQL server at ‘reading initial communication packet’, system error: 61″.

It turns our that in MAMP Pro 1.8, they left out the local bind-address declaration, which for some reason freaks out the default PHP/Apache setup.

So, if you are running Snow Leopard and MAMP Pro and can’t connect to your mySQL, it’s an easy fix.  In MAMP Pro edit your my.cnf template (File > Edit Template) .  Add this line somewhere after the “[mysqld]” declaration (and reload) – Everything should be good.

bind-address = 127.0.0.1

Sep 1 / Phil

idleTimeout – jQuery Idle Session Auto Timeout with Prompt

Update: I just added a CC license (see below) and renamed this project idleTimeout

I just finished the first draft of idleTimeout -  jQuery auto prompt / logout / session expire plugin.  It is fairly simple, but seems to work well for my needs.

session-timeout

read more…

Aug 5 / Phil

Switching from Matchbox to Modular Extensions

[UPDATE: Matchbox is back!]

After over 2 years of being a loyal matchbox user I am now at a crossroads. Our back office framework, e-commerce framework, cms, image galleries, etc. etc. etc. all completely rely on matchbox. Unfortunately, when Codeigniter 1.7 rolled out, matchbox didn’t keep up. There were a few issues with codeigniter’s new validation library with the latest release and I released a hacked matchbox loader in hopes that the developer would eventually come out with his own, but that was last November.

This brings me to the topic of this post – I will be converting all of our applications and modules from Matchbox to Modular Extensions in the coming weeks. As I made that decision I realized there are a lot of other matchbox users who like me haven’t really used Modular Extensions, and are hesitant to take the leap. So, as I work my way through it I will be posting to a new category with my progress. At the end, I will try to wrap it all up and make a step by step conversion tutorial for other matchbox users still on the fence.

My apologies to Zacharias if he just hasn’t had time to work on it (he has been doing it free of charge btw), if not then I am truly sorry to see matchbox die. This post isn’t meant to be a complaint/rip on him, matchbox has been invaluable to us, and this decision was not made easily.

Being a commercial user, and relying on these code bases for my paycheck – not to mention having to support our deployed systems in the future, I simply cant take the chance that when another Codeigniter update rolls out, none of our legacy code will work.

Stay tuned for more updates.

Phil

Aug 5 / Phil

Site Back Up

Well,

After almost a week of hell dealing with 1and1 – philpalmiei.com is back up.

I don’t know if it is 100% their fault, but they definitely didn’t make the situation any better. If you are contemplating using 1and1 for your domain registration – DON’T!!!

It is near impossible to work with them, and if you ever decide to transfer to another registrar, or sell a domain – good luck with that.

For some strange reason (my own fault for not reading) they do not operate like every other of the 10,000 registrars online. You do not purchase a domain name and manage it individually. You purchase domains and add them to a contract. This contract is the biggest pain in the ass to manage, and prevents you from handling the domains’ accounts directly. You do have full dns control etc. but, they will CANCEL all of your domains in that contract if you have an accounting problem like i did.

My credit card declined on a charge about 2 months ago, i logged in and updated my card info (it had expired), but because my 1and1 account has nothing to do with my contract account, they didn’t just re-run the new card on file like GoDaddy and everyone else does. They instead send me a crappy email that went straight to my spam box (because it included a shit load of ads along with the failure notice) and then proceeded to just cancel every domain in the contract.

Yes, this is a ‘venting my frustration’ post and it is purely based on my experience with them. But i will not be recommending them to anyone for anything.. go with godaddy.

Phil