Friday, 29 May 2009

Open SSL

Command to generate a private key
genrsa -des3 -out [CertRoot]/private/privateKey.pem 1024

Command to generate a private key for a self signed cert
genrsa -des3 -out [CertRoot]/private/cAPrivateKey.pem 1024

Command to create a private key for Bank-Link

genrsa -out [CertRoot]/private/banklinkPrivate.pem 1024

Commands to create self seigned cert
req -new -x509 -keyout [CertRoot]/private/cAPrivateKey.pem -out [CertRoot]/ca/CACert.pem -config [CertRoot]/openssl.cnf -days[days]

req -new -x509 -key [CertRoot]/private/cAPrivateKey.pem -out [CertRoot]/ca/CACert.pem -config [CertRoot]/openssl.cnf -days [days]

Command to create a certificate request
req -new -key [CertRoot]/private/privateKey.pem -out [CertRoot]/cert.csr

Command to sign a server certiciate request
x509 -req -in [CertRoot]/cert.csr -CA [CertRoot]/ca/CACert.pem -CAkey [CertRoot]/private/CAPrivateKey.pem -CAserial [CertRoot]/serial -out [CertRoot]/cert.pem -days [days]

ca -policy policy_anything -config [CertRoot]/openssl.cnf -cert [CertRoot]/ca/CACert.pem -keyfile [CertRoot]/private/CAPrivateKey.pem -in [CertRoot]/cert.csr -out [CertRoot]/cert.pem -days [days]

Command to convert a PKCS#12 file to .pem format
openssl pkcs12 -in banklink.pfx -out banklink.pem -nodes

See also - To install cert in IIS
http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html

See also - Free SSL supported by browsers
https://cert.startcom.org/

Thursday, 28 May 2009

SQL Server - Useful Stuff

To fix orphansed users.
Occurs when you force a db backup onto another instance on another server
------------------------------------------------------------------------------------------------
exec sp_change_users_login 'Auto_Fix', ''

To move data around

You can use SQL Server 2008 to move data into older databases


See where CPU is being used when CPU utilisation is high
---------------------------------------------------------------------
Select
signal_wait_time_ms=sum(signal_wait_time_ms)
, '%signal (cpu) waits' = cast(100.0 * sum(signal_wait_time_ms) / sum (wait_time_ms) as numeric(20,2))
, resource_wait_time_ms=sum(wait_time_ms - signal_wait_time_ms)
, '%resource waits'= cast(100.0 * sum(wait_time_ms - signal_wait_time_ms) / sum (wait_time_ms) as numeric(20,2))
From sys.dm_os_wait_stats


If % signal waits (i.e. time spent waiting for CPU to be free) is greater than 25%, then more CPUs / faster CPUs will help

if % resource waits is high then use the following to see what:
---------------------------------------------------------------------------
SELECT * FROM sys.dm_os_wait_stats

Before doing a check call the following to reset wait counters:
---------------------------------------------------------------------------
DBCC SQLPERF ('sys.dm_os_wait_stats', CLEAR)
How To Get Donmar Warehouse Tickets

Ten seats for every performance are released at 10.30 each morning; there are 20 spaces for standing. Then there are potential returns. If you are prepared to queue from 9.00 on Saturday you can usually get a ticket. Take a book, a coffee, chat to your fellow theatrephiles; it's a risk, but worth it.

Wednesday, 27 May 2009

MQ Series Useful Stuff

MQ Series

To connect to an MQ Series server

1) I
nstall MQ Client. Note that if you are on the same machine as the MQServer then the client should be installed using the server installation disks not eth client ones.

2) Set environment variable:
MQSERVER=[Channel]/[Protocol]/[HostName]([port])

[Channel] - Is the name of teh server connection channel that the client will use. The default vaue of
SYSTEM.DEF.SVRCONN is usually sufficient.

[Protocol] - The network prorocol to use to communicate with the server. the default value of TCP is usually used.

[HostName] - Is the remote MQ Server hostname or IP address

[Port] - Is the port for the QM manager process on the MQ server. Normally the default (1414) will do.

So, a vald string looks like:
MQSERVER=SYSTEM.DEF.SVRCONN/TCP/aHost(1414)

To check client connectivity

Use a test utility bundled with the client: (in bin directory)
amqscnxc -x [server name]([port])
e.g. amqscnxc -x 192.168.100.14(1414) -c DEFAULT.SERVER.CON QNAME
If you leave the params off it looks for vaklues in MQSERVER environment variable so its a good way to test that is set correctly.

If that doesn't exist, use amqsputc [QName] [QMName]
Should be able to enter some text that will appear as a meessage. Then [enter] to submit to server
This also uses MQ Client and MQSERVER environment variable

From Java
Note that the MQClient jars are in the folder:
[MQ Root Dir]\eclipse\plugins\com.ibm.mq.runtime_7.0.0.1

E.g.:
C:\Program Files\IBM\WebSphere MQ\eclipse\plugins\com.ibm.mq.runtime_7.0.0.1

More info
http://www3.sympatico.ca/n.rieck/docs/mqseries_client_on_openvms.html

Using JMS to connect Java to MQ:
http://www.devx.com/Java/Article/40866/1954?pf=true

http://hursleyonwmq.wordpress.com/2007/05/29/simplest-sample-applications-using-websphere-
mq-jms/


http://www.academictutorials.com/jms/jsm-mqseries.asp


MQBooks:
http://www-01.ibm.com/software/integration/wmq/library/crossplatform_books.html