November’s Cloud
Posted by mkhairul - November 27, 2008 at 08:11:46 am - No CommentsCategories: blog
I missed the deadline for this month’s cloud. I was too deep inside some code for a new application, the Master Plan, that I forgot all about the cloud.

Making jQuery selector/contains case insensitive
Posted by mkhairul - November 26, 2008 at 03:11:49 pm - 2 CommentsCategories: Troubleshoot, blog, code
Just another stuff from work. There’s huge list to select people to be put into groups in the LMS. I added a javascript function for the user to type in a name and it will search and select a user in the list box.
I use Selector/contains for this but the problem is, it is case sensitive. That’s gonna be a problem to type in the exact case from the list. Here’s a snippet to extend the selector.
jQuery.extend(
jQuery.expr[':'], {
contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
});
Took the snippet from StackOverflow, but it has a typo.
CodeIgniter 1.7 DBForge Error (Array to string conversion error)
Posted by mkhairul - November 20, 2008 at 11:11:13 am - No CommentsCategories: Troubleshoot, blog, code, codeigniter, php
I think the ellislab team is swamped with bug reports and stuffs. But I’m sure the next release will solve this problem.
I found this solution at the forum, CI 1.7 Forge Problems. Basically what you need to do is find DB_driver.php inside the database folder. Go to function _protect_identifiers (most probably on line 1193).
Add in this code (inside the function).
if (is_array($item))
{
$array = array();
foreach($item as $one)
{
$array[] = $this->_protect_identifiers($one, $prefix_single, $protect_identifiers, $field_exists);
}
return $array;
}
Alright, that should fix it up.
Master Plan
Posted by mkhairul - November 19, 2008 at 02:11:13 pm - 1 CommentCategories: blog
There is a new assignment. I am being assigned to create a system for the Master Plan! Woah! Sounds like a notorious scheme by the Masters of Evil. But alas it is not.
It is a collection of forms that creates a timeline for specific types of stuffs. Its a form generator something like Wufoo. But with specific custom needs, like a DataTable. I went through all the examples and some other examples from other developers but none to my liking.
There’s a datagrid plugin called Flexigrid for jQuery but then again, there’s all this hurdles that I have to go through to make it perform certain stuffs and I don’t like to constraint myself inside that type of UI.
After browsing through Smashing Magazine’s Pricing Table Examples and Best Practices. I’ve decided to use jEditable to accomodate a normal table with the function that I need by just putting in an inline editable feature to it.
The deadline is in 10 days. The system must be functional on 1st December. Let the death march begins!
Adding confirm dialogue box for delete links with jQuery
Posted by mkhairul - November 15, 2008 at 01:11:33 am - 6 CommentsCategories: Tips, blog, code
I use this all the time. Its simple, clean and gracefully degrades. Even though its simple some people might miss it. So I post it here.
$('.delete').click(function(){
if(!confirm('Are you sure you want to delete?'))
{
return false;
}
})
By returning false you stop any action from the link (redirecting you to the url)
You can see the demo here.
Form Snippets for CodeIgniter in Komodo Edit
Posted by mkhairul - November 13, 2008 at 12:11:03 pm - 1 CommentCategories: blog
Here’s a code snippet(in CodeIgniter) for creating a submit function inside a controller. I use this all the time.
$rules[''] = '';
$fields[''] = '';
$this->load->library('validation');
$this->validation->set_rules($rules);
$this->validation->set_fields($fields);
if($this->validation->run() === FALSE)
{
$this->
}
else
{
$timestamp = strtotime('now');
$data = array(
'' => ''
);
$this->load->model('', '');
$this->session->set_flashdata('misc_success', '');
redirect();
}
I intentionally left some stuffs inside there, which is supposed to be filled anyway.
This is usable but it can be better. I’ll try to elaborate in the next post, or the post after the next. As soon as I finish up an example.
Debugging an SQL Query
Posted by mkhairul - November 12, 2008 at 11:11:26 pm - No CommentsCategories: Tips, Troubleshoot, blog, code
So, I debugged an error for a good friend recently. Only certain kind of item would be displayed, everything else was not found in the search. The first thing I suspect is the SQL Query. I printed out the SQL Query and tried to debug it.
The first thing I did is to arrange the SQL Query in a readable manner.
Since I do not have the time to follow the trail from the SQL Query manually, I just comment out 3 conditions at a time, and add a condition each time until the item was found. In the above picture, I’ve found the culprit its the one below the commented out line.
When I commented out the line, the results for the keyword appeared as follow.
So thats the divide and conquer part. So now I know the problem is with the commented out criteria and the one below it. I traced it back to its table (products_to_categories) and found out that the category_id value is empty. Thats why it can’t join in with the categories table and thus there’s no result.
So what did I do? I told my friend about the problem, explained it to him (I gave him a couple of screenshots to explain the problem) and gives him a solution. UPDATE products_to_categories SET categories_id = xx. So that all the item have a category and will be displayed when it is searched by the application.
Erm, yeah. Thats about it.
Disappointing and frustrating
Posted by mkhairul - November 11, 2008 at 03:11:47 pm - 3 CommentsCategories: blog, rants
Right now I can’t think of anything. There’s too much stuff in my mind and my train of thought just wanders aimlessly to one subject to the other and my attention span is the size of a gnat.
Between that and my frustration from lack of communication within the team, it just felt like taking a blow with a sledgehammer in the chest. It brings you down, lying on the floor, barely alive in the pool of your own blood with every bit of hope crushed out of your lungs. Its the feeling of helplessness that is too much to bare. After 5 months of relentless effort to nurture communication between team members, I felt as though I have accomplished nothing. There is still very little communication.
A typical day would be like this.
*comes over to teammate cubicle*
Me: "Whats up? What are you guys people doing?" ("Korang tengah buat ape?")
*long explanation of the tasks at hand which they can solve*
Me: "Ok, cool. Just don’t forget to log it into the Issue tracker and update the wiki"
Teammate: "But I don’t have time. I’m very busy, you know"
Me: "So you’d rather answer phone calls over in the weekend when something happens than write about it? We are a team we need to know how to solve problems that the team members have already solved. We must not think as many but as one!" (My ramblings continues.. )
Continue reading Disappointing and frustrating…
Adding a new feature to a project
Posted by mkhairul - November 6, 2008 at 03:11:27 pm - No CommentsCategories: blog
I thought of this process after a meeting with our Counselor and Solution Architect. The discussion was brief, the counselor discusses some stuffs up-front with the solution architect, and then the SA called me up and explained it to me, since I also think the feature is suppose to be in the system, there was no objection, I agreed and proceed with the implementation (its a very small system, we didn’t need to do any of the review and approval kind of stuffs).
Since I want to track all this stuff up, and make it available for other people (in the company) to see the activity inside the project, I log the issue inside Mantis the Issue Tracking System. I put in as much detailed information as I can to avoid any vague description of the problem. But wait! The version information for the project is missing, I didn’t write up any docs for version 0.1 (because there wasn’t a need for it at that time, its a small insignificant system after all), so I went into the manage project settings and add in a few version (0.1, 0.2, 0.3). Report the issue and went ahead and branch the trunk into 0.1. (for any of you unfamiliar with Branch and Trunk, its a term we use in Version Control , for more information head to A Visual Guide to Version Control ).
After branching for 0.1, I branched the trunk again for 0.2 to implement the new feature. I know there’s more procedure to it than this but for this kind of small project, I’d rather skip it and get something done.
As soon as I’m done implementing this feature, I’d better write up some docs to help people modify the stuff up (if they want to, but I highly doubt anyone would want to), just in case. Now, I have to put this stuff up into the wiki in bullet points so the team would/might read it.
Steam Problem
Posted by mkhairul - November 4, 2008 at 10:11:34 pm - No CommentsCategories: Troubleshoot, rants
I bought fallout 3 using steam (digital distribution service from Valve), the first problem that I had was updating steam. I downloaded steam through their site and installed it normally. When I run steam, it updates something and then it can’t find a DLL (steam.dll). Searched through the forum on the net, found some answers, try it out, still the problem persists.
I went ahead and find steam.dll, downloaded it, and it says can’t find steamui.dll. I downloaded that too and continued, it updates just fine.
Few hours ago, when I arrived home from work, ran steam and it doesn’t load. It says there’s no connection to steam. I deleted cleanregistry.blob and still no luck (but this time all the login info is lost). Restored the blob file and restarted the router. Finally it runs smoothly. This is some crappy software that valve have. Time to shoot some mutants!
GimpStyle Theme design by Horacio Bella.






