Sunday, June 17, 2012

Glade

This one for the Systems Programmers out there:

Years ago, Glade was a GUI editor for C users only, a lot like MFC/Java.  Well a few years back, it became Python friendly too, but who uses Python?  As of recently, I now use Python- that's who!  So, I began to wonder about Glade all over again, and my oh my how it's changed.

Back in the bad old days Glade made a make file, and a buncho support files for C and Gtk use.  It was what is best described as a mess.  You'd look at it and say; ok, it's somewhat useful.  Now however, Glade does all the same things in drawing a GUI interface from the basic widgets of Gtk, but now they are packed neatly into an XML file.  This XML file is then processed by your programming language, to setup your form design widgets.  And that's what so forkin neat about it.  Now your code can share dialog boxes, like the idea of common dialog boxes in Windows.  How cool is that?  So you could Prototype in Python, and then Compile Binary in C later, for better speed.  Woohoo!

But making your application from Glade work, is like the worsted described mystery in all Linux programming.  There are two complications here;  First, GtkBuilder vs. Libglade.  And Libglade is already obsolete, however it's what 90% of the tutorials on the Internet use.  Second, the PyGtk tells you there are OnButtonClicked events predefined, which really doesn't tell you how to use a menu item, or what these predefined names are... 

Like everything in the Gtk, you'd better have some crib-notes close by.  So understand that in the Gtk, unlike everywhere else, a menu is activated, as a button is clicked.  Everywhere else, a menu is nothing more than a button.  So the events are 'activate' and 'clicked', and finding those in the Signals controls is not very hard, but now we have to deal with the trick of Libglade vs GtkBuilder.  When Gtk said it was predefined, they meant IN GtkBuilder only!  Again, most of the tutorials are in Libglade, which is where it all comes off the rails.  Finding those predefined names isn't so hard, once your using GtkBuilder- they are the first event option in the list.

What really going to change though is the start up.  Here's a basic Python file, that has both (Libglade commented out).
#!/usr/bin/env python

import sys
try:
     import pygtk
      pygtk.require("2.0")
except:
      pass
try:
    import gtk
      import gtk.glade
except:
    print "Glade/Gtk failure!"
    sys.exit(1)

class RawTemplate:
    """
    The RAWTemplate class
    RAW stands for nothing, this is just a skeleton class to      create GTK
    applications quickly with common dialogs already in place ready to go.
    (THIS RAW has been altered for use with Glade)
   
    Program requires the following set:
     
    """
    #--------------------------------------------------
    def __init__(self):
        self.gladefile = "./booger.glade" 
        builder = gtk.Builder()
        builder.add_from_file(self.gladefile)
        self.window = builder.get_object("window1")

        # self.wTree = gtk.glade.XML(self.gladefile)
        # self.window = self.wTree.get_widget("window1")
        if (self.window):
            self.window.connect("destroy", gtk.main_quit)
        self.window.show_all()


if __name__ == "__main__":
    RawTemplate()
    gtk.main()


***Pardon the scrolling, if you copy/paste this into a text editor, it works fine.  I can't find the good old BLOCKQUOTE in this Blogger editor, so it's messing the python code up.

Anyway, this article was not intended as a tutorial, only as comment on the mystery statements made by all the tutorials out there.  Once most of you are brighter than me, you shouldn't have any problem with this.


Friday, June 8, 2012

Fork me, FALLING OFF THE GRID?


When I got a Ubuntu machine, the Upgrade Manager appeared with a check box, that upgraded the WHOLE operating system to the latest version. Something I was quite hesitant to do, once old versions of Linux use to take no prisoners, and repartition hard drives before installing (loosing all your data). Well, once I got BIG ASS EXTERNAL 2TB hard drive to make backups on, I got my nerve. I checked that box, and seamlessly it was done, and it became expected by the user. There was my fatal mistake, in trusting that check box to show time and again, for I haven't seen it again for at least 3 version releases.

NOW, Upgrade Manager is prompting me for the CD for the latest version to do installs. Which is not such a problem because I have downloaded the CD image, but the Upgrade Manager has chosen to “Ignore” it. Meaning- DO YOUR OWN UPGRADE BUCCEROO!

So with much fear and trembling, here we go again! I'm trapped into upgrades I really don't want to make, in order to own the newest and spiffiest versions of... I really don't know why I need to upgrade, other than to keep UPGRADE MANAGER working correctly? It's sad, but true!

Wednesday, June 29, 2011

Open Office is closed?

Well, we feared that Oracle really wouldn't get and understand the idea behind Open Source, and apparently they don't. OpenOffice.Org is now shut-down by Oracle, so don't bother going there.

It is to my understanding that the staff left, and formed Libreoffice. Libreoffice is being packaged in Fedora 15, which has just been released recently.

What's going on and where we go from here would be anyone's guess. Once Oracle isn't talking, so Techie haven't much to say. The project is suppose to pass to Apache. So now we have two office suits, both basically the same thing?

Oracle has managed this poorly. We'll keep you posted as it all shakes out.

UPDATE:
OpenOffice.ORG has been restored (moved?) which is a relief.
However, the question is still is it a dead product now?

Large Storage

One of my problems with Linux is SCALE- nearly everything quickly becomes too big. This is a PC problem in general. You have new version upon new version. The more Mega-pixels your camera has, or you start editing video... It all eats space, huge amounts of space. Sooner or later, your going to go External Hard Drive SHOPPING, and WOW they're monsters!

Issue #1, on older systems is USB. Everything comes USB2 these days, so I'm going assume you're not older than that, and really functional. But fear not these USB3 devices, most come with a USB2 to a USB3 cabling. So they will work, as of this writing.

Issue #2, is usability. I just bought a 2TB system for $94, and it came Preformatted for Windows. Let see what this system really is, I'll talk you through this as I do it here: Click on System menu on the Desktop Toolbar, and down to Administration Menu, and then on application Disk Utility (this is using Ubuntu). I have the Western Digital (WD) 'My Book' 1130. And in the lower section under Volumes, it says it's formatted NTFS.

Now NTFS is Windows NT's kiss of death for Open Source sharing, HOWEVER in recent years, Microsoft is now allowing sharing of this technology, with non-Microsoft system. Which is to say, my Linux box is using it and happy with it today, no extras being added. So this was a long way to go to say; YES you can use them right out of the box! I have no desire to reformat it EXT3, why?

Issue #3, is security. These external drives can be HOT SWAPPED, even on a Linux machine. So, you have the positive power of AIR GAP, which is 100% hacker safe when it's unplugged (hint). But that will not keep you safe from Virus, that have already dug themselves into your data. So scan, scan, scan, make sure the data is clean before you roll them off onto an external.

Unix system like Linux, make backups easy and hard at the same time. It's easy to backup your personal data, that all in your home directory. It's hard to do the ENTIRE home directory for all users, unless you become the root user, or as some call it; the Super User. Because then you're the top of the food chain, and nothing is off limits to you- and that's what you'll need.

As I'm sure you know already, we're going to need a terminal window application open. At the prompt $ enter:
$ sudo su
and then enter your root user password (if you never done this before; and you have one user account it boots into, it most likely is the same as your password). When you sucessfully become the root user, the prompt changes from $ to #.
Next let's learn about TAR and tarballs. You can make tarballs from Gnomes Browser (nautilis) Edit menu. But you have to be able to write to exactly where your at, and the command line is stronger and better for this job.
# tar cvfz /media/My Book/100615backup.tar.gz /home /var/lib
say what?
tar {flag operations} {backup file's name} {... (what you want backed up, one after another)}
c create, v verify, f file archive, z gzip compression
C and V are the only two flags important to this, and I included /var/lib in the example because that is where your PostgreSQL and MySQL data is stored, in case you didn't know? (but it is BETTER to dump your databases before a backup, than to back them up- it's a portability issue that can burn you bad).
# exit

My last words of advice are simple, and actually important. Don't trust your electric company to bring you stable power. I've had microwave ovens, and coffee machines, cellphones, and even computers damaged by spikes and brown outs. So UNPLUG not only the USB cable, but also from the WALL when not in use, to keep your backup system SAFE!

DATA RECOVERY
You can recover your data with just the Gnome Browser. Once it has full paths stored into it, you will want to write the files to the root system path '/', and they'll fall right back into place, if your restoring the whole thing. Otherwise single files can be picked out with the Gnome, and put anywhere you'd like. Data recovery is the easy part.

Wednesday, March 9, 2011

Finding the good software

In the Ubuntu Software Center programs are ranked with stars. But Ubuntu really doesn't go out of it's way to promote software. However, the Fedora Project is still trying like hell to talk people into trying Open Source systems, so they actually promote the best of the best, as part of that sales pitch. So to learn what's new, and worth looking at, make a visit to Fedora, even if your not using their Linux. Almost all those same programs and versions are in Ubuntu too.
(See Linux Distributions list (to the right))

Monday, March 7, 2011

Men are from Mars

A friend is trying to setup a server with Myth TV, so he's taking the plunge into Linux. And he's getting madder and madder by the minute. Took me 3 minutes to download and install Myth TV. And in a Linux install, unless the Kernel changes, nothing EVER has to reboot. So he tells me, he can't find anything he wants, and when he does, he has to compile it, and then he has to install it and he doesn't know where this shit should go- AND EVERYTHING REQUIRES ME TO REBOOT, RANDY!!! Whoa! So ah, what's going on here- clearly I'm not understanding. And it's just like me to snap back at being snapped at, so this is not a good situation, and this is an experienced programmer I'm dealing with. SO WTF???

Well, I've got some hardware problems of my own that have shown up. They crawled into my system on several upgrades recently (which is such a great sales pitch). There is no chatter out there about these being bugs, so it must be unique to me (a misfired script). So, I start downloading the newest versions, and could sworn that I was running a 64 bit version, so that's what I downloaded. I baked my CD, and booted it up, and the 64 was working fine- I'm just not ready to torch the install I use daily, so I don't bother with installing this one, I just add it to the inbox on my desk.

After exchanging some hostile emails with my buddy, I decided to download Fedora 14, and give that a test drive. Which comes in a i686 package but only 32 bit? Ok, I don't care. Things written for bigger bus paths, aren't normally faster to begin with, it's just something to fool to public, mostly! I bake it on to a CD, and give it test drive. It's been a few years since I was on Fedora, and the menus are lot more complex. And the application installer is quite a bit different that Debian or Ubuntu. These are things you forget over time. Anyway, while I like the artwork of Fedora about a x1000 better, it again is not something I'm willing to trash my current install for right away, so in the inbox it goes too.

I'm still extremely puzzled by my friend's frustration with Ubuntu. And what does he mean he can't find anything he wants? The Software Center or Synaptic Package Manager have EVERYTHING ready to download and install, no building, no hassle of knowing where it should go- download, run, enter root password, chugga chugga DONE! Up and running.

So I pop the 64 bit Ubuntu 10.10 back into the CD drive, and reboot. It comes up, so I'm wondering why he said he couldn't even get the Flash player to load into Firefox or Chrome? So I take that as my challenge, put the Flash player in place, even running on a Ram Disk (rather than a hard drive install). And I can't even get it recognized as a plugin that is available? And just like he said, I tried EVERYTHING that was an option from the Adobe website. So then I went to the Firefox website, and looked for plugins. I was baffled too. While I was in Fedora, I managed to install an Open Source one- it didn't work well, but it was there. Couldn't find that either in any of the Ubuntu installers? Hey, I can't even find Myth TV? What's up? Why are there such lame ass limited versions here, compared to what I'm using daily? Something wrong! Then it dawns on me- this is the 64 bit version. It's sooooo new, there isn't any software built for it, is why the installer is so retarded.

So, I go back to Adobe, and get the 64bit version of Flash. It has just the old Netscape style plugin file, in an archive package. No installer program written. Well, I know what to do, I'm just not sure I can do this as a guest on a Ram Disk version of Linux?

So I open a terminal window, and sudo su, hey I'm right there, not password prompt or nothing? I type in nautilus, and the Gnome browser pops up. I go to /tmp and double-click that archive, it opens right up. I tell it to extract into (got to go searching a bit) /usr/lib/firefox-addons/plugins. I close everything up, and restart Firefox, and goto YouTube, and watch some Jim Gaffigan videos (he so funny).

I did it, and I solved the mystery like Subby Doo. FUCK THE DAMN 64 BIT VERSION, IT AIN'T READY! Download and install the 32 bit version and you'll be fine. My friend on the other hand, he doesn't seem to be talking to me today. Don't worry, I'm just giving him some shit here, our friendship can take it- he's not that mad, and neither am I.

Meanwhile, I confirmed that I don't have a hardware problem with my computer, just a bad script in there somewhere? So I got something out of his misadventure too! (Two more junk Linux CDs, and no desire to upgrade anything).

Monday, February 28, 2011

No BS, why Open Source?

Everything the ESTABLISHMENT tells you is total BS, about making code you can change. Here are the real facts; to run on the largest number of systems, as Unix does, Linux is run mostly by SCRIPTS, rather than compiled binary files which are common particularly in Windows. Most of these scripts are just text files, and for that reason, anybody can read and change them.

Much of this stuff started before the Internet. So like GNU General Public License reads the way it reads, because most of the early programs were distributed on floppy disks from Public Domain bins, back in the day. Today, you download everything direct from the primary developers off the Internet. So distribution parts of Licensing seems kind of crazy, when you can get it directly from the source these days.

Still though, you're best to download the recommended version for your current Linux distribution (version/brand). Almost none of programs these days require that MAKE anything, when you download this way. The biggest problem with Open Source software is how quickly EVERYTHING changes, verses how slow it is on Windows. But install by the distributions installer, normally puts you directly into the automatic upgrade loop. Don't worry, it has a pop-up form that shows up and let's you select the things you want to upgrade. This can get a little annoying when day after day there is something new that showed up overnight- but rarely to these upgrades require rebooting, unlike EVERYTHING in Windows.

In Ubunto, under the Applications Menu, there is the 'Ubuntu Software Center'. These are the most recommended add-ons for the system, but not the whole catalog. To find the whole catalog, you must look under the Systems Menu and Administration for the 'Synaptic Package Manager', and this catalog is HUGE, but unrated like the other. If your wondering what was installed, or if the whole package was there, the Synaptic can provide those answers better than the Software Center. Both of these methods of adding software, put in things ready to run. However, when your prowling for Open Source, frequently they're not ready to run and you'll have to MAKE them, which is why I say check these programs first. They'll hook the menus and everything else for you.

For example: Myth TV list just the front end product in the Software Center. However, checking Synaptic, you find that the Backend is installed too. Which is what kind of spurred this article into existence to begin with.