Saturday, December 1, 2012

Linux Basics

I thought I knew something about Linux. All confident in my knowledge. But I didn't know Jack - still don't. But as I was reading the LPIC (Linux Professional Institute Certification) Study Guide I learned a lot. A LOT! Holy moly that book kicks ass. Now I just want to share a little of what I learned.

Friday, October 26, 2012

Gentoo On My HP Part 3

Things are going pretty well. Not well enough for me to change my GRUB2 default yet... Well, I guess I could.

But I did run across some curious problems and their solutions. The first was starting X via xdm (instead of startx). SLiM would just get stuck - not starting anything but what looked like a twm session (less terminal window). When I made xdm be the default display manager by editing /etc/conf.d/xdm and changing DISPLAYMANAGER="slim" to "xdm", the result was a loop of xdm trying to start "LXDE" but just kicking it back to the login screen.

Checking /var/log/xdm.log yields
xdm error (pid 2441): Dbus error: Unable to open session: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
xdm error (pid 2441): console-kit-daemon not running?
The solution was to add dbus to the default runlevel and restart. rc-update add dbus default They left that out of the manuals, I guess because dbus got pulled in by something else - not sure what.

As a bonus to adding dbus to the default runlevel, my MP3 player is now auto-mounted when I plug it in. (At least) Two birds with one stone!

Also, I emerged the "murrine" packages - and that cleared up most of my icon problems. x11-themes/murrine-themes and x11-themes/gtk-engines-murrine

Thursday, October 25, 2012

Gentoo on my HP - Continued

I'm pretty sure that I got lucky when I configured the sound on this thing. It didn't work at first, but I'm sure that it's because I didn't have the right flags in make.conf. When I installed pysolfc, the sound worked and I'm pretty sure I did that before messing with the sound configuration in the kernel. And all I did there was to compile it as modules so I could figure out which ones I needed and which ones I didn't.

I had written a bunch of simple scripts for my Dell that I sure miss now. Some of them I rewrote - the really easy ones like the one to watch the progress of the emerge or the progress of the fetch. "tail -f /var/log/emerge.log" - easy, like I said, but I always forget where they put the emerge.log - so it comes in handy. I had a really cool one that backed up imo important files like /usr/src/linux/.config and /etc/conf.d and stuff like that and tacked the date onto it. Now I'll have to figure out how to do that again.

Sunday, October 21, 2012

Gentoo on my HP2000-425NR

Well, my Dell died :-( May it rest in peace. So I bought the cheapest good machine I could find, or maybe the best cheap machine - which turned out to be a HP-2000. Memory was on sale, so I got an extra 4G.

Specs:
AMD E300 1.3 GHz processor.
6GB Ram
320GB Hard Drive
Ralink RT5390 Wireless
ATI Technologies Inc AMD Radeon HD 6310 GraphicsATI
ATI Technologies Inc SBx00 Azalia (Intel HDA) (rev 40)

Installing Linux has proven problematic.

Friday, February 17, 2012

A cheesy application to check for new podcasts and transfer them to my Walkman

#! /usr/bin/env python

""" Version 0.02.02
        Just a simple file manipulation tool.
        Used in this instance as a Podcast updater.
        Still stuff to do - see TODO file"""

import sys, os, time, stat, shutil
import tkFileDialog, ttk, tkMessageBox
from Tkinter import *

Monday, February 13, 2012

Python Tkinter and Feedparser.py Cleaned Up a Little.

So, after some massaging of the available information and examples, I now have a list (not necessarily a python list) of items in the feed. Instead of printing them, I'm going to insert them into the form.

Sunday, February 12, 2012

Using FeedParser.py to Get Feed Info From a Website.

This is what I'm talking about with the documentation. I wanted to open the url and get the information from it. But how do you do that? I tried urllib2.urlopen(url[, data][, timeout]), but that didn't work. FeedParser.py comes with a nice example program - and that is what I shamelessly copied.

Friday, February 10, 2012

A Way to Use Tkinter and Python

There's probably as many ways to learn as there are people.

I'm learning Python, and OOP, and Java and a ton of other things. There seems to be no end to the number of things of which I am ignorant. But I like Python - it fits my procedural style while giving me a transition into OOP.

There are a ton of great sites out there. Effbot has a kick-ass site. Python's documentation is very good. But my questions are often more practical than the intelligent stuff these guys talk about.

For example, this my first post, is all about writing the code for a Tkinter application. But I wanted to put the code for the GUI in one file and all the meat in another. Seems simple enough, and for most of the programmers out there it undoubtedly is. It's probably so easy, they don't feel the need to write about it. I, on the other hand, am baffled by easy stuff like this.

And so, I wrote a really simple application to do - well not much of anything. But it does contain a file which defines the application - two buttons and a text label. The other file contains an instance of the class and a function which reacts to a button press. I hope this helps someone.

file listing for generic.py - the gui portion of the project. So the idea is to write the GUI part - and then to more-or-less forget about it.

#! /usr/bin/env python

"""generic.py was written as an example of how to split a project
     into multiple files"""

import sys
from Tkinter import *

class Application(Frame):

        def __init__(self,master=None):
                Frame.__init__(self, master)
                self.pack()
                self.createWidgets()

        def createWidgets(self):

            self.frame0 = Frame(self)
            self.frame0.pack()
           
            self.label1 = Label(self.frame0, text="This is a text label.")
            self.label1.grid( row=0, column=0)

            self.button1 = Button(self.frame0, text = "Push Button")
            self.button1.grid(row=1,column=0)

            self.button2 = Button(self.frame0, text = "Quit" , command = self.quit)
            self.button2.grid(row=1,column=1)

And, its companion l-gen.py


#! /usr/bin/env python
from generic import *

app=Application()
app.master.title("Hello There")
app.master.geometry("600x400+20+20")

def process(self):
     pass
     print ("process activated")

app.button1.bind("<Button-1>", process)

app.mainloop()

Next, I want to make the button go to a website. Where I'm going is to get a podcast feed list, and eventually i want to download them and play them. For now, I'll use Tkinter, but I'd prefer to use PyQt. I can't wait to figure out how to do that.