De curând am intrat în posesia unui telefon HTC Leo (zis și HTC HD2), telefon care are ca sistem de operare Windows Mobile 6.5.
Windows Mobile 6.5 nu poate afișa corect diacriticele românești, în special ș și ț cu virgulă. La introdus diacritice de la tastatură HTC HD2/Leo permite introducerea lui â, î, ş și ţ (varianta cu sedilă), dar lipsește ă.
Diacriticele se introduc după ce se ține apăsată tasta a, i, s, respectiv t, după care se aleg din meniul prezentat. În practică mie mi s-a părut destul de greoi să țin apăsată tasta și apoi să aleg din meniu.
Pentru a repara problema afișării diacriticelor am făcut un cab cu fontul Droid, font care este oferit de Google sub o licență care permite redistribuirea liberă. Fontul original Droid duce lipsa lui ț, am folosit o variantă modificată.
Pentru problema introducerii diacriticelor am făcut un cab cu modificări aduse aranjamentului de taste implicit (două fișiere xml, unul pentru modul portret și unul pentru modul peisaj). Diacriticele se introduc direct ținând apăsat tastele a, q, i, s, t.
Numerele și restul de simboluri care se introduceau în mod direct ținând apăsat tastele sunt accesibile din meniu. Am adăugat în mod implicit simbolul € pe tasta f, simbolul $ este accesibil din meniu.
Rezultatul se află în captura de mai jos:
Caburile se află aici: DroidFonts.cab, respectiv htc_leo_keyboard.cab. Ar mai fi de menționat faptul că este necesar un restart al telefonului, că s-ar putea să meargă doar pe HTC Leo și că nu funcționează cu T9.
Edit Am făcut o nouă versiune de htc_leo_keyboard.cab, versiune care nu mai are caracterul "â" și pe tasta "a" (în modul portret nu mai încăpea meniul pe ecran). De asemenea am inversat $ cu € pe tastatura numerică.
Spor la tastat.
2010-09-21
2010-09-02
DirectX Error Lookup
DirectShow is a COM based technology. COM uses for error reporting the (in)famous HRESULTs.
These HRESULTs are numbers like 0x80040227, but what do they mean? Visual Studio has a nifty MFC utility called "Error Lookup". But what happens if you lookup 0x80040227? "Message not found" pops up.
It seems that the DirectShow HRESULTs are out of reach for "Error Lookup". "Error Lookup" has a button named "Modules", maybe we can add the DirectShow HRESULTs there.
After adding "QUARTZ.DLL" in "Error Lookup" module list, 0x80040227 becomes "The operation could not be performed because the filter is in the wrong state." Sometimes the trick of adding quartz.dll doesn't work, then what?
DirectX has some nice error lookup functions named DXGetErrorString and DXGetErrorDescription, which give information about DirectX components and Win32 functions.
I have made a small tool called dxerr (source code here) which makes use of the two functions.
You might be tempted to use these two functions in your programs, but note that these functions might increase your binary with a couple of hundred kilobytes, and you need to have the DirectX SDK installed.
With the use of dxerr 0x80040227 has also a name: VFW_E_WRONG_STATE, which you might have found out by doing a Google search.
Here is a screenshot displaying "Error Lookup" and "dxerr".
After creating the "dxerr" tool I've found out that there is a tool named "DXErr.exe" in the DirectX SDK under "Utilities\bin\x86". I had no idea about that, but now that I know about it, it doesn't make a big difference :)
dxerr can be of use to those who do not have the DirectX SDK installed, to those who program with other programming languages than C++, or to those who program using C++ but with a compiler from a different vendor.
These HRESULTs are numbers like 0x80040227, but what do they mean? Visual Studio has a nifty MFC utility called "Error Lookup". But what happens if you lookup 0x80040227? "Message not found" pops up.
It seems that the DirectShow HRESULTs are out of reach for "Error Lookup". "Error Lookup" has a button named "Modules", maybe we can add the DirectShow HRESULTs there.
After adding "QUARTZ.DLL" in "Error Lookup" module list, 0x80040227 becomes "The operation could not be performed because the filter is in the wrong state." Sometimes the trick of adding quartz.dll doesn't work, then what?
DirectX has some nice error lookup functions named DXGetErrorString and DXGetErrorDescription, which give information about DirectX components and Win32 functions.
I have made a small tool called dxerr (source code here) which makes use of the two functions.
You might be tempted to use these two functions in your programs, but note that these functions might increase your binary with a couple of hundred kilobytes, and you need to have the DirectX SDK installed.
With the use of dxerr 0x80040227 has also a name: VFW_E_WRONG_STATE, which you might have found out by doing a Google search.
Here is a screenshot displaying "Error Lookup" and "dxerr".
After creating the "dxerr" tool I've found out that there is a tool named "DXErr.exe" in the DirectX SDK under "Utilities\bin\x86". I had no idea about that, but now that I know about it, it doesn't make a big difference :)
dxerr can be of use to those who do not have the DirectX SDK installed, to those who program with other programming languages than C++, or to those who program using C++ but with a compiler from a different vendor.
2010-08-04
OpenCodecs, WebM, and Windows Mobile
Over a month ago I have released the first version of OpenCodecs. OpenCodecs is the new name of the OggCodecs DirectShow package after the addition of WebM codecs.
OpenCodecs was the first release to have an unified 32/64 bit installer package, the 64 bit components are installed only if the operating system is 64 bit.
Today I have released a new OpenCodecs version, one for Windows Mobile 5.0 - 6.5. This is only a decoder package and WebM/VP8 decoders are not present.
Seeking is also disabled for Ogg Vorbis, Theora and Speex, due to the way the seeking table is build (at beginning, reading the whole media file), which turns to be very slow on Windows Mobile.
On my Palm Treo Pro (which is actually a rebranded HTC) the default video renderer "HTC DX Renderer" does not work with Theora, I had to change it with the Microsoft "Video Renderer" to have Theora working.
This was done by changing the filter merit in Registry. I have used Total Commander for this task (it has a Registry editor) and View Graph to test which filters actually work (this is the Windows Mobile version of GraphEdit)
I have made a recording showing "Big Buck Bunny" running on my Palm Treo Pro:
This version doesn't have any arm assembly optimizations for Vorbis, Theora, and for yuv2rgb conversion. My test video had a resolution of 320x180 (Palm Treo Pro has a 320x320 display) and I do not know how well it works with higher resolution video files.
Edit: In case you were thinking at changing the video renderer's filter merit, here is what you need to look after (beware that you might experience sudden system reboots):
Palm Teo Pro:
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}]
@="Video Renderer"
"Merit"=dword:00800000
[HKEY_CLASSES_ROOT\CLSID\{016229F3-158F-4a0a-8656-85F894F1405D}]
@="HTC DX Renderer"
"Merit"=dword:00800100
HTC Touch Pro 2:
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}]
@="Video Renderer"
"Merit"=dword:00800000
[HKEY_CLASSES_ROOT\CLSID\{1ADAFBDB-2E09-447f-94C4-39B195860BC6}]
@="HTC DDR(VO)"
"Merit"=dword:00800005
You will have to swap the merits for those two filters. Normally Theora should also work with HTC Video Rendrers, but at the moment I do not know how to make them work.
I'm planning (if I get my US visitor visa) to go to Open Video Alliance, and FOMS in October.
I have put a Donate button (orange button on the right side) in the hope of financing the trip to New York for my wife.
Thank you for your support and enjoy this OpenCodecs release.
OpenCodecs was the first release to have an unified 32/64 bit installer package, the 64 bit components are installed only if the operating system is 64 bit.
Today I have released a new OpenCodecs version, one for Windows Mobile 5.0 - 6.5. This is only a decoder package and WebM/VP8 decoders are not present.
Seeking is also disabled for Ogg Vorbis, Theora and Speex, due to the way the seeking table is build (at beginning, reading the whole media file), which turns to be very slow on Windows Mobile.
On my Palm Treo Pro (which is actually a rebranded HTC) the default video renderer "HTC DX Renderer" does not work with Theora, I had to change it with the Microsoft "Video Renderer" to have Theora working.
This was done by changing the filter merit in Registry. I have used Total Commander for this task (it has a Registry editor) and View Graph to test which filters actually work (this is the Windows Mobile version of GraphEdit)
I have made a recording showing "Big Buck Bunny" running on my Palm Treo Pro:
This version doesn't have any arm assembly optimizations for Vorbis, Theora, and for yuv2rgb conversion. My test video had a resolution of 320x180 (Palm Treo Pro has a 320x320 display) and I do not know how well it works with higher resolution video files.
Edit: In case you were thinking at changing the video renderer's filter merit, here is what you need to look after (beware that you might experience sudden system reboots):
Palm Teo Pro:
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}]
@="Video Renderer"
"Merit"=dword:00800000
[HKEY_CLASSES_ROOT\CLSID\{016229F3-158F-4a0a-8656-85F894F1405D}]
@="HTC DX Renderer"
"Merit"=dword:00800100
HTC Touch Pro 2:
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}]
@="Video Renderer"
"Merit"=dword:00800000
[HKEY_CLASSES_ROOT\CLSID\{1ADAFBDB-2E09-447f-94C4-39B195860BC6}]
@="HTC DDR(VO)"
"Merit"=dword:00800005
You will have to swap the merits for those two filters. Normally Theora should also work with HTC Video Rendrers, but at the moment I do not know how to make them work.
I'm planning (if I get my US visitor visa) to go to Open Video Alliance, and FOMS in October.
I have put a Donate button (orange button on the right side) in the hope of financing the trip to New York for my wife.
Thank you for your support and enjoy this OpenCodecs release.
2010-05-16
rOGG on!
The "rOGG on!" title was borrowed from the FSFE campaign: Radio stations granted awards for using Open Standards. I think FSFE should also "boo" radio stations which drop support for Open Standards (Radio Swiss Jazz used to have a Vorbis stream)
In a previous blog entry I was presenting a technical preview of the HTML5 <video> tag running on Internet Explorer. That version worked only in
a few controlled cases.
I have released a new Xiph.Org Ogg Codecs version (grab it from here) which makes the technical preview of the HTML5 <video> tag a bit more useful.
In this version I have dropped the custom file/network reading code and now I rely on built in DirectShow filters to provide the same (better) functionality. Now one can listen to Absolute Classic Rock behind a network proxy using Windows Media Player.
Here are the improvements to the HTML5 <video> tag:
I have made a screen cast to illustrate the new features (better viewed full screen):
The wallpaper picture was taken in the beautiful island of Burano
I would like to thank Philip Jägenstedt for his contribution, which speedup this release.
In a previous blog entry I was presenting a technical preview of the HTML5 <video> tag running on Internet Explorer. That version worked only in
a few controlled cases.
I have released a new Xiph.Org Ogg Codecs version (grab it from here) which makes the technical preview of the HTML5 <video> tag a bit more useful.
In this version I have dropped the custom file/network reading code and now I rely on built in DirectShow filters to provide the same (better) functionality. Now one can listen to Absolute Classic Rock behind a network proxy using Windows Media Player.
Here are the improvements to the HTML5 <video> tag:
- URI support given by uriparser library
- VMR9 support (instead of VMR7), this requires DirectX9
- Internet Explorer Standards mode support, instead of just Quirks mode
- width and height basic attribute support
I have made a screen cast to illustrate the new features (better viewed full screen):
The wallpaper picture was taken in the beautiful island of Burano
I would like to thank Philip Jägenstedt for his contribution, which speedup this release.
2010-04-29
Browsere Moderne II
În articolul Browsere Moderne am testat comportamentul browserelor Internet Explorer, Firefox, Chrome, Opera, Safari în privința randării textului folosind caractere (ș și ț cu virgulă) care nu se află în fonturile instalate în sistemul de operare (Windows XP).
Rezultatele nu au fost foarte bune, caracterele lipsă arată corespunzător dar nu se integrează cu restul textului.

În acest articol voi testa browserele folosind pagini web conținând fonturi stocate pe server (înglobate), fonturi care conțin caracterele ș și ț cu virgulă. Am ales familia de fonturi "DejaVu Sans" deoarece poate fi distribuită liber (familie de fonturi folosită pe sistemul de operare Linux, distribuită și în suita de software birotic "Open Office")
Un font poate fi înglobat într-o pagină web folosind directiva CSS @font-face. Toate browserele suportă fonturile în format „TrueType (.ttf)”, excepție făcând Internet Explorer care suportă formatul „Embedded OpenType (.eot)”. Am convertit fonturile din formatul „TrueType” la formatul „Embedded OpenType” folosind ttf2eot. Un exemplu de cum se folosește @font-face se găsește aici.
Paginile de web folosite la testarea browserelor sunt: pangrama (codată UTF-8), pangrama-latin10 (codată ISO-8859-16), respectiv versiunile pentru Internet Explorer: pangrama-ie și pangrama-ie-latin10
Rezultatele obținute pe sistemul de operare Windows XP SP2, fără fonturi actualizate, și fără a avea familia de fonturi „DejaVu Sans” instalată local în sistemul de operare sunt:
Toate browserele de mai sus afișează pagina codată UTF-8 perfect, pagina codată ISO-8859-16 este afișată incorect doar de către Internet Explorer.
Internet Explorer începând cu versiunea 7 suportă codarea ISO-8859-16, dar din păcate parțial. Am raportat problema la Microsoft #554861 - ISO-8859-16 codepage support.
Un dezavantaj al fonturilor incluse în pagina web poate fi mărimea lor (aproximativ 3 Mbytes), deoarece trebuie descărcate de pe server la accesare. Acest dezavantaj poate fi redus prin stocarea fonturilor, de către browser, pentru accesări ulterioare.
Am arătat că se pot afișa pagini web, care conțin diacriticele corecte, pe sistemul de operare Windows XP, singura condiție este ca utilizatorul să ruleze un browser care suportă directiva CSS @font-face. Aici găsiți o listă cu aceste browsere.
Actualizare Google a lansat serviciul Google Font Directory, serviciu care oferă fonturi pentru „toată lumea”. Tehnic @font-face este folosit, dar indirect, sub o formă care merge pe toate browserele.
Am făcut pagini de test pentru toate fonturile din Google Font Directory, din păcate foarte multe dintre ele au probleme cu diacriticele. Puteți vota pentru sugestia făcută de mine, poate Google va lua măsuri și va repara problema cu diacriticele.
Rezultatele nu au fost foarte bune, caracterele lipsă arată corespunzător dar nu se integrează cu restul textului.

În acest articol voi testa browserele folosind pagini web conținând fonturi stocate pe server (înglobate), fonturi care conțin caracterele ș și ț cu virgulă. Am ales familia de fonturi "DejaVu Sans" deoarece poate fi distribuită liber (familie de fonturi folosită pe sistemul de operare Linux, distribuită și în suita de software birotic "Open Office")
Un font poate fi înglobat într-o pagină web folosind directiva CSS @font-face. Toate browserele suportă fonturile în format „TrueType (.ttf)”, excepție făcând Internet Explorer care suportă formatul „Embedded OpenType (.eot)”. Am convertit fonturile din formatul „TrueType” la formatul „Embedded OpenType” folosind ttf2eot. Un exemplu de cum se folosește @font-face se găsește aici.
Paginile de web folosite la testarea browserelor sunt: pangrama (codată UTF-8), pangrama-latin10 (codată ISO-8859-16), respectiv versiunile pentru Internet Explorer: pangrama-ie și pangrama-ie-latin10
Rezultatele obținute pe sistemul de operare Windows XP SP2, fără fonturi actualizate, și fără a avea familia de fonturi „DejaVu Sans” instalată local în sistemul de operare sunt:
- Internet Explorer 6: UTF-8, ISO-8859-16
- Internet Explorer 7: UTF-8, ISO-8859-16
- Internet Explorer 8: UTF-8, ISO-8859-16
- Mozilla Firefox 3.6.3: UTF-8, ISO-8859-16
- Chrome 4.1: UTF-8, ISO-8859-16
- Opera 10.52: UTF-8, ISO-8859-16
- Safari 4.1: UTF-8, ISO-8859-16
Toate browserele de mai sus afișează pagina codată UTF-8 perfect, pagina codată ISO-8859-16 este afișată incorect doar de către Internet Explorer.
Internet Explorer începând cu versiunea 7 suportă codarea ISO-8859-16, dar din păcate parțial. Am raportat problema la Microsoft #554861 - ISO-8859-16 codepage support.
Un dezavantaj al fonturilor incluse în pagina web poate fi mărimea lor (aproximativ 3 Mbytes), deoarece trebuie descărcate de pe server la accesare. Acest dezavantaj poate fi redus prin stocarea fonturilor, de către browser, pentru accesări ulterioare.
Am arătat că se pot afișa pagini web, care conțin diacriticele corecte, pe sistemul de operare Windows XP, singura condiție este ca utilizatorul să ruleze un browser care suportă directiva CSS @font-face. Aici găsiți o listă cu aceste browsere.
Actualizare Google a lansat serviciul Google Font Directory, serviciu care oferă fonturi pentru „toată lumea”. Tehnic @font-face este folosit, dar indirect, sub o formă care merge pe toate browserele.
Am făcut pagini de test pentru toate fonturile din Google Font Directory, din păcate foarte multe dintre ele au probleme cu diacriticele. Puteți vota pentru sugestia făcută de mine, poate Google va lua măsuri și va repara problema cu diacriticele.
2010-02-22
IE <video> tag - Take Two
Recently I have released a new version of Xiph.Org Ogg Codecs (grab it from here), this new version includes a few Theora and FLAC bugfixes, better Windows 7 support and a Technical Preview of the <video> tag for Internet Explorer.
By Technical Preview I mean only basic playback, no seeking, no controls, no HTML5 interfaces.
I have made a screen cast showing this feature:
To enable <video> tag for Internet Explorer you need to add xmlns="http://www.w3.org/1999/xhtml/video" attribute.
Edit: It works only when Internet Explorer is in Quirks mode
Mozilla's Bug 435339 - DirectShow backend for HTML5 video element - has helped me a lot, to say the least (thank you Chris Pearce).
The webpage used in screencast is: http://people.xiph.org/~maikmerten/demos/bigbuckbunny-videoonly.html with the xmlns attribute for <video>. Note that I have copied the webpage and the movie on my webserver, that page does not have the xmlns attribute.
Hope it works for you as it did for me in the screen cast above :)
Download the 32bit version installer from here (1,09Mb).
Edit: In order to use the <video> tag on Internet Explorer 6.0 and 7.0 please read my first IE <video> tag blog entry.
I have found out that there is an incompatibility between Windows XP and VMware while using the DirectShow Video Mixing Renderer 7 filter.
By Technical Preview I mean only basic playback, no seeking, no controls, no HTML5 interfaces.
I have made a screen cast showing this feature:
To enable <video> tag for Internet Explorer you need to add xmlns="http://www.w3.org/1999/xhtml/video" attribute.
Edit: It works only when Internet Explorer is in Quirks mode
Mozilla's Bug 435339 - DirectShow backend for HTML5 video element - has helped me a lot, to say the least (thank you Chris Pearce).
The webpage used in screencast is: http://people.xiph.org/~maikmerten/demos/bigbuckbunny-videoonly.html with the xmlns attribute for <video>. Note that I have copied the webpage and the movie on my webserver, that page does not have the xmlns attribute.
Hope it works for you as it did for me in the screen cast above :)
Download the 32bit version installer from here (1,09Mb).
Edit: In order to use the <video> tag on Internet Explorer 6.0 and 7.0 please read my first IE <video> tag blog entry.
I have found out that there is an incompatibility between Windows XP and VMware while using the DirectShow Video Mixing Renderer 7 filter.
2010-02-11
IECanvas build
In my previous blog entry I've mentioned Vladimir Vukićević's IECanvas experiment, but at that time my IECanvas build was not working.
In the meantime I've made it work, added support for the new IE8 xml namespace, removed some of the ActiveX usage popups (there is only one infobar popup at first run), packaged it in a small installer.
Souce code with all dependent libraries (cairo, pixman, libpng, zlib) is located here. Download the 32bit installer from here (329Kb)
I've made a screen cast about how IECanvas experience looks like (nice beta fish background):
The two presented canvases are: squares with alpha blending and clock (which should look a bit different in other browsers than in the video)
One only needs to add the xmlns="http://www.w3.org/1999/xhtml/canvas" attribute to a <canvas> tag to have canvas working on IE, but the <canvas> support in IECanvas is far from complete.
<video> will have the same user experience as the IECanvas ActiveX,
and it theory it should be able to coexist with the <canvas> tag.
In the meantime I've made it work, added support for the new IE8 xml namespace, removed some of the ActiveX usage popups (there is only one infobar popup at first run), packaged it in a small installer.
Souce code with all dependent libraries (cairo, pixman, libpng, zlib) is located here. Download the 32bit installer from here (329Kb)
I've made a screen cast about how IECanvas experience looks like (nice beta fish background):
The two presented canvases are: squares with alpha blending and clock (which should look a bit different in other browsers than in the video)
One only needs to add the xmlns="http://www.w3.org/1999/xhtml/canvas" attribute to a <canvas> tag to have canvas working on IE, but the <canvas> support in IECanvas is far from complete.
<video> will have the same user experience as the IECanvas ActiveX,
and it theory it should be able to coexist with the <canvas> tag.
2010-01-15
IE <video> tag
I have started hacking a <video> tag implementation for Microsoft Internet Explorer, based on the work of Vladimir Vukićević's IECanvas experiment. Source code is located here.
The AxPlayer will use the DirectShow OggCodecs for the actual video playback. At the moment it doesn't do much, it just displays a gray rectangle where the video should be, as seen below:

Internet Explorer versions 6.0 and 7.0 required the following syntax for Binary Element Behaviour components:
Internet Explorer 8 has an improved syntax:
The <object> information has been moved into Windows Registry instead of html code:

The xmlns needs to be there in order to link <video> tag to AxPlayer, but the code looks way better :)
Next steps would be:
The AxPlayer will use the DirectShow OggCodecs for the actual video playback. At the moment it doesn't do much, it just displays a gray rectangle where the video should be, as seen below:

Internet Explorer versions 6.0 and 7.0 required the following syntax for Binary Element Behaviour components:
<html xmlns:html5>
<head>
<object id="videoFactory" classid="clsid:7cc95ae6-c1fa-40cc-ab17-3e91da2f77ca"></object>
<?import namespace="html5" implementation="#videoFactory"?>
</head>
<body>
<p>This is a header </p>
<html5:video src="http://videos.mozilla.org/firefox/3.5/meet/meet.ogv">
<p>your browser cannot handle video tag</p>
</html5:video>
<p>This is a footer </p>
</body>
</html>
Internet Explorer 8 has an improved syntax:
<html>
<body>
<p>This is a header </p>
<video src="http://videos.mozilla.org/firefox/3.5/meet/meet.ogv"
xmlns="http://www.w3.org/1999/xhtml">
<p>your browser cannot handle video tag.</p>
</video>
<p>This is a footer </p>
</body>
</html>
The <object> information has been moved into Windows Registry instead of html code:

The xmlns needs to be there in order to link <video> tag to AxPlayer, but the code looks way better :)
Next steps would be:
- Actually display a video instead of a gray rectangle
- Modify the OggCodecs source filter to proper handle videos from network
- Implement the <video> and <audio> W3C HTML5 tag specifications
- Improve the user experience by implementing all it's needed for Internet Explorer not to display the ActiveX warning popups.
2009-11-22
Windows Console and True Type Fonts
In a previous article (Pimpin' Windows XP's cmd.exe) I've presented a way to change the font for the Windows Console - hacking a font and name it Lucida Console.
The above method is a hack, since Microsoft has presented with a dialog to change the font, surely they've thought on a method to add new true type fonts, and it turns out that they did.
The console font configuration is done by the means of Registry, the following registry key is responsible for that:
There you will find "Lucida Console" as number "0", if you will add the value "1" as "DejaVu Sans Mono" nothing will happen, you need to add the second font as "00", third as "000" and so on.
Microsoft has a KB on how to add a font to the console. A button in the
Windows Console property pages would have been far more useful than a KB page.
Here is a screenshot showing "DejaVu Sans Mono" in the console font property page:
The above method is a hack, since Microsoft has presented with a dialog to change the font, surely they've thought on a method to add new true type fonts, and it turns out that they did.
The console font configuration is done by the means of Registry, the following registry key is responsible for that:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Console\TrueTypeFont
There you will find "Lucida Console" as number "0", if you will add the value "1" as "DejaVu Sans Mono" nothing will happen, you need to add the second font as "00", third as "000" and so on.
Microsoft has a KB on how to add a font to the console. A button in the
Windows Console property pages would have been far more useful than a KB page.
Here is a screenshot showing "DejaVu Sans Mono" in the console font property page:
2009-10-08
Silverlight for Windows Embedded^H...^H C++
Microsoft has released Silverlight for Windows Embedded. OK, Silverlight runs also on Embedded Devices, not a big deal, not for me anyways, but the first thing that came to my eye was "Silverlight for Windows Embedded is a native code (C++) UI framework".
Native code (C++) UI framework, awesome! Here is a more wide description from the Overview video:
Next I wanted to see how the code looks like, I've found this tutorial and a document on how to "Create a Custom User Control in Silverlight for Windows Embedded".
I don't see why this C++ Silverlight framework should not be available for Desktop, performance and small footprint are also important for Desktop applications.
This would be a great addition for Visual Studio 2010 for native developers, besides the new Intellisense based on the EDG C++ frontend. But I guess the feature list for Visual Studio 2010 is frozen, maybe for Visual Studio 2012.
If you think that having this technology brought to the Desktop is a good idea please sign this petition and spread the word.
Native code (C++) UI framework, awesome! Here is a more wide description from the Overview video:
Is a C++ backend instead of managed, for performance and for footprint, but, also we've taken the toolchain from the Silverlight development process so you still get all the benefits of having the two disciplines of the designer and the developer.
So with Expression Bend you are still able to design all of your UIs and all of the storyboards and animations and all the effects that encapsulate the UI are all still done by the designer and then the developer takes that XAML and instead of writing managed C# or VB they write C++ code.
Next I wanted to see how the code looks like, I've found this tutorial and a document on how to "Create a Custom User Control in Silverlight for Windows Embedded".
I don't see why this C++ Silverlight framework should not be available for Desktop, performance and small footprint are also important for Desktop applications.
This would be a great addition for Visual Studio 2010 for native developers, besides the new Intellisense based on the EDG C++ frontend. But I guess the feature list for Visual Studio 2010 is frozen, maybe for Visual Studio 2012.
If you think that having this technology brought to the Desktop is a good idea please sign this petition and spread the word.
2009-09-30
Batch change script for Visual C/C++ Projects
Visual C/C++ projects are XML files but they have a different file extension (*.vcproj).
Having to change an option to through tens of projects files each with more than one platform (Win32, Win64, Windows Mobile) and multiple configurations (Debug, Release) only by loading the projects in Visual Studio and clicking through the UI is not very appealing.
Since we already know that the project files are XML files one can write a program / script to change the desired option, in my case the change of the C runtime library - dynamic / static.
I have chosen WSH JScript, MSXML 3.0 and XPath to write a script to change Visual C/C++ projects. My decision was due two arguments: JScript is present on Windows XP, and the scripts can be debugged by Visual Studio 2005+ (//X command line parameter).
During the development I have stumbled on a XPath query problem, the function contains was not found in msxml3.dll. The problem was due to the fact that MSXML 3.0 was not instructed to use XPath as selection language (xmlDoc.setProperty("SelectionLanguage", "XPath");). Newer MSXML versions do not have this requirement though.
The message boxes displayed when issued from command line like change_runtime.js myproject.vcproj are due to the fact that JScript is not the default scripting language in WSH. One solution is to call the script like: cscript change_runtime.js myproject.vcproj, which requires some typing, the other solution is to change the default scripting language in WSH, which can be accomplished by running cscript //H:CScript.
The source code can be found here. Changing Visual C/C++ projects just become easier for me :-)
Having to change an option to through tens of projects files each with more than one platform (Win32, Win64, Windows Mobile) and multiple configurations (Debug, Release) only by loading the projects in Visual Studio and clicking through the UI is not very appealing.
Since we already know that the project files are XML files one can write a program / script to change the desired option, in my case the change of the C runtime library - dynamic / static.
I have chosen WSH JScript, MSXML 3.0 and XPath to write a script to change Visual C/C++ projects. My decision was due two arguments: JScript is present on Windows XP, and the scripts can be debugged by Visual Studio 2005+ (//X command line parameter).
During the development I have stumbled on a XPath query problem, the function contains was not found in msxml3.dll. The problem was due to the fact that MSXML 3.0 was not instructed to use XPath as selection language (xmlDoc.setProperty("SelectionLanguage", "XPath");). Newer MSXML versions do not have this requirement though.
The message boxes displayed when issued from command line like change_runtime.js myproject.vcproj are due to the fact that JScript is not the default scripting language in WSH. One solution is to call the script like: cscript change_runtime.js myproject.vcproj, which requires some typing, the other solution is to change the default scripting language in WSH, which can be accomplished by running cscript //H:CScript.
The source code can be found here. Changing Visual C/C++ projects just become easier for me :-)
2009-09-19
Browsere moderne
Browserele web moderne (ultimile versiuni) știu să genereze caracterele lipsă din fonturi atunci când pagina web o cere.
Am decis să testez această funcționalitate pe un sistem Windows XP SP2, cu setările implicite (Engleză SUA), și fără actualizări. În special am urmărit cum se descurcă cu caracterele ș și ț cu virgulă, care lipsesc din fonturile cu care vine Windows XP SP2 (pentru mai multe informații a se vedea pagina lui Cristian Secară ș-uri și ț-uri). Ulterior am testat și sistemul de operare Windows 7.
Pagina de test conține o pangramă (Muzicologă în bej, vând whisky şi tequila, preţ fix.) scrisă cu familiile implicite de fonturi serif, fără serif și monospațiat în forma normală și cursivă. Setul de caractere setat a fost UTF-8.
Microsoft Internet Explorer 6

Microsoft Internet Explorer 7

Microsoft Internet Explorer 8

Mozilla Firefox 3.5.3

Google Chrome 3.0

Opera 10.0

Safari 4.0.3

Internet Explorer 6 a fost luat drept referință. Mozilla Firefox s-a descurcat cel mai bine la famillile de fonturi serif și fără serif în forma normală, forma cursivă și cea monospațiată a caracterelor ș și ț nu se integrează foarte bine cu restul caracterelor.
Pentru a repara problema caracterelor ș și ț în fonturile serif și fără serif Microsoft în luna Mai 2007 a scos un pachet de actualizare a unor fonturi din sistemele de operare Windows XP și Windows Vista.
Familia de fonturi monospațiate nu a beneficiat de o actualizare, a se vedea captura de ecran de mai jos:
Microsoft Internet Explorer 8 (cu pachetul de fonturi actualizate)

Windows 7 beneficiază de fonturi monspațiate care conțin caracterele ș și ț, a se vedea captura de ecran de mai jos:

Captura de ecran de mai sus arată o problemă în Internet Explorer 8 din Windows 7, problemă cu varianta implicită a fontului serif. Setarea "clear type" a fost activată, dar dintr-un motiv necunoscut textul este afișat foarte prost.
Mozilla Firefox 3.5.3 afișează corect caracterele ș și ț rulând pe Windows 7:

Google Chrome 3.0 afișează corect caracterele ș și ț rulând pe Windows 7:

Safari 4.0.3 afișează corect caracterele ș și ț rulând pe Windows 7:

Opera 10.0 afișează corect caracterele ș și ț rulând pe Windows 7:

Concluzie: în Windows 7 problema caracterelor ș și ț cu virgulă este deja rezolvată.
Am decis să testez această funcționalitate pe un sistem Windows XP SP2, cu setările implicite (Engleză SUA), și fără actualizări. În special am urmărit cum se descurcă cu caracterele ș și ț cu virgulă, care lipsesc din fonturile cu care vine Windows XP SP2 (pentru mai multe informații a se vedea pagina lui Cristian Secară ș-uri și ț-uri). Ulterior am testat și sistemul de operare Windows 7.
Pagina de test conține o pangramă (Muzicologă în bej, vând whisky şi tequila, preţ fix.) scrisă cu familiile implicite de fonturi serif, fără serif și monospațiat în forma normală și cursivă. Setul de caractere setat a fost UTF-8.
Microsoft Internet Explorer 6

Microsoft Internet Explorer 7

Microsoft Internet Explorer 8

Mozilla Firefox 3.5.3

Google Chrome 3.0

Opera 10.0

Safari 4.0.3

Internet Explorer 6 a fost luat drept referință. Mozilla Firefox s-a descurcat cel mai bine la famillile de fonturi serif și fără serif în forma normală, forma cursivă și cea monospațiată a caracterelor ș și ț nu se integrează foarte bine cu restul caracterelor.
Pentru a repara problema caracterelor ș și ț în fonturile serif și fără serif Microsoft în luna Mai 2007 a scos un pachet de actualizare a unor fonturi din sistemele de operare Windows XP și Windows Vista.
Familia de fonturi monospațiate nu a beneficiat de o actualizare, a se vedea captura de ecran de mai jos:
Microsoft Internet Explorer 8 (cu pachetul de fonturi actualizate)

Windows 7 beneficiază de fonturi monspațiate care conțin caracterele ș și ț, a se vedea captura de ecran de mai jos:

Captura de ecran de mai sus arată o problemă în Internet Explorer 8 din Windows 7, problemă cu varianta implicită a fontului serif. Setarea "clear type" a fost activată, dar dintr-un motiv necunoscut textul este afișat foarte prost.
Mozilla Firefox 3.5.3 afișează corect caracterele ș și ț rulând pe Windows 7:

Google Chrome 3.0 afișează corect caracterele ș și ț rulând pe Windows 7:

Safari 4.0.3 afișează corect caracterele ș și ț rulând pe Windows 7:

Opera 10.0 afișează corect caracterele ș și ț rulând pe Windows 7:

Concluzie: în Windows 7 problema caracterelor ș și ț cu virgulă este deja rezolvată.
Hidden stream
If you wondered why does a security dialog pop up when you try to run the oggcodecs installer (or every executable for that matter) after downloading it from the Internet, this post is for you.
The security dialog looks like:

If you look at the file properties there is no checkbox like "this file came from the Internet" (CHM files have a check for this though), but this information is stored somewhere, in a NTFS Alternate Data Stream.
To check if a file has a NTFS Alternate Data Stream one can use the Streams utility made by By Mark Russinovich of Sysinternals fame.
Running streams oggcodecs_0.81.15562-win32.exe resulted: :Zone.Identifier:$DATA 46.
To view this "Zone.Identifier" stream I have used the more command like more < oggcodecs_0.81.15562-win32.exe:Zone.Identifier which resulted:
Firefox is adding this extra information for every executable file downloaded. Does every web browser (I've tested only I few I know of) on Windows add this extra information?
Interesting how the size of the stream varies with every browser. I have submitted a bug report to Opera, because they should also add this extra information to the downloaded files.
Adding the Zone.Identifier stream can be done easily with a batch file
(from_internet.cmd)
Deleting a stream can be done by using streams -d.
The security dialog looks like:

If you look at the file properties there is no checkbox like "this file came from the Internet" (CHM files have a check for this though), but this information is stored somewhere, in a NTFS Alternate Data Stream.
To check if a file has a NTFS Alternate Data Stream one can use the Streams utility made by By Mark Russinovich of Sysinternals fame.
Running streams oggcodecs_0.81.15562-win32.exe resulted: :Zone.Identifier:$DATA 46.
To view this "Zone.Identifier" stream I have used the more command like more < oggcodecs_0.81.15562-win32.exe:Zone.Identifier which resulted:
[ZoneTransfer]
ZoneId=3Firefox is adding this extra information for every executable file downloaded. Does every web browser (I've tested only I few I know of) on Windows add this extra information?
- Mozilla Firefox 3.5.3 - yes (:Zone.Identifier:$DATA 46)
- Microsoft Internet Explorer 8.0 - yes (:Zone.Identifier:$DATA 26)
- Google Chrome 3.0 - yes (:Zone.Identifier:$DATA 24)
- Safari 4.0.3 - yes (:Zone.Identifier:$DATA 26)
- Opera 10.0 - no
Interesting how the size of the stream varies with every browser. I have submitted a bug report to Opera, because they should also add this extra information to the downloaded files.
Adding the Zone.Identifier stream can be done easily with a batch file
(from_internet.cmd)
@echo off
if [%1] == [] (
echo Usage: from_internet.cmd executable_name
) else (
echo [ZoneTransfer]> %1:Zone.Identifier
echo ZoneId=3 >> %1:Zone.Identifier
)Deleting a stream can be done by using streams -d.
2009-05-23
Colorful Epiphany
I always thought that the RGB macro (Win32 GDI) which takes three arguments - red, green and blue - will create a 0xRRGGBB value.
I was wrong! Win32 GDI uses BGR colors!
Here is another assertion on the path of assertiveness (germ. Durchsetzungsvermögen)
I was wrong! Win32 GDI uses BGR colors!
Here is another assertion on the path of assertiveness (germ. Durchsetzungsvermögen)
#include <windows.h>
#include <assert.h>
int main()
{
COLORREF color_rgb = 0xBBAADD;
assert(color_rgb == RGB(0xBB, 0xAA, 0xDD));
}
Cheers!
2009-05-12
Visual Studio 2008 Donation
2009-05-10
2009-03-11
DirectShow oggenc v0.1
I have created a DirectShow oggenc clone, mainly due to Ticket #1517 (How to calculate the OGG encoding complete percent correctly?). It is a Visual C++ console application which renders an audio file, removes the audio renderer and inserts a Vorbis encoder and an Ogg muxer filter.
The example also illustrates how to use the IVorbisEncodeSettings and IOggMuxProgress COM interfaces.
During the development of the tool I have found out a few quirks of the COM interfaces, all of which I will address in future oggcodecs releases.
The supported audio source file formats are: WAV, MP3, WMA. FLAC and OGG are not supported because I have used IMediaDet DirectShow interface, which is not supported by oggcodecs at this moment.
One can use another methods of determining the length of the audio source file (seeking at the end of the file and getting the position), which would enable support for FLAC and OGG.
Testing the tool showed that encoding a 4m50s audio wave file on Windows Vista 64bit took an average of 18.1 seconds for the 32bit version, while the 64bit version took on average 13.1 seconds, a speed improvement of ~27%.
Source code can be found here, binaries can be found here (32 bit) and here (64 bit).
The example also illustrates how to use the IVorbisEncodeSettings and IOggMuxProgress COM interfaces.
During the development of the tool I have found out a few quirks of the COM interfaces, all of which I will address in future oggcodecs releases.
The supported audio source file formats are: WAV, MP3, WMA. FLAC and OGG are not supported because I have used IMediaDet DirectShow interface, which is not supported by oggcodecs at this moment.
One can use another methods of determining the length of the audio source file (seeking at the end of the file and getting the position), which would enable support for FLAC and OGG.
Testing the tool showed that encoding a 4m50s audio wave file on Windows Vista 64bit took an average of 18.1 seconds for the 32bit version, while the 64bit version took on average 13.1 seconds, a speed improvement of ~27%.
Source code can be found here, binaries can be found here (32 bit) and here (64 bit).
2009-02-23
Windows 7
Today while doing a bit of research regarding https://trac.xiph.org/ticket/1498
I found out another limitation of the default audio renderer in DirectShow.
The DirectSound audio renderer cannot play 192KHz, 24 bit audio samples. This behaviour was present on Windows XP SP3 and Windows Vista SP1.
To my surprise Windows 7 (build 7000) doesn't have this limitation, Windows Media Player 12 was able to play the 192Khz 24bit sample FLAC file from Linn Records
Windows Media Player 12 also knows about Ogg Vorbis metadata, which came as a surprise as well.
If somebody will ask me why he/she should upgrade to Windows 7 now I now what to answer :)
I found out another limitation of the default audio renderer in DirectShow.
The DirectSound audio renderer cannot play 192KHz, 24 bit audio samples. This behaviour was present on Windows XP SP3 and Windows Vista SP1.
To my surprise Windows 7 (build 7000) doesn't have this limitation, Windows Media Player 12 was able to play the 192Khz 24bit sample FLAC file from Linn Records
Windows Media Player 12 also knows about Ogg Vorbis metadata, which came as a surprise as well.
If somebody will ask me why he/she should upgrade to Windows 7 now I now what to answer :)
2009-01-21
Mono 2.2
Recently Mono 2.2 was released. It has a bunch of new stuff, one of them is: SIMD (Single Instruction, Multiple Data) support in Mono.
Miguel de Icaza has a blog entry where he describes the new SIMD support in Mono. He has ported to C# a C++ application, to illustrate the new SIMD stuff, and then he compares the results, the C++ program was rather slow. I had a look at the source code an I've seen that the C++ program was compiled in debug mode.
I've decided to make a few tests for myself. I've used MinGW 4.3.2 and Visual Studio 2005, the tests where run on my Intel Mobile Core 2 Duo T7500.
Here are the results (in seconds):

The parameters for the above results were:

Mono is not quite there yet (at least on Windows).
I had to change the timing code for the C++ code, glib::GTimer is not a very good option on Windows. I've used the high-resolution performance counter, the code is presented below:
There are a few things I would like to point out about the Mono 2.2 Windows installer.
1. The executable is not digitally signed by Novell.

2. The graphics are hideous, 16 colors dithering? why? Is anybody in their right mind running Windows in 16 colors?

Miguel de Icaza has a blog entry where he describes the new SIMD support in Mono. He has ported to C# a C++ application, to illustrate the new SIMD stuff, and then he compares the results, the C++ program was rather slow. I had a look at the source code an I've seen that the C++ program was compiled in debug mode.
I've decided to make a few tests for myself. I've used MinGW 4.3.2 and Visual Studio 2005, the tests where run on my Intel Mobile Core 2 Duo T7500.
Here are the results (in seconds):

The parameters for the above results were:

Mono is not quite there yet (at least on Windows).
I had to change the timing code for the C++ code, glib::GTimer is not a very good option on Windows. I've used the high-resolution performance counter, the code is presented below:
#ifndef PERFTIMER_H
#define PERFTIMER_H
#include <windows.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
class PerfTimer
{
LARGE_INTEGER start_;
LARGE_INTEGER stop_;
LARGE_INTEGER freq_;
public:
PerfTimer()
{
QueryPerformanceFrequency(&freq_);
}
void Start()
{
QueryPerformanceCounter(&start_);
}
void Stop()
{
QueryPerformanceCounter(&stop_);
}
std::string ToString()
{
const int precision = 10000000;
unsigned long time = static_cast<unsigned long>(
(stop_.QuadPart - start_.QuadPart) * precision /
freq_.QuadPart);
std::ostringstream os;
os << std::setfill('0');
os << std::setw(2) << time / precision / 3600 << ":";
os << std::setw(2) << time / precision % 3600 / 60 << ":";
os << std::setw(2) << time / precision % 60 << ".";
os << std::setw(7) << time % precision;
os << std::setfill(' ');
return os.str();
}
};
#if 0
int main()
{
PerfTimer timer;
timer.Start();
Sleep(1250);
timer.Stop();
std::cout << "Time: " << timer.ToString() << std::endl;
return 0;
}
#endif
#endif // PERFTIMER_H
There are a few things I would like to point out about the Mono 2.2 Windows installer.
1. The executable is not digitally signed by Novell.

2. The graphics are hideous, 16 colors dithering? why? Is anybody in their right mind running Windows in 16 colors?

2009-01-18
Windows CE
I've been busy with the port to Windows CE of libogg, libvorbis, libflac. This is only the beginning, there is still allot of work remaining.
Also I've done a bit of restructuring, I've reduced the number of binaries from 30 to 20, by changing from dynamic link libraries to static libraries. I've changed the usage of the CRT, from dynamic to static linking, this has increased the size of the binaries but overall the installer has the same size, thanks to LZMA solid compression :-)
The above changes will ease the usage of the libraries, for example only dsfOggDemux2.dll dsfVorbisDecoder.dll are needed for Vorbis decoding.
I have created my first Windows CE "Hello World" program. I've wanted for a long time to do that. I've learned that Windows CE has only Unicode support, no more multi byte nightmare.
Because you don't have a console attached the classical "Hello World" is a bit different, a bit WIN32 APIsh:
If you try to run an executable which is not digitally signed, you are being prompted by the operating system telling you that it's dangerous to run "unknown" software.
Since I have a certificate from CERTUM I have signed the executable, but still the prompt was there. The problem was that my telephone doesn't have the root certificate from CERTUM installed. I've went to CERTUM's root certificate page and taken the "Public Key of Certum Level II", installed it and my program ran without any prompts from the operating system.
And now the mandatory "screen shot":
Also I've done a bit of restructuring, I've reduced the number of binaries from 30 to 20, by changing from dynamic link libraries to static libraries. I've changed the usage of the CRT, from dynamic to static linking, this has increased the size of the binaries but overall the installer has the same size, thanks to LZMA solid compression :-)
The above changes will ease the usage of the libraries, for example only dsfOggDemux2.dll dsfVorbisDecoder.dll are needed for Vorbis decoding.
I have created my first Windows CE "Hello World" program. I've wanted for a long time to do that. I've learned that Windows CE has only Unicode support, no more multi byte nightmare.
Because you don't have a console attached the classical "Hello World" is a bit different, a bit WIN32 APIsh:
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
{
wchar_t message[] = L"Goodbye cruel adventure world!";
wchar_t caption[] = L"Monkeys are listening";
::MessageBox(0, message, caption, MB_OK | MB_ICONINFORMATION);
return 0;
}
If you try to run an executable which is not digitally signed, you are being prompted by the operating system telling you that it's dangerous to run "unknown" software.
Since I have a certificate from CERTUM I have signed the executable, but still the prompt was there. The problem was that my telephone doesn't have the root certificate from CERTUM installed. I've went to CERTUM's root certificate page and taken the "Public Key of Certum Level II", installed it and my program ran without any prompts from the operating system.
And now the mandatory "screen shot":
Subscribe to:
Posts (Atom)



