In our previous post we explained how to use EditPlus to transform a list of values into an array. This time we will show you how to transform a <select> tag and its options <option> into an array. By doing this, you can easily convert a list of values from a web page into an array to use in your own applications.
First, you need to get an overall idea what we did in our previous post.
Then, just modify the first step and use this rule to replace a regular expression:
Find What: ^(.*)value="([0-9]*)">(.*)</option>
Replace With: \3

By using editors that support regular expressions you can easily transform a list of values or options into a PHP array that later will allow you to create more complex things like options on a <select> tag.
1. Get the list of values
Once you have the list of values, it will show something like this:
2. Replace each line
To replace each line between quotes, we can use the following regular expression:
Find: ^(.*)
Replace With: "\1",
3. Complete the beginning and end of the array
To complete the beginning and end of the array just need to use the PHP array format assigning it to a variable.
$list = array(
"Agiortiko",
"Aglianico",
"Airen",
"Albana",
"Albarinho",
"Albarinyo",
"Albillo",
"Alfrocheiro Preto",
"Aligote",
"Aragonez",
"Arinto",
"Arneis",
"Assyrtiko",
"Auxerois",
"Baboso negro",
"Bacchus",
"Baga");
Then, $list is ready to be used in your application with the list of values.
Using Git is pretty much similar than SVN in many senses. However, the first time you use it will encounter some minor differences, for example when you try to do the first Checkout (or Clone in terms of Git).
A couple of good resources for Git beginners.
Installing TortoiseGit on Windows
This article explains how to install TortoiseGit on Windows.
This article covers many aspects related to the transition from Subversion to Git, and as described here you can know the reasons to use Git instead of Subversion:
Why Switch?
There are several advantages to using git over other version control systems:
- Being a distributed version control system, everyone has their own version of the whole repository. The central repository (at GitHub in my case) is just arbitrary. This means that you can do operations such as tagging, branching and diff without having to be connected to the central server. This article by Eric Sink is a good explanation of how git differs from traditional version control.
- Due to the git:// protocol and the way git stores and tracks the data and changes in repositories, it’s really fast and the repositories don’t take up much room on disk.
- Quick, cheap, easy branching.
- The repository and branches are separate from the filesystem.
- GitHub. Why go to the trouble of hosting a central repository yourself, when you can do it securely, cheaply and quickly with GitHub? There’s Sourceforge for svn, but for me GitHub does it better. If you can get to grips with GitHub, it opens up a world of possibilities for publishing or consuming open source code.
Using ezPDF you can create nicely PDF documents in PHP.
Here is a function that will help you to add Page numbers on each individual page.
$this->ezStartPageNumbers(750,590,10,'','',1);
If you are having issues when using the SUM() function with time values in Google Spreadsheet, then please make sure you are using the format Hours and not Time in your cells.
Then, try adding the new sum cell using for example SUM(A1:A10) when A1 to A10 means the column/rows containing the values to sum.
This could be an usual problem while dealing with timesheets or time tracking on a Google Spreadsheet.
Replacing text in a MySQL table is easy if you have a client like phpmyadmin to run SQL commands.
update wp_downloads set file = replace(file, 'download/', 'downloads/');
Unfortunately Amazon S3 don’t support (until this post was published) to rename buckets or objects. The way you can rename it is downloading, renaming and uploading again the object. That is really a lack in Amazon’s product but they say will support this functionality in the near future.
If you use Subversion to update your published web pages, you can avoid the access to any .svn directory by adding some rules to .htaccess file. The files under these folders produce a vulnerability on security checks.
RewriteEngine On
RewriteRule ^.svn/(.*)$ http://www.netvivs.com [R]
If you are spending a nice holiday at South Africa and interested in renting cars there, you can hire unlimited Km. cars or vans. The major companies like Avis, Budget or Thrift have support for online orders.
If you like soccer (football) then probably you are interested in spending vacation in South Africa to see 2010 worldcup. Now is possible to purchase tickets online. If you buy tickets online in advance then you can search for exclusive offers and sales before waiting for Worldcup season.