So close, yet so farfetched.

I’ve begun implementing Style 1 for NPM’s user interface but it is much less functional then style 2. I think style 1 is a lot more conventional, it’s based on an idea I had a long time ago. After I installed Qt3 bindings for Ruby I thought about writing a ports front end with that kind of layout.

I personally like style 2, it has a ‘orthodox’ file manager like style to it, since I’ve never gotten to use such a file manager a lot that might be why I like it lool. I stil need to write the loading code but that won’t be difficult in python.

It is however the most obvious thing in the world to me that as soon as my family is up and about there is not even a snow balls chance in hell of getting further work done.

Which as this case proves, means it’s time to kill some time until bed time… So I can get back to coding in piece and start work on my PC-BSD test machine.

Yet that dream still naggs at my mind….

I figure for today, I can probably work on updating my PC-BSD test machine to using FreeBSD 7, for updating the ports that will likely have to wait for later. With luck I can leave it running over night.

I want to spend some time working on the user-interface for NPM, I know what I want but I am not sure what value it will have. Essentially my idea is for the user to select from several implementations of the main window including the ability to use custom made modules for it.

I also want to implement an option by which each module is checked against a given list of checksums, if the module fails the checksum it won’t be allowed to load. With this method one could theroectically restrict any non-NPM supplied window layouts from being loaded but it’s probably a useless feature but one I’d like to tinker with just for the fun of it lol.

I also know if I don’t get a few things out of my head I’m going to pop.. Maybe coding will help :.

NPM going Beta soon !!!

I’ve spent the last 3 hours or so hashing out changes in NPM’s sources.

I’m not totally satisfied with the look of the settings dialog, I don’t think it looks professional enough for a proper release… Maybe it is just me. This is one reason I’m axious for the Qt4/KDE4 port because I’d like to get my arms around some of the changes in layout but I guess it can wait.

I still need to come up with icons for the menu to replace the text labels (ports, logging, network) but I think this is a good enough settings front end for now. I took a quick screen shot of each of the pages that show the preferences that I’ve setup so far:

[click to enlarge]
Free Image Hosting at www.ImageShack.us

Free Image Hosting at www.ImageShack.us

Free Image Hosting at www.ImageShack.us

That should take care of the basic user settings for now. I really think it is time I start to focus on the back end slots. Because as much progress as I have made in the last several commits of getting the GUI to work with the settings system I never got around to writing code to get it to make setting changes persistent through the GUI :o)

Once that OptionsInterface and related code is done and interfaced with the code in portactions.py I can work on the next phases I need done before a beta release:

  1. Implement the GUI front ends for running portsnap/cvsup/csup, atm it should run but without user output and a start button lol.
  2. Write the about dialog and integrate access of the Options GUI (the above screen shots show it) into NPM_MainWindow (the main application window).
  3. Alternate NPM_MainWindow forms that can be loaded at user choice 🙂
  4. Tweak code for setting ports build options more

After that, I guess Neo Ports Manager will be ready to have a Beta Release.

The handling the dialog that stands in for make config, I know sooner or later I’m going to have to resort to calculating a full scale depends list of options much like make config-recursive does because doing otherwise would screw up during any operation that tries to do a make config: the display area is read only to the user, no I/O form user to portupgrade and friends. Fixing that will come later… I also need to get my tookus back to the German translation when I’ve got the time to spare.

Oh what fun it will be when NPM hits a 1.1 Release, I can finally have a coffee break of sorts <_< hehe.

I would do more tonight but work is in the morning… Thus time to go to bed when you consider it’s after 0330R [local morning], well at least this is the earliest I’ve gone to bed in awhile LOL.

Brushing up with Java

It’s been quite an interest of mine to brush up with Java and Perl for awhile now but time has never really allowed me to do so.

Java for me is a language to which a lot of knowledge is stored away in the ol’brain but little wisdom so to speak. Java was maybe my 3rd language but I’ve also done a pretty good job of writing almost no Java code over the years hehe. I’m used to the syntax though. One day the Library had a sale of old books and one was the Java Sourcebook by Ed Anuff.

This was maybe 2006 and the book was so old that some where in the interface I think it said that JDK 1.0 Beta would be released by the time people were buying the book. Until more recent aspects involving Python and C++ with Qt3 / Qt4 its introduction (unwritten) to Javas Abstract Window Toolkit (AWT) was the closest I ever got to GUI work.

It is a very good book IMHO but of course very dated, I don’t know how much java.lang.applet and whatnot has changed over the years, I never really cared much for Java applets! But I am pretty sure that a lot is different with AWT and the newer Swing toolkit. One thing that I actually find interesting, the Java Sourcebook is maybe the only book I’ve seen that uses the same brace style I tend to use in C. Hmm, maybe it was an influence on my ways of doing things :

Not to long ago I checked out a nice O’Reilly book on Java because I wanted to see how much the language had changed in the past ten years or so. Java indeed changed quite a lot, it is way more fatter then I remember but it is still just as sweet.

One thing I like about C, the syntax is small enough to cram in ones head easy and follow it up with a reference of the standard library for stuff you don’t use often. Java OTOH is probably a few orders of magnitude larger then that for most people. With the things I noted, inner classes, generics, etc I was a little suprised that they were there but the language seems to have grown naturally. As I read though parts of the book I was constantly like “Oh, that works just like I expected” when comparing the detailed explanations of how things work along side the code listings.

C++ was my first language aye but I think I’m more comfortable with Java. Because in the fields where C++ differs from C, I tend to get a little more lost, while with Java most of it is already there.

Perl, my second language but probably the weakest in my skill set. I quickly got board and skipped a lot which gradually filtered through over the years. I respect Perl for its power and flexibility but I think it has gotten a little to big for its own good IMHO, although I wait to see what Perl 6 will bring us.

I remember in the Java Sourcebook there were several examples, such as an implementation for Lamp and LightBulb classes that interacted and various cat related ones that used a speak() method to examine how overloading methods and inheritance worked.

This is a reworking of it from memory, same basic idea though:

Jeez now that I think of it, those examples remind me of stuff from an UnrealScript tutorial I looked at a couple years back too. Who knows with how much UnrealScript feels like a customized Java they probably read the same book hehe.


/**
* Feline.java, abstract representation of felines
*/
abstract class Feline {
abstract void speak();
}


/**
* HouseCat.java, implements a feline that meows
*/
class HouseCat extends Feline {
HouseCat() {
}
HouseCat(String call) {
this.speak(call);
}
void
speak() {
System.out.println("Meeeooowww!!!");
}
private void
speak(String call) {
System.out.println(call);
}
public static void
main(String[] args) {
HouseCat theCat,newCat;
theCat = new HouseCat(); /* use default constructor */
newCat = new HouseCat("I am a cat!");

theCat.speak();
}
}

The HouseCat class implements a Feline (abstract meaning you can subclass it but you can’t create it directly). There is a simple constructor made to behave like a default constructor and one that invokes a private version of the speak() method using a supplied string.

I have the Java Development Kit and Run Time Environment installed from the packages on the FreeBSD Foundation website. Compiles fine with javac and gcj42, that is the GNU Compiler for Java ;-).

What I do like about Java, its fairly portable between systems running the same implementation (e.g. Suns JRE) as far as language features go. It also follows a largely logical behavior for many things from what I have seen.

And to top it all off, GCJ can compile to native machine code rather then Java Bytecode — for me a huge plus. I do have Qt4 bindings for Java installed on my desktop so I am interested to see where that goes, as far as my laptop is concerned I would probably need to use Suns compiler for AWT/Swing apps though. Not sure if Qt Jambi is in FreeBSD ports yet either.

As much as I love C, there are just some things that I don’t really want to have to implement in it. And as productive as I am in Python and Ruby I really need to cuddle up with some thing a bit closer to C’s end of the spectrum. I don’t really care a lot for C++, I can use it fine but don’t see much point for it over C besides templates and exceptions. Java lacks pointers in the same light as C/C++ uses but the references should be fine enough for my general needs.

C++ is multiple inheritance and Java is single, I’m not really partial to either concept as long as nether takes to biting me often. I have long enjoyed the design of Java’s classes and interfaces though, I love the interface thing in Java.

I don’t exactly care much for Suns compiler though but hey, if it works (y).

Codes before Pillows

Sat down and started working on NPM again, this is my first commit in a few weeks… Mainly because the last few weeks have been a living pain in the ass rather then a codeathon.

Terry@dixie$ svn log -r HEAD                                               8:55
------------------------------------------------------------------------
r53 | sas_spidey01 | 2008-02-20 08:54:55 +0000 (Wed, 20 Feb 2008) | 23 lines

optionsinterface.py added

A thin wrapper around a dictionary of options (to be kept private)
that exposes a getter and setter method for each key:value pair.
For which is intended to be used as a slot from the GUI or a call back
of sorts from a slot in the GUI to the options interface.

A simple 'flush' method is provided to update saved config (not
finished). NPM_OptionsInterface is to be integrated with NPM_Options
in some suitable manor that removes as much as possible of the system
from the 'middle' of code that needs to get / set options values.

The question of using Qt's settings subsystem or the existing one
remains to be decided.

npmwidgets.py modified, gaining an extra slot for NPM_SpinBox -> man I wish Python had Cs Preprocessor some times.

settingspages.py -> checkboxes, spinboxes, and the override server prompt connected to the NPM_OptionsInterface provided.


More to be changed in the future design wise (for the better).. When I've got more sleep to think about it.


------------------------------------------------------------------------
Terry@dixie$ 8:5

If I didn’t have work in the next city tomorrow I’d be working on this for another two hours nut alas it’s already approaching 0400R / 0900Z rapidly… And I’m to tired to comment much more.

I do know this, I want to be able to get / set options as necessary through slots. Without having to have any understanding of how the config file is handled else wheres. At the moment I’ve basically started a switch from NPM_Options::config to NPM_OptionsInterface::config for storing the options in memory. The difference being at the moment NPM_Options is only able to read the configuration files using Pythons INI parsing classes for our needs. And it exposes a dictionary of option=settings. The difference between obj.config[‘optionKey’] = value and obj.getOptionKey(value) is negiable for me.

The thing of it is, what if we need to do more then just assign a value to keep things in order ? At least with a set of methods around the problem the rest of the program can be insulated from any major changes in that part of the system. I also know that I have very little interest in extending pythons dictionary class just for the occasion lol.

sleep….

Beware of Pythons

One sad side effect of using Python so much the past few months..

I actually had to invoke GDB’s ‘help’ command when debugging some C code tonight :

I know several languages but I tend to do things in “the language of the moment”, if I’m working on some thing in C, most of what I do on the side will usually end up in C. Like wise if its a project in Ruby, ruby scripts start filling up lol.

Maybe my brain could use an extra 256K of memory?

Restructure and Refeeding

Well, got some work done.

Completed the change over (mostly) from a single hard-coded dialog for handling the output of processes to being a subclass of a display builder like parent class. Python doesn’t support abstract classes as far as I know or even private members for that matter (but has a nifty name mangling like thing for a making a naming __convention).

The original reason I wanted to do this is I figured that A.) The class was cluttered with code common to any ol’dialog window and B.) The rest of it was just specialized for the task of running a process and nabbing it’s output.

So I moved the common code into the NPM_AbstractDisplayDialog class and wrote a NPM_ProcessDisplayDialog subclass of it to replace the original NPM_DisplayDialog which also will allow me to use a similar dialog for other tasks without having to duplicate the code they would share if I was to implement another like-wise class in parallel. Because for example the NPM_DisplayDialog class was setup to ensure the process was neutralized before completing it’s termination I setup NPM_AbstractDisplayDialog::aboutToDie() as a signal to connect a slot from my subclass(es) to be called to do clean up, basically an advisory destructor you could say. And I connected it to the button to call QWidget::close() to this slot so aboutToDie() is sent when the dialog is about ready to be terminated.

I also found a fixed a small error in the pkg_info parsing, things like that is some thing that most concerns me.. lol.

Now the remaining problem is I’m starving and it’s 0746 Zulu (that’s 0246 local morning)… Must find food, then I guess I should get some sleep :

Days coding

The current stage of things for the settings menu. As can be seen I still have a few things to do with the layouts, I think a grid would be better personally. At the moment it also doesn’t actually set the settings it front ends for yet. I still need to test out the QSettings class first to see if I want to replace the custom system I’ve done with Pythons build in INI parser or not. I also need to cook up some icons and finish the portsnap entry. Right now it is purely a Qt3 program but if PC-BSD has finally fixed the ‘ugly’ theme settings for root under KDE I might consider a conversion to KDE modules before Qt4/KDE4. At least since what ever version I used to install on my Laptop the default Qt3 themes for Root are even worse…

Another thing I want to do is look at Pythons ability to handle manipulation of UID, it would be kind of nice to prompt for roots password and only elevate permissions when necessary. I aim for things to be the best they can be but paranoia never hurt in programming… hehe. Some day I would also like to expand this beyond explicitly using portupgrade/pkg_*/portsnap/csup/cvsup/psearch in the background but I don’t have time right now. I could get more done if I had a peaceful working environment…. any way here are some screen shots

click to enlarge images

ports settings
Free Image Hosting at www.ImageShack.us

logging settings
Free Image Hosting at www.ImageShack.us

network settings
Free Image Hosting at www.ImageShack.us

I think this is pretty good considering I rewrite most of what I already had today and most of this was done in about 6 hours of work, between chores, dog walking, lunch, interruptions, and phone answering ! Plus another hour or so of minor changes and additions so far tonight. I wish my strength could hold out for another 5 hours worth of work so I could get done some of the other things on my list for the night…. Hopefully I can get at least some of the other work done before I pass out. because I do need to get some shuteye if I’m ever going to make it to work in the tomorrow on time.

*SIGH*

NPM Settings Menu

Photobucket

Work begins on a settings GUI for NPM. I have a QIconView standing in for the list of config topics, I expect in the end it will probably be some form of widget stack or some thing like that. The changes I’ve committed to the trunk tonight are purely cosmetic, there is no link to the exsisting settings code that revolves around an RC file yet. I’m actually interresting in moving to using QSettings instead, tests will show the direction to be taken.

At the moment it has the majority of important options. I want the logging section to allow the user to set the logging level and files e.t.c. one thing that I think would be cool is to save the result files from portupgrade with a proper time-stamp appended to the file name. Although it would only take a minute to check the script to see if it would truncate the log file if reused.

There also needs to be a small network section whether separate or added to the others that can handle setting the portsnap/sup servers to use. And I would like it to be able to have a list of servers to query set. So that if it can’t reach one it tries the next (pardoning the retry options set).

days recap

It’s been a bit of a busy night, took a little time to work on the NPM_PortConfig class but I’m still not really happy with it. The main thing that concerns me at the moment is dealing with saved config’s. Namely how to handle a situation where the Makefile has more options in it then the saved options from last time the system was built. Because other then that, it is really just as simple as check for a saved config,parse it if found and the makefile if not then and move on..

Also been playing around with the ol’C++ tonight. So farI’ve been reminded of why I hate C++ and why I love Qt and the GNU Compiler Collection at the same time lol. It does feel kind of weird to be working on some thing in C++ again, it was my first language but I have not used it in ages.. used C yeah sure but not C++ :

Lead some Planning & Leading training on TG#1 today. I was a little disapointed that Chester was the only one that showed up… But I think it whent quite good. Chester continues to show he’s worth our time in training. And the best part, we got to sneak past a ton of tango’s right under their noses hehe xD

Still early here, 0320R (local) but it’s hard to keep my mind on the code…

*sighs* women… lol.