Wednesday, August 22, 2012

ODL vs IDL

Copied for longevity

(from the great Igor Tandetnik):

The difference is not between ODL and IDL - you can change the file
extension to .idl and it will behave exactly the same way. The
difference is in the file structure.

The way MIDL compiler works, .h file is generated based on the
declarations _outside_ the library block. TLB is generated based on the
declarations inside the library block. The usual approach is to defined
all the interfaces (and structs and enums) outside the library block,
then mention them inside (usually as part of coclass statement). This
way, you would get them both in the header file and in TLB.

Your ODL file, I bet, defines everything inside a library block.

(from the great Alexander Nickolov):

If you deselect ODL mode for your MFC project, you must also
rename it with IDL extension since it's no longer an ODL file.
ODL = Object Description Language - only describes type libraries
IDL = Interface Definition Language - describes both interfaces and
type libraries (contains ODL as a subset).

Historically, initially IDL coudn't be used for type libraries, so
Microsoft invented ODL. Later they joined the two languages
under the IDL name. IDL itself is inherited from OSF DCE RPC
spec and extended to support COM interfaces. It does contain
the original IDL as a subset - you can still use it to define RPC
interfaces (e.g. don't specify [object] for the interface).

Wednesday, August 08, 2012

Catching HTTP 401/403 using Java SWT IE Browser

I've been working on a bit of Java code which needs to handle an HTTP proxy authentication failure, the code in question uses IE via the SWT browser and unfortunately I've discovered that you cannot chain onto the NavigateError event!

The event is handled inside IE.java (SWT source) but just does some specialised UNC handling without giving you the opportunity to do something useful (like catch the HTTP status code). As such I've had to restort to using an additional connection using HttpURLConnection and Authenticator.setDefault() / getPasswordAuthentication() - which is wasteful as I'm now having to make two connections to the webserver...

It's not even as if you can derive a new class from org.eclipse.swt.browser.IE because the required member variables have default visibility which means anything outside the org.eclipse.swt.browser package can't access them :(

Wednesday, May 30, 2012

a useful reminder for converting wide strings to narrow (ATL)

LPCSTR pszNarrow = NULL;
USES_CONVERSION;

pszNarrow = W2CA(pszWide);

Tuesday, March 20, 2012

howto pause for a finite number of seconds in a dos batch file

You can leverage the choice command for pausing for <x> number of seconds:
choice /D y /T 1 >NUL
(substituting the '1')

Tuesday, March 13, 2012

Tortoise SVN password decryption

Need to retrieve the locally stored encrypted password that Tortoise SVN stores for each of your repositories?

http://www.leapbeyond.com/ric/TSvnPD/

Saved my bacon today :)

Friday, February 24, 2012

User profile migration XP/Vista/Windows 7

My client was recently taken over by another company and as such all of the network infastructure was migrated over to a new Active Directory domain. As ever the instructions provided the "IT team" fell miserably short of what was required for a smooth transition. Namely, they offered no way of migrating your user profile, so our old AD accounts were disabled and then we had to login to our new accounts and face a blank profile (i.e registry / software nightmares as well as any customisations you may of had / etc.) - so I went Googling' and came across this:

http://www.forensit.com/domain-migration.html - User Profile Wizard by ForensiT.

Worked flawlessly first time and it's free. Very nice product and highly reccomended.

Thursday, January 26, 2012

Debug release mode crash

Useful information on debugging problems in release builds when all your customer has is an instruction pointer address as the error.

Gives detailed information on best practices for generating the MAP file and then using this to determine which line number and source file is causing the exception / APPCRASH / issue.

http://www.codeproject.com/Articles/3472/Finding-crash-information-using-the-MAP-file

Wednesday, January 25, 2012

Bluetooth via the command line

Need to manipulate Windows bluetooth via the command line?

Bluetooth command line tools:
http://bluetoothinstaller.com/bluetooth-command-line-tools/