Monday, July 21, 2008

Installing IIS on Windows XP Pro / Reminder

Since i always forgot

Installing IIS on Windows XP Pro

If you are running Windows XP Professional on your computer you can install Microsoft's web server, Internet Information Server 5.1 (IIS) for free from the Windows XP Pro installation CD and configure it to run on your system by following the instructions below: -

1. Place the Windows XP Professional CD-Rom into your CD-Rom Drive.

2. Open 'Add/Remove Windows Components' found in 'Add/Remove Programs' in the 'Control Panel'.

3. Place a tick in the check box for 'Internet Information Services (IIS)' leaving all the default installation settings intact.

4. Once IIS is installed on your machine you can view your home page in a web browser by typing 'http://localhost' (you can substitute 'localhost' for the name of your computer) into the address bar of your web browser. If you have not placed your web site into the default directory you should now be looking at the IIS documentation.

5. If you are not sure of the name of your computer right-click on the 'My Computer' icon on your desktop, select 'Properties' from the shortcut menu, and click on the 'Computer Name' tab.

6. Your default web directory to place your web site in is 'C:\Inetpub\wwwroot', but if you don't want to over write the IIS documentation found in this directory you can set up your own virtual directory through the 'Internet Information Services' console.

7. The 'Internet Information Services' console can be found in the 'Administration Tools' in the 'Control Panel' under 'Performance and Maintenance', if you do not have the control panel in Classic View.

8. Double-click on the 'Internet Information Services' icon.

8. Once the 'Internet Information Services' console is open you will see any IIS web services you have running on your machine including the SMTP server and FTP server, if you chose to install them with IIS.

9. To add a new virtual directory right click on 'Default Web Site' and select 'New', followed by 'Virtual Directory', from the drop down list.

7. Next you will see the 'Virtual Directory Creation Wizard' from the first screen click the 'next' button.

9. You will then be asked to type in an 'Alias' by which you will access the virtual directory from your web browser (this is the name you will type into your web browser after 'localhost' to view any web pages you place in the directory).

10. Next you will see a 'Browse...' button, click on this to select the directory your web site pages are in on your computer, after which click on the 'next' button to continue.

11. On the final part of the wizard you will see a series of boxes, if you are not worried about security then select them all, if you are and want to run ASP scripts then check the first two, followed by the 'next' button.

12. Once the virtual directory is created you can view the web pages in the folder by typing 'http://localhost/aliasName' (where 'aliasName' is, place the alias you called the virtual directory) into the address bar of your web browser (you can substitute 'localhost' for the name of your computer if you wish).

Wednesday, July 16, 2008

How to detect the selected language on Mac OS 10 Tiger/Leopard

I noticed many post on Apple Dev web site of people trying to know what is the current language selected on Mac OS 10 when doing a drag and drop of japanese language before english.

The following code tested on Tiger will work like a charm.

static Boolean s_curLangInited = FALSE;
static Boolean s_bJapanese = FALSE;

if (!s_curLangInited)
{
CFComparisonResult result;
CFStringEncoding encoding = kCFStringEncodingMacRoman; // = 0;
CFAllocatorRef alloc_default = kCFAllocatorDefault; // = NULL;

// a couple of c string literals.
const char cstr_ja[] = "ja_JP";

// convert from c string to CFString
CFStringRef cf_jaString = CFStringCreateWithCString(alloc_default,cstr_ja,encoding);
//CString curLangStr = AfxGetApp()->GetProfileString(_T("Settings"), _T("Language"), _T("nil"));
CFLocaleRef loc = ::CFLocaleCopyCurrent();
CFStringRef cf_lang = (CFStringRef)::CFLocaleGetValue (loc, kCFLocaleLanguageCode);

CFMutableArrayRef available_locales;
CFArrayRef intersected_locales;
char user_locale[50];
struct direct *file;
DIR *dir;
CFArrayRef prefered_languages;

CFLocaleRef user_locale_ref = CFLocaleCopyCurrent();
CFStringRef user_locale_string_ref = CFLocaleGetIdentifier( user_locale_ref );

/* the prefered language in System Preferences.app, because it can differ from CFLocaleCopyCurrent().
However this prefered language is stored using the general language denotation
that may not include the country code (en,fr,en-GB,...) which is not accepted
by setlocale (setlocale would expect en_US,fr_FR,en_GB,...).

So we retrieve possible locales from /usr/share/locale and intersect them
with the prefered languages using CFBundleCopyLocalizationsForPreferences.
*/
dir = opendir("/usr/share/locale");
available_locales = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
while ((file = readdir(dir)))
{
/* This filters the 'right' locales (xx_xx.UTF-8) */
if (strstr(file->d_name, ".UTF-8"))
CFArrayAppendValue(available_locales, (void*)CFStringCreateWithCString(kCFAllocatorDefault,
file->d_name, kCFStringEncodingUTF8));
}
closedir(dir);

CFPreferencesAppSynchronize(kCFPreferencesAnyApplication);
prefered_languages = (CFArrayRef)CFPreferencesCopyValue( CFSTR("AppleLanguages"), kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser, kCFPreferencesAnyHost);

if (prefered_languages)
{
CFArrayRef intersected_locales = (CFArrayRef)CFBundleCopyLocalizationsForPreferences(available_locales, prefered_languages);
CFStringRef user_language = NULL;

if(CFArrayGetCount(intersected_locales))
user_language = (CFStringRef)CFArrayGetValueAtIndex(intersected_locales, 0);
if(user_language)
{
CFStringGetCString( user_language, user_locale, sizeof(user_locale), kCFStringEncodingUTF8 );

result = CFStringCompareWithOptions(user_language, cf_jaString, CFRangeMake( 0 ,CFStringGetLength(cf_jaString)), kCFCompareCaseInsensitive);
if (result == kCFCompareEqualTo) {

s_bJapanese = true;
}
else
{
s_bJapanese = false;
}

Tuesday, July 15, 2008

why didn't Apple let AT&T sell/activate the new iPhone over launch weekend?

good question !

http://www.flickr.com/photos/lasean/2668369038/

Monday, July 14, 2008

Papervision 3d

An interesting 3d engine alternative

http://www.papervision3d.org/

Tuesday, July 01, 2008

Modal Dialog using Carbon

Not a long time ago i was force to find a way to display an Alert Dialog on MAC OS X
and here is a basic sequence to display a modal dialog on the mac similar to Win32 MessageBox

{
DialogRef alert;
DialogItemIndex outHit;
CFStringRef errMsg;
CFStringRef errorExplanation;
UInt32 textLength;

alertStringExplanation = SomeUTF String
alertStringTitle = SomeUTF String

l1 = alertStringExplanation.length();
l2 = alertStringTitle.length();
textLength = l2;
errMsg = ::CFStringCreateWithBytes(NULL, (UInt8 *) alertStringTitle.get(), textLength, CFStringGetSystemEncoding(), false);
textLength = l1;

errorExplanation = ::CFStringCreateWithBytes(NULL, (UInt8 *) alertStringExplanation.get(), textLength, CFStringGetSystemEncoding(), false);
UInt32 numUnicodeChars = ::CFStringGetMaximumSizeForEncoding(textLength, kCFStringEncodingUnicode);

CreateStandardAlert(kAlertCautionAlert, errMsg, errorExplanation, NULL, &alert);
RunStandardAlert(alert, NULL, &outHit);

}

Indexing SWF file

http://seekingalpha.com/article/83397-adobe-ups-relevance-with-searchable-flash?source=yahoo

For most people on the Web, if Google or Yahoo cannot find something, it doesn’t exist. That has been one of the biggest drawbacks to creating a Website or application that displays itself as a Flash (SWF) file. Search engines could see the file, but they could not see what was in it. Until now.

Adobe has come up with a way for the search engines to read SWF files and index all of the information they contain. That means any text or links in a Flash application can now be indexed. This is a huge step forward for Adobe and anyone who develops in Flash/Flex. Michele Turner, Adobe’s VP of marketing for its platform business, explains:

We are releasing technology to Google and Yahoo that enables them to crawl and index SWF files. They are now searchable. This will open up millions of Flash files to search.

Adobe has created a special Flash player for the search engines that acts like a virtual user going through each application. It actually goes through the runtime of each Flash application and translates it into something the search engines can understand. So all of those fancy interactive Flash Websites and other rich Internet applications that have been invisible to search engines, can now be seen by them.

Turner acknowledges that this invisibility so far “has been a big problem for those developing rich applications.” After all, it doesn’t matter how pretty your Website is if nobody can find it. Flash applications and Websites (many ironically created by ad agencies) have not been able to take advantage of any of the search-engine juice that so many online ad campaigns depend upon. This should be seen as part of Adobe’s larger efforts to remove any remaining restrictions associated with Flash (in April, for instance, it opened up the Flash runtime as part of its the Open Screen Project).

Google is already rolling out the SWF-indexing technology, while Yahoo still “has some work to do,” says Turner. Even so, this won’t solve all the problems with Flash content showing up on search engines.

Google SWF

http://googlewebmastercentral.blogspot.com/2008/06/improved-flash-indexing.html

ADOBE SWF searchability

http://www.adobe.com/devnet/flashplayer/articles/swf_searchability.html