Show PDF-Documents in a C# WPF Application

The easiest way to do this is to display the Adobe Reader Browser Plugin. This can be done with a UserControl which can be hosted in a WindowsFormsHost control in a WPF Form. You require a reference to the dlls AxInterop.AcroPDFLib.dll and Interop.AcroPDFLib.dll which you can find in the Reader SDK on the Adobe Developer Homepage. The code for a UserControl is shown below:

PDFControl.Designer.cs:

C# Automating Exel - Document not saved error

If you try to automate Microsoft Excel in the background with a C# Application (Microsoft.Office.Interop.Excel) after processing some documents sometimes an error "Document not saved" pops up. If you do not wish to save the document you can supress the message like this:

var excelApp = new Microsoft.Office.Interop.Excel.Application(); 
excelApp.DisplayAlerts = false;

 

C# Convert Excel, Word- and PowerPoint-Documents to XPS

You can easily automate the office apps to convert office documents to the XPS-Format. With Microsoft Word you can as well convert RTF, HTML and TXT Documents to the XPS Format.

You need to reference the following Assemblies:

- Microsoft.Office.Interop.Excel

- Microsoft.Office.Interop.PowerPoint

- Microsoft.Office.Interop.Word

- Office

 

Access MS Exchange with Java

MySQL Server 5.5 Logging on Windows 7

First you need to find out which settings file is active. Usually you can find it under C:\ProgramData\MySQL\MySQL Server 5.5\my.ini. Then you need to add the output configuration. Be careful to use the right syntax for the path. Below [mysqld] you can add something like:

log-output=FILE 
general_log = 1 
general_log_file = "C:/mysql-queries.log"

After you restart the service your queries will be logged. If it doesn't work you can consult the Errorfile (C:\ProgramData\MySQL\MySQL Server 5.5\data\computername.err)

 

Tags:

Tika parseToString returns empty string when calling with a word-document

If you get an empty string from the parseToString method (and you don't get an exception) it is usually the lack of the tika-parsers-0.9.jar file.

As soon as you add it (including it's dependencies poi-3.7, poi-ooxml-3.7, poi-ooxml-schmeas-3.7, dom4j-1.6.1, geronimo-stax-api_1.0, xmlbeans-2.3, poi-scratchpad and commons-compress) to the classpath you will get the text.

Tags:

Linux add native resolution for external monitor

First you need to check the list of supported modes. When running the command

xrandr -q

it shows me (for my netbook with external monitor) two displays: LVDS1 and VGA1. VGA1 is the external monitor but xrandr doesn't recognize it's native resolution.

We can generate the mode we want to add with the following command:

cvt 1680 1050

The output should be Modeline and then some text. We create the new mode with the following command:

Tags:

Gnome 3 Tricks

remove elements from panels in fallback mode

Just hold the alt key while doing a right click on the element. This will show you the Remove from Panel option.

Nautilus Exit Fullscreen Mode

Just press Alt + F7 and move you mouse. This will reset the window to the normalized state

Tags:

GCC undefined reference to `vtable for ...'

Quite annoying one because it's hard to guess what the error really is. Usually you forgot to link one of the object files, didn't implement a pure virtual method in the derived class or forgot to implement the virtual Destructor.

Drupal and SVN Repository conflicts

If you happen to maintain your webpage with Drupal and also host a SVN-Repository on the very same host you can run into trouble. Just try to commit a file starting with a period (for example a project file from eclipse: .project). It will give you an error "access denied for unknown reason". The solution is quite simple. There is a rule in the .htaccess file from Drupal which denies access to files starting with a period. You can either delete this rule or restrict it to only apply for the drupal part of the page.

Pages

Subscribe to uhlme.ch RSS