Site Sponsors:
Virtualization, Windows 98, and Java - Oh My! 
Lots of folks just LOVE those old Microsoft Operating Systems. Be we looking to play a classic game, run a licensed application, or simply enjoy the ability to use Windows 98 and / or Windows 2000 much like we would any activation-free operating system, having the ability to "just boot it" is a refreshing experience.

Indeed, in as much as most folks with any tenure in the industry at-all have 8 to 10 classic Windows 98 / Windows 2000 licenses with keys, the fact that we are not even able to re-activate Win98 or Win2K over and over again ... is a real bonus!

So while doing a little testing for a book I have been researching, I decided to pop-in a '98 next to the '2K, 'XP and '7 in Oracle's Virtual Box.

Installing Windows 98


With something as old as Windows 98 (almost 15 years at the time of this writing!), one might expect a few "gotchas" along the way.

When creating your Windows 98 VM using Virtual Box, be sure to:

(1) Don't be afraid to use a lot of resources: Windows 98 can address 1.5GB of RAM, as well as a few gigs of disk - feel free to chew-up a little over 135GB on that virtual hard drive. Most folks find that 2GB is usually more than enough.

(2) Like any old software, do NOT let that hard-drive expand virtually! When creating the virtual drive therefore, be sure all disk is formatted & ready for use - just like we have to do when installing SQL Server!

(3) Be sure to enable linear, real-mode addressing!

To enable the supported "flat-mode addressing" in the VM, while creating the VM simply click on "Settings" then (a) select the "Processor" tab under "System" to "Enable PAE/NX", then (b) under the "Acceleration" tab, be sure to DISABLE VT-x/AMD-V (and yes, I was using an AMD chipset - the downgrade works fine.)

(4) While installing Windows 98SE (the recommended release -- available on eBay for about $10), feel free to click "Y"es on the two blue-screen message you may get if they are complaining about missing DLL's. This is a soft problem. Works fine afterward.

Installing Java


Java 5 is officially the last release to support Windows 95, Windows 98, Windows ME. If we can endure a single install-time warning however, Java 6 Update 7 (1.6.0.7) was the last demonstrably working version. Use jre-6u1-windows-i586-p.exe after installing '95, '98, or 'ME.

Before installing Java however, note that unlike my EzInstall (which includes the installer & un-installer as part of the program itself), that in order to install anything created with Microsoft Installers, you need to first install ... uh ... the installer. For Win98, we will also need to download Microsoft Installer Version 2.0.

Browser Caveats


There are two:

Of course the browser is ancient. In modern terms (CSS, XML, HTML 5) Windows Explorer will not do a lot for you.

Indeed, when I first started the '98 browser, by default it would not allow me to browse anywhere without selecting a modem.

We can easily get around that problem by setting up a LAN to connect to the Internet before opening the browser the next time.

The second browser problem is the default home page. Since Windows 98 is no longer supported, the junk loaded at the default Microsoft site actually crashed the bowser!

To fix the problem, simply cancel the browser-fetch when you first start Internet Explorer, then set up the "use blank page" default under "Internet Options."

Virtual Box Caveats


Note that Oracle's Host Extensions will not work. The last of the 16 bit MS Operating Systems, one must get used to not being able to run 32 bit code. In as much as Win98 can boot MSDOS in real-mode however, folks with an interest in that DOS legacy can easily learn to live with the limitation.

Unfortunately, when we loose the ability to install Oracle's Host Extensions, we also loose the ability to share host-folders with a virtual machine. So while things like FTP, USB (if you can find a driver), ISO images, email, and CD-ROMS are viable data interchange options, note that the browser will allow us to pull things down just fine.

Support & Security


'95, '98, and 'ME are no longer supported. Don't even bother checking for updates (another bonus?) -After installing everything you need, consider disconnecting the VM from the Internet.

Why drop the 'Net? Because even if the VM is behind a firewall, there simply were TONS of back-doors and exploits (see the 'Bottom-line Benefits' section (below) for recovery information.)

By way of clarification, we should note that a down-to-earth (pun intended), home-spun, external-net-disabled LAN is great for game-play. Just remember: Less Internet, less attack surface.

(In a like manner, unless one lives well out-of-range, then be sure to button-down that wifi, too!)

Bottom-line Benefits


From an end-user point of view, certainly the greatest benefit of using virtualization is the ability to take snapshots, and export appliances. A snap-shot allows us to save an image before a potentially dangerous operation. If things go bump-in-the-core, we can quickly set the entire machine back to a last-stable snapshot. When restoring a snapshot, since the delta (restored change) comes from outside of the VM, even a newly-installed virus doesn't stand a chance of being a problem. (I use the snapshot feature a lot when installing, layering, and cross-upgrading software on Microsoft Servers!)

Exporting an appliance is also one great way to back things up. Unlike when using snap-shots, routinely exporting appliances will allow us to take our work with us (by importing the appliance to a laptop (etc.) "just like a book"), or recovering the entire (operating system + installed applications + our data) as part of an extremely robust disaster-recovery plan. --No safe deposit box should be without one.

Conclusion


After reviewing the above tome, I must admit that it all LOOKS a lot more involved than it is. Rather than being intimidated, just give it a try.

Enjoy the freedom!

-Rn




[ view entry ] ( 2446 views )   |  permalink
Java: Custom / Owner Drawn Listbox Woes 
In Java, many things are difficult. Some things are easy.

Interestingly, sometimes the difficult things seem to work better than the simple things!

Take, for example, the need to draw a custom listbox. Unlike much of the rendering framework, the task starts out deceptively simple. To render a listbox item differently, all we need do is to create our own rendition of a ListCellRenderer:


public class PrettyList01 implements ListCellRenderer {
}


Once created, our interface need only return a JLabel from a simple member function getListCellRendererComponent. --In fact, getListCellRendererComponent even has a method to create a JLabel for us.

While everything works swimmingly whilst working with text, things get a bit odd when working with the JLabelian setIcon method:



It seems that - when using the Oracle / Sun JDK (as tested on both Windows on Linux) 'Labelian animation will only work when the background color for the listbox, not the label, is changed. Once changed, 'Labelian animation woks okay - but there is a flaky caveat: When we select the LAST item in the list, our hacked-in color-munge becomes the default color for the entire box (sigh).

If we DON'T change the default list-background color, there are no problems - except that the icons will no longer work!

Here is the code:


package pretty_list01;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

/**
* Sunday Morning Research Session.
*
* @author profnagy
*/
public class PrettyList01 implements ListCellRenderer {

private TitledBorder focused = null;
private Border unFocused = new EmptyBorder(15, 1, 1, 1);
private DefaultListCellRenderer rend = new DefaultListCellRenderer();
private Font zFontSel = null;
private Color clrBack = null;
private Color clrFore = null;
private Color clrTitle = null;
private Icon iconSel = null;
private Icon icon = null;

public PrettyList01(Color clrFore, Color clrBack, Icon icon, Icon iconSel, String sTitle) {
this.clrFore = clrFore;
this.clrBack = clrBack;
this.clrTitle = clrBack;
focused = new TitledBorder(LineBorder.createBlackLineBorder(), sTitle);
this.focused.setTitleColor(clrTitle);
java.net.URL url = null;
Class loader = getClass();
this.icon = icon;
this.iconSel = iconSel;
}

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel render = (JLabel) rend.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (cellHasFocus) {
if (zFontSel == null) {
Font f1 = list.getFont();
zFontSel = new Font(f1.getFontName(), f1.getStyle(), f1.getSize() - 5);
}
render.setFont(zFontSel);
render.setBorder(focused);
render.setIcon(iconSel);
render.setBackground(clrFore);
render.setForeground(Color.red);
// Oracle JDK 1.x - 1.7 - Ubuntu
// ==========
// Phew! -If we keep the color the same, ths icons will NOT animate.
// Yet if we change the color, the LAST item in the list will color badly!
list.setBackground(Color.white);
} else {
render.setBorder(unFocused);
render.setIcon(icon);
render.setBackground(clrBack);
render.setForeground(clrFore);
list.setBackground(render.getBackground());
}
render.setIconTextGap(20);
return render;
}
}


Feel free to download the project.

Cheers!

-Rn





[ view entry ] ( 911 views )   |  permalink  |  related link
Publishing VB.NET Training on YouTube 
"Designed for the total beginner, this VB.NET Boot Camp is the first segment of a multi-part presentation. In this first session, we will discover how to write Visual Basic .NET (VB.NET) Programs from the console - other tools not required!

(video)

Targeted to help new software developers get started writing their own software, this first session also includes a light overview of the software development and testing process."

Enjoy,

-Rn




[ view entry ] ( 1660 views )   |  permalink  |  related link

<<First <Back | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Next> Last>>