Various bits of useful but geeky knowledge.
As distinct from Computer Science. A few random notes at present.
Introduction, languages, main concept summary
The simulation that hit this problem involved random-walking hard spheres until they just touch - i.e. the output of a FP computation (determining the distance between two points) was being compared to the required separation (`2r`) at various stages of the code.
Comparing double precision numbers that may be exactly equal (and in this case where they should be ==) is always a bit hairy, and to be avoided. The code I inherited relied on such a comparison always being consistent, which need not be the case. A simple example would be (in C):
int main()
{
double x=sqrt(2.0);
volatile double y=x;
if (x!=y) printf("Uh oh!\n");
return 0;
}
One would assume that this should never print 'Uh oh!', but when compiled with optimization under gcc for x86 [1] it can indeed find that x!=y. Similar problems can arise with code of the form:
if( (y={something-nasty-mathsy-expression}) > x ) {
// Do something fab...
{something fab}
// Check consistency:
assert( y > x );
}
The assert line can fail, even though the if construct would seem to assure that y is always greater than x here. As before, the failure only tends to happen under optimization.
The issue is that under optimization, more floating point numbers are stored in registers more frequently (or rather, stored to memory less frequently as storing things is slow), and the registers on these chips actually store floating point numbers using, say, 80 bits ('extended precision') instead of 64 bits. If the numbers are rounded at every stage (e.g. by being stored to memory) then no inconsistencies arise, but if not, as is more common for optimized code, then FP variables utilised at different stages of the code may differ due to this variable degree of rounding. In the above assertion example, the first comparison happens on chip just after y is computed, at extended precision, and determines y to be greater than x. Later on, after both variables have been rounded to 64 bits via a store-to-memory operation, x is no longer greater than y because at this level of precision x is in fact equal to y.
This also explains another thing I hit with this code: that by adding a subroutine call (e.g. printf("")) in certain places in such codes the unexpected behaviour can be stopped. A function call forces all variables to be stored to memory (or at least onto the stack), unless the function is inlined.
As noted in the references below, there may always be some residual problems due to this kind of extended precision issue. However, under gcc on x86, you can get rid of a lot of them by using the -ffloat-store compiler flag (if I remember correctly, it only works when placed after the -O option, but this contradicts the manual and so I may be wrong about that). I have only observed this problem under gcc C/C++, it did not happen under Portland Group's pgcc/pgCC and I have no idea if it can happen under other languages or compilers. For what it's worth, I suspect it does not happen when using FORTRAN - the standard is probably rather specific on this issue.
The residual problems mentioned above arise in the temporaries used during evaluation - in short, everything you assign, e.g. the x in
x = {something-mathsy}
will be rounded consistently, but the temporaries used in {something-mathsy} will often be evaluated under extended precision. For many simulation purposes this is fine (and frequently desirable), but for the purposes of the purest forms of numerical analysis (where one is concerned with creating exactly reproducible algorithms dependent on e.g. IEEE arithmetic and independent of compiler-specific and processor-specific issues) it may be troublesome.
However, for me, the real problem was that the code I was working with was designed to use floating point numbers when the entire thing could have been done using integer arithmetic. The spheres are made to random-walk on a lattice, and the discrete nature of this problem makes an integer algorithm possible and indeed preferable. Using floats under these conditions give the algorithm more freedom than it requires, and provides just enough rope for it to hang itself. Alternatively, if one insists on using floats, even just comparing the squares of the seperation between points (instead of taking the square root) would have led to a more stable algorithm, as the kind of numbers the code was dealing with would then never have been rounded at all.
[1]The level of optimization required to observe this behaviour depends on the particular version of gcc being used.
Don't re-invent the wheel.
http://www.nr.com/
C, FORTRAN???
Bugs and rebuttal.
http://www.nag.com/
C, FORTRAN???
http://www.vni.com/products/imsl/ C, FORTRAN, Java.
http://www.gnu.org/software/gsl/
C, with wrappers for???
Graphic Gems??? Colt, library for Java-based numerical computation. http://hoschek.home.cern.ch/hoschek/colt/ ???
Lack of coordination of other potentially general library systems?
FFTW
BLAS, ATLAS, LINPACK, etc etc
Issues concerning input, storage, output and sharing of scientific data. Machine-dependancy, endian-ness IEEE and so on.
As of September 2002, the Special Educational Needs and Disability Act (SENDA) made it unlawful for any higher-education establishment to place a disabled student at any kind of 'significant disadvantage'. As EPCC now offers courses to students, this legislation affects us. Here are a few links on the subject.
The hopelessly badly-named browser scripting language that has nothing to do with Java.
Career-related stuff for geeks like me.
There are many recruitment websites, but it is rather difficult to know which ones are actually well-used and popular with employers. Monster may have much advertising, and I started there assuming that this meant it was a good site to use. It's not, and in retrospect perhaps the reason there was so much advertising for it was precisely because few people use it.
Anyways, I found that JobSite is pretty good for IT, but is perhaps superceded by the most highly recommended site I've found so far, Planet Recruit. Apparently this includes most if not all of the JobSite positions, with quite a few more on top.
Is it possible to circumvent the patenting of ideas, particularly in the form of Software Patents, by creating a repository where Open Source folks can publicize their ideas. We are only concerned about ideas that are considered obvious by those in the field, so we do not lose anything when people decide to keep ideas to themselves because ideas that good cannot be that obvious. Once the idea has been openly published, that should mean that patents on the idea should not be granted, and if granted would be trivially invalidated.
I always have to look things up. These links should help.
Opinion "I think there are key features that powerful text editors share and a few that should be but are not as common.
I have one long running source of frustration when trying to do simulation work: the lack of good visualization tools that can be easily integrated into a simulation code. Almost all of the physics stuff I do uses fairly simple classical models that would be easy to show graphically. The big advantage of this is that one can very rapidly see if things are working properly, just be checking if it looks right.
However, all the graphics libraries I've seen require a great deal of setup, and a large amount of 'pollution' of the code. I don't want to risk messing up my simulation code by having to strap in lots of visualization stuff - I just want one function call that says 'show me this'.
As an unhappy medium, I've decided to write small Java test cases where I can do graphical plots easily in order to test the algorithm, then copy and paste the algorithm into the simulation code itself. The current problem is one I seem to come across every few years - how to bounce a sphere off the inside of a cylinder. The first time was when I was very young, and wanted to write a 'speeding around a big maze of tubes' game (not a million miles from Wipeout, but with arcade-adventure style gameplay). At the moment, it's trying to get tracer particles to bounce off the inside of the tube that the fluid is moving through.
Anyways, here's the example applet. You'll need to have the Java plug-in installed for you to be able to see it[1]. Note that the particle starts at a random location, so it will look different every time. The source code itself is attached to the bottom of this page.[2]
Notice that by examining the corners, and the pattern that emerges over time, one can see that the implementation is essentially correct. In fact, it looks just like those things I used to make using cotton reels when I was a kid.
And, on a related note, the future is not looking good where a lack of vision is concerned.
I realised there were some silly bugs in the finer detail of the code, which are now fixed. I plotted the bounce points to check the reflection was okay, and it was completely wrong. I guess one way of visualizing a code is never enough!
[1] Annoyingly, I just discovered that the 'official' syntax for including a Java applet on a web page is ridiculously hideous and over complicated and depends on your browser, JavaScript, and on which flavour of HTML you want to use. Utterly idiotic. If you don't have the plugin, and you really want to see this thing, you can probably download the JRE from here.
[2] And you'll notice that the code is about 95% stuff for doing the graphics, and 5% actual particle-bouncing mathematics. :(
| Attachment | Size |
|---|---|
| CircleBouncePhyslet.java | 9.96 KB |
I wrote this some time ago, when I was using Java 1.0 and 1.1. Those early versions had no library routines for loading Double/Float values from a String, so I rolled my own (see below). Since Java 1.2 however, all you have to do is
try {
double a = Double.parseDouble("1.5311243e-23").doubleValue();
} catch( NumberFormatException e ) {
panic(e);
}
I'm not sure whether the parseDouble method copes with using a 'D' as the seperator between the mantissa and exponent, but I suspect it does. Check the Java API for more info.
While Java does have methods such as Integer.parseInt(
Routine to show parseDouble in action... Should correctly interpret inputstr = -.4322e+02 value = -43.22 2*value = -86.44
The routine will translate strings of the form
Please feel free to copy and use the parseDouble routine, and If anyone knows a better way of doing it, e-mail me about it so I can improve my code. One known problem is that if the routine is made to translate a string it doesn't recognise, it just writes 'Bad data!' to the standard output and returns (double) 0.0. Whenever I get around to seriously using this routine, I'll alter it so it throws a NumberFormatException if there is a problem.
Included here verbatim, and can also be downloaded from the link below.
// --> parseDoubleEG.java
// Example stand-alone application which uses the parseDouble routine:
// By A N Jackson.
import java.io.*;
class parseDoubleEG {
public static void main(String args[]) {
String filename,inputstr;
float indat;
inputstr = " -.4322e+02 ";
System.out.println("Routine to show parseDouble in action...");
System.out.println("Should correctly interpret inputstr = " + inputstr);
indat = (float) parseDouble(inputstr);
System.out.println("value = " + indat);
indat *= 2.0;
System.out.println("2*value = " + indat);
}
/* --> parseDouble v1.0
Routine to parse a floating point number from a string.
Written by A N Jackson (c) 27th January 1998.
*/
public static double parseDouble(String ipstr) {
double num = 0.0, mant = 0.0, exp = 0.0;
int mantsn = 1,expsn = 1,dp = -1,i,len,inum = 0;
boolean inmant = true,inexp = false, skip = false;
char ichr;
String istr;
len = ipstr.length();
for (i=0; i-1) dp++;
if (inmant) mant = mant*10.0 + inum;
if (inexp) exp = exp*10.0 + inum;
}
}
if (dp==-1) dp = 0;
num = mantsn*mant*Math.pow(10.0, expsn*exp - dp);
return num;
}
}
| Attachment | Size |
|---|---|
| ParseDoubleEG.java | 2.38 KB |
A repository for useful bits and bobs I've found good at the shell prompt. Mostly in bash (Giffle:bash-shell).
As I don't have admin privileges at work, it's handy to be able to unpack a binary RPM so I can use recent software without properly installing it. I was wanting to use wxPython, so I downloaded the RPMs and unpacked them in my home space:
rpm2cpio wxPython-common-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.rpm > \
wxPython-common-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.cpio
cpio -idv < wxPython-common-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.cpio
rpm2cpio wxPython2.6-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.rpm > \
wxPython2.6-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.cpio
cpio -idv < wxPython2.6-gtk2-ansi-2.6.3.3-fc2_py2.3.i386.cpio
I could then twiddle with my PYTHONPATH and LD_LIBRARY_PATH so that python would see these new libraries, and so can now run wxPython apps at work. (Something like this, although I may has mis-remembered the paths).
export PYTHONPATH=$HOME/usr/local/lib/python2.3/site-packages export LD_LIBRARY_PATH=$HOME/usr/local/lib
gzip -dc.tar.gz | tar -xvf -
To execute a shell command on every file in a directory, as separate execs, we can use
#!/bin/bash for file in \`ls $1\` do echo eins; cat header $1$file > /tmp/temp cat /tmp/temp > $1$file done exit 0;
OR
find ./ -name "*.ext" -exec chmod a+r {} \;
but this works recursively.
Another quite nice thing, used for updating CVS/Root files on a Zaurus:
find . -name Root | xargs cp newRoot
Just copies the contents of newRoot into every Root file. I think this works too:
find . -name Root | xargs 'echo user@machine.dom:/dir/root >'
as long as the quote are used to avoid the initial interpretation of the >.
These pieces of randomness will look for all .sh files in PWD and print the 41st line of each - don't ask me why I wanted to know. Thanks to Brian R for these.
for f in *.sh; do sed -n '41p' $f; done
or
ls *.sh | xargs -l sed -n '41p'
I'm always forgetting how these work, so here goes... To perform a regex replace on a set of files, I do stuff like this:
perl -pi -e's/ukqcd2/trumpton/' `find ./ -name Root` perl -pi -e's/\@SHELL\@/sh/' `find ./ -name Makefile`
Just found a better way to do perl one-liners. You tend to get a command-line buffer overflow using the previous technique on some OSs. This works better:
find . -name Makefile -exec perl -pi -e "s/e/f/g" {} \;
find . -type d -exec chmod 755 {} \;
The ; at the end *must* be escaped with a backslash.
for i in *.wma ; do mplayer.exe -vo null -vc dummy -af resample=44100 -ao pcm -waveheader "$i"; mv audiodump.wav "`basename "$i" .wma`.wav";done
From here
My solution to boot using a floppy disk might help. I boot of the floppy and am able to run from my USB CD-ROM. You will need to boot from the Knoppix CD first to get to the modules you need.
1) Boot up Knoppix, with your USB HDD attached and do an lsmod from a shell or command prompt. Locate the stuff used for USB. In my case, my USB CD-ROM uses usbcore for the bus, usb-uhci for the interface on the drive, and usb-storage to access the drive.
2) Then go to /lib/modules/2.4.20-xfs/kernel/drivers/usb. There you should find usbcore and usb-uhci for example (notice they and in .o). I also had to cd to storage to get usb-storage.o.
3) Copy the needed module files to a blank floppy. (This can also be used for you config saves)
4) Make a boot floppy from the CD using another floppy.
5) Shut down and reboot with the floppy. Choose expert mode when booting. It will go to spot where it asks you if you want to load additional modules, and it will list all the ones that are on the boot floppy. You do not want any of these so continue. It will then ask if you want to load additional modules from another floppy, yes you do. It will prompt you to insert that floppy, do so. Then it will list the modules you coppied. In my case I first load usbcore.o then usb-uhci.o and lastly usb-storage.o.
6) Then continue, it should locate your device and search it for a Knoppix install.
Good Luck, let me know if that works for you.
This section covers ways of finding out about your hardware without opening the box. It's mostly UNIX stuff to be used from the command line. If you want to write programs that determine this stuff, you might find this Rosetta Stone API page useful.
$ uname -a Linux green.ph.ed.ac.uk 2.6.9-42.0.3.ELsmp #1 SMP Mon Sep 25 17:28:02 EDT 2006 i686 i686 i386 GNU/Linux
On linux, you can find out what memory your machine has like this:
$ free -m
total used free shared buffers cached
Mem: 239 235 4 0 0 31
-/+ buffers/cache: 202 36
Swap: 2000 216 1783
Or you can use
$ cat /proc/meminfo MemTotal: 245228 kB MemFree: 5264 kB Buffers: 408 kB Cached: 40896 kB SwapCached: 92316 kB Active: 168328 kB Inactive: 54412 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 245228 kB LowFree: 5264 kB SwapTotal: 2048248 kB SwapFree: 1891664 kB Dirty: 148 kB Writeback: 0 kB Mapped: 185496 kB Slab: 12484 kB CommitLimit: 2170860 kB Committed_AS: 416392 kB PageTables: 1996 kB VmallocTotal: 782328 kB VmallocUsed: 2260 kB VmallocChunk: 780052 kB
Or even:
$ dmesg | grep MEM 0MB HIGHMEM available. 247MB LOWMEM available. MEM window: ea000000-ebffffff
Or, if you can access the machine, watch out for it on boot or check via the BIOS. More info can be found on this Linux and Memory web page, including how to get a machine to recognise memory that is going unnoticed.
You can find out about the CPU's on your machine using this command:
cat /proc/cpuinfo
Or using this command:
/usr/sbin/x86info
Be warned that on hyperthreaded systems, one or more real CPUs may be managed as two or more virtual processors. My machine in Edinburgh shows up 4 CPU cores, but actually only has two. I'm not sure how to detect this from the command line.
$ uname -a SunOS frontend 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Fire-15000
You can find out about your memory, cpu's and peripherals using
/usr/sbin/prtdiag
Or, if that doesn't work, you could try:
/usr/platform/`uname -i`/sbin/prtdiag
This will provide more wordy CPU info:
/usr/sbin/psrinfo -v
A remarkably large about of impenetrable information is unleashed my typing:
kstat
Not sure what much of it means though.
Much information is available via
systeminfo
To look up the available memory, you can use this
sysctl -n hw.physmem
I was trying to find out how to tell, from within a C program under GCC, what OS the code was being compiled under. I was porting RPCemu to MacOSX, and wanted to switch between big and little endian code without doing something clunky in autoconf.
I Googled for lists of pre-defined C pre-processor macros, but found didn't find any. Eventually, I discovered that you can get a list of the macros under GCC on a particular platform by creating an empty c file (empty.c) and running this command:
gcc -std=c99 -E -dM empty.c
#define HAVE_BUILTIN_SETJMP 1 #define unix 1 #define i386 1 #define SIZE_TYPE unsigned int #define ELF 1 #define GNUC_PATCHLEVEL 3 #define GNUC_RH_RELEASE 56 #define __linux 1 #define __unix 1 #define linux 1 #define STDC_VERSION 199901L #define USER_LABEL_PREFIX #define STDC_HOSTED 1 #define WCHAR_TYPE long int #define gnu_linux 1 #define WINT_TYPE unsigned int #define GNUC 3 #define STRICT_ANSI 1 #define __GXX_ABI_VERSION 102 #define GNUC_MINOR 2 #define STDC 1 #define PTRDIFF_TYPE int #define tune_i386 1 #define REGISTER_PREFIX #define NO_INLINE 1 #define __i386 1 #define VERSION "3.2.3 20030502 (Red Hat Linux 3.2.3-56)"
#define DBL_MIN_EXP (-1021) #define FLT_MIN 1.17549435e-38F #define CHAR_BIT 8 #define WCHAR_MAX 2147483647 #define DBL_DENORM_MIN 4.9406564584124654e-324 #define FLT_EVAL_METHOD 0 #define DBL_MIN_10_EXP (-307) #define FINITE_MATH_ONLY 0 #define GNUC_PATCHLEVEL 1 #define SHRT_MAX 32767 #define LDBL_MAX 1.79769313486231580793728971405301e+308L #define APPLE_CC 5341 #define UINTMAX_TYPE long long unsigned int #define LDBL_MAX_EXP 1024 #define SCHAR_MAX 127 #define USER_LABEL_PREFIX _ #define STDC_HOSTED 1 #define LDBL_HAS_INFINITY 1 #define DBL_DIG 15 #define FLT_EPSILON 1.19209290e-7F #define LDBL_MIN 2.00416836000897277799610805135016e-292L #define ppc 1 #define __strong #define APPLE 1 #define DECIMAL_DIG 33 #define LDBL_HAS_QUIET_NAN 1 #define DYNAMIC 1 #define GNUC 4 #define DBL_MAX 1.7976931348623157e+308 #define DBL_HAS_INFINITY 1 #define STRICT_ANSI 1 #define __weak #define DBL_MAX_EXP 1024 #define LONG_LONG_MAX 9223372036854775807LL #define __GXX_ABI_VERSION 1002 #define FLT_MIN_EXP (-125) #define DBL_MIN 2.2250738585072014e-308 #define DBL_HAS_QUIET_NAN 1 #define REGISTER_PREFIX #define NO_INLINE 1 #define _ARCH_PPC 1 #define FLT_MANT_DIG 24 #define VERSION "4.0.1 (Apple Computer, Inc. build 5341)" #define BIG_ENDIAN 1 #define SIZE_TYPE long unsigned int #define FLT_RADIX 2 #define LDBL_EPSILON 4.94065645841246544176568792868221e-324L #define NATURAL_ALIGNMENT 1 #define FLT_HAS_QUIET_NAN 1 #define FLT_MAX_10_EXP 38 #define LONG_MAX 2147483647L #define FLT_HAS_INFINITY 1 #define STDC_VERSION 199901L #define _BIG_ENDIAN 1 #define LDBL_MANT_DIG 106 #define WCHAR_TYPE int #define FLT_DIG 6 #define INT_MAX 2147483647 #define LONG_DOUBLE_128 1 #define FLT_MAX_EXP 128 #define DBL_MANT_DIG 53 #define WINT_TYPE int #define LDBL_MIN_EXP (-968) #define MACH 1 #define LDBL_MAX_10_EXP 308 #define DBL_EPSILON 2.2204460492503131e-16 #define INTMAX_MAX 9223372036854775807LL #define FLT_DENORM_MIN 1.40129846e-45F #define PIC 1 #define FLT_MAX 3.40282347e+38F #define FLT_MIN_10_EXP (-37) #define INTMAX_TYPE long long int #define GNUC_MINOR 0 #define DBL_MAX_10_EXP 308 #define LDBL_DENORM_MIN 4.94065645841246544176568792868221e-324L #define PTRDIFF_TYPE int #define LDBL_MIN_10_EXP (-291) #define LDBL_DIG 31 #define POWERPC 1
I have access to a number of machine through work, and it's sometimes hard to find adequate information about the operating systems that are installed on them. The first problem is finding out what version of what operating system they are using. Usually, the uname -a command is enough to work out what's running on a UNIX machine, but sometimes (particularly with Linuxes) it does not provide quite enough info. This page contains a list examples for determining exactly what your working on.
$ uname -a Linux green.ph.ed.ac.uk 2.4.21-47.ELsmp #1 SMP Wed Jul 5 20:38:41 EDT 2006 i686 i686 i386 GNU/Linux $ rpm -q redhat-release redhat-release-3WS-13.8.3
So, we are running Red Hat Enterprise 3, with the AS/ES/WS/D suffix indicating the flavour as follows:
It's not clear if you can work out which RHEL Update is installed, at least without explicitly comparing version numbers of installed packages. The 13.8.3 bit should tell us, but I don't know where to look it up.
$ uname -a Linux p15187550 2.6.16-rc6-060319a #1 SMP Sun Mar 19 16:28:15 CET 2006 i686 GNU/Linux $ cat /etc/debian_version 3.1
Also known as Sarge.
$ uname -a Darwin stoat.local 8.7.0 Darwin Kernel Version 8.7.0: Fri May 26 15:20:53 PDT 2006; root:xnu-792.6.76.obj~1/RELEASE_PPC Power Macintosh powerpc $ sw_vers ProductName: Mac OS X ProductVersion: 10.4.7 BuildVersion: 8J135
a.k.a. Tiger.
$ uname -a SunOS frontend 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Fire-15000
In Sun-speak, this means we are running on Solaris 9. The leading digit in the version number got cast aside when SunOS was renamed Solaris, I think.
$ uname -a AIX l1f401 3 5 00CD7EAF4C00 $ oslevel 5.3.0.0
This machine is running IBM's AIX 5.3. As an aside, on AIX you can use the lslpp command to determine the versions of the installed software packages.
Various tips when using the secure shell ssh.
I was having some serious problems with this error cropping up in the server logs just as a particular user logged in, just like this (taken from here):
Dec 1 03:27:28 mx sshd[743]: Failed none for mxadmin from 192.168.3.3 port 4321 ssh2 Dec 1 03:27:37 mx sshd[743]: Accepted password for mxadmin from 192.168.3.3 port 4321 ssh2
This was in turn causing denyhosts to kick in and block the user's IP address. I eventually discovered that the reason the client software was attempting a login without any authentication method was because the users ~/.ssh directory and the files within it were world readable. A quick
chmod -R 700 ~/.ssh
on the user's machine fixed the problem. Quite why OpenSSH behaves this way escapes me.
andyj@garnet$ ssh-keygen -t dsa Enter file in which to save the key(/home/andyj/.ssh/id_dsa): Generating public/private dsa key pair. Enter passphrase(empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/andyj/.ssh/id_dsa. Your public key has been saved in /home/andyj/.ssh/id_dsa.pub. The key fingerprint is: md5 1024 43:71:68:a2:9d:a1:9a:62:16:53:3e:f3:4b:6d:90:57 andyj@garnet andyj@garnet$
Keys usually come in pairs, with one half being the public key and the other half being the private key. With OpenSSL, the private key contains the public key information as well, so a public key doesn't need to be generated separately.
Public keys come in several flavors, using different cryptographic algorithms. The most popular ones associated with certificates are RSA and DSA, and this HOWTO will show how to generate each of them.
A RSA key can be used both for encryption and for signing. Generating an RSA private-key certificate is quite easy, all you have to do is the following:
openssl genrsa -des3 -out privkey.pem 2048
With this variant, you will be prompted for a protecting password. If you don't want your key to be protected by a password, remove the flag '-des3' from the command line above.
Somehow convert the private key into a signed pub-priv certificate via the certificate authority.
To load PEM format (Globus-style) user certificates into Netscape or Internet Explorer, you first need to convert them into pkcs#12 format. This is most easily done with openssl version 0.9.3 or later.
If you have used your certificate with Globus, the conversion is most easily done on the machine with the .globus directory where your working Globus certificates are stored. (You can run grid-proxy-init to check they are installed correctly if you are in any doubt.)
That machine must have openssl installed for the following procedure to work. If you are using Redhat Linux 7.x then you have probably got openssl installed already. Typing openssl version will verify it is installed and tell you what version. (For Redhat 6.x, you can download a suitable OpenSSL RPM from http://datagrid.in2p3.fr/distribution/external/)
Once you have a working installation of openssl, you need to check that the certificate you have is valid for use in a web browser, by issuing the command:
openssl x509 -in usercert.pem -text
The output should include these lines (possibly with the SSL Server and S/MIME references absent):
Netscape Cert Type: SSL Client, SSL Server, S/MIME
If SSL Client is missing, you will need to have your certificate reissued by your certificate authority, with the additional Cert Type "SSL Client"
Once you have an SSL-Client valid certificate, generate a pkcs12 version of your certificate and key by issuing the following command (NB the .p12 file includes a copy of your private key from userkey.pem, protected by the passphrase you are prompted for. You should treat the .p12 file with the same care as your userkey.pem private key.)
openssl pkcs12 \
-export -in ~/.globus/usercert.pem \
-inkey ~/.globus/userkey.pem \
-out ~/.globus/uskycert.p12
The resulting file uskycert.p12 can then be loaded into Netscape or Internet Explorer, either on the Unix machine with your .globus directory or by copying the file to a Windows machine and loading it there.
For Netscape: Communicator | Tools | Security Info | Certificates | Yours | Import a Certificate
For Internet Explorer: Tools | Internet Options | Content | Certificates | ?Personal? | Import
Looking at content management systems for public websites.
The standard for standards that will allow us to standardize every standard in a standards-conformant manner. As standard.
I have a Zaurus SL-5500. That's nice isn't it?
The FAT32 filing system that most SD/CF cards come formatted as if rather handy in that it can be read 'most anywhere. However, it does not support things like symbolic links, and so cannot be used reliably when trying to install ipks onto them. I keep a 128MB SD card in my Zaurus, formatted as ext2 so that I can use it to hold the big stuff like Apache, PHP and MySQL (see Pocket LAMP).
To install software on an SD card, it needs to be ext2 formatted. You need Fdisk to do this. If you haven't already, insert the SD/MMC card into Zaurus and type the following commands within Terminal program.
umount /dev/mmcda1 fdisk /dev/mmcda o [ENTER] n [ENTER] p [ENTER] 1 [ENTER] [ENTER] [ENTER] t [ENTER] 1 [ENTER] 83 [ENTER] w [ENTER]
In a few moments fdisk will finish and you will be back to console. Next type in following:
mkfs.ext2 /dev/mmcda1
above command will convert the SD card to ext2 file format. Once the formatting finishes type in the command below to mount the SD card.
mount /dev/mmcda1 /mnt/card
LAMP is a very popular web development platform, and my Zaurus is a very nice way to keep a portable web server in my pocket.
The standard download for MySQL on the Zaurus is here. This has been very useful, but that version of MySQL (3.22.xx) is a little old and does not support the now very popular INNER JOIN syntax. So, I have hacked the latest stable Debian ARM packages in order to bring a 3.23.xx version of MySQL to the Zaurus.
After stealing a couple of files from the 3.22.xx distribution, I managed to to build an ipk distribution that deploys successfully on my Zaurus. Be warned that I have not stripped the original MySQL 3.23.49-8.7 distribution down very much, and you'll need a fair bit of space for the install. I put it onto my SD card and then ipkg-link'ed it in from there.
Note that this package MUST be installed to a proper linuxy filesystem - the FAT32 filesystem that is the default for SD/CF cards is no good and the ipkg install should/will fail. See this page for information on formatting a card appropriately.
I've tested the package on my SL-5500 with the v3.1 Sharp ROM, and I know someone got it working on a C750. Please get in touch if you have any questions, or if you can confirm that the package works on other Zaurii/ROMs.
Share and Enjoy.
I originally tried to pick the packages apart under Cygwin using dpkg version 1.10.4, but the relavent command for turning a Debian package (.deb) into a tar archive (.tar):
dpkg-deb --fsys-tarfile package_name.deb > package_name.tar
kept dying with wierd errors in 'subprocess paste', whatever that means. Eventually tried version 1.6.14 on Solaris and it worked a treat.
Once this was working, I got the mysql packages and their dependencies (ignoring libc6 as the Zaurus already has this) and turned them all into tar archives using the syntax above. The required files can then be pulled from the tarchives and blatted together to create a suitable distribution. The only tricks were finding a machine I could use where I could set the UID and GID to be 0 (root:root on the Z), and getting the file permissions right so that the package deployed cleanly.
My port of sabcmd (the Sablotron XSLT processor) for the Zaurus. Tested on my SL-5500 under the Sharp ROMs.
| Attachment | Size |
|---|---|
| Sablot-0.98.tar.bz2 | 496.04 KB |