Saturday, December 12, 2015

Backups - rsync and Google cloud storage

I've been using Google's cloud storage for backups, and I am impressed with what I have found.

My previous method was to use rsync and store backups on a local server. It works, although the local server is old -- and a bit small. Eventually, I would need a larger disc.

Google's cloud services remove that problem.

Synchronizing with the Google store is, interestingly, faster than the synchronization with the local server. The first time was longer, of course, as the Google gs_utils package had to transfer every file to the cloud. But after that first transfer, successive synchronizations have been must faster.

Google cloud services aren't free. But for pennies a month (literally), I can have backups that are accessible anywhere I have a network connection.

Saturday, October 31, 2015

New old equipment: Apple Powerbook G4

A friend provided me with an old Apple PowerBook G4. It's been sitting on the shelf for a while, staring at me. I decided to do something about it.

Examination showed that the unit was in good shape, except the keyboard. No scratches or dents, or other signs of abuse. But the keyboard was not firmly attached to the underlying layer -- the top two rows of keys had rolled away and were floating in air. This position is not untenable, but it does mean that the key hinges would come loose. More troubling is the missing keys for F1, F2, and F12.

Super-glue helped get the keyboard back in line, although the result is not perfect. The edges are still up a bit, so the ESC and F11, F12, and EJECT keys are floating up. And F1, F2, and F12 are still missing. But its workable.

The unit needed a power adapter, so that was the next order of business. It had to be -- i could not test anything else without it. So off to the good folks at macbookadapter.com! They provided me with a genuine Apple PowerBook adapter with the proper plug.

Testing showed that it would not boot from the hard drive. I could boot from a CD-ROM, and I used Ubuntu 12.10 for the PowerPC. Ubuntu came up and found the video card and the network adapter, but it could not install on the hard drive.

On the assumption that the drive had failed, I ordered a replacement. Finding drives for a PowerBook G4 is a little tricky, as it uses IDE (or PATA) drives, not the SATA drives in today's laptops. Persistence paid off, and I found a nice little 40 GB drive for $20.

Installation of the drive was challenging but not impossible. Opening the G4 requires removing quite a few small screws (about 20) all but two being Phillips head, the other two required a hex key. Carefully lifting the keyboard tray reveals the innards.

Removing the old drive was simple, once I recognized that a small bracket held the drive in place. Remove two screws, lift out the old drive, unscrew the four mounting screws, screw them into the new drive, and attach the cable and insert into its position.

Then replace the keyboard tray and its 20-odd screws.

Now for an operating system. I could install Mac OS X 10.4 (Tiger). I have a copy, and it is the latest version of Mac OS X that supported the PowerBook series. But Apple ceased supporting 10.4 quite some time ago, and the old software and Safari provided a poor experience. Also, modern software for Mac OS X doesn't want to install on 10.4. So I needed something else, and I chose Ubuntu.

The PowerBook G4 uses a PowerPC CPU, not an Intel chip. Therefore, the standard (Intel) issue of Ubuntu won't do. I needed the PowerPC version, which is available. Ubuntu PowerPC 12.10 is the last version that has an install that fits on a CD, so that was the one I selected.

Ubuntu installed without difficulty, but needed some assistance. It found drivers for video, Ethernet, and touchpad, but not for wifi. Those had to be installed from the legacy broadcom package.

There is a later version of Ubuntu (14.10 LTS) but it cannot talk to the video card. (I tried the upgrade and it failed, leaving Ubuntu in an inconsistent state. I re-installed 12.10 and left it there.)

The experience, so far, is tolerable but not excellent. The Apple PowerBook G4 has a nice 15" screen but is heavy, and it runs a bit warm. The screen is bright and clear but Ubuntu doesn't recognize the brightness controls (F9 and F10, if the keys are to be believed).

Ubuntu 12.10 LTS for PowerPC has Firefox (version 39) but not Chrome.

Performance is sluggish. Web pages load, but I guess I've been spoiled by newer computers. Yet it's a nice machine, one I'd like to use more.

Saturday, October 17, 2015

Projects and technologies

Credit subsidy calculator: Develop a replacement for the existing C++ Windows desktop application. The new version will be written in C#/.NET and will run as a web service. There is a small command-line executable that will be distributed to agencies for them to use the web service.

We expect a release of the old (C++) version in September and again in November. We may, depending on progress, see a test release of the new (C#/.NET) version in November.

Interest model and Sensitivity model: Improve and modernize the code of these two interrelated applications, preparing for conversion from C++ to C#/.NET. These may remain Windows desktop applications; unlike the Credit subsidy calculation, the Interest Model and Sensitivity Model are used by a very limited number of people.

The models are used prior to the preparation of the budget and the preparation of the mid-session review. There are a number of changes for the Sensitivity model's calculations that must be made in September.

We have a number of technical issues with these projects (mostly with the new version of the Credit subsidy calculator). The issues appear to be resolvable with the right amount of time, research, and testing.

I have upgraded my home PC (which I use for remote access) to Windows 10. I have successfully connected to the office with Windows 10 and the new Edge browser. Performance is about the same as with Windows 8 and Internet Explorer.
 

Sunday, June 28, 2015

Building a BASIC interpreter in Ruby

I've been working on a side project: Build a BASIC interpreter in Ruby. The purpose is to help me learn the Ruby language, and to that end the project has worked well.

Learning a new programming language can be difficult. It's easy enough to write a simple "Hello, world!" program, but that simply confirms that the compiler (or interpreter) is installed correctly. What does one do next?

I picked the BASIC interpreter as a task with some complexity, but not too much. The BASIC language gives me a challenge but not one that is insurmountable. Also, I have an early text on programming in BASIC that provides example programs with their expected outputs.

As a bonus, programming a BASIC interpreter is a stroll down memory lane. BASIC was the first programming language that I learned. It is an old friend, one I have not seen in quite some time.

So as a project, the BASIC interpreter is challenging, supported, and fun.

I spell BASIC in all capitals because of the variant I am implementing. The BASIC language had a number of variants over time, from the early Dartmouth implementation in the 1960s to the DEC versions of the 1970s and 1980s, culminating in Visual Basic 6 from Microsoft. (Or perhaps VB.NET, but that seems less BASIC than any of the variants.)

My project is to implement an early version, one that is close to Dartmouth BASIC. It has a simplicity about it, yet it also has its intricacies. Dartmouth BASIC allows one to specify user-defined functions, but only on one line and only with a very limited set of names ('FNA' through 'FNZ'). It supports some elements of structured programming but still allows GOTO statements, and one can 'GOTO' from the inside of a loop to the outside, do some work, and 'GOTO' back into the loop. (One can also 'GOTO' out of a loop and not return into the loop.)

Early version or late, my experience has been a good one. I have been forced to learn the Ruby language. While I am not an expert, I am at least comfortable with the major constructs and classes of the language. And that was the point.

Sunday, January 18, 2015

Cloud9, part 3.

More work with Cloud9. I did not intend to write multiple posts. Yet here I am.

I'm getting more impressed with Cloud9 (the proper spelling does not have a space) and I am getting more impressed with Python. (Cloud9 lets one use Python, Javascript, Ruby, or plain HTML/CSS.)

My project is in Python, and this weekend I was struggling with a problem in the webapp2 framework. The problem was not in the framework, but in my use of it. Having the source for the webapp2 framework and the Paste and WebOb packages made it possible for me to find my mistake and fix it. Such investigation would not have been possible with a language like C+ or Java.

Python's debugger was not helpful in tracking down this problem. It may be due to my unfamiliarity with 'pdb', or it may be caused by the use of multiple threads. I had to fall back to 'debug by printf()' to find my problem. Once I saw the actual values of certain variables, I knew the solution.

I'm getting familiar with Cloud9. It is an IDE that runs in the browser, which means I can access it from anywhere. That's a nice feature; I don't want to drag my files around with me. (It also allows for better collaboration among team members, a feature I have yet to try.)

Cloud9 copies a lot of the features from regular, PC-based IDEs, but it has its own style. I find it easier to use than Eclipse, which I have tried to use several times. Cloud9 sits on top of Linux, and it provides bash and terminal windows to your virtual machine. Anything you cannot do in the IDE you can do in a terminal -- but I've resorted to it only once or twice.

Saturday, January 10, 2015

Cloud 9, part 2

After several months of ignoring Cloud9 (the web-based collaborative IDE) I sat down today and did something with it. Today's task was to build a cloud app that was compatible with Google's App Engine. And after a few hours, I did just that.

Cloud 9 supports several languages: JavaScript, Python, Ruby, and PHP. I picked Python, as I have experience with Google's App Engine (GAE) and Python.

To build a Python app for GAE, one needs the webapp2 framework. Webapp2 handles the inbound and outbound web requests. Cloud9 supplies a number of libraries for Python, but webapp2 is not one of them. Not a problem, however, as one can quickly install it with the 'easy_install' utility, which *is* included. (The webapp2 website has the instructions, and a sample program.)

Getting the webapp2 sample to run took some doing. (In my opinion, their sample is almost correct byt not quite correct.. I had to import the 'os' module and enclose parameters to the 'getenv()' function in quotes.

I found the documentation for Cloud9 useful -- once I found the right page. The Cloud9 web site has poor indexing into their support pages. Finding the right page is difficult -- until you switch to Google.

Problems were not limited to the Cloud9 website. Google Chrome failed as well, often displaying its "aw, snap!" page, forcing me to re-load the Cloud9 website (not a small site, due to JavaScript).

Overall, my experience was a bit frustrating, yet successful. Cloud9 may not have perfect documentation, but the IDE itself seems workable.