Run your own script from Launcher (UBUNTU)

Ubuntu new brand logo

Look at that… pretty neat and unique isn’t it? ๐Ÿ™‚ the more beautifull ubuntu will be, the more I love it.

Okay, so this post is the last part wich that started from this post. And if you never create any bash script, you can start from here.

So I have my own script that check wether I connected to the internet or not by do the ping to google.com. If the connectivity still unavailable I would hear some sound until it finally connected and then I would hear some other sound. You can check the script and how to create it from my previous post.

I assume you have your script already in /home/myubuntu/cheko/chek.sh

now, go move your lazy cursor to your top panel bar. For you ubuntu noob or doesn’t understand wich top panel bar is.. here:

this is what I called top panel bar ๐Ÿ™‚

FYI, I called this TOP panel bar, because I prefer that thing is stay at the TOP of my desktop. Yes, you can move this thing to each edge of your desktop.

Next, right click on the panel bar , and the choose Add to panel… then you should see a new Gnome-panel window pop out. Now, choose the Custom Application Launcher.

You are ready to put some command that we usually use at terminal, as you can see :

change your launcher icon!

remember to try the command first in terminal,just in case that is something wrong with it. the “&” you find in the end of the command means the programs would run in background.

And if you do not want any scary blinking cursor with black & and white texts appear if you run the script, then you should switch the type form Application in terminal to Application.

Click close to confirm.

Voila!

voila!

There you go, your own script launcher. Click that icon and your script is running.

That’s all. ๐Ÿ™‚

Bash Script: Check Connectivity

#!/bin/bash -x
limiter=0;
while [ $limiter -lt 10 ];do
chek=$(ping google.com -c 1 | awk '/data/ {print $7}')
if [ "$chek" = "data." ]; then
play /home/your-pc/hack/snd/Alarm.wav
exit 0
else
play /home/your-pc/hack/snd/gitar.wav
let limiter+=1
fi
done

This simple bash script was made to check your current connectivity. It ping google.com and play sounds until it meet a few conditions to stop.

  • First condition is when the stringย  $chek contains “data.” , I’ll explain it later.
  • Second condition is when the $limiter reach 9

First, we assign 0 to a variable called limiter .Then..

while [ $limiter -lt 10]; do

In this line, we set a loop using while..do with a condition. the “-lt” means lesser than or < . So when the $limiter value is 10, it then stop the looping.


chek=$(ping google.com -c 1 | awk '/data/ {print $7}')

This is how you assign a variable’s value from output of commands. ping google.com -c 1 will do a ping to google.com one time. The output of ping will be used in awk ‘/data/ {print $7}‘ย  AWK is a programming language that is designed for processing text-based data.

For example: if the connectivity is available the ping output will be.

PING google.com (216.239.61.104) 56(84) bytes of data.

and if the connectivity is unavailable, in some relatively-normal-case it just show this.

PING: unknown host google.com

The awk line is awk ‘/data/ {print $7}’. It means it will find the line containing word “data”, and then print the 7th column of the line. If connectivity is available the seventh line is “data.” (notes: the first column is “PING”).ย  And that is why in the next line of the script it will do comparison to check wether the string $chek is “data.”. This means, if connectivity is unavalaible the ping output would be as shown above then $chek does not contain “data.” or empty ” “.


if [ "$chek" = "data." ]; then
play /home/your-pc/hack/snd/Alarm.wav
exit 0
else
play /home/your-pc/hack/snd/gitar.wav
let limiter+=1
fi
done

We are ready to check wether we should hear Alarm sounds or the gitar sounds. ๐Ÿ™‚
I used the play tool to play the sounds. My friend said that it only a python script that runs some other scripts or library to play sounds. Most linux distributions has it pre-installed (He guess). So if you use ubuntu 9.10 as same as I use, this will be okay. Let’s proceed! (wait, what? windows? go search for batch tutorial)

As you can see, in line 01 the script does the comparison wether the $chek is contain “data.” or empty ” “.ย  If it is contain “data.” then it will start the play commands, and start to play the sounds found in /home/your-pc/hack/snd/Alarm.wav .ย  After it done play the sound, then it will simply stop the loop and finish the script.

But, when $chek does not contain “data.” or empty ” ” this means you have no connectivity, and it will play the sounds found in /home/your-pc/hack/snd/gitar.wav .It’s not over yet, after done play the sounds,

in line 06 it will increment the $limiter values to 1–>

then finish the ifย  –> check wether the $limiter is now less than 10 (wich means 9)–> oh no it is not yet 9! –>

do the ping again –> assign the new values for $chek –> do the rest code all over again. –>

UNTIL, the $limiter finally reach nine and then finish the loop and stop the script. Why? Because, maybe in some case it is not about losing connectivity temporary. Without the while looping the script will play the sounds until it finally connected (wich we might sure,that it would be for a long-long time). And that can be iritating, but yes you can do the Ctrl-C to terminate the script if you run this directly from the terminal.

(what? you run this script from terminal?? I don’t want to see those scary blinking cursor with black and white text around it!)

okay, I’ll documenting once again how you can run this script simply from your top panel bar and run it with just a click. ๐Ÿ™‚

So you can do other things more useful than hitting reload button all over again :p, while listening to smooth sound of looping guitar pattern.

Oh! This, maybe you interested to another bash script implementation for the good use of linux. My other friend share it here.

AND IF YOU THINK YOU ARE HARDCORE PROGRAMMER, WICH APPARENTLY LAUGHING AT MY SCRIPT>>> Please..pleasee..pleaseeee… give me another algorithm that probably more simple than my stupid script…please…

The Bandwidth Abuser

Do any of you are the loyal user of Internet Download Manager? Do you always set the allowed connection to (max) 16? Do you use that configuration when you use a shared internet connection? If you answer yes to all those question, than probably you should aware that you are actually a bandwidth abuser.

18Mb?!@
18 Mbps ???????

But there are things that make you are not the bandwidth abuser:

  • you own the connection and you yourself paid it but you kindly shared it with some of your friends.
  • you set that hell of maximum connections ONLY when you SURELY know that you are the only host that up on your network

    the cheap script

Continue reading “The Bandwidth Abuser”

My dream

This is not about me talking about my dream to have my own happy family with finest job and coziest house and of course a nice eco-friendly car. But there.. I already told you. LOL.

This “my dream” is to remaster an Operating System optimized to fit an old computer or a low spec one. Well, it is diferrent, an old computer used to be the high spec computer at the time, but now we also found a brand new low spec computer built for unheavy tasks. This OS should cover lot of usual or daily tasks like browsing, office things, chatting, play musics and movies. YES, my dream is rather an easy one to be true, I have found lots of project wich has the same background as mine. Like PuppyLinux, DamnSmallLinux, and so on. But why did I still dreaming it instead of realizing it by using the Puppy and the Damn one? ๐Ÿ™‚ Because I have the dream! Haha.

So, I’ve tried the PuppyLinux and it was awesome. I haven’t tried this one, but look at this Puppy Linux 4.2 “Deep Tought” :

Puppy Linux 4.2 Screenshot

If I may say, without the sidebar stuff , I remembered the Windows 98 desktop when I look at puppy desktop. ๐Ÿ™‚

This puppy OS, is so wonderful even it only consume 100Mb of RAM and 256Mb if using OpenOffice. I’ve tried it on a PC with 256Mb of RAM and old single core AMD CPU, and it works really nice. How nice?Well I just compared it. When I used Windows XP on that PC, that just a hell of painful effort and waiting just to simply startup, start the browser then open Facebook, but when I use Puppy its just done in a few seconds and a few one clicks, lightly and happily!

Continue reading “My dream”

Video flickering on Ubuntu 8.10 with Ati Radeon HD 3200

Here’s quick explanation about the problem:
-I am using ubuntu 8.10
-My notebook used ATI Radeon HD 3200 as VGA card
-I’ve installed the ATI driver downloaded from the ATI website
-I’ve installed the compiz fusion and the 3D cube with other features runs quite well.
-I’ve installed the gstreamer codec. (but still I can’t hear any sound.)
-When I played any movie file, the pictures of the movie is flickering

.

This is the problem this post going to solve. And this is going to work with VLC player.

open the VLC player form Application>>Sound& Video>>VLC playe

Open the VLC Preferences from VLC menubar Tools>>Preferences

Set the Show Settings to All.

Click Video>>Output Modules>> Then Change the Video Output mode from default toย ย  X11 Video Output.

Notes: Actually withย  Visual Effect on the Apperance Preferences set to none you can play the movie without flickering pictures. However,the explanation above solve the problem without setting the Visual Effect to none.

My COMPAQ PRESARIO CQ45-110AU

My Compaq Presario
My Compaq Presario

This is a multimedia notebook, with vista basic pre-installed. There is a quick play button for playing dvd without booting Vista, but what happen is you still boot vista before you accessed the quick play. With AMD turion X2 2.2Ghz and ATI radeon HD 3200 shared VGA, you might think that this is a gaming notebook. Yes it is, but some upgrade must be done if you want a perfect gaming experience. I have to say, I was rather disapointed to have windows vista basic pre-installed in this series, it was run very slow on both startup and shutdown. With 1Gb RAM its not a good choice to expect excellent processing in multitasking. With windows vista multitasking makes everythings runs very slow and annoying to me.
So i decided to have ubuntu 8.10 running on this notebook. I relieve to installed ubuntu 8.10 amd64 without any problems. But problems then comes again when I have to manually installed the ATI Radeon HD 3200. And the biggest and most annoying problem is, it has no sound. You can’t hear any sounds. I have searchs any solution for this problem on forums, but it was a dead end. The last choice is to take this to the advance. I am going to do that and report anything again.

Not everything goes bad when I use ubuntu intrepid ibex on this notebook, the resolution was perfect, and multitasking was run so good, I’ve try to run multiple mozilla browser and a few application with compiz desktopcube enabled, and it run smooth. The wireless device , wich is broadcom, is running well on ubuntu. After first update you’ll find some bug fixed. And when I plug my Nokia 5310 express music with USB cable, the ubuntu recognized it as a wireless device ,or you can say a modem, you can easily use your mobile device as a modem and connect to the internet as long you have configured the packet data authorization on your mobile device.

So, the biggest problem is, that you cant hear any sound. Thats my problem until Ive published this post.