Archive for the ‘Ubuntu’ Category.

Ubuntu Spam

Using gmails spam filters I normally don’t have a problem with spam. However my one email that does receive a lot of spam is my Ubuntu email address. Interestingly enough a few open source members have droped there open source email addresses due to this exact problem. Jeff Bailey has disabled his @gnu.org email address, and talked about doing the same to his Ubuntu address. Daniel Robitaille has also posted on the problem. Now I like my Ubuntu email address so I’m not about going to delete it but I did receive three rather “great” bits of “email” to it today (Ill only include screen shots of two).

Ubuntu Spam 01

Ubuntu Spam 02

What I thought was “great” about these messages was that they where “sent” to Colin Watson and Corey Burger. Yes they got the emails wrong but I recognized the name instantly. I did find it funny that I had “antecedently” received personal emails to the both. It would be great if we where to use google apps, to run the Ubuntu emails that way we could take advantage of google great spam filters but I know that wont happen. I guess for now I’m stuck reading emails about the sexual prowess of Colin Watson and Corey Burger.

Cheating At Nethack

I’m not really a gamer, I think this has to do with a lack of skill, its no fun playing Americas Army if you die in 30 seconds, and yes they have a Linux installer. One game that I do come back to every now and then is nethack, however just like Americas Army I still die every 30 seconds. My solution … cheat. I use two simple shell scripts (backup.sh and restore.sh) to cheat.

How to cheat

  1. Save backup.sh and restore.sh in /var/games
  2. Play nethack I use nethack-gnome
  3. When you get to a spot you want to save, save and exit <ctrl + s>
  4. Using a terminal navigate to /var/games and run sudo sh backup.sh
  5. Reload nethack and continue to play
  6. If you die or need to reload your save point exit nethack navigate to /var/games and run sudo sh restore.sh then run nethack again

backup.sh
[sourcecode language="jscript"]
rm -rf nethack.bak
cp -ra nethack nethack.bak
[/sourcecode]

restore.sh
[sourcecode language="jscript"]
rm -rf nethack
cp -ra nethack.bak nethack
[/sourcecode]

It would be really great if someone created a version of nethack-gnome with cheating built right in.

AptUrl – Why don’t we use it for the Ubuntu wiki?

I often recommend Ubuntu to people and recommend that they install programs like miro, and geany. Geany comes stock in the Ubuntu repositories and miro has great step-by-step install instruction for beginners, however as I make this post they currently have no official Gutsy support. When I recommend a program to a user I usually send them the command line install command sudo aptitude install geany as well as sending them instructions

Go to System, then Administration, then click Synaptic. From there you can search for geany and you should be able to double click the name then click install and Ubuntu will install geany for you.

In my mind both solutions extremely simple, but then I have been using Linux for a while now and am a computer geek. I was trying to set up ssh the other day for a friend and they where complaining to me about how on Windows they can just click the program the select run, I claimed that you could do the same thing in Ubuntu (with a deb file) but the claim was that the website (repository browser) was ugly, and well I cant really argue with that. Now that Geany is out I can go back to my friend with another solution and if they want to install Inkscape I can just say “here you go“.

The only downside is that currently adding a new repository is disabled, my two cents is that we should give the user a nice large warning then go ahead and add the new repository. Another anoying and easily fixed thing is that I was looking at the Ubuntu wiki for games yesterday and I thought “ohh I’ll add in some apt:// URLs so that users can just click to install games”, but currently the Ubuntu wiki doesn’t support apt:// URLs so I got them working on my own wiki, just to make sure that it was easy and started a list of my favorite applications.

I guess I really have 2 requests:

  1. Enable AptUrl to add third party repositories, I’m going to download the code eventually and take a look at this and post a deb file if I make one. But It would be great if someone beet me to it.
  2. Add support for apt:// URLs on the Ubuntu wiki.

Oh and thanks for such a great feature.

New Hackergotchi

In light of the fact that I am now bald, today I uploaded a new hackergotchi to the planet ubuntu bzr tree. Uploading the picture was easy, making the picture was a bit harder. This is my first time using GIMP 2.4.0-rc3 and it seems that the selection tools don’t work the same way that they used to. In the old gimp I was able to make a selection the drag that selection around in order to remove it. It would seem that in the new gimp the only way to remove a selection (That I my girlfriend, could figure out) is to cut (<ctrl>+x) that selection. On the other hand the fuzzy select still works great.

TIP: when using fuzzy select you can use the ctrl key to un-select things that you have selected.

All in all I would say the update was a success. I just wish I had had a larger source image, (The large scale version of my new hackergotchi is a bit jagged around the edges, stupid digital camera being broken).

Large Version

From Me

Small Version

From Me

On a side note it would be fun to make a web page linking all the planet ubuntu faces to there websites / launchpad IDs, any thoughts on this? (Update: it could be just like the gnome one unless we all ready have one?)

Also I have three midterms this week, wish me luck.

Top 10 Gutsy Forum Feature Requests Revisited

A while back I posted about my top 10 feature requests for Gutsy on the Ubuntu Forums. Gutsy has brought some great new features to Ubuntu many of which I did not include in my original top 10 feature requests but if I was to do it again I probably would. In fact when I wrote the original list I had a bit of trouble coming up with 10 and in my opinion “Allow Us To Vote (like ideastorm, digg, etc.) On Ideas Here.” while it would be a grate addition to the Ubuntu Forums is not a feature for Ubuntu and hence a bit of a cop-out. All the same with the release of Gutsy I think its about time I revisited that list and commented on that list again and congratulate everyone who worked on it.

10. [IDEA] Nautilus “Restore from Trash” – Still not implemented. This feature would be quite hard to implement and for me it is a very low priority, but I can see why other users would want it.

9. [IDEA] Modify the installer so that it asks for Timezone instead of City. – While this did not happen, as far as I could tell there where a lot more cities to pick from during the install.

8. [IDEA] Reliable Kill for Fullscreen Applications – I think the best way to do this is still <Alt>f2 then type xkill then click the application.

7. [IDEA] Auto removal of old kernels - Unknown so I will assume no. (kernels are removed during a dist upgrade, thanks Kai Schröder)

6. [IDEA] Bring back screensaver settings - The new screensaver settings manager is still being used, how do I change a screensavers options in this gui?

5. [IDEA]: Warning about disk being full – Nope, per this blueprint on launchpad this feature never got out of the idea stage. (This feature might be included according to Kai Schröder … Thanks)

4. [IDEA] External Monitor Support – This feature is now included, however using the propitiatory drivers nvidia-settings gave me more options

3. [idea] Fix the delay when searching in Synaptic – It feels faster, but then this is a fresh install.

2. [IDEA] Graphical Frontend for xorgconfig (dpkg-reconfigure xserver-xorg) – This works really well. I’m really glad to see this feature.

1. Allow Us To Vote (like ideastorm, digg, etc.) On Ideas Here. – As I said before this is a cop-out and It has not been implemented on the Ubuntu Forums, however the forum staff did a great job of communicating the forums needs.

So that gives us about three 3.5 (I rounded to three 3.5 because there was a few half implemented features ex feature 9) out of the nine (I’m not counting feature number 1) features that I blogged about all that time ago and that doesn’t even include the 10 rocking features in 10 days. All in all I think that makes Great Gutsy Gibbon.

SUMming Up The Stats

I’m quite a fan of stats, checking my most viewed posts is a bit of an obsession of mine. On of my posts that continues to baffle me in how much activity it gets is my post about ubuntu root access. This post resulted in a friendly argument between me and a friend during class. At the time it was a quick and dirty post to try and prove to him that linux was far superior to windows (lol, j/k, only a friendly debate).

In response to that post so long ago I now want to post about SUM (Screenshots). SUM lets you control your boot settings, including your boot password, from a GUI. For anyone interested you can get SUM here, or if you use propensity you can import this .pa file.

SVN Error With Fix!

I have my own subversion repository, I use this to store my school work, personal data like my resume, and pretty much anything else I want to keep backups of or keep synced across all of my computers. The other day I was trying to do an svn up and I was getting the following error “Can’t find a temporary directory: Internal error“. With all my googling I found a lot of people that said that they had this error also but that the problem had fixed its self. This was no good for me since the posts I found seemed to be implying that the problem was on the side of the svn server, but since I ran my own svn server the problem was mine to fix.

Well it turns out that the problem was that my computer that runs the server had run out of space and the simple fix was to delete some old files I had. Just thought I would put this out there for anyone else having this problem.

Python vte.Terminal example

About a week ago while working on propensity, I was trying to add an impeded terminal into the program instead of just sending commands to an xterm. I quickly found out about the VTE Terminal Widget, this is the same widget used by the gnome-terminal. Now while I was able to find a great API, I was working in python not C and while I love API’s when I’m using a new feature I also find examples to be one of the best ways for me to learn, but even with all my google searching I found it really hard to find a simple python example of the VTE Terminal Widget. The good news is I now have a simple working example, its a basic gui that lets you enter a command and then that command will be run in a separate terminal window (I’m not exactly sure why I used two windows now that I think of it.)


An so without further ado here is the code (all GPL). Hope this helps someone in the future. You can download the code here, or view it below.

VirtualTerminal.py (This code could be used in your program)
[sourcecode language="python"]#!/usr/bin/env python
#
# VirtualTerminal.py
#
# Copyright 2007 Edward Andrew Robinson &lt;earobinson@gmail&gt;
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

# Imports
import os
import vte
import gtk
import time

class VirtualTerminal(vte.Terminal):
def __init__(self, log_file = None, history_length = 5, prompt_watch = {}, prompt_auto_reply = True, icon = None):
# Set up terminal
vte.Terminal.__init__(self)

self.history = []
self.history_length = history_length
self.icon = icon
self.last_row_logged = 0
self.log_file = log_file
self.prompt_auto_reply = prompt_auto_reply
self.prompt_watch = prompt_watch

self.connect(‘eof’, self.run_command_done_callback)
self.connect(‘child-exited’, self.run_command_done_callback)
self.connect(‘cursor-moved’, self.contents_changed_callback)

if False:
self.connect(‘char-size-changed’, self.activate_action, ‘char-size-changed’)
#self.connect(‘child-exited’, self.activate_action, ‘child-exited’)
self.connect(‘commit’, self.activate_action, ‘commit’)
self.connect(‘contents-changed’, self.activate_action, ‘contents-changed’)
#self.connect(‘cursor-moved’, self.activate_action, ‘cursor-moved’)
self.connect(‘decrease-font-size’, self.activate_action, ‘decrease-font-size’)
self.connect(‘deiconify-window’, self.activate_action, ‘deiconify-window’)
self.connect(‘emulation-changed’, self.activate_action, ‘emulation-changed’)
self.connect(‘encoding-changed’, self.activate_action, ‘encoding-changed’)
#self.connect(‘eof’, self.activate_action, ‘eof’)
self.connect(‘icon-title-changed’, self.activate_action, ‘icon-title-changed’)
self.connect(‘iconify-window’, self.activate_action, ‘iconify-window’)
self.connect(‘increase-font-size’, self.activate_action, ‘increase-font-size’)
self.connect(‘lower-window’, self.activate_action, ‘lower-window’)
self.connect(‘maximize-window’, self.activate_action, ‘maximize-window’)
self.connect(‘move-window’, self.activate_action, ‘move-window’)
self.connect(‘raise-window’, self.activate_action, ‘raise-window’)
self.connect(‘refresh-window’, self.activate_action, ‘refresh-window’)
self.connect(‘resize-window’, self.activate_action, ‘resize-window’)
self.connect(‘restore-window’, self.activate_action, ‘restore-window’)
self.connect(’selection-changed’, self.activate_action, ’selection-changed’)
self.connect(’status-line-changed’, self.activate_action, ’status-line-changed’)
self.connect(‘text-deleted’, self.activate_action, ‘text-deleted’)
self.connect(‘text-inserted’, self.activate_action, ‘text-inserted’)
self.connect(‘text-modified’, self.activate_action, ‘text-modified’)
self.connect(‘text-scrolled’, self.activate_action, ‘text-scrolled’)
self.connect(‘window-title-changed’, self.activate_action, ‘window-title-changed’)

def activate_action(self, action, string):
print ‘Action ‘ + action.get_name() + ‘ activated ‘ + str(string)

def capture_text(self,text,text2,text3,text4):
return True

def contents_changed_callback(self, terminal):
”’Gets the last line printed to the terminal, it will log
this line using self.log() (if the logger is on, and it will
also prompt this line using self.prompt() if the line needs
prompting”’
column,row = self.get_cursor_position()
if self.last_row_logged != row:
off = row-self.last_row_logged
text = self.get_text_range(row-off,0,row-1,-1,self.capture_text)
self.last_row_logged=row
text = text.strip()

# Log
self.log(text)

# Prompter
self.prompter()

def get_last_line(self):
terminal_text = self.get_text(self.capture_text)
terminal_text = terminal_text.split(‘\\\\n’)
ii = len(terminal_text) – 1
while terminal_text[ii] == ”:
ii = ii – 1
terminal_text = terminal_text[ii]

return terminal_text

def log(self, text):
”’if self.log_file is not None the the line will be logged to
self.log_file. This function also stors the info in self.histoy
if self.history_lenght &gt; 0”’
if self.log_file != None:
date_string = time.strftime(‘[%d %b %Y %H:%M:%S] ‘, time.localtime())
file = open(self.log_file, ‘a’)
file.write(date_string + text + ‘\\\\n’)
file.close

# Append to internal history
if self.history_length != 0:
if len(self.history) &gt;= self.history_length:
self.history.pop(0)
self.history.append(text)

def prompter(self):
last_line = self.get_last_line()
if last_line in self.prompt_watch:
if self.prompt_auto_reply == False:
message = ”
for ii in self.prompt_watch[last_line]:
message = message + self.history[self.history_length - 1 - ii]
if self.yes_no_question(message):
self.feed_child(‘Yes\\\\n’)
# TODO not sure why this is needed twice
self.feed_child(‘Yes\\\\n’)
else:
self.feed_child(‘No\\\\n’)
else:
self.feed_child(‘Yes\\\\n’)

def run_command(self, command_string):
”’run_command runs the command_string in the terminal. This
function will only return when self.thred_running is set to
True, this is done by run_command_done_callback”’
self.thread_running = True
spaces = ”
for ii in range(80 – len(command_string) – 2):
spaces = spaces + ‘ ‘
self.feed(‘$ ‘ + str(command_string) + spaces)
self.log(‘$ ‘ + str(command_string) + spaces)

command = command_string.split(‘ ‘)
pid = self.fork_command(command=command[0], argv=command, directory=os.getcwd())

while self.thread_running:
#time.sleep(.01)
gtk.main_iteration()

def run_command_done_callback(self, terminal):
”’When called this function sets the thread as done allowing
the run_command function to exit”’
#print ‘child done’
self.thread_running = False

def yes_no_question(self, message):
message = message.replace(‘\\\\n\\\\n’, ‘[NEWLINE][NEWLINE]‘).replace(‘\\\\n’, ”).replace(‘[NEWLINE]‘, ‘\\\\n’)

if message.find(‘?’) == -1:
message = message + ‘\\\\n\\\\nDo you want to continue?’

type=gtk.MESSAGE_QUESTION
if message.lower().find(‘warning’) != -1:
type=gtk.MESSAGE_WARNING

dialog = gtk.MessageDialog(parent=None, flags=0, type=type, buttons=gtk.BUTTONS_YES_NO, message_format=message)
dialog.set_icon(self.icon)
dialog.show_all()
responce = dialog.run()
dialog.destroy()

# Responce == yes
return responce == -8
[/sourcecode]

TestVirtualTerminal.py Used to actually make the GUIs, this is the program you should run.
[sourcecode language="python"]#!/usr/bin/env python
#
# TestVirtualTerminal.py
#
# Copyright 2007 Edward Andrew Robinson &lt;earobinson@gmail&gt;
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

import gtk

from VirtualTerminal import VirtualTerminal

class mainWindow(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self.connect(‘destroy’, lambda w: gtk.main_quit())
self.set_default_size(400, 400)

self.button = gtk.Button(‘press me’)
self.button.connect(“clicked”, self.pressed_callback)

self.command_entry = gtk.Entry()
self.command_entry.set_text(‘python count.py’)
#self.command_entry.set_text(’sudo aptitude install gaim-encryption’)

vbox = gtk.VBox()

self.r = 0

self.add(vbox)

vbox.pack_start(self.command_entry, False)
vbox.pack_start(self.button, True)

self.myTerminal = terminal()

self.show_all()

gtk.main()

def pressed_callback(self, button):
print ‘presed’
column,row = self.myTerminal.terminal.get_cursor_position()
if self.r != row:
off = row-self.r
text = self.myTerminal.terminal.get_text_range(row-off,0,row-1,-1,self.capture_text)
self.r=row
text = text.strip()
print text
self.button.set_sensitive(False)
self.myTerminal.terminal.run_command(self.command_entry.get_text())
self.button.set_sensitive(True)
print ‘done’

def capture_text(self,text,text2,text3,text4):
return True

class terminal(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
#self.set_title(self.settings.application_name)
self.connect(‘destroy’, lambda w: gtk.main_quit())

self.terminal = VirtualTerminal()

#self.child_pid = self.terminal.fork_command()

self.add(self.terminal)
self.show_all()

mainWindow()[/sourcecode]

count.py A little test program but you can run any command you want
[sourcecode language="python"]#!/usr/bin/python

import time

print ‘0′

for ii in range (10):
time.sleep(1)
print ii + 1[/sourcecode]

A special thanks to Alberto Milone for all the help he provided me with for this.

Propensity – feedback wanted

I have been using ubuntu for quite some time, and I have ubuntu installed on 20+ computers at one time. I find myself always installing ubuntu on a different computer. One of the things that I always do is install some programs that don’t come stock with ubuntu like geany, or miro. At first I had a simple shell script that I ran that aptituded (lol) all the programs I wanted to install. But soon that was not enough because different computers had different uses and installing miro or gaim guifications on a work computer, or a computer that will be going back to a client is out of the question. Another thing I wanted was to updated the source.list file with new repositories cleanly. And so eventually that shell script involved into a python program.

I have spent a bit of my summer cleaning up that python program and the result is propensity (I looked for synonyms for aptitude) and now I figure its almost ready to be released into the public. I have uploaded both a deb file and the source to my website, and would love some feedback.

Some features that I would like to add before I release it are:

  • I would like propensity to generate a standalone shell script that could be used to standalone install the package
  • Icon
  • Splash screen
  • Ability to add your own programs and save them (so you can load them from a file at a later date) Thanks Ed
  • Documentation

To sum up you can get the deb file here, and the source here. Thanks for any feedback you have.

Update 01: I made a post to the ubuntu forums and posted a screenshot
Update 02: I have been dugg.
Update 03: Propensity has only been tested on feisty.

Linux live CD as a window recovery tool

As a computer geek one of the first things people say to me when learn that I’m a computer geek is “can you fix my computer”. Now depending on my mood or how exactly they asked, offering beer is always a good idea, I usually respond with “I don’t use windows, and haven’t used it in years”. But if your nice and its convenient for me sure Ill give it a shot.

The other day a friend of mines computer laptop had stopped booting, during the boot it would get the blue screen of death. She had all ready called IBM, she got her laptop before Lenovo bought the thinkpad name, who said the hard drive was most likely dead. Seeing as she had lost all her data I first scolded her for not creating proper backups, and then told her that if she brought her computer to me I would give it a shot at fixing it.

Popping a Ubuntu live cd into her computer and then plugging in an IPod we where able to recover most of the data on her computer. To me it seemed second nature to be able to run an operating system off a live cd in order to recover data, but to her it seemed foreign since windows would not boot she had assumed all was lost.

Is this really still the case for windows, what do you do if windows wont boot (and yes safe mode and the “IBM recovery button” would not boot)?

Disclamer: This is not a windows bash but is there no way to yank your data off the computer if it wont boot other than taking out the hard drive?