October 25th, 2009 by admin · 1 Comment
Hi all,
I came across “Simple HTML DOM Parser” recently that allows jQuery like DOM selection. This function is quite handy to do some kungfoo DOM manipulation on the fly!
I needed to use it on codeIgniter so modified the files and integrated it into a single codeIgniter library. The original files can be accessed from here its sourceforge project page. For the codeigniter version of the library click here.
-
$this->load->library(‘domparser’);
-
$html = $this->domparser->file_get_html(‘http://www.google.com/’);
-
$rank = $html->find(‘b.gb1′);
-
-
print_r($rank);
// will show all content of tag with class gb1
For further utility functions of the DOM parser visit this link.
Feel free to comment or contact me directly for any query.
take care,
thephpx
Tags: codeigniter
September 8th, 2009 by admin · No Comments
Today I am going to share a little customization that I do while i develop codeigniter based web application. Now a days in most web application development firms a three-tire development process is followed. This is done to ensure smooth roll-out of the application from development to live.
The three-tire development methodology involves three stages of development servers. First comes the local server which is setup in your laptop or workstation. Then comes the internal test server, which is a central server that holds all the SVN repository as well as hosts the site and make it accessable to all from within the network. This server is also sometimes called staggin server. Last but not the least comes the live server, in most cases its your clients server where you upload your codes after they have passed the QA checks of both local-server and staging-server.
One related aspect of staged development is that in most cases they involve using SVN server for version control. Using SVN, though you can automatically update your server files from SVN server through “svn update” command but if the config file is not configured to take the different servers into consideration you will have to update the config file every time you do update on a server or set separate config file on each server and add the file to ignor list of the SVN repository.
Our way of doing it is to use a single config file and make it lookup the host address to determine which configuration settings to use. If you are familiar with codeigniter then you already know you will find your config file at system/application/config/config.php.
Find the following line in the config.php file:
-
$config[‘base_url’] = "http://localhost/codeigniter/";
Replace the line with the following lines -
-
if($_SERVER[‘HTTP_HOST’] == "localhost"){
-
$config[‘base_url’] = "http://localhost/codeigniter/";
-
}else if($_SERVER[‘HTTP_HOST’] == "192.168.1.1"){
-
$config[‘base_url’] = "http://192.168.1.1/codeigniter/";
-
}else{
-
$config[‘base_url’] = "http://www.live-server.com/codeigniter/";
-
}
Now all your URL’s will be adjusted based on the server the site is accessed from. Next we will modify the database.php file which is also located in system/application/config/database.php
Find the following line(s) in the database.php file:
-
$db[‘default’][‘hostname’] = "localhost";
-
$db[‘default’][‘username’] = "root";
-
$db[‘default’][‘password’] = "";
-
$db[‘default’][‘database’] = "restobolivia";
-
$db[‘default’][‘dbdriver’] = "mysql";
-
$db[‘default’][‘dbprefix’] = "";
-
$db[‘default’][‘pconnect’] = TRUE;
-
$db[‘default’][‘db_debug’] = TRUE;
-
$db[‘default’][‘cache_on’] = FALSE;
-
$db[‘default’][‘cachedir’] = "";
-
$db[‘default’][‘char_set’] = "utf8";
-
$db[‘default’][‘dbcollat’] = "utf8_general_ci";
Replace the above line with the following once:
-
if($_SERVER[‘HTTP_HOST’] == "localhost"){
-
-
$db[‘default’][‘hostname’] = "localhost";
-
$db[‘default’][‘username’] = "root";
-
$db[‘default’][‘password’] = "password";
-
$db[‘default’][‘database’] = "database_name";
-
$db[‘default’][‘dbdriver’] = "mysql";
-
$db[‘default’][‘dbprefix’] = "";
-
$db[‘default’][‘pconnect’] = TRUE;
-
$db[‘default’][‘db_debug’] = TRUE;
-
$db[‘default’][‘cache_on’] = FALSE;
-
$db[‘default’][‘cachedir’] = "";
-
$db[‘default’][‘char_set’] = "utf8";
-
$db[‘default’][‘dbcollat’] = "utf8_general_ci";
-
-
}else if($_SERVER[‘HTTP_HOST’] == "192.168.1.1"){
-
-
$db[‘default’][‘hostname’] = "localhost";
-
$db[‘default’][‘username’] = "root";
-
$db[‘default’][‘password’] = "password";
-
$db[‘default’][‘database’] = "database_name";
-
$db[‘default’][‘dbdriver’] = "mysql";
-
$db[‘default’][‘dbprefix’] = "";
-
$db[‘default’][‘pconnect’] = TRUE;
-
$db[‘default’][‘db_debug’] = FALSE;
-
$db[‘default’][‘cache_on’] = FALSE;
-
$db[‘default’][‘cachedir’] = "";
-
$db[‘default’][‘char_set’] = "utf8";
-
$db[‘default’][‘dbcollat’] = "utf8_general_ci";
-
-
}else{
-
-
$db[‘default’][‘hostname’] = "localhost";
-
$db[‘default’][‘username’] = "root";
-
$db[‘default’][‘password’] = "password";
-
$db[‘default’][‘database’] = "database_name";
-
$db[‘default’][‘dbdriver’] = "mysql";
-
$db[‘default’][‘dbprefix’] = "";
-
$db[‘default’][‘pconnect’] = TRUE;
-
$db[‘default’][‘db_debug’] = FALSE;
-
$db[‘default’][‘cache_on’] = FALSE;
-
$db[‘default’][‘cachedir’] = "";
-
$db[‘default’][‘char_set’] = "utf8";
-
$db[‘default’][‘dbcollat’] = "utf8_general_ci";
-
-
}
The above code will give the server specific database configuration to the application based on the server it is accessed from.
Now save these two files and test your application you should be able to use the same config.php file in different servers if they are properly configured on config.php and database.php
For any further query feel free to leave a comment I will try my best to help you out.
take care,
thephpx
Tags: development · efficiency
August 6th, 2009 by admin · No Comments
On my endeavor to find the perfect SCRUM project management tool I came across a freeware option named “Sprintometer”. It is not entirely free as it sounds but the options it gives to a manager for free is quite outstanding. The application can be downloaded from their website { sprintometer.com } for free.
Sprintometer support project mangement in both XP and SCRUM methodology. Once you create a project it first of all asks the way the project is going to be managed. Then onward a product backlog can be prepared with stories and tasks assigned to it. Each task then can be assigned to a developer or a coder or a tester.
On the basis of the project specification the application itself generated some very useful charts that give the manager a good understanding about where the project is actually heading. Some of these charts are -
- Track Chart: Tracks the amount of work done and the amount of work remaining through a line graph.
- Scope Chart: Shows in hour(s) the amount of work left against a story.
- Resource and Budget Chart: A matrix showing the resource and cost both story-wise and day-wise
- Story Readiness Chart: Shows how much closer to completion a story is through a table.
- Summary Report: Gives a overall report about the story in terms of work done, remaining and days left.
- Workload Report: This shows the amount of workload taken on by each project team members.
From a project manger perspective it gives me a complete hold on where my project is heading. But the only thing it lacks is integration of team members to give their inputs directly to the system. Hope they are working on it and will be made available to the freeware version in near future :p
take care,
- thephpx
Tags: development · efficiency
August 2nd, 2009 by admin · No Comments
Most of today’s site uses PNG images due to use of transparencies. While they give a fine solution to the transparency problem with finer edge but it also brings about page load time issues.
To solve this problem i recently came across a PNG file compression utility. This tiny utility is hosted on Source Forge and can be downloaded from here. This utility claims to have compressed PNG files upto 50%.
Though the utility is somewhat crude and runs in command prompt but there is a nifty post about how to call it from the windows shell.
For the shell add-on you may visit the following post.
take care,
- thephpx
Tags: design · development · efficiency · graphics · xhtml
August 1st, 2009 by admin · No Comments
Hello everyone,
Every developer has there very own zen settings so do i
. Today I am going to writing about the stuffs I use while I am at development. If you have any better alternatives or suggestions to these applications please feel free to come forward
My preferred application development platform includes the following -
Local Work-Station/Laptop:
Central Repository Server Applications:
- WAMP – for basic windows, apache, mysql, php server on central repository
- Free SMTP - for SMTP server on the central repository
- KpyM Telnet/SSH Server – for SSH access to my central repository
- VisualSVN – for SVN repository server management at central repository
That is the whole host of applications that are involved in my development process which I find very helpful and agile. I work on two-stage development, my local workstation/laptop and then to my central repository where I host my SVN repositories and also live demos.
The two stage method has so far proven extreamly helpful, specially if you have a VPS account where you are at your will to install applications.
I hope this one helps you setup your zen environment :p.
take care,
- thephpx
Tags: development · efficiency · mysql · php
July 31st, 2009 by admin · No Comments
Hello everybody,
I am back at blogging. This is just the starter hope to come-up with some solid posts ASAP!
So, hang-on and keep visiting
- thephpx
Tags: Uncategorized