Archive

Posts Tagged ‘tool’

JS Bin

March 12th, 2009 No comments

JS Bin is an online tool that allows you to test JavaScript without having to muck about with files. You can just quickly cut and paste some code in and view the output. It is even possible to make the code you are looking at public and then use this as part of an ajax call in another instance of the application.

To get you started there is a nice help section, which also includes a couple of videos.

JS Bin

This tool really impressed me, especially the easy inclusion of several different JavaScript frameworks. I don’t mind testing JavaScript, but sometimes I just want to run a little bit of code on it’s own to see why it isn’t working as I expected it would. This tool fills that much needed gap, and the addition of allowing other people to view your code is a very nice feature. Well worth a look!

Automated Build With Phing

January 2nd, 2009 No comments

Phing is a PHP tool that allows you to build projects. Phing stands for PHing Is Not Gnu make, which is kind of a common coder’s joke. It is basically a tool that will take a set of files in multiple directories and create either a zip file or a numerous other things that you might want to do with a project.

Phing itself is a PHP program, so all that is needed to run it is a working copy of PHP. Also, because Phing is part of PEAR it is easy to install, and you don’t need to install Apache to run it.

Over the next few posts I will be talking about the sort of things you can do with Phing, how to install it, how to create zip files and how to use variables to simplify things.

Categories: PHP Tags: , , , ,

Manage MySQL Databases With phpMyAdmin

August 7th, 2008 No comments

phpMyAdmin is a tool, written in PHP, that allows you to handle the administration of a MySQL database server. You could always download the MySQL GUI tools, but the problem there is that you need to give external access to a user account, which isn’t always possible to do. This is where phpMyAdmin steps in.

Manage MySQL Databases With phpMyAdmin

The tool is easy to use and I have done some tricky stuff with it in the past. It can do everything that you need it to do with MySQL.

I have tried to install phpMyAdmin a couple of times and have failed each time. Admittedly, I only attempted it half-heartedly, but this is the only stumbling block I can see in the average user trying to use this system. However, many hosts will give you access to this tool as part of the hosting package, and it is only really needed if you expect to do a lot of database administration otherwise you can just run PHP scripts.

The website contains extensive documentation, and even if this isn’t enough there are a few books available for the tool.

reWork: A Regular Expression Workbench

March 21st, 2008 No comments

Regular expressions are a very useful tool for any programmer wanting to validate input, format strings, change words, reformat data or even split apart a string into an array. However, when you are starting out, writing them it can be hard going, they are not very easy to learn and the only way to really understand them is to practice, practice, practice.

This is where reWork steps in. It is a fully functional online regular expression workbench that will allow you to plug the expression and the text in one end, and it will show you exactly what is being matched. This simple JavaScript program is far better than any stand alone application I have seen and has more functionality than you could even think about.

reWork: Regular Expression Workbench

I have often wondered why a program wasn’t working and found that I had written an expression incorrectly so that the correct string wasn’t being found. reWork has been a real help on those occasions. I especially like the fact that I can get an expression ready and then copy the JavaScript or PHP code from the bottom of the page.

If you are starting out you should get yourself a decent regular expressions book, and then use this tool to see what an expression does and how they work. However, this tool is exceedingly useful for seasoned developers. Go ahead and try it!

Apache Bench Tool

February 25th, 2008 No comments

The Apache Bench tool can be found in the bin directory of any standard instillation of the Apache HTTP server. It can be used to test the response times of any web server you want and can be useful if you want to stress test a mission critical server before it goes live.

To use the tool open a command prompt (or terminal), navigate the Apache bin folder and find the program ab, this is the Apache Bench tool. The simplest form of running the tool is to use a single URL. However, you must enter a full file name or the tool will give you an invalid URL error.

./ab http://www.google.com/index.html

This gives the following output.

Benchmarking www.google.com (be patient).....done
 
Server Software: gws
Server Hostname: www.google.com
Server Port: 80
 
Document Path: /index.html
Document Length: 231 bytes
 
Concurrency Level: 1
Time taken for tests: 0.94090 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Non-2xx responses: 1
Total transferred: 590 bytes
HTML transferred: 231 bytes
Requests per second: 10.63 [#/sec] (mean)
Time per request: 94.090 [ms] (mean)
Time per request: 94.090 [ms] (mean, across all concurrent requests)
Transfer rate: 0.00 [Kbytes/sec] received
 
Connection Times (ms)
  min mean[+/-sd] median max
Connect: 41 41 0.0 41 41
Processing: 52 52 0.0 52 52
Waiting: 51 51 0.0 51 51
Total: 93 93 0.0 93 93

In this example, the tool has made a single request to the Google server. Apache Bench can be made to complete multiple, concurrent requests to the server with the addition of two flags. The first flag is -n, which is used to tell Apache Bench how many tests it should run, if the number 5 is used, the tool will repeat itself 5 times. The second flag is -c, which is used to tell Apache Bench how many concurrent connections should be made. The following example repeats the original test, but this time uses the -n and -c flags to run the tests 10 times, with 10 connections each time.

./ab -n 10 -c 10 http://www.google.com/index.html

This produced the following output.

Benchmarking www.google.com (be patient).....done
 
Server Software: gws
Server Hostname: www.google.com
Server Port: 80
 
Document Path: /index.html
Document Length: 231 bytes
 
Concurrency Level: 10
Time taken for tests: 0.229686 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Non-2xx responses: 10
Total transferred: 5900 bytes
HTML transferred: 2310 bytes
Requests per second: 43.54 [#/sec] (mean)
Time per request: 229.686 [ms] (mean)
Time per request: 22.969 [ms] (mean, across all concurrent requests)
Transfer rate: 21.77 [Kbytes/sec] received
 
Connection Times (ms)
    min mean[+/-sd] median max
Connect: 41 55 9.1 55 68
Processing: 54 100 37.9 87 164
Waiting: 51 97 37.8 83 159
Total: 95 155 43.9 149 229
 
Percentage of the requests served within a certain time (ms)
50% 149
66% 175
75% 189
80% 210
90% 229
95% 229
98% 229
99% 229
100% 229 (longest request)

When running the tool on your own server you will rarely see times like this. For example, when running the tool with the same parameters on a local server with a standard WordPress install it longest request time was 4227.

To find out a list of the options available just type in the following.
./ab -h

Categories: Apache Tags: , , , , , ,