About a month ago I started working with the CodeIgniter framework. It’s the first framework I have worked with and frankly, I love it!
So I was looking to add a second parameter to a form_validation callback. Here’s what I found:
$this->form_validation('user_name', 'name', "callback_test_name[$param2]");
and the callback:
test_name($name, $param2){
..// some logic to return
}
The form_validation class uses the form value as the first parameter, and you can pass the second parameter in the arguments as you would with any other rule references. (First snippet)
At first I was calling 2 validations. First the standard type of validation, then another validation on the same input. * BAD IDEA *
There were some issues with order of operations. I found it best to chain the whole lot together. Like so:
$this->form_validation('user_name', 'name', "required|min_length[10]|callback_test_name[$param2]");
I hope that helps anybody with the same question.
I was on the hunt not only to find the different variations each courier had for their tracking numbers but also a regex to match. Most of the google fu I found was outdated. Fedex “recently” (months? years? days?) changed from a 12 digit to 15 digit system. And NO, tracking numbers are not totally random. There is usually a space separation on the printed labels you see. Each of the spaced out subsets have a meaning to the courier as well as a checksum. Checksum being, a pre selected sequence of particular number positions added together then divided by a pre selected number. That you can search up yourself if you like. I didn’t find all too much on that matter either.
I am not very good with regex so if there are any suggestions by l33t coderz, they are more than welcome. On with the codes:
/****
[ UPS ]
9 digits, or 1Z+whatever digits
The quick brown fox 1Z9999W99999999999 jumps over the lazy dog.
*/
$ups = '/(\b\d{9}\b)|(\b1Z\d+\b)/';
/****
[ Fedex ]
12 digits, 15 digits, or '96'+ 20 digits
The quick brown fox 999999999999 jumps over the lazy dog.
*/
$fedex = '/(\b96\d{20}\b)|(\b\d{15}\b)|(\b\d{12}\b)/';
/***
[ USPS ]
30 digits, '91'+20 digits, 20 digits (untested)
< TOTALLY UNTESTED BY ME AT THIS TIME >
*/
$usps = '/(\b\d{30}\b)|(\b91\d+\b)|(\b\d{20}\b)/';
I did get the common characters per courier from Packagetrackr. I don’t know how much of it is accurate, but from what I could tell from my experience with FedEx and UPS it seemed to be in line. I was unable to find an all inclusive source.
6:20 Intro, and new people introducing themselves to the group.
6:27 Aaron talked about his car, and introduced Kevin Schroeder, Zend Technolgies tech evangelist.
6:30 Kevin tells us of his background (cool nerdy stuff)
A book he wrote
Kevin offered $100 off zendcon in our group, as well as a drawing for a free ticket (1,400 value).
Drawing for a free version of Zend studio at tonights meeting.
In my opinion live blogging is very distracting to me…
Kevin is going into the framework now and it will take about an hour. Im done bloggin for now…
Zend Studio is pretty cool. Especially code tracing.
7:20 break time.