Tuesday, October 20, 2009

Blogger : Syntax highlighting for code

I hate the way Blogger displays code , XML etc, inside the "blockqoute" construct.

Then I came across this:

How to add syntax highlight to Blogger.

This uses Syntax Highlighter.

Just to add:

You don't need to host the files. You can use:

http://syntaxhighlighter.googlecode.com/svn/trunk/

e.g. the link in the article would become:
http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css

Update: As per the comment:

More info. available here:
http://mlawire.blogspot.com/2009/07/blogger-syntax-highlighting.html

Warning: There are a number of posts around on how to do this - all slightly different - use at your own risk.

Enjoy!

Log4J : Path to properties file

For Glassfish, we normally put the log4j.properties in the "domain / config" directory.

To enable Glassfish to find it, add the following to the Glassfish JVM settings. Easiest way is to use the Admin console i.e. Application Server / JVM Settings / JVM Options.

Add this line:

-Dlog4j.configuration=file:///${com.sun.aas.instanceRoot}/config/log4j.properties

Enjoy!

Netbeans : Generating getters and setters for a Java class

Using Netbeans 6.5.

Unlike Eclipse (where the link to do this is obvious), in Netbeans you will find this under:

Refactor / Encapsulate Fields

Enjoy!

Metro : JAX WS catalogue

One of the problems with using Netbeans to generate web services using Glassfish / Metro is that when you want to create a new Web service client, you are asked to select the web service which is normally on your local machine.

This means that the web service has an address like http://localhost:8080 and it then becomes a problem when you deploy to other environments.

One way around this is to use a catalog to resolve the addresses at run time. The file is called jax-ws-catalog.xml and it's placed in the META-INF directory.

It looks like e.g.

 
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<rewriteSystem
systemIdStartString="http://localhost:8080/"
rewritePrefix="http://some url:some port/"/>
<rewriteURI
uriStartString="http://localhost:8080/"
rewritePrefix="http://some url:some port/" />
</catalog>


This searches for any URL that starts with "http://localhost:8080/" and replaces this with "http://some url:some port/" e.g.

http://localhost:8080/webserver/WebService

becomes

http://some url:some port/webserver/WebService

The ant build files in Netbeans use the -catalog option to point to a file called catalog.xml in the project root directory. You can apply the same principles to this file to resolve addresses at compile time.

Some useful links:

Using a JAX-WS Catalog

How to write an XML catalog file

Global URI re-writing with jax-ws-catalog

Enjoy!

Friday, August 07, 2009

Netbeans : New Web Service client error

I use Netbeans 6.7.

In the web applications project where you are trying to add a web service call to e.g. a servlet, click "New / Web Service Client" and select the project where the actual web service lives. When you click Finish, you get the error.

"wsimport doesn't support the "xnocompile" attribute"

To get round this:

In the project where you are trying to add the web service client, right-click the web service under the "Web Service Reference" sub-tree.

Select "Edit Web Service Attributes".

Click "WsImport Options" tab.

Select the xnocompile line and Remove then OK.

Right-click again on the web service under the "Web Service Reference" sub-tree.

Select "Refresh Client"

The client should now be created.

These a good tutorial about Netbeans web services
here

Enjoy!

Netbeans : Display Web Service Designer and Axis2

This is displayed (I use Netbeans 6.7) when you right click on a web applications project and select "New / Web Service".

You then get two tabs - Source and Design.

However, you do NOT see these tabs if you have previously loaded the Axis2 support plugin.

Enjoy!

Thursday, July 09, 2009

Eclipse : Problems with web.xml

If you use Eclipse with the Sysdeo plugin you sometimes get problems with web.xml when you add more servlet mappings. The message is:

The content of element type "web-app" must match "(icon?,display-
name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-
mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-
ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-
ref*)".


e.g. you may have


web-app
servlet A
servlet-name
servlet-class
/servlet

servlet-mapping A
servlet-name
url-pattern
/servlet-mapping

servlet B
servlet-name
servlet-class
/servlet

servlet-mapping B
servlet-name
url-pattern
/servlet-mapping

/web-app


The problem is in the order. You can't intermix servlet and servlet-mapping. All the servlets have to come first followed by all the servlet-mappings. So the above would look like:


web-app
servlet A
servlet-name
servlet-class
/servlet

servlet B
servlet-name
servlet-class
/servlet

servlet-mapping A
servlet-name
url-pattern
/servlet-mapping

servlet-mapping B
servlet-name
url-pattern
/servlet-mapping

/web-app


You can check this by : Right click inside the xml window - Validate.

Enjoy!

Tuesday, July 07, 2009

Notepad++ : Error with nppcm.dll

Use this freebie program a lot as a simple text editor on Windows XP. I used the right context click plugin which one day suddenly came up with:

""Error creating process: nppcm.dll needs to be in the same directory than notepad++.exe"

Mr Google to the rescue and found the answer.

There is a file in the root of the hard drive called 'Program' - no extension.

Delete this file and all is sweetness and light!

Enjoy!

Wednesday, June 17, 2009

Eclipse : Preview html / jsp pages

When you view some kinds of files in Eclipse e.g. wsdl files the "wizard" shows you two tabs at the bottom right viz. "Design" and "Source".

This doesn't automatically happen with html or jsp files.

Right-click on the html or jsp file in the "Package Explorer" window and either "Open with - "

"Web Browser" (which just shows you the preview - note the the "Refresh" button at the top) or

"Web Page Editor" (which enables "Design / Preview" tabs). It also splits the screen in half so you can see both at the same time.

Ensure that "Windows / Preferences / General / Web Browser" option is set to "Use internal web browser".

Very neat.

Enjoy!

Eclipse : Debugging web services and servlets

Been playing with this kind of stuff (Eclipse / Tomcat / Axis2 / jsp / servlets) and came across two good links that explain how to do it all!

How to Debug a Web Service?

and

Debugging a servlet with tomcat and Eclipse tutorial.

Enjoy!

Friday, May 01, 2009

Misc : A good day at Serverfault

Got an email invite to the beta so signed up and:



100+ rep - 6 badges - heck - I'll take that!

Actually, it's the first time I've ever had a number next to every item. Take that, sir!

Enjoy!

Tuesday, April 21, 2009

Misc : My 10 Awesome Things I Remember About Computers Continues

Inspired by Scott Hanselman's 10 Awesome Things I Remember About Computers:

This is a continuation of a previous post ...

Disk drives and tape drives



This picture shows the platters of a mainframe disk. These were normally encased in a plastic cover. The operator lifted up the whole unit from a cupboard and then screwed it into the drive which looked something like a top-loading washing machine. Turning it one way screwed it into the drive. Then turning it the other way unscrewed the cover. You then closed the lid and powered the drive up.



Here's a picture with the cover on. The amount of disc space depended on the number of platters. 5 platters would be about 120 Mb. 4 platters would be about 400 Mb. Sounds like a joke right? You can get that on a cheap USB drive these days!

You needed lots of tape drives because you normally needed one input and one output for each job running.

A typical spec. for a Burroughs tape drive would be:

Magnetic 1/4 inch tape drive - 60 Mb capacity - 90 K bytes / second transfer rate - 90 inches / second tape speed.



Here's a picture of a whole row.



And here's a picture of one in close up. You mounted the tape on one side and threaded the tape onto a reel on the other side. Below both reels were vacuum columns and the tape loop moved up and down inside the column depending on the speed and I/O operations. The vacuum columns were needed to even out the load on the tape otherwise it would simply snap. And it did sometimes when the unit was faulty. Spaghetti doesn't even begin to describe it.



A picture of the actual tape. It had a white plastic surround with a clip and a hook to hang it up in a tape cabinet. Each company had their own filing system and the operators had to run to grab the next tape when the mainframe demanded one, And of course, sometimes they were mis-filed which meant searching all the cabinets.



This picture puts it all together. Tapes on the left, disc drives on the right. Console right centre and line printer left centre. Note the tapes left foreground, all ready for a run.

Winsock



"In computing, the Windows Sockets API, which was later shortened to Winsock, is a technical specification that defines how Windows network software should access network services, especially TCP/IP. It defines a standard interface between a Windows TCP/IP client application (such as an FTP client or a Gopher client) and the underlying TCP/IP protocol stack.

Early Microsoft operating systems, both MS-DOS and Microsoft Windows, offered limited networking capability, chiefly based on NetBIOS/NetBEUI.

In particular, Microsoft completely ignored the TCP/IP protocol stack at that time.

Trumpet Winsock was one of the few Winsock 1.0 implementations that could be installed under Windows 3.0, which had no built-in support for Winsock. Trumpet was also the most popular shareware implementation of Winsock for Windows 3.x."

Trumpet was in fact the implementation that we used for a large range of products, mainly on Windows 3.1.

Our main source of reference was sockets.com. If you look at the site now, you'll see it refers to the Winsock 2 standard which does not support 16 bit (i.e. Windows 3.1). This is due to the fact that service providers expressed little interest in developing 16-bit versions of their modules. (Funny that!)

"WinSock version 1.1 has been the standard since its release in January of 1993, and has exceeded its authors' original intent to provide a powerful and flexible API for creating universal TCP/IP applications. Some have argued that it was an unsung hero in the Internet's phenomenal success, as it enabled the creation of a single network application--like Netscape's browser, for example--to run on the many TCP/IP stacks for PC's that existed at the time.

Since those early days, the PC network industry has changed completely. The many TCP/IP vendors have all but disappeared after their software was replaced by Microsoft's free TCP/IP implementations built into the operating systems."

Once again, Microsoft realised they had made a mistake, added a TCP/IP stack and it became mainstream. For most people, there was no reason to ever have to do sockets programming again.

The other main reference site was Stardust. Just to show you how much has changed, this URL now points to a site that sells contemporary furniture.

Another extremely useful site was Stroud's The Consummate WinSock Applications List which listed Forest Stroud's annotated list of popular shareware and public domain WinSock applications. This included an online forum for discussions about the applications.

Nowadays, that URL redirects to WinPlanet which seems to be some kind of portal for small businesses.

Terminate and Stay Resident

"Terminate and Stay Resident (TSR) is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory.

Many software vendors use the call to create the appearance of multitasking, by transferring control back to the terminated program on automatic or externally-generated events, such as pressing a certain key on the keyboard.

Some TSR programs are effectively device drivers for hardware not directly supported by the operating system, while others are small utility programs offering frequently-used functionality such as scheduling and contact directories.

The original call, INT 27H, is called 'Terminate But Stay Resident', hence the name 'TSR'. Using this call, a program can make only up to 64KB of its memory resident. MS-DOS version 2.0 introduced an improved call, INT 21H/31H ('Keep Process'), which removed this limitation and also let the program return an exit code.

Before making this call, the program can install one or several interrupt vectors pointing into itself, so that it can be called again. Installing a hardware interrupt vector allows such a program to react to hardware events; a software interrupt vector allows it to be called by the currently running program; using a timer interrupt allowed a TSR to be summoned periodically.

By chaining the interrupt vectors TSR programs could take complete control of the computer. A TSR could then cascade with other TSR's by calling the old interrupt vector. This could be done before or after they executed their actual code. This way TSR's could form a chain of programs where each one calls the next one."

We used TSR's extensively for various networking drivers and also because we were a Novel OEM. Novell used TSR's to control the original file servers e.g.

typing

"cd g:"

when drive G was actually a partition on an external Novell file server required a TSR to trap the "Change directory" call and reroute it to the Novell code which then accessed the external drive via Novell's proprietary
IPX / SPX LAN protocol.

TSR's were DOS related and had their heyday during the DOS / Windows 3.1 (which ran on top of DOS) era.

The TSR has now almost disappeared completely as multitasking operating systems such as Windows XP provide the facilities for multiple programs and device drivers to run simultaneously without the need for special programming tricks.

Bulletin boards



"A Bulletin Board System, or BBS, is a computer system running software that allows users to connect and login to the system using a terminal program. Originally BBSes were accessed only over a phone line using a modem, but by the early 1990s some BBSes allowed access via a Telnet, packet switched network, or packet radio connection.

Once logged in, a user could perform functions such as downloading or uploading software and data, reading news, and exchanging messages with other users, either through electronic mail or in public message boards.

Many BBSes also offered on-line games, in which users could compete with each other, and BBSes with multiple phone lines often offered chat rooms, allowing users to interact with each other."

BBS's were how everyone communicated before the WWW. The public message boards were the precursor to the modern day Internet forums.

We used a BBS to provide all our software updates and patches. Customers could dial-in and download our latest software and bulletins. They also used it to upload error reports.

Because access involved a phone call, we had a BBS in each major centre to save our customers from incurring toll fees.

Access was slow - typically 1200 baud modems were used.

Because most terminals were the VT100 green-screen type which were text based, there were no graphics and graphics were simulated by using "ASCII art". You can see an example in the screen above.

(As an aside, there is an entire Star Wars rendered in ASCII art here.)

Personally. I used BBS's to download shareware - mainly games - but some useful utilities. As I recall, one of the earliest I downloaded was PKArc which was a precursor to the far more successful PKZip.

In the late 90's the WWW was well established and BBS's gradually faded away. You could do pretty much the same things from inside a browser.

Wednesday, April 15, 2009

Stackoverflow : Magic rep mark of 3000

Finally got my rep over the magic 3000 mark - I am now officially allowed to vote for closing posts.

I feel a close coming on - let me get at it!

Enjoy!

C# : Illustrated C# 2008

RedGate have released this as a free e-book.

Download from here.

"Illustrated C# 2008

If you're a C++ or VB programmer migrating to C# 2008, this book is well worth reading. The author, Daniel Solis offers a very visual approach – with lots of figures, diagrams and code samples – that will help you get to work with C# fast."

Enjoy !

Wednesday, March 25, 2009

Misc : My 10 Awesome Things I Remember About Computers

Inspired by Scott Hanselman's 10 Awesome Things I Remember About Computers:

OK - there's more than 10 and some have overflowed to another blog entry ...

Pong
"Pong (marketed as PONG) is one of the earliest arcade video games, and is a tennis sports game featuring simple two-dimensional graphics. The aim is to defeat an opponent—either computer-controlled or a second player—by earning a higher score."



Punchcards

"A punch card or punched card (or punchcard or Hollerith card or IBM card), is a piece of stiff paper that contains digital information represented by the presence or absence of holes in predefined positions. ... It was used through the 20th century in unit record machines for input, processing, and data storage. Early digital computers used punched cards as the primary medium for input of both computer programs and data, with offline data entry on key punch machines."



You punched them on a machine like this:



and read them on a machine like this:



They were stored in a box like this with different programs secured by a rubber band. This was in fact the earliest example of a code repository!



CompuServe

"CompuServe, (CompuServe Information Service, also known by its acronym CIS), was the first major commercial online service in the United States. It dominated the field during the 1980s and remained a major player through the mid-1990s".



The original TTY screens were navigated via numeric menus. You navigated to forums via the magic word "Go" e.g. "Go Microsoft" or "Go Novell".

BASIC Computer games



This book was written by David Ahl and was the first million-selling computer book. The book contained the source code of a number of games in BASIC and I typed them into a early IBM PC (running GWBASIC) and then spent many happy hours playing the games.

The table of contents and the source code can be found here. And no, you couldn't scan the source in - this was 1978 dude!

Star_Trek



This was another BASIC game that I spent hours playing.

"Star Trek is a text-only computer game that originated within the BASIC programming language hacker culture of the 1970s."

"The rules to the game are fairly simple. You are the commander of the starship USS Enterprise (NCC-1701) and have the obligation of eliminating the Klingon menace so democracy in the galaxy can be maintained. The original game existed within an 8-by-8 grid of the galaxy. The entire galaxy contains 64 quadrants and each quadrant contains 64 sectors. The starship can move either between sectors or between entire quadrants using text commands. The ship has a maximum number of energy units, which are used to move the ship, power the ship's shields, and fire phasers. The object of the game is to destroy all the Klingon ships within the galaxy without the Enterprise itself being destroyed."

The beauty of it all was that I had the source so if I wanted more photon torpedoes, I didn't need a cheat code - I simply hacked the code.

There is a version of this game included in the BASIC book above called Super Star Trek.

Hunt the Wumpus

"Hunt the Wumpus is an early computer game, based on a simple hide and seek format featuring a mysterious monster (the Wumpus) that lurks deep inside a network of rooms."



Another game that I spent hours playing and messing around with the BASIC source code. It's been ported to many languages - there's a C# version here.

First IBM PC



"The first IBM PC ran on a 4.77 MHz Intel 8088 microprocessor. The PC came equipped with 16 kilobytes of memory, expandable to 256k. The PC came with one or two 160k floppy disk drives and an optional color monitor. The price tag started at $1,565, which would be nearly $4,000 today." That's correct - it did not have a hard drive.

I bought the technical manual which had a full listing of the operating system - written in 8086 assembler of course - and I rapidly became proficient in using the features of the operating system. The MS-DOS API did most things via a call to INT 21h.

e.g.

AH=9h DS:DX=pointer to '$' terminated string WRITE STRING

setting the AH register to 9h and pointing DS:DX to a "$" terminated string and executing a INT 21h call caused the string to be written on the console. Everything was accessible by these calls meaning that the hardware could be driven directly. Often (especially for games) the standard OS calls were too slow so developers implemented their own drivers. So much fun - those were the days!

Developers had an intimate understanding of how the PC worked and consequently write better and more efficient code. The code had to be compact because there was virtually no memory.

Computer Bismarck



"Computer Bismarck is the first computer game by Strategic Simulations, Inc., who developed and published it in 1979. It simulated the Bismarck Chase, with the player commanding the British forces; the relatively simple artificial intelligence (AI) opponent (named Otto von Computer) controlled the German battleship Bismarck."

I used to play it on a friend's TRS-80. SSI went on to publish a range of computer games (including the "Panzer General" series) but this was the one that turned me on.

It came on a 32K cassette or a 48K disc and cost something like $59.95.

Mosaic



"Mosaic is the web browser credited with popularizing the World Wide Web. It was also a client for earlier protocols such as FTP, Usenet, and Gopher. Its clean, easily understood user interface, reliability, Windows port and simple installation all contributed to making it the application that opened up the Web to the general public. Mosaic was also the first browser to display images inline with text instead of displaying images in a separate window.

Mosaic was developed at the National Center for Supercomputing Applications (NCSA) beginning in late 1992. NCSA released the browser in 1993."

I'd heard about it on Usenet and one weekend set up my 4800 baud modem to download it. It took the whole weekend! but once I'd got it installed, I realised that I had seen the future and that WAIS, Archie, Veronica, Gopher etc. were all toast.

The first article I read was a tour of the Vatican and the second was Is There a Swimming Pool in the Kremlin?". To summarise:

"A group of reference librarians at a major university library (which shall remain nameless) were a bit skeptical when a WAIS terminal was installed at their reference desk. Not that they were computerphobic.

Far from it, they just felt they were already masters of the best research tools available. So someone posed the question, "Is there a swimming pool in the Kremlin?" Well, in this post-glasnost era, certainly we should be able to find out.

"The reference librarians scurried off to their favorite research mines --some to the card catalog, some to Dialog, some to the periodical indexes. The WAIS wizard worked quietly at his terminal. Within ten minutes, he'd found several citations and one whole article about a retired member of the Red Guard who swam every day, just outside the Kremlin walls. More than half an hour after he'd finished, the librarians straggled back. A few had struck out. A couple had a few cold leads, and one had, with a lot more work, located the same article in about quadruple the time it took on WAIS.

Think they were convinced?"

CP/M



"CP/M (Control Program for Microcomputers) is an operating system originally created for Intel 8080/85 based microcomputers by Gary Kildall of Digital Research, Inc. Initially confined to single tasking on 8-bit processors and no more than 64 kilobytes (64 KB) of memory, later versions of CP/M added multi-user variations (M/PM) and were migrated to 16-bit processors.

The combination of CP/M and S-100 bus computers patterned on the MITS Altair was an early "industry standard" for microcomputers, and was widely used through the late 1970s and into the mid-1980s. By greatly reducing the amount of programming required to install an application on a new manufacturer's computer, CP/M increased the market size for both hardware and software."

The beauty of CP/M lay in the BDOS and BIOS:

"Basic disk operating system
The Basic Disk Operating System, or BDOS, provided access to such operations as opening a file, output to the console, or printing. Application programs would load processor registers with a function code for the operation, and addresses for parameters or memory buffers, and call a fixed address in memory. Since the address was the same independent of the amount of memory in the system, application programs would run the same way for any type or configuration of hardware.

Basic input output system
The Basic Input Output System, or BIOS, provided the lowest level functions required by the operating system. These included reading or writing single characters to the system consoles and reading or writing a sector of data from the disk. The BDOS handled some of the buffering of data from the diskette, but before CP/M 3.0 it assumed a fixed disk sector size of 128 Bytes, as used on single-density 8-inch floppy disks. Since most 5.25-inch disk formats used larger sectors, the blocking and deblocking and the management of a disk buffer area was handled by model-specific code in the BIOS."

Because these were largely written by you (in 8086 assembler of course), CP/M could be made to run on any hardware. I worked for a company that imported mini-computers from the US of A and we grabbed a damaged mother board and a spare monitor and keyboard and two of us software geeks hooked up with one of the hardware guys to try and get CP/M running on it. The gurus in the States said it couldn't be done. The hardware dude fixed the mother board and changed the memory mapping so that it had a large chunk of contiguous memory and we imported a copy of CP/M from the States.

The first problem was that we didn't have a 8086 assembler so we wrote a cross-assembler that run on the mini. Then we wrote the BDOS and BIOS that enabled CP/M to communicate with our hardware. We had a number of problems and ended up writing our own debugger as well.

We got to the point that everything was sort-of-working but it was working well enough for us to use the CP/M editor, assembler and debugger to debug the system and one glorious day it all worked.

We bought a few games and played them and it sat in the corner for years for people who wanted to play Star Trek at lunch times but we never went much further. All the fun was in getting it to work!

And then of course MS/DOS came along and CP/M was history.

Gopher, Veronica, Archie, Jughead and WAIS

No, it's not a coincidence that some of these are names from the Archie comics.

This was the Internet until the browser came along. Everything was text-based and essentially non-graphical. The fact is that it worked pretty well. It just wasn't whizzy enough!

Gopher



"Gopher is a distributed document search and retrieval network protocol designed for the Internet. Its goal is to function as an improved form of Anonymous FTP, enhanced with hyperlinking features similar to those of the World Wide Web.

The Gopher protocol offers some features not natively supported by the Web and imposes a much stronger hierarchy on information stored on it. Its text menu interface is well-suited to computing environments that rely heavily on remote computer terminals, common in universities at the time of its creation in 1991 until 1993."

It was developed at the University of Minnesota. In the early days of the web, it provided a hierarchical way to search documents. With the arrival of the browser, it's popularity fell away and there are currently about 125 Gopher services still in existence. Its lack of popularity is shown by the fact that IE no longer supports it.

e.g. gopher://gopher.floodgap.com/7/v2/vs is a valid URL (like http: https: ftp:).

Veronica



"Veronica is a search engine system for the Gopher protocol, developed in 1992 at the University of Nevada, Reno.

Veronica is a constantly updated database of the names of almost every menu item on thousands of Gopher servers. The Veronica database can be searched from most major Gopher menus.

The name, although officially an acronym for "Very Easy Rodent-Oriented Net-wide Index to Computer Archives", was chosen to match that of the FTP search service known as Archie — Veronica Lodge being the name of another character from the Archie Comics."

Archie



"Archie is a tool for indexing FTP archives, allowing people to find specific files. It is considered to be the first Internet search engine. The original implementation was written in 1990 at McGill University in Montreal.

The earliest versions of Archie simply contacted a list of FTP archives on a regular basis (contacting each roughly once a month, so as not to waste too much resources on the remote servers) and requested a listing."

The World Wide Web made searching for files much easier, and there are currently very few archie servers in operation.

Jughead

"Jughead is a search engine system for the Gopher protocol. It is distinct from Veronica in that it searches a single server at a time.

Jughead is officially an acronym for Jonzy's Universal Gopher Hierarchy Excavation And Display, though it was originally chosen to match that of the FTP search service known as Archie — Jughead Jones being the name of another character from the Archie Comics.

Jughead was developed at the University of Utah."

WAIS



"Wide Area Information Servers or WAIS is a client-server text searching system that uses the ANSI Standard Z39.50 Information Retrieval Service Definition and Protocol Specifications for Library Applications" (Z39.50:1988) to search index databases on remote computers. It was developed in the late 1980's.

Public WAIS was often used as a full text search engine for individual Internet Gopher servers, supplementing the popular Veronica system which only searched the menu titles of Gopher sites."

Visual C++ 1.0 on Windows 3.1



I can well remember the day we got the box containing the new-fangled Visual C++ with IDE, debugger etc. We must have been among the first people in the country to purchase it. Up to that point, we'd used command line C to compile and a reasonably simple DOS editor called Brief to write the code. For Windows 3.1, we first used to design the screen on graph paper, then manually count the pixels and then code the screen layout. It was a huge pain to change anything.

None of us had any object oriented exposure so we started off by using Visual C++ to design the screen using drag-and-drop and then used the resulting .res / .rc files as the input to a C program (which compiled inside a C++ wrapper).

Just the fact that everything was integrated in one IDE was a huge time-saver but none of us actually ever got round to using C++!

Friday, March 20, 2009

MSIL : Running MSIL code inside Visual Studio

Using Visual Studio 2005.

Project Create - choose Visual C++ and then "Makefile Project".

This simple example will add two numbers so call the project AddTwoNum.

This bring up a wizard.

Click "Next". For Debug settings, in the "Build Command Line" type:

build.bat

Then click "Finish".

In the Solution Explorer, delete "readme.txt".

Add a text file called "Build.bat" to the project.

It contains:

ilasm /nologo /debug AddTwoNum.il


(ilasm is the command line MSIL assembler).

Add a text file called "AddTwoNum.il" to the project.

It contains:

.assembly AddTwoNum {}

.method static public void main() il managed
{
.entrypoint

.maxstack 10

.locals init (int32 firstNum,
int32 secondNum,
int32 resultNum)

ldc.i4 11
stloc firstNum
ldc.i4 22
stloc secondNum
ldloc firstNum
ldloc secondNum
add
stloc resultNum

ldstr "{0} + {1} = {2}"

ldloc firstNum
box int32

ldloc secondNum
box int32

ldloc resultNum
box int32

call void [mscorlib]System.Console::WriteLine(string, object, object, object)

// This bit just waits for a key to keep the command line prompt open

ldstr "Press Enter to continue"
call void [mscorlib]System.Console::WriteLine(class System.String)

// Call the System.Console.Read function
call int32 [mscorlib]System.Console::Read()

// The pop instruction removes the top element from the stack.
// (remove number returned by Read() function)
pop

ret
}


Now press "F6". Project should assemble cleanly.

Press "F5" to run it.

Answer "Yes" to "The project is out of date - Rebuild?"

Command prompt will display:


11 + 22 = 33
Press Enter to continue


You can set breakpoints in the normal way, step through the code in the usual way and the "Locals" debug window will display the values of the three variables.

Enjoy!

Monday, March 16, 2009

Java : Checking version on your PC

Came across a nice feature that does this from the Sun web site.

Verify Java installation

If your installation is out-of-date, just click on the link and the latest one is installed.

Very handy!

Enjoy!

Thursday, March 12, 2009

XP : TortoiseSVN and Explorer

We've moved from VSS to Subversion and I downloaded TortoiseSVN as my Windows client.
Every time I right-clicked on a folder, I get"

"Windows Explorer has encountered a problem and has to close"

Mr. Google to the rescue - took me a while - but eventually I discovered that the problem was with PowerDesk which I rarely use anymore.

So I uninstalled it and now all is well!

Enjoy!

Misc : A good day on Stackoverflow



Check this out.

100 rep - 3 badges - heck, I can live with that.

Enjoy!

Friday, March 06, 2009

Misc : Google Sites

OK - have a home page on Google Sites:

Home page

Enjoy!

Misc : Top Google search result





Searching Google for "DOS grep equivalent" shows "Random thoughts and collisions" is the top dog!

It's 1 out of about 62,000.

Check it out by double-clicking on the image above.

Enjoy!

Wednesday, February 25, 2009

Misc : Setting up and adding your gravatar

What is a gravatar? As per the site, "A gravatar, or globally recognized avatar, is quite simply an image that follows you from site to site appearing beside your name when you do things".

As per Wikipedia, "A Gravatar avatar can be up to 512 pixels wide, is always square and is displayed at 80 by 80 pixels by default. If the uploaded avatar is larger or smaller, the avatar is scaled appropriately".

I wanted to add one to Stack Overflow.

So I searched Google Images for a small image and saved it to my hard drive as a .jpg.

Then I used the ubiquitous Paint to open it. Under "Image / Attributes", it showed as:

Width = 60, Height = 40.

To keep it square, I needed to make the width 40. Simple maths shows that I needed it to be reduced by a third. So "Image / Stretch/Skew" and type 67 (i.e. 67 %) into the "Horizontal" box for "Stretch".

Another "Image / Attributes" showed it was pretty much as required. Save on the hard drive.

So logon to Gravatar. "My Account / Manage" Click "Add a new image". Browse to where the file was saved, select the file, crop as appropriate (I just dragged the box to fit the image), select the content type (hopefully it's "G"!) and you're done.

Now any site that uses gravatars will display your new image.

Enjoy!

Monday, February 16, 2009

XP : DOS equivalent of Traceroute

I've used Traceroute often to trace the path between two hosts and highlight potential bottlenecks.

But it is not a Windows program. However, "PathPing" is a network utility in XP.

"It combines the functionality of Ping with that of Traceroute (in Windows: tracert), by providing details of the path between two hosts and Ping-like statistics for each node in the path based on samples taken over a time period".


C:\>pathping

Usage: pathping [-g host-list] [-h maximum_hops] [-i address] [-n]
[-p period] [-q num_queries] [-w timeout] [-P] [-R] [-T]
[-4] [-6] target_name

Options:
-g host-list Loose source route along host-list.
-h maximum_hops Maximum number of hops to search for target.
-i address Use the specified source address.
-n Do not resolve addresses to hostnames.
-p period Wait period milliseconds between pings.
-q num_queries Number of queries per hop.
-w timeout Wait timeout milliseconds for each reply.
-P Test for RSVP PATH connectivity.
-R Test if each hop is RSVP aware.
-T Test connectivity to each hop with Layer-2 priority tags.
-4 Force using IPv4.
-6 Force using IPv6.


Or (as above), use tracert.


C:\>tracert

Usage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name

Options:
-d Do not resolve addresses to hostnames.
-h maximum_hops Maximum number of hops to search for target.
-j host-list Loose source route along host-list.
-w timeout Wait timeout milliseconds for each reply.


Enjoy!

Friday, January 30, 2009

C# : Removing non-ASCII characters

I was trying to filter some files and remove all the non-ASCII characters. Using Mr. Google lead me to this very helpful
post.

Essentially:


string s = "søme string";
s = Regex.Replace(s, @"[^\u0000-\u007F]", "");


I didn't want control characters so my filter was \u0020-\u007F.

Enjoy!