Month: September 2018

Backup MySQL and Ubuntu to Dropbox automatically

Recently I was looking for a solution to backup my website and the MySQL database to a Dropbox account…

These are the steps you’d want to follow:

  1. Get the DropboxBack script from:
    follow the instructions here to install:
  2. Install rar on your server:
    apt-get install rar
    # if it fails, follow this post: install rar on ubuntu
  3. Setup cronjob that will run it daily. example (runs every day at 12 o’clock):

    # m h dom mon dow command
    0 12 * * * /bin/bash /root/

  4. If during the backup process, you notice the following error:
    mysqldump: Got error: 1044: Access denied for user ‘root’@’localhost’ to database ‘information_schema’ when using LOCK TABLESThen do the following:
    # login to mysql
    $ mysql -u root -p#And type:
    mysql> GRANT SELECT,LOCK TABLES ON DBNAME.* TO ‘username’@’localhost’;
    (replace the username with the actual user that you see in the above error message).
No Comments

Categories: Uncategorized

Captcha solution using ASP 3 & JS (source included)

Few years ago, I was looking for a simple way to embed a captcha solution on one of my sites (that was hosted on a shared IIS web-server). I looked all over for a captcha solution that won’t require installing an external DLL or connecting to a remote captcha server that will slow down the process (such as reCaptcha).

Back then I was coding in ASP3, so I decided to write my own class to do the job, and I named it “Captchavator”.

I’ve planned to release it to the public… but never did (I just forgot about it).

Last night, while I was browsing my HDD, I stumbled upon the Captchavator folder and the decided it’s time to make a move :)

You might say that ASP 3 is obsolete… and I’ll say “true, true…”, but since there are still many old sites out there, I think that even even if one person will find this useful, then it was worth releasing…

So what’s so special about this solution?

  • It requires your web-server to support ASP 3, Javascript and nothing more
  • Does not require installing any com/activex object on the server
  • Does not require storing images on the server
  • Developers can generate their own captcha characters using the included “painter” tool
  • Does not use any database to operate
  • Can be used with any shared hosting IIS web server

How can you use it?

The process is very simple and involves 4 simple steps…

Step 1 – Include the captcha class in your ASP page.

Step 2 – Create an instance of the Captchavatorobject

Set objCaptcha = New Captchavator

Step 3 – Generate a new captcha (pass the length of the requested captcha, in the following example, I’ve asked for a 6 chars long captcha).


Step 4 – Print the captcha


To validate the captcha, following these steps:

Step 1 – Include the captcha class in your ASP page.

Step 2 – Create an instance of the Captchavatorobject

Set objCaptcha = New Captchavator

Step 3 – Check if the passed POST/GET parameter matches the captcha

objCaptcha.Validate( Request(“txt1″) ) ‘will return true if validated successfully!

What’s included in the archive?

captcha.asp – This is the main Captchavator class

captcha_painter.asp – Use this file to generate your own captcha characters. Please note the painter only works with Internet Explorer (I’m too lazy to fix it to work with FF).

demo.asp – Demonstration of the complete process

I sure hope you’ll find this useful….

No Comments

Categories: Uncategorized

The hunt for Google weather API alternative (since Google just killed their weather API)

Not so long ago (on January 2012), I’ve written about the Secret Google Weather API. Surprisingly, few days ago, Google decided to secretly shut down the Google Weather API entirely.

Many developers (including myself) who were relying on the free Google Weather API were left hanging in the air and began looking for a proper alternative to the free Google weather API .

My requirements for the Google Weather API alternative were as follows:

  •  The API should provide existing weather conditions for a given city name / coordinates.
  • International (should support at least the main cities world wide)
  • Should support at least 3 days weather forecast.
  • And last but not least… should be 100% FREE!

My personal hunt for an alternative for the Google Weather API took about an hour,  and I came up with the following findings…

  1.– very nice projects with a free & open API that will let you retrieve the existing weather conditions in every country in the world
    PROs: absolutely free
    CONS: doesn’t seem to support weather forecastsSample JSON response:
    PROs: includes city weather reports (including forecasts).
    CONs: there’s a cap of 500 call per day (plus 10 per minute) for the free plan.API :
  3.  weather service from the Norwegian Meteorological Institute ( and the Norwegian Broadcasting Corporation.
    PROs: Free, 6 millions including 3 days weather forecastAPI: translation)
    I haven’t tested this service, but it looks promising…
    PROs: free including 3 days weather forecast.
    CONs: owners request developers not to excess 500 requests per hour (see FAQ:

I’m sure there are many more alternatives that I haven’t covered… so if you are familiar with another 100% FREEservice, please post a comment.

No Comments

Categories: Uncategorized

Free weather API (secret Google Weather API)

The other day, I was looking for a free weather forecast api for a project I’m working on. I managed to find a few, but the one that seemed to be the fastest and easiest to implement was  ”The secret Google Weather API” (that’s the way it was called in few posts I’ve read).

Anyhow, the “Free Computer Advice” blog, had a nice post that explained how to use this weather API with PHP, but since the site went down on Dec 2011 it’s not accessible anymore.
Luckily, I managed to snag the post’s content from Google Cache before it was removed entirely, so here it is for your pleasure.

Google Weather API

Every web designer has at one point or another been asked, “How can I get weather on my site?” The old answer was to have a giant ugly weather channel gadget. Something that looked very nasty and you couldn’t un-brand it no matter what. Some used an iframe to display external data and have it appear to be on their site. Lastly you could always just have a link that says ‘click here for weather’. My goal was to get weather data from an external source and be able to customize how it looks. Fortunately now there are some great resources out there. I’m going with one that is my favorite, something extremely easy to use and customize – Google’s Weather API.

To start lets pull up the URL in your browser.,ny

You’ll see XML data of the weather in New York! Easy enough, let’s take a look at the output.

  1. <xml_api_reply version=”1″>
  2. <weather module_id=”0″ tab_id=”0″ mobile_row=”0″ mobile_zipped=”1″ row=”0″ section=”0″ >
  3. <forecast_information>
  4. <city data=”New York, NY”/>
  5. <postal_code data=”new york,ny”/>
  6. <latitude_e6 data=” “/>
  7. <longitude_e6 data=” “/>
  8. <forecast_date data=”2009-08-02″/>
  9. <current_date_time data=”2009-08-02 12:19:00 +0000″/>
  10. <unit_system data=”US”/>
  11. </forecast_information>
  12.      <current_conditions>
  13.      <condition data=”Light rain”/>
  14.      <temp_f data=”72″/>
  15.      <temp_c data=”22″/>
  16.      <humidity data=”Humidity: 94%”/>
  17.      <icon data=”/ig/images/weather/mist.gif”/>
  18.      <wind_condition data=”Wind: N at 6 mph”/>
  19.      </current_conditions>
  20. </weather>
  21. </xml_api_reply>

Wow check out how easy that was. Now all we did was submit the location and hit enter. Now we have in XML weather data for that area. No advertisements and since the data is in XML we can make it look however we want. Note: I shortened the output to only one day. So what’s next? Well in my case I used a PHP script to output this data. Let’s take a look at that source code.


  1. <?php
  2. function getWeather() {
  3. $requestAddress = “”;
  4. // Downloads weather data based on location – I used my zip code.
  5. $xml_str = file_get_contents($requestAddress,0);
  6. // Parses XML
  7. $xml = new SimplexmlElement($xml_str);
  8. // Loops XML
  9. $count = 0;
  10. echo ‘<div id=”weather”>’;
  11.      foreach($xml->weather as $item) {
  12.           foreach($item->forecast_conditions as $new) {
  13.                echo ‘<div class=”weatherIcon”>’;
  14.                echo ‘<img src=”’ . $new->icon[‘data’] . ‘”/><br/>’;
  15.                echo $new->day_of_week[‘data’];
  16.                echo ‘</div>’;
  17.                }
  18.           }
  19. echo ‘</div>’;
  20. }
  21. getWeather();
  22. ?>

I hope this tutorial was helpful! The Weather API is great on so many levels, fast, easy and customizable.

No Comments

Categories: Uncategorized