see sharp RSS 2.0
# Thursday, 07 May 2009
If you need to zip a file or files you can use the java zip utilities supplied with VS.
All you have to do is to add vjslib.dll and vjslibcws.dll .net assemblies as project references.
They are present whe you install Visual J#. It can easily handle multiple files.
 
// ZIP Test
string inputFileName = @"C:\test.txt";
string zipFileName = Path.ChangeExtension(inputFileName, "ZIP"
);
string zipEntryName = Path
.GetFileName(inputFileName);
java.io.
FileOutputStream fileStream = new java.io.FileOutputStream
(zipFileName);
java.util.zip.
ZipOutputStream outputStream = new java.util.zip.ZipOutputStream
(fileStream);
java.io.
FileInputStream inputStream = new java.io.FileInputStream
(inputFileName);
java.util.zip.
ZipEntry zipEntry = new java.util.zip.ZipEntry
(
zipEntryName);
outputStream.putNextEntry(zipEntry);
sbyte[] buffer = new sbyte
[2048];
int
bytes = 0;
while
((bytes = inputStream.read(buffer, 0, buffer.Length)) > 0)
{
   outputStream.write(buffer, 0, bytes);
}
outputStream.closeEntry();
inputStream.close();
outputStream.close();

 
This was a nice try, but J# has been removed from VS2008.
To enable your application for ZIPs use dotnetzip: http://dotnetzip.codeplex.com/.
... or you may want to look at the OPC packaging API at http://msdn.microsoft.com/en-us/library/system.io.packaging.package.aspx
Thursday, 07 May 2009 19:29:30 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
C# | OPC
# Wednesday, 06 May 2009

dasBlog is great, but it uses an older version of the nice freeTextbox to edit the posts.

This little editor provides great enhancments for editing and formatting, and IE8 is known from Version 3.2.0, but thats not the version we are using in dasBlog.
Luckily IE8 has a 'Compatibility View' setting, which defines a list of websites that will receive the old (IE7) user-agent string.

 


Image: Tools->Compatibility View Settings

If you own the website, you can set the compat mode using a meta-tag:

<meta http-equiv="X-UA-Compatible" content="IE=7" />

Wednesday, 06 May 2009 12:38:58 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
anything else
# Sunday, 03 May 2009
So, this weekend I completed the move from simpleBlog to dasBlog, changing technology from PHP (which was good) to ASP.NET which is more suitable.
The content has to be migrated too, which will follow on one of the next weekends.

Sunday, 03 May 2009 10:07:55 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
anything else
# Saturday, 02 May 2009
Coding conventions are for whimps :-)
 
I like that:
It's written for JAVA :-), but it matches other languages like C# too.
 
Brad Adams writes on how to make it better >http://blogs.msdn.com/brada/pages/361363.aspx<
 
Saturday, 02 May 2009 19:26:56 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
anything else
# Thursday, 30 April 2009
Thursday, 30 April 2009 18:40:13 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
anything else
# Wednesday, 29 April 2009
You can increase the logging level of the Certificate service in the event log for troubleshooting.
This causes Certificate services to log more frequent and verbose Application Event log entries.
To increase the logging level of the Certificate service, run the command:

certutil -setreg ca\loglevel logginglevel

where logginglevel is the level you want to use, and then restart the service.

The following ranges are available:

0 CERTLOG_MINIMAL
1 CERTLOG_TERSE
2 CERTLOG_ERROR
3 CERTLOG_WARNING (Default)
4 CERTLOG_VERBOSE

taken from http://support.microsoft.com/kb/305018

and don't forget to restart the certificate services :-)

If you use CLM you may also want to set the loglevel for the Policy and Exit modules:

Policy module
Add a string value named Microsoft.Clm.PolicyModule to the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\CAName\PolicyModules\Clm.Policy
 
Exit module
Add a string value named Microsoft.Clm.ExitModule in the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\CAName\ExitModules\Clm.Exit

Set the string value to the desired logging level (Info, Warning, Error or verbose), and then restart the CLM Service to apply the trace logging settings.

Policy module plugins
If you need logging for the CLM policy module plugins, you must create a config file.
Enabling trace logging for the policy module plug-ins causes CLM 2007 to write the error output to the system debug stream, viewable using DebugView.

To enable trace logging, you must create a config file for certsrv.exe file in the C:\WINDOWS\system32 folder.
Create a new text document and name it certsrv.exe.config;
open the new file and copy/paste the following configuration information (It's standard .NET tracing):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.diagnostics>
  <trace autoflush="true" indentsize="2" />
  <switches>
    <add name="Microsoft.Clm.PolicyModulePlugins" value="4" />
  </switches>
</system.diagnostics>
</configuration>

Wednesday, 29 April 2009 18:48:59 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
CLM | Tracing
# Saturday, 25 April 2009
Saturday, 25 April 2009 19:32:22 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -
anything else | C#
# Wednesday, 22 April 2009
Xpath is always fun when it comes to selecting nodes, but it gets even more fun when you have to select the node by attribute.

Assume this XML:
<test>
    <add key="one" value="two"/>
</test>


We can easily select the whole add node with the attribute 'one' by using this path: 

  /test/add[@key='one'] 

Thats perfectly fine, but now I want the value attribute for that node.
As we have an xpath to the node itself we can use this:

  /test/add[@key='one']/@value  

I always have to look such things up ;-)

A nice compilation of Xpath can be found >here<

Wednesday, 22 April 2009 18:53:44 (Mitteleuropäische Sommerzeit, UTC+02:00)  #    -

# Tuesday, 24 March 2009
To delete a certificate store you created using the .NET API (X509Store) you have to use the P/Invoke version of  CertOpenStore with the CERT_STORE_DELETE flag:

First, import the function:
[DllImport("crypt32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr CertOpenStore(
        IntPtr storeProvider,
        uint dwMsgAndCertEncodingType,
        IntPtr hCryptProv,
        uint dwFlags,
        String cchNameString);


Next define some constants (wincrypt.h is your friend):
const int CERT_STORE_PROV_SYSTEM = 10;
const int CERT_SYSTEM_STORE_CURRENT_USER = 0x1 << 16;
const int CERT_STORE_DELETE_FLAG = 0x10; 


Finally, call the open function:
CertOpenStore(
(IntPtr)CERT_STORE_PROV_SYSTEM,
0,
IntPtr.Zero,
CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_DELETE_FLAG,
storeName);

Tuesday, 24 March 2009 18:21:52 (Mitteleuropäische Zeit, UTC+01:00)  #    -
C# | CAPI | P/INVOKE
# Wednesday, 11 March 2009
If you are developing with RMS you often need to run Office programs in a PreProduction hierarchy.
Many articles have been written on how to set up a PreProduction environment.
A nice article on how to setup Office 2007 in a PreProduction env can be found >here<

I have heard rumors that some customers did not instantly upgrade to the new and shiny Office 2007 and still use the old office 2003, and here is a way on setting it up:

  1. get the PreProduction keys and the genmanifest tool

  2. create a MCF file for the application: You will need the MSO.DLL, OLE32.DLL and of course winword.exe and msdrm.dll:
    AUTO-GUID
    "C:\\projects\\PreProductionKeys\\ISVTier5AppSigningPrivKey.dat"
    
    MODULELIST
        REQ     "%PROGRAMFILES%\\Microsoft Office\\OFFICE11\\winword.exe"
        REQ     "%COMMONPROGRAMFILES%\\Microsoft Shared\\office11\\mso.dll"  
        req NOHASH "%Windowsdir%\\system32\\ole32.dll"  
        opt     "%WINDIR%\\system32\\msdrm.dll"
    
    
    POLICYLIST
        INCLUSION
            PUBLICKEY "C:\\projects\\PreProductionKeys\\ISVTier5AppSigningPubKey.dat"
        EXCLUSION
    (be sure to change the hard-coded path to fit your needs)

  3. create a backup of the XML files in your office installation (located at "%PROGRAMFILES%\\Microsoft Office\\OFFICE11")

  4. run the manifest tool:
    genmanifest -chain "ISVTier5AppSignSDK_Client.xml" WinWord_pre_prod.mcf WRDPRTID.XML

Wednesday, 11 March 2009 18:32:33 (Mitteleuropäische Zeit, UTC+01:00)  #    -
RMS
Archive
<2009 May>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Any link on this site may lead to an external website that is not under my control and that external website might show an opinion that is not mine.

© Copyright 2017
Hannes Köhler
Sign In
Statistics
Total Posts: 39
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2017, Hannes Köhler
DasBlog theme 'Business' created by Christoph De Baene (delarou)