winter's blog

Get the Full URL for Referrals and Organic Sources in Google Analytics

in

One of the great new features of Google Analytics is the ability to get the Referral Paths for a Referring Site. You can do this by going to 'Traffic Sources > Referring Sites' and then click on one of the sites listed. The first thing that you will notice if you do this is that it is just the Request URI from the Referring Site with no domain or query parameters. If the site is a dynamic site then there is no way to see exactly where the visit came from. I have come up with a solution for this problem.

How to hide your iframe from Search Engine

in

 "rel=nofollow" is not a recognised attribute for the <iframe> tag according to W3C specs.
 
 Use some javascript and document.write to place the iframe code on the page. You'll still need to make sure that the url is recognised as being a url, so I'd suggest first passing the html through the javascript escape() function, then copying and pasting that into the javascript code:
 
 <script type="text/javascript">
document.write( unescape('your%20escaped%20html%20code') );
</script>

How to join results with UNION in MySQL?

in

The UNIONs were introduced in MySQL 4. The unions are useful if you wish to join the results from more than one query, but be aware that the number of the returned columns by each select query should be the same.
(as well as their type)
 
The very simple example below show you the basics of the UNION statement
 
SELECT id, name FROM my_table
UNION
SELECT id, name FROM my_table;

How often does Google Analytics update?

in

 I have often wondered how often Google Analytics updates and I set out to find that out today. One thing you need to keep in mind, regardless of how often it updates or refreshes, is that the best time to view your stats is the next day. You will notice that if you check your stats at 2-3 am it will account for every hour, but when you view the stats at around noon, the actual number of visits and keywords used to reach your site has risen.

How To Restart an Apache Web Server (Linux)

in
  1. Login to your Web server machine using SSH or telnet.
  2. Su to root.
  3. Run the apache control program:
    apachectl graceful
  4. You can also run the apache control program in this way:
    apachectl restart

To stop it : apachectl stop

Vietnamese characters for pathauto.

in

We know to use pathauto module in drupal to make URL friendly but the default file i18n-ascii.txt not support Vietnamese characters.

For sample , your title "Tường thuật trực tiếp giải bóng đá Tây Ban Nha Villarreal gặp Barcelona" would be :

 

t%C6%B0%E1%BB%9Dng-thu%E1%BA%ADt-tr%E1%BB%B1c-ti%E1.....

 

but if you Vietnamese filter :

 

tuong-thuat-truc-tiep-giai-bong-da-tay-ban-nha-villarreal-gap-barcelona

 

Very nice , huh?

Use regex (preg_match_all) to extract e-mail from a page

in

When parsing a site to harvest e-mail , we use Regex with preg_match_all() function to get all e-mail but the problem is that in some html,  user type email like that : abc @ gmail.com
 
How we solve this issue. Use this regex pattern:
 
$pattern="/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i"; preg_match_all($pattern, $html_page, $matches);
 
That pattern will extract all type of email.

Use the wget command to download files to a remote Unix/Linux workstation

in

Suppose you're working on a Unix/Linux machine remotely through an SSH session, and then you need to get a resource (like a tar or gzip file) that's on the Internet to that machine. Well, you could download that file to your local machine, and then use scp to copy it to your remote Unix box. Or ... you can get the URL for the resource on your local workstation, copy the URL, and then use wget on the remote workstation and download it directly to that machine.

Drupal Multi-site - Hosting Multiple Domains from a Common Codebase

in

Drupal multi-site has the advantage of using one codebase for multiple websites and therefore enabling an administrator to centrally maintain and upgrade the code while serving similar or different content to different website on different domains.

Generate revenue from your site

in

If you have a blog or a content site, now you can generate revenue from the effort that you make to publish your work.

Google has a program named AdSense that lets you generate revenue by placing relevant text advertising in your site pages.

This site has been making significant revenue by placing Google AdSense ads. You can do the same even if your site has low traffic or even if the site content is not in English.

Stop working for free and be paid for providing valuable content to your site users.

Syndicate content