Site Sponsors:
Installing Ubuntu on the iMac G3 PowerPC (PPC) 
There is something truly wonderful about keeping those old computers doing useful things. -So as everyone from Apple to Microsoft encourages us to chum our old hardware into the ocean by dropping support, I find more and more reasons to convert them from Windows, OS 9, or OS X, to Linux.





Indeed, as feature-bloat & patches make proprietary operating systems slower and slower each day, many have discovered that even 12-year-old hardware can do some pretty mainframe-worthy operations. All due to the lightweight machine requirement of Linux!

Dusting off a few G3s today, here is the process:

(1) Create a bootable CD from the ISO. Because I prefer the long-time support versions (LTS), we used Lucid Lynx (Version 10.04.) A CD-R worked fine.

(2) Start the computer, then insert the CD into that iMac (or any Apple PowerPC.)

(3) Re-start the computer, afterward holding down the 'c' key until the CD boots.

(4) Use the 'live' video option, as mentioned at the boot prompt. (i.e boot: video=ofonly)

(5) When the install complains, use the default low-res setting for a "this boot only" option.

(6) Once the graphical Ubuntu screen shows, wait a few minutes to cancel the package management prompting. -While this step is optional, it makes things a whole lot easier to understand.

(7) Click on the install icon, and install as prompted / desired.

(*) Note that once Ubuntu is installed, that the disk will automatically eject. If you abort the installation, remember that holding the mouse button down after the "wall-(e) sound" will eject the CD during the early stages of a re-boot. You can also try this.

(*) Once the Ubuntu GUI is running (visible or not), note also that pressing ctrl-option-F1 will give us a command prompt. When the live boot is in pester, starting a terminal session using this combination might take a couple of tries... but it works just fine.

(8) Finally, to disable that incessant request to change your password each and every time you run a command-prompt (is your date / time battery not holding a charge?), then change the '0' to being completely empty in the last-date-change field. -That field will be the 3rd field on the line containing your login name in the /etc/shadow file. More information can be had via the `man shadow` page. If you are new to Linux, then the `man passwd` page is also worth a read.

If and when you get tired of manually asserting the default video mode, rumor has it that the "video-ofonly" is in yaboot.conf. -Someone else mentioned that you could also try adding nomodeset to the kernel command line. (Since I use the G3s as non-gui servers, I have not been too concerned about X11. While you can use apt-get to remove the GUI entirely, you can also edit the /etc/rc.local script to fix-in a shell. We can then use startx whenever we want to GUI.)

If you do not want a GUI, note that there are ever more creative ways to stop the GNOME Display Manager (gdm) from starting. Take a Google to find out how...

Enjoy,

-Rn

(p.s. If you like those magic Apple key-combinations, then here is a nice list of them.)



[ add comment ] ( 2358 views )   |  permalink
Simple XML Serialization 

Peeves


Having formerly been a Principle Software Development Engineer at Informix - the maker of the fastest database of the era - I can say that many senior folks simply *HATE* the way people use databases today. -Not only do folks use them to store everything from web-site logging to SOX telemetry, but few developers know how to scale them properly... let alone document their schema.

Bottlenecks


Indeed, when doing performance reviews, I often find that the first performance logerjam is most often found at the persistence layer. Not only is the way people save data at fault, but the sheer range of data being stored in a single database - at the same time - is often a critical performance problem.

Bottom Lines


In general folks simply need to remember that databases are merely managing files! -Indexed or not, there is purely no magic in the word d-a-t-a-b-a-s-e. The implementation of each and all eventually boils down to caching, latencies... and bits-on-a-disk.

By way of liberating the databases from gratuitous data storage, I have found many interface-free (emphasis on having a FREE interface, not on having NO interface) -ways of storing varying amounts data. From using spreadsheet-savvy formats - like CSV, TDF, and SDF - to using editors & XML-Tagged data - options abound. Certainly when managing any day's worth of data in an appropriately-named location!

Of course, with a little help, simple data formats are great even when storing huge amounts of data. (our DBO package is an example.) But certainly when the envisioned amount of data can be stored in-memory... or for personal edit-and-use, why use a database at-all?

ClassIO


When we resolve the need to store data down to the brass tax of it all, we can see that the first challenge we solve is one of demarcation. Be the data binary or text, how to delimit them?

Once we resolve upon a human-editable form, for many it next all comes down to simple, traditional ASCII. Yes, yes - we can do a lot more - but 80% of an intelligent developer's raw data-collection activities, localized text is enough for most of the planet.

Interestingly, when is comes to XML readers & writers, many have found - for just about the same percentage - that well-formed XML is good enough, too!

So allow me to share ClassIO. -While far, far from the be-all and end-all to XML generation (the present version has yet to implement XML Attributes, for example) for most of what most-of-us might like to do, it will get the job done.

You can download the present version at Sourceforge.NET.

How ClassIO Works


ClassIO supports a simple command-line interface. -It also generates Java.

To start ClassIO up, enter:

java -jar com.soft9000.ClassGenerator.jar

By way of shoring off what ClassIO can do, enter:

java -jar com.soft9000.ClassGenerator.jar pkg cUsr Name Email


Here is the generated code. Note the isNull(a personal favorite), the copy constructor, an equality operation, object-assignment, as well as the ability to read an entire set of objects from a file:


package pkg;

import java.io.File;
import java.util.ArrayList;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;


public class cUsr {
public cUsr() {
}
public cUsr(cUsr ref) {
if(ref == null) ref = new cUsr();
this.Name = ref.Name;
this.Email = ref.Email;
}
private String Name = "";
private String Email = "";

public String getName() {
return Name;
}
public String getEmail() {
return Email;
}
public void setName(String ref) {
if(ref == null) ref = "";
this.Name = ref;
}
public void setEmail(String ref) {
if(ref == null) ref = "";
this.Email = ref;
}
public boolean isNull() {
if(this.Name == null) return true;
if(this.Name.equals("") == false) return false;
if(this.Email == null) return true;
if(this.Email.equals("") == false) return false;
return true;
}
public boolean equals(cUsr ref) {
if(this == ref) return true;
if(ref == null) ref = new cUsr();
if(this.Name.equals(ref.Name) == false) return false;
if(this.Email.equals(ref.Email) == false) return false;
return true;
}
public void assign(cUsr ref) {
if(ref == null) ref = new cUsr();
this.Name = ref.Name;
this.Email = ref.Email;
}
private boolean set(Node val) {
if(val == null) return false;
NodeList nodes = val.getChildNodes();
int nelem = nodes.getLength();
for (int ss = 0; ss < nelem; ss++) {
Node node = nodes.item(ss);
if (setField(node.getNodeName(), node.getTextContent()) == false) {
return false;
}
}
return true;
}
private boolean setField(String sTag, String sValue) {
if(sTag == null || sValue == null) return false;
if(sTag.equals("Name")) {
setName(sValue);
return true;
}
if(sTag.equals("Email")) {
setEmail(sValue);
return true;
}
return true; // XML has meta stuff - just accept it.
}
public static cUsr[] FromXML(File file) throws Exception {
ArrayList<cUsr> list = new ArrayList<cUsr>();
DocumentBuilderFactory domFactory =
DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(false);
DocumentBuilder builder = domFactory.newDocumentBuilder();
org.w3c.dom.Document doc = builder.parse(file);
XPath xpath = XPathFactory.newInstance().newXPath();
// XPath Query for showing all nodes value
XPathExpression expr = xpath.compile("//cUsr");
Object result = expr.evaluate(doc, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
Node val = nodes.item(i);
cUsr ref = new cUsr();
if(ref.set(val) == false) throw new Exception("Error: Invalid xml data.");
list.add(ref);
}
cUsr[] dresult = new cUsr[list.size()];
list.toArray(dresult);
return dresult;
}
public String toXml() {
StringBuilder sb = new StringBuilder();
sb.append("<cUsr>\n");

sb.append("<Name>");
sb.append(Name);
sb.append("</Name>\n");

sb.append("<Email>");
sb.append(Email);
sb.append("</Email>\n");

sb.append("</cUsr>\n");
return sb.toString();
}
public static String ToXml(cUsr[] array) {
StringBuilder sb = new StringBuilder();
sb.append("<pkg>\n");
for(int ss = 0; ss < array.length; ss++) {
sb.append(array[ss].toXml());
}
sb.append("</pkg>\n");
return sb.toString();
}
};


While adhering to the JavaBean Specification (i.e. the above could quickly become 'import java.io.Serializable'), the use of XML solves the perpetual data-conversion efforts required when even lightly changing a Serializable class definition. 'Gotta love the POJO.

Easier Maintenance


Since we have come to the above observations, note that if you plan to re-generate your ClassIO code - or even if you don't ;-) -then you should consider using inheritance. While few developers consider the possibility these days, using a tool like ClassIO to update a base parent-class is to be preferred to endlessly merging code.

-Enjoy!

-Rn



[ add comment ] ( 3673 views )   |  permalink  |  related link
Of UML, VISIO, & Developers? 
When is a scenario, not a scenario?

When we are using UML under VISIO, of course!

If you ever have received the message "Shape protection and/or layer properties prevent execution of this command." under Microsoft Office VISIO (Version 2000 – 2007, to present?), then you know what I mean:



Fortunately, the solution to the problem is easy: Just right-click on the offending shape to modify its protection:



After activating the dialog, simply clear the Text check-box:



… and you will be allowed to do some really strange, bizarre things …



- like adding a text description to your Use Case Scenarios!

But wait – if you are going to have more than a single scenario, then rather than doing the same operation over, and over, and over, and over again, rather than doing something rational (like re-using that tool bar symbol), be sure to cut-and-paste that first shape a few dozen times.

(Hey: Wouldn’t it be great if those who developed our tools, had to use them?)


Enjoy,

-Rn

[ add comment ] ( 2205 views )   |  permalink

<<First <Back | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Next> Last>>