We always create separate assemblies so that we can reuse some of the classes, and declare the classes as public so that can be accessed by other assemblies. However this will allow other people to use the assemblies that we created. To protect our assemblies to be assessed by our owned assemblies only, we can declare the classes as internal and do the following setup:
For the assembly that will access your shared assembly
- Use SN utility to create a new key pair and save it in an out put file (key.snk). SN is available in .Net SDK.
sn -k key.snk
- Use your .Net IDE (either Visual Studio or Sharpdevelop) to sign the assembly with the key file (key.snk).
- Compile the assembly.
- Use SECUTIL to extract the strong name information from the assembly (usually in the bin\debug directory in you project folder) in hex string format and save it to a text file (strong.txt). SECUTIL is also available in .Net SDK.
secutil -hex -s application.exe > strong.txt
- Inside the strong name file (strong.txt), you can see a long hex string, copy it (remember to exclude the first 2 character 0x)
For the shared assembly
- Use SN utility to create a another key pair and save it in an out put file (key1.snk).
sn -k key1.snk
- Use your .Net IDE (either Visual Studio or Sharpdevelop) to sign the assembly with the key file (key1.snk).
- Open AssemblyInfo.cs, (or AssemblyInfo.vb, depend on the language that you used)
- Be sure System.Runtime.Compiler.Services is imported:
- Go to last line of the file, add the following line (ProgramName is the name of you referring assembly and hexstring is the hex string that you copied from the strong name file just now)
[assembly: InternalsVisibleTo("ProgramName, PublicKey=hexstring")]
- Compile the assembly.
Now you should able to refer the shared assembly and use the internal classes.
You might not need to install SDK to get SN or SECUTIL, try google around should able to find some download links.
I have recommend Flamerobin as Firebird Management Tool in my earlier post, because it is free and light weighted. Recently I found another tool called EMS SQL Manager for InterBase/Firebird. It is a commercial software which has a free version. The free version does not have an expire date, but it will have a splash screen that halt the program for a while during start up. However I do believe the wait is worth because it has a bunch of features that every developer want.
To use EMS SQL Manager (I download the stand alone version, which no need for installation), you will need Firebird Access Library that within Firebird binary folder. Depend on what type of server you want to connect, for server based Firebird, you need to configure the Manager where fbclient.dll located. And for embedded Firebird, you need to locate where is fbembed.dll.
Other than Firebird, there are tools for other database such as:
- EMS SQL Manager for MySQL
- EMS SQL Manager for MSSQL
- EMS SQL Manager for Oracle
Simple method to configure Tomcat (the version I try is Tomcat 6) so that all HTTP access will redirect to HTTPS.
Edit [TOMCAT_HOME]\webapps\ROOT\WEB-INF\web.xml, add the following codes inside the web-app tag (or just the above of </web-app>).
<web-resource-name>Automatic SSL Forwarding</web-resource-name>
Here are same useful CPIO command samples (assume the tape is /dev/st0):
- To list out the content of the tape:
cpio -tv -F /dev/st0
- To extract the tape to working directory:
cpio -iv -F /dev/st0
- To archive files from working directory to tape:
find . -print | cpio -ov -F /dev/st0
Sometime we might face problem in extracting the tape because wrong block size is used. To check the block size used in a CPIO archived tape catridges, try command below:
dd if=/dev/sto of=/tmp/deleteme ibs=64k count=1
If no error prompts out, it means the tape is archived in 64k. Else try other block size number such as 128k until you find a figure that doesn’t result an error message. The command will create a dummy file called deleteme at /tmp, which can safely be removed. After you know the block size, use command below to list or extract the content of the tape:
cpio -tv --block-size 64 -F /dev/st0
cpio -iv --block-size 64 -F /dev/st0