HTTP explained
http://www.jmarshall.com/easy/http/
Those useful and interesting technology snippets that I keep forgetting to write down until I need them again.
Tuesday, 24 July 2012
Thursday, 19 July 2012
Thursday, 7 June 2012
Adding Complex SOAP Headers
Good articles on how to add SOAP headers when you are using CXF and the headers are complex XML rather than simple strings.
http://stackoverflow.com/questions/3807922/with-cxf-actually-groovyws-how-do-i-generate-a-soap-header-with-one-child-nod
http://blog.bemoko.com/2010/08/12/groovyws-cxf-and-net-webservices-with-an-authheader-pain/
http://stackoverflow.com/questions/3807922/with-cxf-actually-groovyws-how-do-i-generate-a-soap-header-with-one-child-nod
http://blog.bemoko.com/2010/08/12/groovyws-cxf-and-net-webservices-with-an-authheader-pain/
Friday, 27 April 2012
Wrapped vs Bare in Doc/Lit web services
Best explanation that I have seen to date. Includes a description of the constraints that need to be applied to wsdl to make it work
http://atmanes.blogspot.co.uk/2005/03/wrapped-documentliteral-convention.html
Saturday, 21 April 2012
PermGen In Grails
Found this useful tidbit on Grails Facebook page - how to fix Grails permgen issues
- Hi ,default ram size occupied by jvm is 64MB you can increase it manually by the code given by santosh CATALINA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=256m". configure the above code in tomcat config file.Friday at 09:40 · ·
1
- Prabhat Roy 2)Some time memory leak causes this problem, than abome wont work use profiler and chekout the code , dont include unnecessary jars and check the code module by module remove unneccessary object creation , if required call garbage collection explicitly to kill the useless objects. its bit difficult to debug.Friday at 09:44 · ·
1
- Prabhat Roy 3)(a)Put JDBC driver in common/lib (as tomcat documentation says) and not in WEB-INF/lib
(b)Don't put commons-logging into WEB-INF/lib since tomcat already bootstraps it - Prabhat Roy new class objects get placed into the PermGen and thus occupy an ever increasing amount of space. Regardless of how large you make the PermGen space, it will inevitably top out after enough deployments. What you need to do is take measures to flush the PermGen so that you can stabilize its size. There are two JVM flags which handle this cleaning:
-XX:+CMSPermGenSweepingEnabled
This setting includes the PermGen in a garbage collection run. By default, the PermGen space is never included in garbage collection (and thus grows without bounds).
-XX:+CMSClassUnloadingEnabled
This setting tells the PermGen garbage collection sweep to take action on class objects. By default, class objects get an exemption, even when the PermGen space is being visited during a garabage collection.
Wednesday, 18 April 2012
JAXBElement and generateElementProperty
This had me perplexed for a while.
http://docs.oracle.com/cd/E19879-01/820-1072/ahiid/index.html
So, if you have for example a name attribute which is a String and has minOccurs="0" nillable="true" for its schema element then there are 2 representations for "no value":
<person>
<name xsi:nil="true"/>
<age>21</age>
</person>
and:
<person>
<age>21</age>
</person>
Note that an empty String element is not the same:
<person>
<name/>
<age>21</age>
</person>
With this definition its not possible to marshal that in a way that does't lose information if you go direct to String, because you have to pick a representation when you unmarshal.
That is if you perform the marshalling activities xml -> String -> xml you have to pick which representation of nil to use in the final XML, and you have no information to allow you to determine which representation you came from. So its possible they may end up different.
That's not good. So JAXB doesn't do that by default. Instead it wraps elements like this in JAXBElement rather than String so its xml -> JAXBElement -> xml, and the representation is preserved.
Said another way, you can avoid using JAXBElement if you pick the representation of nil you want for XML, by having minOccurs="0", nillable="false" for example.
Or, you can tell JAXB how to do it when you do wsdl2java by providing a binding file that contains generateElementProperty="false".
http://docs.oracle.com/cd/E19879-01/820-1072/ahiid/index.html
So, if you have for example a name attribute which is a String and has minOccurs="0" nillable="true" for its schema element then there are 2 representations for "no value":
<person>
<name xsi:nil="true"/>
<age>21</age>
</person>
and:
<person>
<age>21</age>
</person>
Note that an empty String element is not the same:
<person>
<name/>
<age>21</age>
</person>
This can be interpreted as an empty String, "", rather than nil.
With this definition its not possible to marshal that in a way that does't lose information if you go direct to String, because you have to pick a representation when you unmarshal.
That is if you perform the marshalling activities xml -> String -> xml you have to pick which representation of nil to use in the final XML, and you have no information to allow you to determine which representation you came from. So its possible they may end up different.
That's not good. So JAXB doesn't do that by default. Instead it wraps elements like this in JAXBElement rather than String so its xml -> JAXBElement -> xml, and the representation is preserved.
Said another way, you can avoid using JAXBElement if you pick the representation of nil you want for XML, by having minOccurs="0", nillable="false" for example.
Or, you can tell JAXB how to do it when you do wsdl2java by providing a binding file that contains generateElementProperty="false".
Interesting Grails Pugin - Melody
System reporting within your app.
http://grails.org/plugin/grails-melody
http://code.google.com/p/javamelody/
http://grails.org/plugin/grails-melody
http://code.google.com/p/javamelody/
Friday, 23 March 2012
Friday, 16 March 2012
Thursday, 15 March 2012
Nice way to make a sequential number look random
From here: http://stackoverflow.com/questions/611915/obscure-encrypt-an-order-number-as-another-number-symmetrical-random-appea/612085#612085
Useful if you want to use a sequential number as the unique reference for something, but want to obfuscate it so that its non-obvious that its a sequence
Pick a 8 or 9 digit number at random, say 839712541. Then, take your order number's binary representation (for this example, I'm not using 2's complement), pad it out to the same number of bits (30), reverse it, and xor the flipped order number and the magic number. For example:
1 = 000000000000000000000000000001
Flip = 100000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 010010000011001111111100011101 = 302841629
2 = 000000000000000000000000000010
Flip = 010000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 100010000011001111111100011101 = 571277085
Useful if you want to use a sequential number as the unique reference for something, but want to obfuscate it so that its non-obvious that its a sequence
Pick a 8 or 9 digit number at random, say 839712541. Then, take your order number's binary representation (for this example, I'm not using 2's complement), pad it out to the same number of bits (30), reverse it, and xor the flipped order number and the magic number. For example:
1 = 000000000000000000000000000001
Flip = 100000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 010010000011001111111100011101 = 302841629
2 = 000000000000000000000000000010
Flip = 010000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 100010000011001111111100011101 = 571277085
Tuesday, 24 January 2012
TripleDES block encryption and padding
What the various parts of a cipher string such as "DESede/ECB/PKCS5Padding" means:
http://www.informit.com/articles/article.aspx?p=26343&seqNum=4
http://www.informit.com/articles/article.aspx?p=26343&seqNum=4
Saturday, 14 January 2012
Useful Free Tools
www.BitBucket.com - free dvcs with git
www.cloudbees.com - free jenkins - cheap clous based test servers
http://www.rallydev.com - free agile planning
youtrack - free for public - cheap ($10 / month) private bug tracking
github does it all for $7 month for 1 user
www.cloudbees.com - free jenkins - cheap clous based test servers
http://www.rallydev.com - free agile planning
youtrack - free for public - cheap ($10 / month) private bug tracking
github does it all for $7 month for 1 user
Friday, 6 January 2012
Programmatic configuration of logging Handler for Axis 1.x client
This took ages to work out.
Mostly the web examples involve writing a WSDD to configure a Handler subclass, but I wanted to create a handler which logged outgoing and incoming SOAP messages via Axis 1.4 and I wanted to programmatically control whether the handler was added to the axis client so that when logging was turned off, there were no unnecessary calls being made.
The code I used was to create a subclass of Axis BasicHandler to do what I wanted (by looking at the example LogHandler class provided by axis: http://kickjava.com/src/org/apache/axis/handlers/LogHandler.java.htm)
Then register it (when the configuration was turned on) using the below. Note "css" is a service locator object that is created when you use WSDL2Java on the WSDL for the service being connected to. This is done before you call getPort on the locator to get the service stub.
SimpleProvider clientConfig = new SimpleProvider();
AxisClientLogHandler logHandler = new AxisClientLogHandler();
SimpleChain reqHandler = new SimpleChain();
SimpleChain respHandler = new SimpleChain();
reqHandler.addHandler(logHandler);
respHandler.addHandler(logHandler);
Handler pivot = new HTTPSender();
Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler);
clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME, transport);
css.setEngineConfiguration(clientConfig);
css.setEngine(new AxisClient(clientConfig));
Mostly the web examples involve writing a WSDD to configure a Handler subclass, but I wanted to create a handler which logged outgoing and incoming SOAP messages via Axis 1.4 and I wanted to programmatically control whether the handler was added to the axis client so that when logging was turned off, there were no unnecessary calls being made.
The code I used was to create a subclass of Axis BasicHandler to do what I wanted (by looking at the example LogHandler class provided by axis: http://kickjava.com/src/org/apache/axis/handlers/LogHandler.java.htm)
Then register it (when the configuration was turned on) using the below. Note "css" is a service locator object that is created when you use WSDL2Java on the WSDL for the service being connected to. This is done before you call getPort on the locator to get the service stub.
SimpleProvider clientConfig = new SimpleProvider();
AxisClientLogHandler logHandler = new AxisClientLogHandler();
SimpleChain reqHandler = new SimpleChain();
SimpleChain respHandler = new SimpleChain();
reqHandler.addHandler(logHandler);
respHandler.addHandler(logHandler);
Handler pivot = new HTTPSender();
Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler);
clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME, transport);
css.setEngineConfiguration(clientConfig);
css.setEngine(new AxisClient(clientConfig));
Sunday, 20 November 2011
Grails + CXF Example - Contract First WSDL
There is an excellent tutorial for doing contract first WSDL with CXF in grails here:
http://docs.codehaus.org/pages/viewpage.action?pageId=85983334
After a bit of mucking about I managed to improve it slightly.
Still couldn't get the cxf simpleBean tag to allow injection of grails services - it works but the resultant service fails with errors like:
[Namespace] [method] was not recognized. (Does it exist in service WSDL?)</faultstring></soap:Fault></soap:Body></soap:Envelope>"
I think this is because spring / grails is proxying the beans set up in resources.xml so the object passed to simpleServer does not have the annotation necessary to publish the webservice. Found this:
http://www.techper.net/2009/12/03/cxf-method-not-found-when-further-annotated/
Anyway, the solution is to not use simpleServer and do it yourself in Bootstrap as follows:
1) Inject the grails service that implements the web service into bootstrap
2) start the web service in Bootstrap init:
System.out.println("Starting Security WebService");
Object implementor = injectedService
String address = "/serviceAddress";
Endpoint.publish(address, implementor);
}
http://docs.codehaus.org/pages/viewpage.action?pageId=85983334
After a bit of mucking about I managed to improve it slightly.
Still couldn't get the cxf simpleBean tag to allow injection of grails services - it works but the resultant service fails with errors like:
[Namespace] [method] was not recognized. (Does it exist in service WSDL?)</faultstring></soap:Fault></soap:Body></soap:Envelope>"
I think this is because spring / grails is proxying the beans set up in resources.xml so the object passed to simpleServer does not have the annotation necessary to publish the webservice. Found this:
http://www.techper.net/2009/12/03/cxf-method-not-found-when-further-annotated/
Anyway, the solution is to not use simpleServer and do it yourself in Bootstrap as follows:
1) Inject the grails service that implements the web service into bootstrap
2) start the web service in Bootstrap init:
System.out.println("Starting Security WebService");
Object implementor = injectedService
String address = "/serviceAddress";
Endpoint.publish(address, implementor);
}
Thursday, 3 November 2011
Git Command - Including Deleting Remote Branch
Handy site to remember git commands:
http://gitref.org
The daddy of refs:
http://progit.org/book
A non obvious command to delete a remote branch.
First do git branch -d [branchName] locally
Then: git push origin :[branchName]
This is based on refspecs - doco for which is can be found here:
http://progit.org/book/ch9-5.html
Basically this is saying push an empty reference to [branchName] on the remote system. That has the effect of deleting it.
http://gitref.org
The daddy of refs:
http://progit.org/book
A non obvious command to delete a remote branch.
First do git branch -d [branchName] locally
Then: git push origin :[branchName]
This is based on refspecs - doco for which is can be found here:
http://progit.org/book/ch9-5.html
Basically this is saying push an empty reference to [branchName] on the remote system. That has the effect of deleting it.
Wednesday, 27 April 2011
Windows Memory Settings - Know When RAM Or Page File Is The Bottleneck
From http://support.microsoft.com/kb/2267427
Monitoring RAM and Virtual Memory usage
Performance Monitor is the principle tool for monitoring system performance and identifying what the bottleneck really is. To start Performance Monitor, open Control Panel, clickPerformance Information and Tools, click Advanced Tools, and then click Open Performance Monitor.
The following is a summary of some important counters and what they tell you.
Memory, Committed Bytes: This is a measure of the demand for virtual memory. It shows how many bytes have been allocated by processes and to which the operating system has committed a RAM page frame or a page slot in the pagefile (or both). As Committed Bytes grows above the available RAM, paging increases, and the amount of the pagefile in use also increases. At some point, paging activity starts to significantly affect perceived performance.
Process, Working Set, _Total: This is a measure of the amount of virtual memory in "active" use. It shows how much RAM is required so that the actively used virtual memory for all processes is in RAM. This is always a multiple of 4,096, which is the page size used in Windows. As demand for virtual memory increases above the available RAM, the operating system adjusts the size of virtual memory in the Working Set for a process to optimize the use of available RAM and to minimize paging.
Paging File, %pagefile in use: This is a measure of how much of the pagefile is actually being used. This is the counter you should use to determine whether the pagefile is an appropriate size. If this counter reaches 100, the pagefile is completely full and operations stop working. Depending on the volatility of your workload, you probably want to set the pagefile large enough so that no more than 50 to 75 percent of it is used. If a large part of the pagefile is in use, having more than one pagefile on different physical disks may improve performance.
Memory, Pages/Sec: This is one of the most misunderstood measures. A high value for this counter does not necessarily indicatey that your performance bottleneck is a shortage of RAM. The operating system uses the paging system for purposes other than for swapping pages due to memory over-commitment.
Memory, Pages Output/Sec: This shows how many virtual memory pages were written to the pagefile to free RAM page frames for other purposes each second. This is the best counter to monitor if you suspect that paging is your performance bottleneck. Even if the Committed Bytes value is greater than the installed RAM, a Pages Output/sec value that is low or zero most of the time indicates that there is not a significant performance problem that is caused by not enough RAM.
Memory, Cache Bytes
Memory, Pool Nonpaged Bytes
Memory, Pool Paged Bytes
Memory, System Code Total Bytes
Memory, System Driver Total Bytes
The sum of these counters is a measure of how much of the 2 GB of the shared part of the 4 GB virtual address space is actually in use. Use these counters to determine whether your system is reaching one of the architectural limits discussed above.
Memory, Available MBytes: This measures how much RAM is available to satisfy demands for virtual memory (either new allocations, or for restoring a page from the pagefile). When RAM is in short supply (for example, Committed Bytes is greater than installed RAM), the operating system tries to keep a certain fraction of installed RAM available for immediate use by copying virtual memory pages that are not in active use to the pagefile. For this reason, this counter will not reach zero. Therefore, it is not necessarily a good indication of whether your system is short of RAM.
Monitoring RAM and Virtual Memory usage
Performance Monitor is the principle tool for monitoring system performance and identifying what the bottleneck really is. To start Performance Monitor, open Control Panel, clickPerformance Information and Tools, click Advanced Tools, and then click Open Performance Monitor.
The following is a summary of some important counters and what they tell you.
Memory, Committed Bytes: This is a measure of the demand for virtual memory. It shows how many bytes have been allocated by processes and to which the operating system has committed a RAM page frame or a page slot in the pagefile (or both). As Committed Bytes grows above the available RAM, paging increases, and the amount of the pagefile in use also increases. At some point, paging activity starts to significantly affect perceived performance.
Process, Working Set, _Total: This is a measure of the amount of virtual memory in "active" use. It shows how much RAM is required so that the actively used virtual memory for all processes is in RAM. This is always a multiple of 4,096, which is the page size used in Windows. As demand for virtual memory increases above the available RAM, the operating system adjusts the size of virtual memory in the Working Set for a process to optimize the use of available RAM and to minimize paging.
Paging File, %pagefile in use: This is a measure of how much of the pagefile is actually being used. This is the counter you should use to determine whether the pagefile is an appropriate size. If this counter reaches 100, the pagefile is completely full and operations stop working. Depending on the volatility of your workload, you probably want to set the pagefile large enough so that no more than 50 to 75 percent of it is used. If a large part of the pagefile is in use, having more than one pagefile on different physical disks may improve performance.
Memory, Pages/Sec: This is one of the most misunderstood measures. A high value for this counter does not necessarily indicatey that your performance bottleneck is a shortage of RAM. The operating system uses the paging system for purposes other than for swapping pages due to memory over-commitment.
Memory, Pages Output/Sec: This shows how many virtual memory pages were written to the pagefile to free RAM page frames for other purposes each second. This is the best counter to monitor if you suspect that paging is your performance bottleneck. Even if the Committed Bytes value is greater than the installed RAM, a Pages Output/sec value that is low or zero most of the time indicates that there is not a significant performance problem that is caused by not enough RAM.
Memory, Cache Bytes
Memory, Pool Nonpaged Bytes
Memory, Pool Paged Bytes
Memory, System Code Total Bytes
Memory, System Driver Total Bytes
The sum of these counters is a measure of how much of the 2 GB of the shared part of the 4 GB virtual address space is actually in use. Use these counters to determine whether your system is reaching one of the architectural limits discussed above.
Memory, Available MBytes: This measures how much RAM is available to satisfy demands for virtual memory (either new allocations, or for restoring a page from the pagefile). When RAM is in short supply (for example, Committed Bytes is greater than installed RAM), the operating system tries to keep a certain fraction of installed RAM available for immediate use by copying virtual memory pages that are not in active use to the pagefile. For this reason, this counter will not reach zero. Therefore, it is not necessarily a good indication of whether your system is short of RAM.
Friday, 25 March 2011
Sunday, 13 March 2011
Apoache Ab For Performace Tests
http://httpd.apache.org/docs/2.0/programs/ab.html
common script:
ab -c 50 -n 1000 -e "grails_list_test.csv" http://localhost:8080/benchmark/book/inzsertData?rows=100
common script:
ab -c 50 -n 1000 -e "grails_list_test.csv" http://localhost:8080/benchmark/book/inzsertData?rows=100
Enabling JConsole JMX Remote Monitoring of Tomcat
1) Make sure your CATALINA_HOME environment variable is set to the home directory of your catalina installation
2) Create a file runCatalina.bat somewhere hat looks like:
@startlocal
SET JAVA_OPTS= -Dcom.sun.management.jmxremote
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8086
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
SET JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=256m -XX:MaxPermSize=256m
SET JAVA_OPTS=%JAVA_OPTS% -server -Xms1024m -Xmx1024m
%CATALINA_HOME%\bin\catalina run
endlocal
3) If running Vista check this out, and apply the bugfix:
http://marxsoftware.blogspot.com/2008/01/making-jps-and-jconsole-work-with-java.html
I.e. need to make sure that "Everybody" has appropriate permission on the folder that JConsole uses
4) Run Catalina
5) Run jconsole (in your %JAVA_HOME%\bin directory).
6) Connect to the tomcat instancer remotely using hostname and 8086 (as defined above)
Instructions on what JConsole output means:
http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/p1.html
2) Create a file runCatalina.bat somewhere hat looks like:
@startlocal
SET JAVA_OPTS= -Dcom.sun.management.jmxremote
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8086
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
SET JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
SET JAVA_OPTS=%JAVA_OPTS% -XX:PermSize=256m -XX:MaxPermSize=256m
SET JAVA_OPTS=%JAVA_OPTS% -server -Xms1024m -Xmx1024m
%CATALINA_HOME%\bin\catalina run
endlocal
3) If running Vista check this out, and apply the bugfix:
http://marxsoftware.blogspot.com/2008/01/making-jps-and-jconsole-work-with-java.html
I.e. need to make sure that "Everybody" has appropriate permission on the folder that JConsole uses
4) Run Catalina
5) Run jconsole (in your %JAVA_HOME%\bin directory).
6) Connect to the tomcat instancer remotely using hostname and 8086 (as defined above)
Instructions on what JConsole output means:
http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/p1.html
WSUS and Group Policy
To force client to windows update via WSUS server
wuauclt /detectnow
To force group policy to be applied
wpupdate /force
wuauclt /detectnow
To force group policy to be applied
wpupdate /force
Word Useful
1) Alt f9 to toggle field codes.
2) field codes delimited by {}, but you have to menu Insert Field to get them in.
3) custom doc properties via {DocProperty "custom field name"}.
4) Margin height determines where the distinct part of the document starts and ends. This fixes header and footer height. Header and Footer determines how far from the edge of the document the header and the footer start.
5) For borders, you can set a point setting to change the distance between a border a and the text in the box
2) field codes delimited by {}, but you have to menu Insert Field to get them in.
3) custom doc properties via {DocProperty "custom field name"}.
4) Margin height determines where the distinct part of the document starts and ends. This fixes header and footer height. Header and Footer determines how far from the edge of the document the header and the footer start.
5) For borders, you can set a point setting to change the distance between a border a and the text in the box
Thursday, 16 December 2010
Things To Check Out
Things to check out:
Reverse AJax for scalable AJAX
Spring Integration
Jabber
JSON
GDoc
Canoo ULC
Gradle
Geb
Gaelyic
Monday, 8 November 2010
Smalltalk Useful
Smalltalk Start Settings
http://www.instantiations.com/docs/FAQ/wwhelp/wwhimpl/js/html/wwhelp.htm#href=va03001.html
[abt.exe] -sp:blparams.in -i icxFile -mo128000000 -mn2000000 -mf16000000 -ml80000000 -mi8000000
This option sets the size of the largest old space to XXXX bytes. The default is the size of the old space in the image when it was saved. In a newly packaged image, the default size is the actual byte size required by the image.
Tuesday, 12 October 2010
Monday, 27 September 2010
Useful GUI Mock Up Tools
Pretty cheap and ubiquitous
Also has hooks to confluence and jira - very good.
Free open source
Somore more good ones for jira / Confluence - diagrams in jira/confluence
Saturday, 25 September 2010
Grails & Cobertura Bug
Grails & Cobertura - Cobertura does not cover all classes even though there are tests
Found this by accident. It seems like uncompiled classes that are referenced in a Plugin.groovy script are not poperly instrumented when grails test-app --coverage is run.
However if you do "grails compile" then "grails test-app --coverage" everything then works
Wierd but useful to remember!
Wednesday, 9 June 2010
Useful Tools & Sites
SoapUI - www.soapui.org
Well handy for testing web services. Can import a WDSL and create a test suite.
Burp Suite
Java based proxy for HTTP(S) see what is being sent to a remote localation, manipulate it etc
WireShark
General Network Sniffing Tool - Handy when you aren't sure why a TCP connection is dropping
xSQL
Excellent tool for comparing 2 databases (SQL Server) to document schema differences
Hudson
Continuous Integration
http://www.javapractices.com
http://www.hibernate.org - ORM Mapping
http://www.springframework.org - IOC Server
http://www.quickserver.org/ - Multithreaded network apps
http://maven.apache.org - project building
http://www.theserverside.com - good j2ee site
http://www.postgres.org - Opensource multiversioning database. now supports windows
http://www.h2database.com/ Java based DB
http://www.myeclipse.org
http://www.jdocs.org
http://www.javalobby.org
http://cargo.codehaus.org - Container wrapper api. makes it easier to start stop etc containers from ant
http://www.javapractices.com
http://www.hibernate.org - ORM Mapping
http://www.springframework.org - IOC Server
http://www.quickserver.org/ - Multithreaded network apps
http://maven.apache.org - project building
http://www.theserverside.com - good j2ee site
http://www.postgres.org - Opensource multiversioning database. now supports windows
http://www.h2database.com/ Java based DB
http://www.myeclipse.org
http://www.jdocs.org
http://www.javalobby.org
http://cargo.codehaus.org - Container wrapper api. makes it easier to start stop etc containers from ant
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/
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)
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
---------------------------------------------------------------------
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:
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.
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) Install 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
To connect to an MQ Series server
1) Install 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
Wednesday, 22 October 2008
I'm fed up with keeping my life organised in multiple different places and machines. I kinda like using delicious for bookmarks, but mostly having added a bookmark I rarely go back to it.
So I thought i'd try moving my musings onto a blog as well.
I've never really been the sort to write a diary. So not sure how long this will last. Last time I tried I posted one message in 2004, and then didn't go back, so I'm not holding my breath at this point. Still we'll see...
Now all I have to do is trawl through all my archived stuff, decide what is interesting and what isn't and go from there....
So I thought i'd try moving my musings onto a blog as well.
I've never really been the sort to write a diary. So not sure how long this will last. Last time I tried I posted one message in 2004, and then didn't go back, so I'm not holding my breath at this point. Still we'll see...
Now all I have to do is trawl through all my archived stuff, decide what is interesting and what isn't and go from there....
Subscribe to:
Posts (Atom)