October 2006 Archives

2006 Oct 28

paypal_logo.gif

Paypal is here!.

Here is the registration page.

If you are using paypal for online payments then the Personal account will enough for you, otherwise if you are planning to have an online store you should get the Premier account. Anyway, if you are living in the Philippines like me, even if you have upgraded your account to Premier account, you would still not able to receive any money, maybe just for now.

You may also Apply for the Expanded Use option for just $1.95 to remove your account spend limit, don't worry the $1.95 amount will be refunded after making your first paypal purchase. You will need to enter the 4-digit number on your credit card statement just before the word PAYPAL to verify the use of the Expanded Use option.

2006 Oct 14

Creating a hyperlink in excel is simple. Notice that after typing any uri in excel the text automatically turned into a hyperlink. You can add any link as you like in excel as long as there is a prepended http:// phrase before the text entered.

Now, what if we are going to add a dynamic URL? It would be best explained by example, so here it goes.

For example: We are asked to check multiple sites for the following internet standards; W3C HTML Validator and WDG HTML Validator.

We have a reference cell A1 have the text http://tildemark.com. We all know the URL for the respective standards as:

W3C - http://validator.w3.org/check?uri=http://www.tildemark.com
WDG - http://www.htmlhelp.com/cgi-bin/validate.cgi?url=http://www.tildemark.com&warnings=yes

Now, all we need to create an entry such that each time we change the domain names the entry on each validator also changes.

Do the following on Excel:

Cell A1 - http://www.tildemark.com

  A B
1http://www.tildemark.com       
2  
3  
4  
5  
...  
9=HYPERLINK
("http://validator.w3.org/check?uri="&A1,"Check W3C HTML Validator")
 
10

=HYPERLINK
("http://www.htmlhelp.com/cgi-bin/validate.cgi?url="&A9&"&warnings=yes",
"Page passed WDG validator")

 

More info at Office Website.

2006 Oct 11

Removing a bunch of hyperlinks can be tedious. imagine the time you have to right-click on each of those links and selecting 'remove hyperlink' on the context menu. Of course it would just take two clicks, but what if you are to remove a hundred of them or perhaps 1000 of them? I'm sure that would scrape out the paint of your right-mouse button. :)

I have some simple techniques you can use in order to remove multiple hyperlinks on a page:

Removing just one hyperlink
1. Right-Click on the cell and select Remove Hyperlink on the context menu.

Removing the cell format
1. Select the cells having hyperlinks. You can use CTRL+LEFT CLICK to randomly select a cell.
2. On the menu click on Edit. Hover your mouse to the option Clear and select Fomats. Please note that the cell is still clickable to remove the hyperlink completely you have to select Clear->All.

Remove hyperlink on selected cells the better way
1. Type in any text or number in a blank cell
2. Right-click and select Copy on the context menu.
3. While pressing CTRL, select each hyperlink you wish to be removed
4. On the Edit menu, select Paste Special.
5. Under Operation, click Multiply and then click OK.

Removing using a macro
Assuming you know excel programming you could create a macro to automatically remove the hyperlinks.
1. Start Visual Basic Editor. Alternatively you can press ALT-F11 to start the editor.
2. Double click the workbook you are using on the Project Explorer.
3. Type the following text:


Sub RemoveHyperlinks()
ActiveSheet.Hyperlinks.Delete
End Sub

4. Save your work.
5. Run your macro by pressing ALT-F8 or using the menu by Tools->Macro->Macros
6. Select the macro you have made, it should have the name 'RemoveHyperlinks'.


2006 Oct 2

I often get this error when i'm installing mysql server and running phpmyadmin. Just in case you are also experiencing the same,

Find your php.ini file. Open your httpd.conf file and look for the PHPIniDir variable. If it is set to C:\PHP then use that ini file.

Open your php.ini file on your php folder usually at C:\PHP. Look for this line


;extension=php_mysql.dll

uncomment the line by removing the semicolon ';'

Look for the loadable extension modules directory called extension_dir, set it to


extension_dir = "c:\php\ext"

You might want to enable mbstring and curl modules as well by uncommenting the following lines on your php.ini file.

extension=php_mbstring.dll extension=php_curl.dll
2006 Oct 2

If you came across to this error while installing apache2, well, heres the fix.

Goto your apache installation folder its usually at:

C:\Program Files\Apache Group\Apache2\bin

Execute this command:

Apache.exe -k install -n "Apache2"

-k install -- tells apache to install an Apache service
-n "Apache2" -- sets its service name to be Apache2
-k start -- Start Apache server
-k restart -- Tells Apache to do a restart

You can then test your installation by typing in http://localhost/ to your browser address bar.

2006 Oct 1

when scraping websites, i usually use the function file_get_contents. However, there are times when we only need a specific portion of the site to get; for instance: getting the title of the site or the description.

Instead of using file_get_contents function we instead use the builtin file fopen and fgets functions like this:

<?php
$url = 'http://www.tildemark.com/';
$fp = fopen( $url, 'r' );          // r means open the site for reading
$buffer = trim(fgets($fp, 1024));  // read the first 1024 bytes of data
print "<pre>$buffer</pre>";
?>

But, using CURL functions will be a lot faster. We will use CURLOPT_RANGE to get the specific amount of data from a specified url. CURLOPT_RANGE defines as range(s) of data to retrieve in the format "X-Y" where X or Y are optional. HTTP transfers also support several intervals, separated with commas in the format "X-Y,N-M".

<?php
$url = 'http://www.tildemark.com/';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RANGE, "0-1024");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec ($curl);
echo "<pre>$content</pre>";
?>
2006 Oct 1

Here's a handy function to get specific tag contents. You could modify the tag you wish to scrape by changing the $start_tag and $end_tag variables. Useful in getting data from multiple html tags.

<?php
function get_tag_contents($start_tag, $end_tag, $url){
$data = file_get_contents($url);
preg_match( "|$start_tag(.*)$end_tag|s", $data, $match);
return match[1];
}
$start_tag = '<p>';
$end_tag = '</p>';
$url = 'http://www.tildemark.com/';
$tag_contents = get_tag_contents($start_tag, $end_tag);
print $tag_contents;
?>


Fell free to modify this code and don't forget to post your changes here.

About this Archive

This page is an archive of entries from October 2006 listed from newest to oldest.

September 2006 is the previous archive.

November 2006 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Recent Activity

Today

  • tildemark tweeted, "im so sleepy. Zzzzzzzz"

Sunday

  • tildemark tweeted, "some of my scipts are not working with godaddy. but works fine on the others. not mention their poorly coded admin page"

Thursday

  • tildemark tweeted, "so many pending tasks i need to finish. need more coffee !!!"
  • tildemark tweeted, "@gmtristan i dont think that is true."

Thursday

  • tildemark tweeted, "how does godaddy subdomain behaves? i have some problems with it on my scripts. it does not seem to accept query strings.."

Monday

  • tildemark tweeted, "i had a hard time removing the error messages generated by surf side kick. i ended up uninstalling most of my applications."

Sunday

  • tildemark tweeted, "i got hit by surf side kick and im getting numerous error messages on my screen. tskkkkk"

Saturday

  • tildemark tweeted, "check boxes, i didn't know they can also be complex"
  • tildemark tweeted, "this smart bro internet speed is depressing, i thinking of filling a complaint to the DTI next week."

Today

  • tildemark tweeted, "the seminar turned out to be leadership training. it was fun, learned alot. i have already attended numerous seminars but this is different."