It’s worth remembering what ^Z can do for you.

DOS/Windows users using the Terminal/shell normally find out about the joys of ^Z pretty quickly. ^S can be a real doozy too but it seems that it’s been removed on the Apple Mac for safety.

^Z as you will find stops the app. You commonly find that out when trying to create a file using cat, like copy con file you can do cat > file on *nix but instead of ^Z for an end file *nix uses ^D. In order to get back to the file and be able to press ^D you just need to run fg. That brings the stopped app back to the foreground.

Now that you have found out how to stop an app mid flow there are all sorts of possibilities. You could kill it for example. The other thing is to send it to the background. If you forgot to append the & you can simply stop it then run the bg command to put it in the background.

On Linux ^S sends the application to sleep. It then doesn’t respond to any key presses. At least until you hit ^Q to wake it up. That was one that took me a while to figure out. Having to kill vim when you meant to save the changes did demonstrate its recovery procedure quite nicely though, and I never did lose any work!

Advertisements

Updating the man config to find newly installed stuff

The Hivelogic page has been indispensible when setting up my Mac for development. The one thing that it does not mention is how to tweak your man configuration so that you can see the manual pages for the software you have just installed into /usr/local.

The configuration file for man is in /usr/share/misc/man.conf by default. You can type man man to confirm this. Edit the file as root and add a new MANPATH setting pointing to /usr/local. Simple!

MANPATH /usr/local/man

Grokking source code

I like automating my analysis/fixing of code wherever possible. While new languages that allow us to examine the parse tree will allow us a lot of control there is plenty we can do with the existing languages.

A tool that looks at the source code can do an awful lot without a great deal of understanding.

Even apparently ambigious syntax may not be as problematic as it first appears. Take Visual Objects for example. This language has standard syntax for accessing arrays using square braces a[1]. It also allows string literals to be specified in square braces as well as double quotes and single quotes, like [a string].

Telling the difference between being in a string and not being in a string is quite a fundamental problem when dealing with source code. If you don’t do that then that can have a knock on effect on dealing with comments too.

Is [/* x+ */1] a string or an array index?

The answer is to look at these in real code. In practice an array access must always come after an identifier, the array. A string does not. If there’s an operator before it then it must be a string.

This means that writing a tool for automated source code analysis doesn’t have to be anywhere as complex as it sounds. You don’t necessarily have to fully parse it, you can effectively leave it at little more than a lexical analysis.

By figuring this out and accounting for a bunch of other comment types you can do things like extracting all the strings for an application. Useful for making your application available in other languages.

Advantage in .net for VO developers

I’ve grown quite fond of Advantage since using it. It’s definitely an excellent solution if you need to deal with DBF files. If you are moving from Visual Objects (VO) to Vulcan or another .net environment you are probably looking at ADO.Net as one of the ways to access your data.

Here is a typical connection string for looking at a directory of DBF’s with CDX indexes. This connection string is for the Advantage .Net data provider.

Data Source=c:\path;ServerType=local|remote;
TableType=CDX;CharType=ADS_ANSI;
FilterOptions=RESPECT_WHEN_COUNTING;
TrimTrailingSpaces=True;DbfsUseNulls=True

This assumes that you have your DBF’s in a directory and don’t have and Advantage Data Dictionary. If you are opening your tables using DBServer{ "filename", TRUE, FALSE, "AXDBFCDX" } then that is probably a reasonable assumption.

The CharType is equivalent to the SetCollation command. ADS_ANSI is equivalent to #Windows and ADS_OEM is equivalent to #Clipper. Make sure you get it right, keep accessing the tables in the same way that you do in your VO program.

The DbfsUseNulls defines whether empty values are returned as null values or not. This makes quite a big difference. If you try to cast a value from a RecordSet directly to the type you are interested in and it’s null you will get an exception.
The documentation says that it defaults to False but I’m not convinced. I really ought to double check whether it does or not.

The rest is fairly standard. The one thing that you might want to change is the TrimTrailingSpaces option. I like them to be trimmed but if you want to keep things familiar you might want to turn that off.

Ubuntu on the server

I now have a server running ubuntu.

Get the latest updates going apt-get update ; apt-get upgrade

Just try to get hardware like printers installed without looking for drivers initially. I found that ubuntu had support for my printer out of the box. The download from the manufacturer just muddied the water.

After setting up the printer and then samba I was able to use the printer from other boxes. Even my Mac could use it by selecting windows file sharing.

After installing samba you may need to add the users that can use it. Allow users access to samba using smbpasswd -La username.

Vim and compatible mode

If you like to run vim but seem to be finding that features like tabbing through filenames are not working you might be in compatible mode. I just compiled vim from scratch so that I could get an intel version and I noticed that it mentioned compatible mode on the intro screen. To turn it off permanently just create a .vimrc file in your home directory (if you already have one you won’t have the problem).

Fixing a broken IIS ASP.Net installation

It seems to be quite easy to end up with a dodgy IIS installation, especially if you install IIS after the .net framework. If you are using Visual Studio it will probably complain and then tell you how to fix it if you ask for help. Today I didn’t have that luxury and I got the following error in my eventlog, “Failed to initialize the AppDomain:/LM/W3SVC/1/ROOT”.

In order to fix it you simply need to use the aspnet_regiis -i command while in the ASP.Net directory. This is usually $WINNT\Microsoft.Net\Framework\v\. Run this command while the web server is stopped.

If you have never had the IIS running your .net application and you are seeing lots of strange error messages this could fix it.