Category Archives: scripting

Exporting MediaWiki sites to Google sites

In the last post I’ve talked about moving files from SharePoint to Google Site,

what about a Mediawiki site?
how to export it and upload it?
I’ve already covered the uploading files to Google sites via the Google sites API,
you can use java or python to write a script to mass upload all your files and htmls to your new google site,
but first you need to export everything out of the Mediawiki site.

here is a working method to export your site, these are the steps:

  1. install python
  2. download the mw2html script
  3. export the mediawiki site

Technorati Tags: , , , ,

World Statistics

This is going to be a praise post for gapminder.com :)

I’m going over the data at the site and its amazing stuff,
the main page has lots of statistics which is shown in a new way,
the gapminder app shows the data at what i think is a 4 dimension way,
it shows x and y axis stats, and another axis represented as the size of the balls in the demo,
and how they grow over the 4th dimension – time.

Amazing stuff.

Gapminder

This is the main stats app:

Gapminder stats tool

you can see the advance of the bubbles over the x and y axis,
the z axis is represented with the balls size,
and its all advancing in time.
this default presentation shows Life expectancy over income per person, over population size.

wonderful demo.

Marriage Statistics

This great demo shows you the connection between women age at marriage and the amount of kids they have,
on of the things this tool does best is break myths.
I was under the impression that in Europe – Sweden for example, the marriage age went down,
and with it the number of kids in the family,
but from this graph you can simply see that the number of kids in a family went drastically down over the last 100 years, but the marriage age went drastically up only in the last 30 years,
ans the same behavior can be seen for the US as well.

women age at marriage

Now for the good news.
you cannot upload your own stats to the gapminder app directly,
but Google supplies a very similar tool through its Google documents apps.
Its called motion chart and on the gapminder site you can read the short or the long explanation to how to use the tool, after testing it the outcome can be inserted into any web page and it looks something like this:

I’m still exploring this Google motion chart app,
and my main concern is that it can only be embedded in a live web page,
I still need to find a way to have this presentation as a file on my laptop, to show even if I’m not connected to the net –
If anybody knows how to do that – leave a comment here please :)

Technorati Tags: ,

Get Better Google Adsense Ads!

For site depending on Google AdSense commercials for income,
it is important to have better targeted ads to your content, n order to get better results from the ads,
an easy way to get better targeted ads on your site is by telling google what are the important parts on the page and what they should take special notice of.

adsense-google_b

You can take a look at the adsense targeting page or read the short version below:

Target area for adsense:

<!– google_ad_section_start –>

<!– google_ad_section_end –>

I think its best to have the whole post between these tags, and I also include the comments section between them,
and you can use more then one section like this on your page.

Make Google ignore a part of your page:

<!– google_ad_section_start(weight=ignore) –>

<!– google_ad_section_end –>

For wordpress you need to edit the single.php and add the tags before and after the post data.

Hopefully this will bring better targeted ads for each page, and higher click rate. good luck!

Technorati Tags: , ,

13 books and magazines for linux sysadmins

This is a list of books and magazines i read through the years to learn my job,
there are many other good books as well, but these are my must haves.

1) Magazines:

linux format linux magazin

These two magazines I have been reading for years and they keep getting me fresh ideas and money savers for work,
they have some tutorials for beginners, some more heavy weight material, and fun projects for the free time (ach, whose kidding, what free time…).

although the info in them is usually a little out of date – they are published once a month and the industry is moving so fast, they do have a lot of good ideas in them, and it much more fun to snuggle with a color magazine then sit in front of the screen to read.

2) DNS:

DNS and BIND (5th Edition)

DNS and bind – every Linux sysadmin should know networking as well, and DNS is one of the pillars of the Internet,
even if you are not responsible to a DNS server, if you are working with anything related to the web or networking, you are using DNS, and knowing this subject good will help you solve many networking and web related problems.

3) Sys Admin handbooks:

linux_system unix_system

These are two books from the same authors, both are fantastic easy to use, in depth system administration books,
but you should buy just one out of the two since they very much a like.

so which one to buy? that depends on what flavors of unix/linux you need this info for:
UNIX System Administration Handbook (3rd Edition)
if you have many different unix servers at work you should get the unix book, it covers Solaris 2.7, HP-UX 11.00, Red Hat Linux 6.2, and FreeBSD 3.4.
a little out dated, but still very helpful as it will show you how to do the same thing in the different systems.

Linux Administration Handbook
on the other hand, if you have different linux versions running this book covers redhat, suse and debian – again showing you how to do the same thing in the different flavors.

4) PHP scripting

Different scripting languages are good for different things, PHP is good for building web interfaces for actions you wish your users to do without a shell account on your server.
php allows you to easily build forms and web pages to manipulate files on your server, and changing passwords, restore and backup files, etc…

php_cookbook programming_php

Programming PHP
Is the php book to start with, it takes you through the step of learning a new language and writing easy code.

PHP Cookbook
this php book will give you real world questions and answers for php coding – like how to open and read each word in a local or remote files, working with other web pages etc..

5) PERL scripting

PERL is faster to use when you want to do heavy weight work on databases or files and text manipulation and sorting.

Learning Perl, 5th Edition
The learning perl book will teach you perl from the beginning with real live samples and mind you – perl is tricky.

Programming Perl (3rd Edition)
this is a more in depth book for perl.

6) Bash shell

bash is the most popular shell for the linux environment, its strong and flexible and allows you to do many manipulations from the command line on files and texts, and its a great scripting tool to ease the work of a weary linux sysadmin (or lazy – its a great moto – always write something once).

Learning the bash Shell: Unix Shell Programming

and

bash Cookbook: Solutions and Examples for bash Users

as you can see by now, i really like the combination of a learning book and a cookbook 😉

7) security

hacking_linux_exposed
Hacking Exposed Linux, 3rd Edition

learning what your enemy knows will help you better understand where to look for security holes,
working in this job turns you slowly into a paranoid sysadmin if you wish to continue working, and this book will give you an insight into where likely holes in your servers will be and how to clear them.

8). IT management

practice_system
Practice of System and Network Administration, The (2nd Edition)

Never forget, your not only a linux sysadmin, you are also working in the IT environment and your decision and work is not just linux, you also need to consider network and the other servers and services around you.
this book is about the practice itself, not the technical stuff which we should all learn, and its based on the vast years of experience the authors have.
for example – how to build a support system – the people the software etc,
or how to structure your mail system so you will have place for growth when the company grows.

one of the best books I have read!!!

Technorati Tags: , , ,

Check a web page exists

Here is a short method to check if a web page exists from a perl script,
this script will test the existense of a page and do something as a result:

#!/usr/bin/perl
use LWP::Simple;
print “Content-Type: text/html\n\n”;

$url = “http://site.com/“;

if (head($url)) {
# ok document exists
print “OK: found $url”;
} else {
# something is not well
print “PROBLEM: $url is missing”;
}

This script is using the libwww-perl package.

Technorati Tags: , ,

Check apache from command line

When working with web servers we sometimes need to test them and make sure we are getting what we need to get,
and to see what the web server is sending back including headers.
The simplest and fastest way to do that is through command line.

telnet to the web server port – (usually port 80) like this:
telnet yonitg.com 80

and then just paste:
GET / HTTP/1.1
Host: yonitg.com

and press “Enter” twice.

Your output should be something like this:

HTTP/1.1 200 OK
Date: Wed, 11 Mar 2009 00:09:53 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8 mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Fri, 21 Dec 2007 02:01:16 GMT
ETag: “200000001d649-ca-441c240f37300″
Accept-Ranges: bytes
Content-Length: 202
Content-Type: text/html

these are standard reply headers from the Apache server on my host,
after the headers you will see the rest of the reply from the web server, in my case:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<title></title>
</head>
<body>
<h1>It works!</h1>
</body>
</html>

This way you don’t need a sniffer installed just to check if the web server is sane.
also from the linux command line you can also test this with:
GET http://yonitg.com
or
POST http://yonitg.com

the GET and POST command line apps are good tools to test http response,
they are part of the libwww-perl package.

Technorati Tags: , ,