PDA

View Full Version : Creating "Ubuntu - tip of the day" application


Garyu
February 20th, 2006, 07:53 PM
Hey,

I want to make a "Tip of the day" application for Ubuntu. The thing is, I have never written anything for linux and in general my programming experience is limited. I have found and installed glade and anjuta, but it seems to me that this kind of thing ("Tip of the day"-applications) are quite common, and generally sticks to a certain design and appearance.

What I wish for is a simple template for "Tip of the day" which I can just insert my information into, maybe even without a compile. What do you think would be the best approach for this? There should be room for different language translations as well.

My aim is to make a general Ubuntu "Tip of the day" to be included in Dapper and help new users explore their new OS.

gord
February 20th, 2006, 08:01 PM
bit late for dapper, but i would suggest python and wxpython or pygtk to handle the gui stuff to display. n then use xml or just a plain text file that you read to hold the 'tips'


allthough personally i can't stand those things and allways, allways check the disable box ;)

majikstreet
February 20th, 2006, 08:32 PM
hmph. something that simple could probably be made in bash and then using zenity.. but don't ask me how lol.. my guess would be to take a file, use a certain syntax and make the different boxes, then have a bash program pick a random one, strip out the title and the actual tip, then output that into zenity..

but that's just me.

Plank117
February 21st, 2006, 03:07 AM
import javax.swing.*;

public class TipOfTheDay
{
public static void main(String args[])
{
//Giant pile 'o tips goes here (use an array)
//Tips like: "Did you know that bad things happen if you overwrite /usr/X11?," etc.
//^ Sadly enough, I actually managed to do this once ^

//random number generator grabs tip from giant array

JOptionPane.showMessageDialog(null, tip);

System.exit(0);
}
}


Use Java, and it's just that simple...

Garyu
February 21st, 2006, 07:15 AM
public class TipOfTheDay
{
public static void main(String args[])
{
JOptionPane.showMessageDialog(null, tip);
System.exit(0);
}
}

Use Java, and it's just that simple...

Well, thank you for the tip, it lead to me finding Eclipse which seems to be a GREAT environment for java development. But when I try to run the above code a popup flashes by, without waiting for an OK or anything. So it doesn't work as well as I would hope. :cool:

Zeroangel
February 21st, 2006, 07:29 AM
That's quite and ambitious project you are trying to start. Yeah, Tips would be useful for newbies. However there are 'problems' with the current help systems:

1) Tip of the day: Popup windows are interpreted by most users (and i'm deflecting here) as annoyances that get in the way of actually using the machine. Tip windows, in their current form also hold very limited amounts of information.

2) Help Menu: Navigation takes too long, very clunky. It would be nice if the help menu included a global search feature (ie: Windows help), and even a side pane which allows you to navigate much faster (ie: KDE Help).

I believe it would be better if there was a popup window on first boot (with a 'don't show this again' checkbox) that provided help on getting started with Ubuntu. For example, installing programs, links to the forums and wikis. Maybe even a pointer to setup wizards such as EasyUbuntu.

sapo
February 21st, 2006, 07:46 AM
I think i'd like better a quote of the day.. or the howto of the day.. or the joke of the day :P

Garyu
February 21st, 2006, 10:54 AM
hmph. something that simple could probably be made in bash and then using zenity.. but don't ask me how lol.. my guess would be to take a file, use a certain syntax and make the different boxes, then have a bash program pick a random one, strip out the title and the actual tip, then output that into zenity..

but that's just me.

Majik, this actually does the trick. :)
#!/bin/bash
#
# Ubuntu tips
#
# Displays a random "daily tip" in a dialog box when called
# Usage: "sh ubuntutips.sh < inputfilename"
#
# Author: Dan-Erik Lindberg (Garyu in the Ubuntu forums)
#

# Read a line from the file
while read line
do
number=${line:0:6}
if [ $number = 1 ]
then
echo ${line:0:6}
zenity --title "Ubuntu daily tip" --info --text "${line:7}"
fi
done

exit 0
My input file looks like this now:
1 Installing and configuring samba will let you share files with MS Windows-based computers over a network.
2 You can use ssh (secure shell) to share files with other unix-based computers on your network.

Works great, looks good, and very very simple. I have no linux programming experience and I have hardly touched the command line previously other than to do an apt-get or two, but even I managed to write this script and make it work. Now all I have to do is figure out a way to randomize the row numbers so that different tips come up each time.

I have to say, I don't know what I was doing before I started playing with Ubuntu, but I have sure missed out before. I love this game. :cool:

EDIT: One small thing is missing though... That small checkbox where it should say "Don't display this ever again"...

Garyu
February 21st, 2006, 11:15 AM
1) Tip of the day: Popup windows are interpreted by most users (and i'm deflecting here) as annoyances that get in the way of actually using the machine. Tip windows, in their current form also hold very limited amounts of information.

I believe it would be better if there was a popup window on first boot (with a 'don't show this again' checkbox) that provided help on getting started with Ubuntu. For example, installing programs, links to the forums and wikis. Maybe even a pointer to setup wizards such as EasyUbuntu.

I know this is a potential annoyance, but if you can get a "Don't show again" checkbox as you mention, I think the usefulness of this for new users would overcome the annoyance of checking that box once and clicking OK.

A different approach would be to just include it as a panel applet by default. Easy to remove, easy to click once or twice or many times if you feel like being inspired. :cool:

heimo
February 21st, 2006, 11:57 AM
Now all I have to do is figure out a way to randomize the row numbers so that different tips come up each time.

See this example:
http://www.tldp.org/LDP/abs/html/randomvar.html#PICKCARD

soonindallas
February 21st, 2006, 12:22 PM
I think i'd like better a quote of the day.. or the howto of the day.. or the joke of the day :P

don't you have wanda ?

sapo
February 21st, 2006, 01:58 PM
don't you have wanda ?
What's that?

heimo
February 21st, 2006, 02:05 PM
What's that? Right click on panel->Add to panel->search fish->Add

Also try running fortune on command line.

UbuWu
February 21st, 2006, 06:47 PM
Only thing that is still lacking is a fortune-ubuntu-hints package (there is a fortune-debian-hints package available from the repo's).

keyboardashtray
July 25th, 2007, 05:55 AM
To revive an old thread here: is there an Ubuntu tip of the day program yet? I would love that - I was browsing Add/Remove and I saw one "KTip" for Kubuntu, but nothing for Ubuntu :(

Note360
July 25th, 2007, 11:32 AM
this is a good idea... However, we should redesign the idea of tip popups. I mean i hat them, even if the tips are good. ESPECIALLY in GIMP and if I had it in and OS I might consider dropping into a new OS (or distro for me).

What about a icon in the panel that whn clicked it will display a tip. Very few people will use it but it would be less annoying than popups and those that need it will get it. After that is implemented, implementing a basic help system (like man pages?) would be the next step. THis help system would be easy to get around, maybe even running in the browser (Javascript, html/xml/plaintext this way it doesnt use apache. Unless you want to run it off a server on the net for general use, but then we would need mirrors).

I myself would enjoy working on the second one. Actually a browser one would be cool, because then just make a page that will pop up random tips in it and put a link somewhere maybe even suggest it for the main page?

keyboardashtray
July 25th, 2007, 05:04 PM
Well a net based one would have the advantage of having a more flexible and up-to-date tip list. FAQ from forums, or wherever. I think it is easy enough to have a "Don't Show Tips" checkbox, and assuming it was gotten from the repos anyone who didn't want tips wouldn't install it in the first place. If it actually got to the point it was packaged with future Ubuntu, well then I guess the checkbox or uninstalling it would be an option. In a more advanced program, a general tip could have links to online documentation or help files, a sort of "more info" button. Tips could be little tidbits like console commands, customization options, and even definitions on common terms in Linux that a brand new user might not be familiar with.

AlexThomson_NZ
July 25th, 2007, 07:31 PM
I think this is a great idea, and a pretty good/feasible first program too!

I like the fact that it can be extendable to be either Tips/Messages/Jokes/Quotes. Would not be that keen on having to connect somewhere on the internet to get them, otherwise you have the headache of managing joke/message/etc repositories, making sure the links are active, competing sources, etc. Just update the jokes/quotes/etc. with the program and let the automatic updater take care of it.

I think this would be a better solution that Wanda