Thursday, December 27, 2007

SARG - Squid Analysis Report Generator

SARG - Squid Analysis Report Generator is a tool that allow you to view "where" your users are going to on the Internet.

Its very useful tool which generates graphical and tabular report from your access.log file in a web browser.







You can get sarg from http://sarg.sourceforge.net/sarg.php
Extract it to your src folder, configure it and install it.

The configuration file is sarg.conf. You really don't need to change that file as most of the option can be passed through command line parameters. One thing you must make sure is that the output directory is your web accessible directory. The configuration file is pretty simple. Also make sure that it gets your right access.log file.

Tuesday, December 25, 2007

Google Analytics for you blog

Google Analytics can help you track uses of your site and plan for the future. You must already be knowing about this. I am posting this because adding this to your blog can be a little tricky.

Many users are trying to add the Google analytics code the classical way which works only on classic templates. If you try it for new template you will get the following error.

We were unable to save your template
Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The content of elements must consist of well-formed character data or markup

So to successfully set up try the following way.
Click Template
Click Page Elements
Click Add
Click HTML/JavaScript
Put your code their.
Do not write anything more not even the title. If you do so, it will appear on the homepage.
Check you Google analytics account

Friday, December 21, 2007

Your wife's future


If you are a computer guy then one day you sure will find your wife like in the picture below

Password protect a web page

Password protect your web pages in apache server in a very simple way. This is however not that secure and is not recommended. Just use this for simple thing and when other authentication cant be used.

First create a file which holds username and password.
For this you can use htpasswd program.

/usr/local/httpd/bin/htpasswd -c /usr/local/httpd/passwordfile username

The -c option here creates new file. So if the file already exists or you are just modifying or adding a new user omit -c option. Not doing that will make a new file resulting in loss of old username and password.

The file must be somewhere your webserver can find but not other place. Though the password is encrypted its better to keep it off from human eye.

Now edit you httpd.conf file to include the follwoing line in whichever websites that you require authentication


AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen sungo


Restart apache and you're done.

Additional reading: http://httpd.apache.org/docs/1.3/howto/auth.html#basic

Sunday, December 16, 2007

MRTG for SQUID

MRTG for SQUID gives you a detail idea of what is happening behind the scene. In this tutorial I'll make sure that you will successfully set up one like below.


First thing is to make sure that you have given --enable-snmp option while compiling your squid. If you have not done so then its time to do so. Compile your squid with --enable-snmp and then 'make clean', 'make', and 'make install'

Edit you squid.conf file so that
snmp_port 3401
acl snmppublic snmp_community public
snmp_access allow snmppublic localhost
snmp_access deny all

The first line defines the port SNMP is listening on squid.
Second line defines public as the community string or lets say password.
Third line defines that from localhost snmp query can be made to squid.
Fourth line denies query from all.(except localhost)

Now you need a web server to serve the graphs.

Download apache from http://www.reverse.net/pub/apache/httpd/httpd-2.2.6.tar.bz2
mv ./httpd-2.2.6.tar.bz2 /usr/local/src
cd /usr/local/src
bunzip2 -c /usr/local/src/httpd-2.2.6.tar.bz2 | tar xvf -
rm httpd-2.2.6.tar.bz2
mv httpd-* httpd
cd httpd
./configure --enable-prefix=/usr/local/httpd
make
make install

Now you need to configure apache. Lets just host it in a simple way.

mkdir -p /usr/local/www/mrtg
vi /us/local/httpd/conf/httpd.conf
Change DocumentRoot to "/usr/local/www/mrtg"
save and exit
run /usr/local/httpd/bin/apachectl -k start


Now its time for setting MRTG server. Download the following programs:

http://www.gzip.org/zlib (gzip
http://www.libpng.org/pub/png/libpng.html (libpng)
http://www.libgd.org/ (gd)
http://oss.oetiker.ch/mrtg/pub (mrtg)


Copy zlib to /usr/local/src
gunzip -c zlib-*.tar.gz | tar xvf -
rm zlib-*.tar.gz
mv zlib-* zlib
cd zlib
./configure
make
cd ..


Copy libppng to /usr/local/src
gunzip -c libpng-*.tar.gz |tar xvf -
rm libpng-*.tar.gz
mv libpng-* libpng
cd libpng
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
rm *.so.* *.so
cd ..


The \ in the following line means that they are same line.

Copy gd to /usr/local/src
gunzip -c gd-2.0.11.tar.gz |tar xf -
mv gd-2.0.11 gd
cd gd
env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" \
./configure --disable-shared --without-freetype --without-jpeg
make
cp .libs/* .
cd ..


Copy mrtg to /usr/local/src
gunzip -c mrtg-2.15.2.tar.gz | tar xvf -
cd mrtg-2.15.2
./configure --prefix=/usr/local/mrtg-2 \
--with-gd=/usr/local/src/gd \
--with-z=/usr/local/src/zlib \
--with-png=/usr/local/src/libpng
make
make install
mkdir -p /usr/localmrtg-2/cfg

Now lets make graph for squid.

Download the following two files

mrtg-squid.cfg
squid.mib

Copy them to /usr/local/mrtg-2/cfg/
edit mrtg-squid.cfg and do as the file says. Put working dir as /var/www/mrtg

Lets make graph
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/cfg/mrtg-squid.cfg
Run this for three times. Its OK for now to see few errors.

Lets make index page
/usr/locl/mrtg-2/bin/indexmaker --title="OSR" --show=day --section=title --output=/var/www/mrtg/index.html /usr/local/mrtg-2/cfg/mrtg-squid.cfg

Fire your browser and you should see the graph

For continous monitoring
crontab -e
*/5 * * * *
/usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/cfg/mrtg-squid.cfg --logging=/var/log/mrtg.log

Additional reading: http://wiki.squid-cache.org/SquidFaq/SquidSnmp

Thursday, December 13, 2007

Winter Darkness / Geminids Meteor Shower

The deepening darkness of winter has arrived and with it the beautiful winter skies. The earliest sunset has already passed, but the longest night is yet to come on Friday December 20th when we will experience over 14 hours of twilight and darkness from sunset to sunrise. This date is known as the Winter Solstice and it marks the day when the sun appears to be at its lowest point in the sky (at noon) compared to every other day of the year. From our latitude in San Francisco, this means that the sun will only appear approximately 30 degrees above the southern horizon at noon on December 20th - very low indeed!

December also brings the annual Geminid Meteor Shower. If you spend enough time looking up at the sky on any night of the year you will likely see a few meteors streak across the sky. However, a meteor shower is a special time in which a much higher number of meteors are visible. December 13-15 is a time when the Earth passes through a part of the Solar System which contains a particularly high concentration of dust and particles which enter the atmosphere and burn up, creating the beautiful "shooting stars" that we have come to know. This year the Geminid Meteor Shower comes at a time when moonlight will not interfere with seeing and the weather prospects are good (at least as of the time of this writing). The meteor shower is called the Gemenids because the meteors in the shower all seem to emanate from the same part of the sky in the constellation Gemini.

To see the Geminids, you need to look east in the evening after 9:00 pm, or straight up around midnight, or due west in the pre-dawn skies in the morning. The twin stars of Gemini (Castor and Pollux) are a bright pair and brilliant orange Mars is nearby. These stars and planet mark the spot where the meteors will appear to come from. It's rumored that the early morning hours of Friday 14th should bring some of the finest viewing to us on the west coast. Bundle up in a very warm jacket and hat and take a look. There's no need for a telescope or binoculars. You should see at least a few meteors even in the bright city skies of the Bay Area.

Wednesday, November 7, 2007

Comet Holmes

Over the last three weeks a minor and otherwise dim comet has suddenly flared and become bright. Comet Holmes has been sighted many times since its discovery in 1892 but it has been historically a faint object barely worthy of note when it passed near earth. However, on October 24th this year it brightened suddenly by over 1 million times and became as bright as the neighboring stars in the area of the sky where we can see it now. Comet Holmes is in the constellation Perseus in the evening. This comet is not nearly as distinctive as previous comets such as Hale-Bopp but it has developed a unique shape compared to other comets, something more of a ball of light surrounding the core of the comet. One reason for this is that we are viewing the comet "straight on" from our perspective on earth and not "edge on", like looking at a train approaching from the front where all you see is a headlight and the front of the train, not the side view of the string of train cars from front to back. Because we see the tail of Comet Holmes from the front rather than the side, we see a cloud of glowing dust surrounding the core. In binoculars or a telescope it looks quite impressive. I had a good look at it a few days ago and have been watching it since then. It is subtle with the naked eye, but very distinctive through binoculars or a telescope.

There are excellent accounts of Comet Holmes on many websites. Start at www.skyandtelescope.com and you will find photos, charts and links with the latest information about the comet, since it is such a dynamic object. Astronomers are at a loss to explain exactly what happened to cause Comet Holmes to suddenly flare up. There is no way to know when it might fade from view, but by most accounts it should stay bright and visible for the days ahead.

Wednesday, October 17, 2007

Waxing Moon / International Space Station

Last weekend I was at Ocean Beach as the sun set. Minutes after sunset I spotted a thin crescent moon hovering low on the western horizon. I find the very young crescent moon a beautiful thing in part because of its rarity. We are all quite acquainted with the "normal" appearance of the night sky -- lots of stars! But I find myself drawn to moments when something rare or unique happens in the sky such as the times I have seen a total solar eclipse or a close alignment of planets with a bright star. When a very thin crescent moon emerges in the sunset or sunrise sky, it is quite often a stunning sight because it is so low on the horizon and therefore looks large against the horizon, and because the "earthshine" on the dark portion of the moon gives it a ghostly appearance.

This week the moon is waxing and moving across familiar territory along the ecliptic past Jupiter and through Sagittarius. The moon is, of course, a satellite of the earth. That is to say, it is held in an orbit by earth's gravity and is close enough to the earth that when it is visible it dominates the night sky. There are, of course, many other satellites orbiting earth. These are man-made satellites and they too can be exciting to see in part due to their rarity and in part due to their unusual motion or brightness. The most distinctive satellite we can see on a regular basis is the International Space Station, also known as ISS. It orbits the earth every 90 minutes and is approximately 200 miles above the earth. It makes a fairly constant trip around the earth but each time it does so, the earth rotates part of the way through the day. ISS is quite large (about the size of a football field) and reflects sunlight very well, so when it passes directly overhead just after sunset or just before sunrise (when our skies are darkened but ISS is still in sunlight), it shines very brightly and moves quickly across the sky, much faster than airplanes.

If you want to get a look at this, you need clear skies, attentive eyes, and an accurate wristwatch. NASA maintains a website with all the details when it will appear over which parts of the United States. The website address is http://www.jsc.nasa.gov/sightings/index.html (or just type "ISS sighting" into your search engine). The next opportunity to see ISS from the Bay Area is on Friday Oct 19th at 7:29 pm and Saturday Oct 20th at 7:52 pm. In both cases look to the north-west. The ISS will take about 2 minutes from the time it appears above the horizon until it travels into the shadow of the earth and goes dark.

Good luck and happy viewing.

Wednesday, October 3, 2007

Planet Lineup

As the days grow shorter and the nights longer and the Fall weather brings clearer skies to San Francisco, I find myself with more opportunities to gaze into the heavens. While some may groan that it is dark when they wake up in the morning, I think it is a perfect time for a 60-second peek into the sky. There is much going on so take note and enjoy the fact that Daylight Savings Time lasts an extra week this year (it ends on November 4th).

After the Moon, the five nearest planets are the brightest objects in the night sky. Right now we have clear views of four of them (Mercury is too close to the setting Sun to be seen at this time). Jupiter is an evening object low in the southwest after sunset. By the end of October it will be setting shortly after the Sun. Mars is a nightime object rising due east and moving directly overhead by morning. The diagram illustrates its location this week drifting through Gemini with a close encounter with one of the two bright "twin" stars of Gemini. Venus and Saturn are both morning objects. Given that sunrise is just after 7:00 am this week, the two planets are quite bright in the pre-dawn sky around 6:00 or earlier. Next week there are some beautiful combinations of planets, stars and Moon that you will want to see. The grouping on Sunday morning October 7th should be very striking.

Wednesday, September 12, 2007

Venus, Jupiter and Brightness / Magnitude

Welcome back to another year of astronomy tips and news from the Urban Astronomer. I enjoy the opportunity to share astronomy with the Waldorf community and am glad to appear in the school newsletter from time to time. Throughout the year I'll talk about the changes in the night sky from season to season, share some insights about constellations and other celestial objects, provide information about special events such as eclipses and meteor showers, and of course highlight the changing positions of the planets and the beautiful arrangements of the moon, planets and stars that fill our skies throughout the year.

As we move toward Fall, the days are rapidly getting shorter and you might find yourself in the dark in the morning. Sunrise is at approximately 6:50 am which means if you are an early riser, you will have noticed brilliant Venus which is increasing in brightness and is rising due east more than two hours before the Sun. Just how bright is Venus? Astronomers use a curious system to measure the brightness of stars and planets. The system is called the "magnitude" system and it work the opposite of what you might expect, with lower numbers (and negative numbers) being brighter than higher numbers. For example, the north star (Polaris) is magnitude 2, but a brighter star directly overhead right now is Vega and its magnitude is 0. Venus is even brighter still, blazing at magnitude -4, almost the brightest it gets all year.

In the evening you can see Jupiter which dominates the southwest sky after sunset. Using the same brightness scale, Jupiter shines at magnitude -2. You can compare this to the red giant star Antares which is nearby Jupiter and although impressive at magnitude 1, seems faint compared to bright Jupiter. In the coming weeks you will notice Jupiter getting lower and lower in southwest sky, eventually fading into the sunset in a few months. Next week on Monday and Tuesday the waxing Moon will have a close encounter with Jupiter so if weather permits, enjoy the show anytime after sunset which next week is at approximately 7:15 pm.

Wednesday, June 6, 2007

Planets and Stars

While giving a tour of the sky, I am often asked how I know which "stars" in the sky are planets and which are real stars. The short answer is that planets are always on the go and are thus easy to spot. The word "planet" originates from the Greek word for "wandering star" and as suggested, the planets are not fixed against the background of stars in the sky but wander from place to place. Only five planets are bright enough to be easy to spot in the night sky. Because two of them orbit the Sun inside the orbit of Earth (Venus and Mercury), they move very quickly across the sky, and we only see them shortly after sunset or before sunrise. The three outer planets (Mars, Jupiter and Saturn) are visible throughout the night sky and move more slowly against the background of stars in the sky. Much like the ancient astronomers, I have come to know the basic constellations in the sky and can quickly tell when a planet is interloping in the space of a constellation. With a little investment of time, you can do this too.

The early part of this summer will be a wonderful time to get to know the planets. Venus remains a bright evening object through June and slowly fades in July. Saturn too remains visible in the evening but also fades by the end of July. And Jupiter is just beginning its reign over the summer sky as it is visible immediately after sunset in the southeastern sky. Saturn and Venus will make a remarkable pair on July 1st just on the edge of the constellation Leo. Mark your calendar for that event! If you watch over several weeks, you will notice how much change there is in the position of Venus compared to Gemini (where it is now) and Leo (where it will be in a few weeks).

If you buy yourself a good-sized star chart (10 to 12 inch), or if you buy a quality astronomy magazine such as Night Sky, Astronomy or Sky & Telescope and tear out the monthly star chart, you can get to know a few bright constellations that dominate the spring and summer sky such as Leo (where you will find Saturn and Venus), Virgo, Scorpio (where you will find Jupiter), and Sagittarius. Once you get to know these, you will be able more easily notice where the planets fit in and how they move against the background stars. By the end of summer Mars will be visible in the morning moving through Aries toward Taurus.

Make yourself a promise to learn a few constellations this summer and you'll find yourself more at home and comfortable with the night sky. And you will start to discover just where the planets are each night.

Wednesday, May 30, 2007

Evening Planets / Blue Moon

I spent last week at the Live Power Farm in Covelo with the 3rd grade. The sky there was clear and beautiful and we had two opportunities to meet with the kids to look at the darkening sky. At around 9:00 pm, the evening sky was filled with a parade of planets, something still visible this week as well featuring Mercury and Venus. To see this you will need a clear view of the western horizon over the next many days. The 3rd grade experienced this view and was able to see the changing position of Venus over the three evenings we were there.

Venus is moving quickly across the evening sky so if you view it on successive evenings, you will notice it moving up and to the left compared to the two twin stars in Gemini, Castor and Pollux. Further up and to the left of Venus is Saturn, currently located in the constellation Leo.

The Moon is full on May 31st, the second full moon of May for us in the western hemisphere. This unusual situation takes place infrequently and is known as a "Blue Moon." The exact time of the full moon on May 31st is 6:00 pm in California, when it is already June in Europe and Asia.Therefore, the eastern hemisphere will end up having two full moons in June. The result? We have a Blue Moon in May in North and South America, and the rest of the world gets a Blue Moon in late June. That is truly a "once in two blue moons" situation!

Wednesday, May 2, 2007

Moon, Scorpio and Star Parties

Now that the days are getting longer, it is getting more challenging to see the night sky in the morning. This week I was outside at 5:45 am and the sky was already brightening with daylight. So to see the skies at dawn, you will need to get up very early. Don't despair, however, because if you are a night owl and are up near midnight, you can still see the Moon drifting eastward each night across the constellation Scorpio on May 4th, 5th and 6th. Jupiter is shining brightly and will be visible just above the bright Moon. You will need a good view of the south-eastern horizon to see this at midnight, and a good southern horizon to see this in the early morning.

I would like to say "Thank You" to the Gower and Henderson families. They were the top two "Star Party" bidders at the SFWS auction last weekend and for their contribution, I'll be conducting a personal star party for them and their friends.

What is a star party, you ask? It is a gathering of people in an open space to spend quality time observing the heavens. Many astronomy clubs host star parties, events in which the members of the club assemble in a good viewing spot, set up their telescopes, and share the night sky with other members and friends. I find that amateur astronomers are very friendly people and generally enjoy sharing the wonder of the sky with others. I too enjoy sharing the sky and have conducted astronomy lectures and star parties for some of the classes at SFWS. For those who purchased my star parties, you can be assured we will have a great time learning about the motions of the stars and planets in the heavens and take a close-up look through binoculars and a telescope.

Wednesday, April 18, 2007

Lunar Motion

The Moon is our nearest celestial neighbor and is, from our vantage point, the fastest moving object in the sky. It circles around the Earth in 29 days and as it does presents its slowly-changing face to us at different times of night. The New Moon is the phase when the Moon is "nearest" the Sun. This takes place on Tuesday April 17th this month. Each successive day the Moon's visible area grows, at first a thin sliver and then an ever-growing disk of light.

As the Moon moves across the backdrop of stars each night, it follows a path in the sky shared by the planets and the 12 Zodiac constellations. Many of these constellations are quite bright and form beautiful patterns with the Moon as it passes by. The thin crescent Moon will be low on the horizon on Wednesday April 18th, and during the 24 hours until evening on Thursday April 19th the Moon will have moved a considerable distance across the sky, past the cluster of stars called The Pleiades, then onward just next to Venus (which itself is near the bright stars of Taurus the Bull).

Over the next week as the Moon's phase grows it will slide through Gemini (on April 22nd), next to Saturn (on April 24th) and then into Leo the Lion on the 25th with a close approach to the bright star Regulus. The Moon itself makes a wonderful object to view through binoculars or an inexpensive telescope. As the phase of the Moon changes each night, a telescope will reveal the changing pattern of shadows cast by the craters and mountains on the Moon. Take a minute to enjoy the view over the next two weeks as the Moon grows from New to Full.

Wednesday, February 14, 2007

The Pleiades

The winter sky is dominated by the constellation Orion which fills the southern sky during the evening hours. Orion is a guide to a few other gems in the cold winter sky such as the star Sirius, the brightest star in the skies, and the constellation Taurus which features the bright orange star Aldebaran. The three distinctive belt stars of Orion serve as the guide to these two items, Sirius by following the line of the belt stars down to the lower left of Orion, and Taurus by following the line of the belt stars up to the upper right of Orion. But even more interesting is the very distinctive star cluster just past Taurus, the Pleiades.

The Pleiades are a fascinating group of very young stars which are, relatively speaking, quite close to Earth compared to most of what we see in the night sky. The Pleiades, also known as the Seven Sisters, is an "open cluster" of stars which actually are all related to each other and are about the same age and size. The cluster formed about 100 million years ago, which in astronomical terms is recent history. For comparison, this represents about 1/40th of the time since the formation of our Sun and the Solar System. They are quite hot stars and as such are a distinctive blue color. They are all just over 400 light years away which is relatively close, a distance which is less than 0.1% of the size of the Milky Way galaxy.

During the winter you can find this cluster high in the southern sky, moving westward during the evening. As mentioned, you can use Orion's belt as a guide to find Taurus and a bit further away, the Pleiades. The brightest 9 stars have names (see diagram) which are derived from Greek mythology. The Pleiades are the seven sisters Sterope, Maia, Alcyone, Merope, Electra, Celaeno and Taygeta. Pleione and Atlas are their parents.

Wednesday, January 24, 2007

Close Encounters

Winter skies are beautiful for the richness of the heavens we see. The king of the winter sky is the bright distinctive constellation Orion the Hunter which rises from the south-east and dominates the southern sky during the winter months. Winter can be uncomfortably cold for long astronomy sessions, however, so rather than staying out late in the cold, I find myself enjoying the evening sky when the light changes and the stars emerge and the air has not yet cooled down. For example, on clear evenings from Ocean Beach I enjoy spotting stars and planets as darkness falls.

During the latter part of January and into February the two inner planets dominate the sunset sky. Minutes after sunset you can find Venus in the slowly fading sunset sky. It is very bright and getting brighter over the coming months. Mercury, however, is a difficult planet to find. It never gets very high up in the evening or morning sky and it never shines as bright as Venus. However, over the next week or two you will have a chance to see it twinkling in the darkening sunset sky with Venus as your guide to help find it. You will definitely need a clear western horizon for this.

Part of the joy of astronomy for me is to see these special moments when two planets pass near each other or the moon forms a beautiful pattern with stars and planets. If the skies are clear and you have a chance, enjoy this special time when Mercury and Venus share the stage.