Search Site

Feed Section

Monday, February 18, 2013

TechSource: How To Write Linux Shell Scripts (Part 3)

TechSource: How To Write Linux Shell Scripts (Part 3)


How To Write Linux Shell Scripts (Part 3)

Posted: 17 Feb 2013 06:57 PM PST

In the previous part we learned about variables and how to use them. This time around we'll learn how to take input from the user and store it in a variable.

So far we know that variables are places in memory where you store specific data. In case you haven't forgotten, we declare a variable like this:

myvariable=predator

In the above statement, you store the value of predator in the variable myvariable. But what if we didn't know what value to store in the variable? What if we wanted to ask the user what they prefer and accordingly write our bash script? Well, this is where the read statement comes in handy. The read statement takes input from user and stores it in a variable. Then this variable can be used to perform further operations. This is particularly useful in writing bash scripts wherein you have to ask the user certain things before proceeding with the execution (C programmers can consider this as Bash's version of scanf).


The read statement

Let's see the read statement in action now. Open your favorite text editor and type in or paste the following script:

#!/bin/bash
#Script to read your name from the keyboard
echo "Welcome to BASH"
echo "Please enter your name: "
read name
echo "Hello $name, how are you?"


Save this file as saymyname.sh and then run it using the following commands:

$chmod +x saymyname.sh
$./saymyname.sh


The terminal will show the following output:

$./saymyname.sh
Welcome to BASH
Please enter your name:


Now, here, simply type in your name and press enter. Et voila! You'll have the following output:

Hello , how are you?



Code Explained
:

echo "Please enter your name: "

In this line we simply print out an instruction so that the user knows when to input his name. Then, on the next line we use the read command:

read name


This instructs the shell to 'read' whatever the user types in and store it in a new variable called name. This is the same thing as declaring:

name=TechSource 

However, the only difference here is that you are giving the value to the variable after the script is executed.

You then use the 'name' variable to print out a greeting to the user.

Now that we've understood how it all works, it's time to try something a little more complex.

Open the same file, that is saymyname.sh and make the following modifications to it:

#!/bin/bash
#Script to read your name from the keyboard
echo "Welcome to BASH"
echo "Please enter your full name and age"
read fname lname
echo "Hello $fname $lname, how are you?"
echo "Please enter your age"
read age
echo "So, $fname, you are $age years old!"


Save the file and execute it by using the following command:

$./saymyname.sh

You'll get the following output:

Welcome to BASH
Please enter your full name and age
James Bond << Here you can enter any name you want >>
Hello James Bond, how are you?
Please enter your age
40 << Enter your age here >>
So, James, you are 40 years old!


Code Explained
:

In this example, we have modified the script slightly so that we can get more than one values from the user. Look at the following line:

echo "Please enter your full name and age"
read fname lname


The read command now takes two variables at once. This means that whenever the user is asked for input, they have to write their full name, that is, type their name and surname with a space in between. In this way, you can ask the user to enter multiple variables at once and use those variables individually later on in the script. As you can see, we have used the first name, that is $fname variable later on in the script without the $lname variable.


That's all for today. We'll see you in the next lesson. In the meantime you can try out these exercises:

1. Ask the user about his favorite ice cream flavor and print out "I love (favorite flavor) ice cream!"

2. Ask the user to type in his or her age, height and weight in one line and print it out in the following format:

Age: 32
Weight : 85 kgs
Height: 6 feet


Written by: Abhishek, a regular TechSource contributor and a long-time FOSS advocate.


Saturday, February 16, 2013

TechSource: Why Ubuntu Phone Will Be a Huge Success

TechSource: Why Ubuntu Phone Will Be a Huge Success


Why Ubuntu Phone Will Be a Huge Success

Posted: 15 Feb 2013 07:39 PM PST

2013 came with a lot of surprises for Linux fans. Firstly, Canonical announced its plans for making Ubuntu Phone OS and secondly, it was revealed that the much-awaited Steambox will run Linux. While Ubuntu Phone's demos generated a lot of hype amongst FOSS fanboys and fangirls, Shuttleworth's ambitious plans have been brutally written off by tech bloggers. Techcrunch's Alex Williams chimed in saying that the Ubuntu Phone OS doesn't stand a chance. The Verge's Vlad Savov, on the other hand, wasn't as harsh on Canonical as Alex was; however, he did remark that Canonical was a bit too late in the mobile game. Also, many people have noted that the absence of a mobile carrier or a manufacturer is a huge handicap for Ubuntu considering how saturated the market is right now.

Of course, despite me being a Linux fanboy for years, I have to agree with almost all of the handicaps they have pointed out. Yes, Ubuntu has a lot of shortcomings and is entering the game probably at the worst time possible. In fact, there are more chances of the endeavor failing than of succeeding. Times are tough, and even Shuttleworth knows it. Furthermore, writing off Ubuntu Phone as a failure at this point seems like the easiest thing any tech blogger could do. I, however, hold a slightly different opinion on this. Being an optimist, I think that Ubuntu for phones has more than just a fair chance at the mobile market. In fact, I would go so far as to say that it might actually become a huge success at par with iOS and Android.


Not just any other phone OS

Looking at the demo of the Ubuntu Phone, many Android or iOS users will agree that what they see is way more intuitive than their own device. The omnipresent swipe action that lets you glide through menus and apps makes the phone quite appealing to the so-called 'normal' users. Also, the aubergine charms of its welcome screen are hard to ignore even if you're the most hardcore iOS fan. In short, the Ubuntu phone is not some substandard product that is here to help small-scale manufacturers market their phones. It is here to target the biggies like Android and iOS, which is reflected in the quality of Canonical's design.

While we don't know much about the phone's performance when compared with Android, it's safe to assume that Canonical will make the OS at par with its competitors by 2014.



There's room at the top

There is no doubt that the top spot is absolutely packed. There are only two major players in this game, one is Android and the other is iOS. But that doesn't mean that there is no room for a third or a fourth player here. Remember when Android started out it was dismissed by many users considering the immense popularity the iPhone enjoyed at that time. Look at the open-source OS now; it's giving Apple a tough time. Times change; giants fall.

Another argument against the 'Consumers don't need a new phone OS' is that Ubuntu isn't actually targeting the general user base. It is targeting the enterprise customers who are in need of an unfragmented, reliable mobile operating system. It's a market that would generate huge revenue for Canonical and hopefully propel its growth in other sectors as well.


It's open source; hey, why not?

One of the biggest draws of Ubuntu Phone OS is that it is open source. If you see the mobile scenario right now, most manufacturers are churning out substandard Android devices for the low-end market. There are again small-scale manufacturers that are using Android to sell their devices in the hope that someday they'll go big. The reason you see Android on so many devices is that it is being open-source any mobile manufacturer can use it on their devices and save money at the same time.

Ubuntu Phone might actually turn out to be a breath of fresh air into the market. Small-scale companies who are looking to market their devices might look at this OS and think of giving it a chance so as to stand apart from the crowd. Also, most of the major smartphone manufacturers including Sony, HTC, Asus, Motorola and of course Samsung all use Android. I'm sure at least one of these companies will see a bright future in the OS and use it for their next product.


Fragmentation-free openness, hopefully


Ubuntu Phone OS brings most of the Android goodness -- except the apps, of course -- to the users without the fragmentation. One of the biggest problems with Android is that there are many users who are still stuck at Gingerbread while only a few are enjoying the latest upgrade that is Jelly Bean. Shuttleworth knows about this problem, and I'm pretty sure he'll be doing all he can to avoid it from happening with Ubuntu.


2014: It might actually be worth the wait.

If you look at Ubuntu's trajectory for the past 2 years closely, it's not that different from Microsoft's vision of how their products will be. We are in the era of desktop-mobile convergence and every big company is trying to bridge the gap between various platforms. Microsoft, with Windows 8, took a bold step towards that goal by aiming for a unified user interface across multiple devices. If we look at Shuttleworth's vision, it is not that different from Ballmer's vision. They both are looking for convergence of all devices.

However, when it comes to convergence, Microsoft, so far, has left many unimpressed. Many say that Microsoft is too early in this game. And well, if that's true, then Ubuntu is actually heading in the right direction by waiting until 2014 to release a more mature product.


Written by: Abhishek, a regular TechSource contributor and a long-time FOSS advocate.

Thursday, February 14, 2013

[HowtoForge] Newsletter 02/14/2013

HowtoForge Newsletter 02/14/2013
================================

*** Version 1.3 of the ISPConfig 3 Manual ***
=============================================

The next update of the ISPConfig 3 Manual is available in PDF format (version 1.3 for ISPConfig >= 3.0.4; Date: 10/25/2011).

Version 1.3 for ISPConfig >= 3.0.4 (Date: 10/25/2011)
Author: Falko Timme
333 pages

The manual can be downloaded from these two links:

http://www.ispconfig.org/ispconfig-3/ispconfig-3-manual/
http://www.howtoforge.com/download-the-ispconfig-3-manual


*********************************************
*********************************************


ISPConfig Monitor App for Android Phones
========================================

With the ISPConfig Monitor App, you can check your server status and find out if all services are running as expected. You can check TCP and UDP ports and ping your servers. In addition to that you can use this app to request details from servers that have ISPConfig installed; these details include everything you know from the Monitor module in the ISPConfig Control Panel (e.g. services, mail and system logs, mail queue, CPU and memory info, disk usage, quota, OS details, RKHunter log, etc.).

Download/Usage
==============

For download and usage instructions, please visit http://www.ispconfig.org/ispconfig-3/ispconfig-monitor-app-for-android/ .


*********************************************
********************************************


*** HowtoForge Now Has Its own Facebook Page ***
================================================

We at HowtoForge are proud to announce that our new Facebook page is now available under http://www.facebook.com/howtoforge. As most of you probably have a Facebook account, we want to use this additional channel to post updates and get feedback from you. Therefore we would like you to "Like" our page, share it with your friends, post comments, etc.

http://www.facebook.com/howtoforge
********************************************************************


New HOWTOs:
===========

* The Perfect Desktop - Fedora 18 XFCE
* How To Integrate DropBox Into Thunar (Fedora 18/XFCE)
* Building Nginx From Source On Debian Squeeze
* How To Install Cinnamon Desktop On Fedora 18
* How To Integrate ClamAV Into PureFTPd For Virus Scanning On Fedora 18

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The Perfect Desktop - Fedora 18 XFCE
====================================

This tutorial shows how you can set up a Fedora 18 desktop (with the XFCE desktop environment) that is a full-fledged replacement for a Windows desktop, i.e. that has all the software that people need to do the things they do on their Windows desktops. The advantages are clear: you get a secure system without DRM restrictions that works even on old hardware, and the best thing is: all software comes free of charge.

You can find the document here:
-------------------------------
http://www.howtoforge.com/the-perfect-desktop-fedora-18-xfce




How To Integrate DropBox Into Thunar (Fedora 18/XFCE)
=====================================================

Thunar is the default file manager for XFCE desktops. While it is easy to integrate DropBox into Nautilus, the default file manager for GNOME, it is not so trivial for Thunar. This guide explains how to use DropBox with the Thunar file manager on a Fedora 18 XFCE desktop.

You can find the document here:
-------------------------------
http://www.howtoforge.com/how-to-integrate-dropbox-into-thunar-fedora-18-xfce




Building Nginx From Source On Debian Squeeze
============================================

This tutorial describes how you can build nginx from source on Debian Squeeze. Additionally, we will include some useful 3rd-party modules like the naxsi WAF (web application firewall), SPDY etc.

You can find the document here:
-------------------------------
http://www.howtoforge.com/building-nginx-from-source-on-debian-squeeze




How To Install Cinnamon Desktop On Fedora 18
============================================

This tutorial shows how you can install Linux Mint's Cinnamon desktop on Fedora 18. Since it has now been included in the repositories this can now be done quite quickly. Fedora's default desktop at the moment is GNOME 3.

You can find the document here:
-------------------------------
http://www.howtoforge.com/how-to-install-cinnamon-desktop-on-fedora-18




How To Integrate ClamAV Into PureFTPd For Virus Scanning On Fedora 18
=====================================================================

This tutorial explains how you can integrate ClamAV into PureFTPd for virus scanning on a Fedora 18 system. In the end, whenever a file gets uploaded through PureFTPd, ClamAV will check the file and delete it if it is malware.

You can find the document here:
-------------------------------
http://www.howtoforge.com/how-to-integrate-clamav-into-pureftpd-for-virus-scanning-on-fedora-18


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

You can now support HowtoForge by becoming a subscriber:

HowtoForge Subscription
=======================

*** New! We now accept RBS WorldPay payments in addition to PayPal. ***

For a monthly fee of 5 EUR or 25 EUR for half a year, you can become a HowtoForge supporter and help us cover our costs (servers, bandwidth, etc.) and support ISPConfig development. In return, you receive the following benefits:

1. Download the ISPConfig 3 Manual (from http://www.howtoforge.com/download-the-ispconfig-3-manual).
2. Access the whole HowtoForge web site without any ads.
3. Download the results of our tutorials as VMware images (where available) (a list of downloadable VMware images is available here: http://www.howtoforge.com/list-of-downloadable-vmware-images).
4. Download our tutorials as PDF files.
5. View our tutorials as printer-friendly pages.
6. You will be marked as a "HowtoForge Supporter" in your forum posts.
7. Plus, you support the ISPConfig development.

If you have the free VMware Server or Player installed, you can import our VMware images and start playing around with the results of our tutorials immediately. It's a great way to track down problems with your own setup or simply to save time. ;-)

More details can be found on http://www.howtoforge.com/subscription.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Best Regards,

Your HowtoForge Team
Email: info@howtoforge.com
URL: http://www.howtoforge.com

To unsubscribe or update your records, click here: http://newsletter.howtoforge.com/howtoforge/user/update.php?email=matrixunix.ubuntu@blogger.com&code=d8531959c7da2982ec3a7f8f82a13961

Wednesday, February 13, 2013

TechSource: Best Android Apps For Celebrating Valentine's Day

TechSource: Best Android Apps For Celebrating Valentine's Day


Best Android Apps For Celebrating Valentine's Day

Posted: 12 Feb 2013 09:39 PM PST

It's Valentine's Day, and the season of love has officially begun. Couples from all around the world will be celebrating their love for each other in their own unique way. One of the most special ways to celebrate it is by using a smartphone. Now, I know it sounds quite hipster-esque to do so, but hey, why not? Why not surround yourself with cupids, hearts, and warm kisses? If you too are looking for bringing some love into your Android device, here are some of the best Valentine-themed apps available.


Bubble Blast Valentine


This is a special version of the famous game Bubble Blasted designed exclusively for Valentine's Day celebrations. Instead of bubbles, you'll find multi-colored hearts that you are supposed to burst. Once you burst a heart, it triggers a chain reaction that lets you eliminate them completely. The game comes in 2 modes: puzzle mode and arcade mode. While the arcade mode lets you play the game anyway you want, the puzzle mode lets you progress through the game by completing as many as 5000 different levels. Overall, it's a fun game with a Valentine twist to it.



Dragon Story: Valentine's Day

This is a Valentine's Day edition of the famous game Dragon Story, a game that involves hatching, raising, and breeding magical dragons. The game introduces new Valentine's Day dragons that you can breed along with some changes to the story line.



HowAboutWe Dating


If you don't have a date for this Valentine's Day, don't worry, there's an app for that. HowAboutWe is a unique dating app that lets you post an idea for a date, connect with other people and then meet them offline. The app guarantees that you meet only real people and not someone fake.



Where's My Valentine?

Where's My Valentine? is a Valentine's Day version of the famous Disney game Where's My Water?. You'll find the familiar characters, Swampy and Perry trying to find love across 12 new love-themed levels. This is a trial version of the 250-level game that features more puzzles and characters.



Restaurant Story (Valentine's Day Edition)

Another Valentine's Day version of a popular game, Restaurant Story: Valentine's Day comes with new Valentine's Day-themed recipes, decorations, and supplementary storylines. The game revolves around you, the player, managing and growing your own restaurant. The game is completely free to download with new free content released every week.



Angela's Valentine

This free application features the famous Tom and his soul mate Angela. You'll find ten romantic postcards that you can send to your loved ones along with 2 music videos of Tom and Angela. Furthermore, there are also animations of Tom and Angela kissing each other making your smartphone look even more romantic.



Sweet Heart Live Wallpaper

This free live wallpaper comes with 8 different themes. Once installed, your smartphone will be decorated with floating hearts that glow once they're touched. One great thing about these live wallpapers is that they can be customized according to the user's preferences.



KF Hearts Live Wallpaper

This free live wallpaper brings your home screen to life with colorful animations of drifting hearts. A great thing about this app is that it lets you customize the hearts and animation speed that you see on the screen.



Love Letters Pro

Love Letters Pro is a paid application that brings romantic imagery and phrases across your screen. With over seven different themes, Love Letter Pro can also be randomized so that you see new live wallpaper from time to time.



You may also check out our list of Geeky Valentine's Day Gift Ideas.


Written by: Abhishek, a regular TechSource contributor and a long-time FOSS advocate.

Monday, February 11, 2013

TechSource: How To Make The Most Out Of VLC Player

TechSource: How To Make The Most Out Of VLC Player


How To Make The Most Out Of VLC Player

Posted: 11 Feb 2013 01:56 AM PST

VLC is regarded as one of the best open-source cross-platform media player around. The highly portable, free media player supports most of the available file formats and also lets you stream movies and music over a network. VideoLan project had its humble beginnings as an academic project in 1996. It was initially designed to consist of a client and a server to stream videos across a campus network. The project was then written from scratch in 1998 and was released under the GPL in 2001. More than ten years since its first release, VLC has become the prime choice of many Windows and Linux users. Growing slowly and steadily, this open-source player is now being ported to Windows 8 and Android.

Many people use VLC for playing videos or even music. What they don't know is that VLC is much more powerful than a simple video player. It can be used to do a variety of things and once you know a few tricks, you can turn it into a complete powerhouse. So, without much ado, here are some tips to make the most out of your VLC Player:


Watch YouTube Videos Locally

For those of us who got tired of watching videos in our browsers, there are applications like Minitube. If, however, you don't want to install any additional software then our very own VLC pretty much does the job. To watch a YouTube video on your VLC player all you have to do is open VLC, then press Ctrl+N on the main screen.

Then, once you've done that, paste the URL of the video you want to watch locally and then press the Play button. The video will start playing on VLC instantly.


Download Youtube Videos

Once your video starts playing, press Ctrl + I on the main screen. After that click on Media information and copy the URL that is there in the box that says Location.  Paste this URL in your browser's address bar and press Enter.


Control VLC with your Android Smartphone

The Play Store offers some great applications that let you control VLC using your smartphone. One of my favorites is VLC HD Remote (+ Stream), a free application that lets you control your VLC installation with your Android smartphone.


Stream Content from your Android Smartphone to your Desktop and Vice Versa

By installing a single app you'll be able to stream content from your computer to your phone and vice versa. VLC Direct Pro, once installed, lets you stream local movies, music and photos to your desktop. The same thing can be done the other way round.


Rip DVDs

VLC also lets you rip DVDs while you're playing them. To do this go to View, then click on 'Advanced Controls'. Now, you'll see that a few extra buttons have popped up below the progress slider. Whenever you are playing a video press the red record button (the one that looks like a dot) and your video will be recorded and saved in your home directory.


Written by: Abhishek, a regular TechSource contributor and a long-time FOSS advocate.

Saturday, February 9, 2013

TechSource: Top Astronomy Applications For Ubuntu Linux

TechSource: Top Astronomy Applications For Ubuntu Linux


Top Astronomy Applications For Ubuntu Linux

Posted: 09 Feb 2013 04:38 AM PST

There are billions of stars and galaxies out there. Every time you look up at the sky, you see these stars glowing, moving, and changing. The vastness that lies beyond our planet earth has fascinated people for centuries. It is believed that early cultures gathered huge artifacts for astronomical purpose and in addition to using them for ceremonies, they were used as tools for observing the sky and predicting the seasons. This observation helped our ancestors greatly when it came to planting crops and even hunting to an extent.

These days Astronomy has turned from a tool to a separate branch of study. It is a science dealing with the study of celestial objects. This also includes studying the chemistry and physics of various stars, planets, and galaxies that are millions of miles away from our Earth. From Ptolemy to Galileo, many astronomers have contributed their own knowledge to this field and have literally changed the way in which we view the world.

Astronomers are required to have knowledge in various fields including physics, chemistry, and mathematics. Apart from having a keen eye in the sky, telescopes make up the standard repertoire of these celestial explorers. Of course, not every budding astronomer can afford a full-fledged telescope. In that case, however, there are various tools and software that help them study the stars without spending a dime. Our very own Ubuntu Linux too offers such tools thus making astronomy easy and accessible to everyone. If you're a professional astronomer or a budding stargazer, these applications surely will come in handy in your profession. So, without much ado, here are some of the best astronomy applications that can be easily installed on Ubuntu (and other Linux distros):


Stellarium

Stellarium is a free software that turns your computer into a virtual planetarium. Serving as a valuable educational tool for studying the night sky, this OpenGL-powered application can accurately calculate the positions of the Sun, the moon, and the stars and show us how the sky will look on a particular day. Another cool feature this application offers is that it allows you to simulate astronomical phenomena such as meteor showers and solar/lunar eclipses.

The application is used by professional astronomers and comes with a catalogue of over 600,000 stars. There are also extra catalogues that comprise more than 210 million stars.



SkyChart

SkyChart, as the name suggests, lets users draw sky charts. The application comes loaded with a database of over 2.8 million cities. SkyChart offers Galactic and Ecliptic chart projection along with superimposed survey charts over a digitized sky. The main use of this application is to prepare different sky maps for specific observations.



Virtual Moon Atlas

Virtual Moon Atlas is a free application that lets astronomers and stargazers study the moon and its surface. Once installed, you'll be able to study moon's features by pointing simulated telescopes at the moon's surface.

As a start, you are shown a 3D lunar globe of the moon that can be rotated, zoomed into, and navigated as per need. Virtual Moon Atlas lets you study lunar formation with a unique database of more than 9000 entries and 7000 pictures. Furthermore, you'll also find 34 scientific overlays along with some high-resolution textures thus making it a professional software. Virtual Moon Atlas has been used in the preparation of the Chandrayaan 1 lunar mission.



Celestia

Celestia is a free space-simulation software that works in real time. As compared to other planetarium software, Celestia stands out by letting you travel to all the planets, stars, and galaxies of the solar system. Thus, you're not restricted to your home planet as you are while using other software. Compatible perfectly with both KDE and GNOME, Celestia displays the Hipparcos Catalogue consisting of almost 120,000 stars. What's more, you can also capture high-resolution pictures and movies while traveling through space making it easy for you to share what you saw with the world. Celestia works perfectly across all platforms including Windows, Mac OS X, and Linux.