2008-09-14

IBC

Today I've visited IBC in Amsterdam. I must say that it was impressive. I have failed to cover everything in just six hours. Somehow I've missed the Fluendo booth, but had a short talk with a guy from BBC's Dirac booth.

Next year I plan to visit more. No pictures at the moment, hopefully I can get some from one of my colleagues.

Edit: And the promised picture is here:



ADAM - Professional Audio (Ogg that is :)

2008-08-20

First CodeProject Article!

My first CodeProject Article - regsvr42: Generate SxS Manifest Files from Native DLLs for Registration-Free COM. It was really fun to write, not to mention very useful. I wish I had this tool a few years ago, when I was hunting after COM interfaces into COM components.

Don't forget to logon CodeProject and give a high mark! :-)

2008-08-15

Boost 1.36.0

Boost 1.36.0 has been released and is available from SourceForge.

This release include four new libraries:
  • Accumulators: Framework for incremental calculation, and collection of statistical accumulators, from Eric Niebler.
  • Exception: A library for transporting of arbitrary data in exception objects, and transporting of exceptions between threads, from Emil Dotchevski.
  • Units: Zero-overhead dimensional analysis and unit/quantity manipulation and conversion, from Matthias Schabel and Steven Watanabe
  • Unordered: Unordered associative containers, from Daniel James.
Updated libraries include Asio, Assign, Function, Hash, Interprocess, Intrusive, Math, MPI, Multi-index Containers, PtrContainer, Spirit, Thread, Wave, and Xpressive.

On the same note Microsoft released the first Service Pack for Visual Studio 2008. C++ gets TR1 (shared_ptr, regex and more!) and new MFC face lift classes.

2008-08-14

Visual C++ 2008 Keybinding Reference Poster

One thing I haven't studied since my first encounter with Visual Studio, and back then I haven't had such a nice pdf, is the Visual C++ Keybinding.

Microsoft has nicely made this available for Visual C++ 2008!

I did not know that CTRL+SHIFT+INS is the keymapping for Edit.CycleClipboardRing, I always used Visual Assist's CTRL+SHIFT+V functionality - a menu, not some selected text which you can cycle through. This functionality can come in handy when you don't have access to Visual Assist, either by being stranded in C# land where the landlord is named Resharper or by using the Express (no addons) edition.

Don't forget to print the "Poster", you! might learn something new about Visual C++ Keybinding.

Note: Usually I'm OK with the default Visual C++ keybinding, but since Visual C++ 2003 they've changed the F7 keybinding from "Build Project" to "Build Solution". Visual C++ 2008 has F7 or CTRL+SHIFT+B mapped to "Build Solution". I've customized F7 to Build.BuildSelection (works somehow better than Build.BuildOnlyProject)

2008-06-22

Windows XP Manifest File Maker

Windows XP has introduced a new theming API. You can make your applications to use this new theming API by the use of a .manifest file. This manifest file can sit alongside your application or in your applications resource part.

Here is a batch file which creates such a manifest file:

@echo off

rem (c) 2008 Cristian Adam

if [%1] == [] (

echo Usage: make_manifest file.exe

) else (

if exist %1.manifest goto :EOF

echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes" ?^> >> %1.manifest
echo ^<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"^> >> %1.manifest
echo ^<description^>Windows Forms Common Control manifest^</description^> >> %1.manifest
echo ^<dependency^> >> %1.manifest
echo ^<dependentAssembly^> >> %1.manifest
echo ^<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" /^> >> %1.manifest
echo ^</dependentAssembly^> >> %1.manifest
echo ^</dependency^> >> %1.manifest
echo ^</assembly^> >> %1.manifest

)


And now a screenshot to show the before and after state:

2008-06-15

First release of oggcodecs

I've released my first release of oggcodecs:

Current UNSTABLE Version (0.80.15039) - 14.06.2008
Changes this version

* Support for Microsoft Windows Vista
* Updated compiler to Visual Studio 2008 Express, which drops support for Windows 9x, NT 4.
* Updated libspeex to version 1.2 beta 1
* Updated libvorbis to version 1.2.1 (20080501)
* Updated libogg to version 1.1.3
* Updated libtheora to version 1.0beta3 (20080416)
* Updated libFLAC to version 1.2.1
* Fixed crash at the end of incomplete Theora files.

2008-06-12

Google Translate Learned Romanian

I found out recently that Google translate knows how to translate from Romanian to English and from English to Romanian.

I've used Goosh - Google Shell - to translate a quote from a previous post:

guest@goosh.org:/web> translate en ro This is a great victory for the glorious people of Romania!
translating "This is a great victory for the glorious people of Romania!" from "english" to "romanian":

"Aceasta este o mare victorie pentru oamenii de glorie a Romaniei!"


It's pretty good, with time it will become better :-)

2008-06-11

Why Microsoft? Why?!

Take the cab file format. It's present on every windows from Windows 95. If you use the LZW compression algorithm you get small archives.
986.875 oggcodecs.7z
1.150.890 oggcodecs.cab
1.618.917 oggcodecs.zip

It's better than zip and a bit worse as 7-zip.

The problem with cab file format it's that it's hard to use it in command line.

For example here is what you need to code to compress one directory into a cab file:
for %%i in (oggcodecs\*.*) do echo "%cd%\%%i" >> files.ddf
makecab /L . /D CompresionMemory=21 /D CompressionType=LZX /D DestinationDir=oggcodecs /F files.ddf
del files.ddf
move disk1\1.cab oggcodecs.cab
rmdir disk1
del setup.inf
del setup.rpt

Pretty hard core. One might say that this is not a tool to be used from a command line as rar or other popular archiving programs. This is done only once by me in a script file, so I can live with it.

The problem is with the extraction method. I have created a folder inside that cab file, which I can see with Total Commander, 7-zip File Manager etc, but with Windows Explorer I see directly the files, without the directory. There is one command line program which handles cab archives - expand.exe. Expand.exe doesn't know about directories in cab files, there is no switch to instruct him to preserve the directory structure from the cab file.

Why Microsoft? Why?

The solution is simple, create the destination folder first, d'oh!

mkdir oggcodecs
expand oggcodecs.cab -F:* oggcodecs\

Why not use 7-zip and ignore all this trouble? A cab file I can digitally sign and you can see it's coming from me and you don't need a 3rd party program to unpack!

2008-06-10

Why Microsoft? Why?!

I haven't mentioned here that I lost my fate in Microsoft that they can deliver good development tools a long time ago, I guess that was when I saw Visual Studio .NET 2002 for the first time. The .NET age fuc*ed it up real good.

At work I have Visual Studio 2003 and 2005 installed on D drive. Now I had to install Visual Studio 2008 on my system. I choose D drive, I verify every component that it should install on D drive and click Next, Next... Finish.

To my surprise the C++ component (VC directory) was installed on C drive, I said to myself... hmm, maybe I've forgot to install it on D, but it was working and I've ignored the issue.

The problem was when I've tried to compile something from the console. I've opened a console, setup the environment variables "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" and then hit nmake.

It complained that it could not find rc.exe, WTF. Then I found out that rc.exe is part of the Microsoft SDK which was on D (D:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\). When I try to setup the environment variables for Microsoft SDK ("d:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd" ) it complains that it can not find a compiler...

So now I'm installing everything on C drive, because for Microsoft, C++ should stay on C drive.

Edit: It works now (everything is on drive D), I've uninstalled all the programs that had a connection with Visual Studio 2008. If at first you don't succeed then try again, and again, and again.

2008-06-07

Authenticode

By using code signing with a certificate provided by Certum I was able to change how the oggcodecs installer looks on Windows Vista from this:



to this:



The name of the installer looks different, but my name is displayed under :)

Maintainer for Directshow Filters for Ogg Vorbis, Speex, Theora and FLAC

I probably should have blogged sooner, but here it is: I'm the current maintainer for Directshow Filters for Ogg Vorbis, Speex, Theora and FLAC.

If you want a hardware Ogg Player you should consider buying a Trekstor Samsung (most of their MP3 players support Ogg Vorbis and FLAC formats) product!

2008-05-31

New beta version of Y!M 9

Yahoo Messesnger 9.0 has reached version 9.0.0.1389. This version fixes the long standing bug with Romanian „ă” character inserted with AltGr-A which was interpreted as Ctrl-Alt-A.

This is a great victory for the glorious people of Romania!

2008-04-29

Pimpin' Windows XP's cmd.exe

I like the command line interface, not because I own a Das Keyboard and I'm forced to look at the screen, but because I like to type.

Windows XP's cmd.exe was not one of my favorite consoles, it lacked configurability, especially in the font area. You have only two options when it comes fonts: raster fonts and "Lucida Console".

I grew accustomed with "DejaVu Sans Mono" font from my Linux days and since then when I think about a monospaced font I think of "DejaVu Sans Mono".

One option is to use an alternative console, but I found out that it's not as fast as cmd.exe.

The solution is to replace "Lucida Console" with "DejaVu Sans Mono"! Just fire you your favourite font editor and do the required changes, then install the new "Lucida Console" and that's it.

Here is a screenshot with my pimped cmd.exe



In the meantime I've found an easier way of changing the console font, read more about it here

2008-03-09

Limba noastră-i o comoară

This post is intended to the Romanian audience.

Astăzi am dat peste ceva la care nu m-am gândit niciodată, să traduc în limba română cuvintele cheie din C/C++.

Soluţia este simplă, se foloseşte preprocesorul, iată un exemplu:


#include <cstdio>
#include "romanian.h"

folosim spatiunume::std;

int principal()
{
    scrie("Salutare Lume!\n");
}


Arată foarte interesant. Am văzut acest lucru la semnătura lui Marian Dragomir, iar fişiereul "romanian.h" arată astfel:



#ifndef ROMANIAN_H
#define ROMANIAN_H

#define asm asm
#define auto auto
#define pausa break
#define caz case
#define cara char
#define const const
#define continua continue
#define predefinit default
#define fa do
#define dublu double
#define altfel else
#define enum enum
#define extern extern
#define flotador float
#define pentru for
#define dutela goto
#define daca if
#define expandeaza inline
#define int int
#define lung long
#define registru register
#define restrict restrict
#define intoarce return
#define mic short
#define semnat signed
#define marimede sizeof
#define static static
#define structura struct
#define comuta switch
#define definestetip typedef
#define tipde typeof
#define uniune union
#define farasemn unsigned
#define vid void
#define inflamabil volatile
#define atitcit while
/* definitii pentru C++ */
#define bool bool
#define prinde catch
#define clasa class
#define mold_const const_cast
#define sterge delete
#define mold_dinamic dynamic_cast
#define explicit explicit
#define export export
#define fals false
#define prieten friend
#define mutabil mutable
#define spatiunume namespace
#define nou new
#define operator operator
#define privat private
#define protejat protected
#define public public
#define mold_reinterpreteaza
#define molda_static static_cast
#define sablon template
#define acesta this
#define arunca throw
#define adevarat true
#define intentioneaza try
#define numetip typename
#define idtip typeid
#define folosim using
#define virtual virtual
#define lchar_t wchar_t

/* definitii de functii comune */
#define principal main
#define scrie printf

#endif


Spor la scris „poezii”! ;-)

2007-11-24

Windows Time Sync

Sometimes you need to know if your computer has the correct time, what do you do to ensure that?

On Windows XP you double click on the clock in the right corner of your screen select "Internet Time" and click "Update Now". All the times I did this I got an error. Windows has only two entries in that combobox, and both return errors, why?!

Today I have gone a step further I googled for more Internet Time Servers, on this page I've found plenty. For example Germany has 214 servers in a time server pool (de.pool.ntp.org).

It was about time ;-)

2007-11-10

New Updates to MFC in Visual Studio 2008

Here is an half an hour interview with Pat Brenner on the topic "New Updates to MFC in Visual Studio 2008".

A very informative movie, my favorite quote is "we kinda moved out from the '90s"!

And a quick summary:

What's new for MFC developers:
  • Ribbon

  • Customisable Menubar / Toolbar

  • Visual Studio 2005 like Docking

  • Tabbed MDI

  • New status bar

  • and many more



  • You can get a full visual tour on what's new on the Visual C blog entry.

    Here is a screenshot of MFC demo made by the Wizard:




    All this functionality is available now from 3rd party vendors, but this will be backed by Microsoft. Impressive!

    Edit MFC Update powered by BCGSoft as you can read here.

    Y!M 9.0 Without Ads

    One way to disable the ads from the main window of Yahoo Messenger 9.0 is to cut access to one specific file. With this version it doesn't work any more the trick of clearing the file and making it read only.

    If you have installed Y!M on a NTFS file system you are lucky, you can remove the Read security attribute and the ads are gone (at least until they fix this too).

    Here is the code to remove the access to the file from the command line, or batch file:
    cacls "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"  /E /P %USERNAME%:N


    If you want to bring the ads back because they were adding color to your contact list here is the command line to do just that:
    cacls "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml"  /E /P %USERNAME%:F


    I hope they won't read this blog and fix the hole until the final version 9.0 gets out next year ;-)

    Edit: by upgrading to version 9.0.0.907 I found out that removing reading rights from the file was not enough, you need to fiddle with the Windows Registry e bit. Here is a batch file that does it for you:

    @ECHO OFF
    TITLE Remove ads from Yahoo Messenger 9

    > %TEMP%.\noYMads.reg ECHO REGEDIT4
    >>%TEMP%.\noYMads.reg ECHO.
    >>%TEMP%.\noYMads.reg ECHO [HKEY_CURRENT_USER\Software\Yahoo\Pager\YUrl]
    >>%TEMP%.\noYMads.reg ECHO "First Login Beacon"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Change Room Banner"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Finance Disclaimer"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Messenger Ad"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Chat Adurl"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Calendar Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Conf Adurl"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Mail Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "News Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Personals Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Stock Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Medium"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Big"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Webcam Upload Ad"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Chat Transition Ad"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "N2Phone Adurl"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Webcam Viewer Ad Bid"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "IMVironment Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Auction Alert Ad URL"="noads.html"
    >>%TEMP%.\noYMads.reg ECHO "Login Mobile Ad"="noads.html"
    REGEDIT /S %TEMP%.\noYMads.reg
    DEL %TEMP%.\noYMads.reg

    cacls "%PROGRAMFILES%\Yahoo!\Messenger\Cache\urls.xml" /E /P %USERNAME%:N

    2007-11-09

    Yahoo Keyboard Patch!

    Yahoo! Messenger had a very annoying problem, text selection with Ctrl-A was done when it shouldn't be done.

    For example Windows maps AltGr key to Ctrl-Alt keys combination, which is default behaviour. Yahoo! Messenger treats AltGr-A as Ctrl-Alt-A but then it gets the Ctrl-A part, whole text selection, and afterwards it goes to normal keyboard handling, which with a certain Romanian keyboard layout generates the character "ă", but because the text was selected before, "ă" was the only character left in the sentence you wrote.

    This was very annoying, but then by using the wonderful Microsoft technology called Detours I was able to intercept certain WIN32 API Messages and prevent the text selection from happening. Yahoo! keyboard patch was created.

    Cristian Secară was very nice to host this patch on his webserver, also he made some very good suggestions which improved whole the quality of the software.

    The patch is available at this location (Romanian language only).

    Note: this patch also works with other keyboard layouts, for example the Hungarian default keyboard layout can be used to generate the character "ä" now.

    2007-10-29

    To C or Not to C

    Today I was a bit puzzled by this code (test.c):

    #include <stdio.h>

    int main()
    {
        int i = ceil(2.9f);
        printf("i is: %d\n", i);
    }

    I had compiled the code using the command cl test.c, clean compile no warnings, no messages, after running the program the result was: i is: 1024. WTF?!

    The proper compile command cl /W4 test.c returned this:

    test.c(5) : warning C4013: 'ceil' undefined; assuming extern returning int

    C assumes a bit too much.

    Next time I want to try a code snippet I won't use the .c extension, I'll use .cc, one character makes a big difference:

    test.cc(5) : error C3861: 'ceil': identifier not found


    D'oh, I forgot to #include <math.h>!