Archive for the 'Computer Science' Category

Page 2 of 6

Visual Studio 2008 Service Pack 1 – And All His Friends

Visual Studio 2008’s Service Pack 1 brings a big bunch of new features, e.g. the “fancy” MFC Feature Pack – to name but one. If you install the Service Pack, you should install the updated MSDN Library as well. And if you wanna check out the corresponding Feature Pack Samples, you have to integrate the latest Sample Library, because it won’t updated automatically. Well, and if you gonna deploy your MFC application, you have to include the latest Redistributable Package or supply a link to download it. As you can see, there are a couple of depending components. So I created a very short list of them (to be continued):

Pizza Wundaba

Kennt Ihr Kotipizza? Vermutlich noch nicht ;) Kotipizza ist eine “home delivery” Pizza Restaurant-Kette hier in Finnland. Das Unternehmen wurde 1987 gegründet und ist die größte Pizza-Kette in den nördlichen Ländern mit über 220 Restaurants, davon 100 alleine in Finnland. Das heißt also, Kottipizza-Läden findet man hier an jeder Ecke. Und das stimmt, so z.B. auch in unserem DUO-Einkaufszentrum hier in Tampere-Hervanta!

Ich kann den Laden absolut empfehlen! Falls Ihr also irgendwann einmal an einer Kottipizza-Hütte vorbeikommt, solltet Ihr eine Pizza Margarita mit extra Shrimps und Oregano nehmen. Schmeckt wirklich “wie vom ander’n Stern”, ist relativ preiswert (Studenten erhalten sogar einen kleinen Rabatt) und man bekommt als Zugabe jedesmal zwei Purukumi Tuggummi (Kaugummi) :) Anbei ein Foto von dieser Pizza (ja ja, die andere Hälfte hatte ich schon verputzt als das Foto gemacht wurde).

Dabei ist mir aufgefallen, dass das Logo auf der Pizza-Schachtel ein Misch-Masch aus Apple und Microsoft-Logo ist! Oder vielleicht doch nicht? Bin ich denn tatsächlich ein Nerd? Vermutlich ja.


Zend Framework Rewrite with 1&1 Web Hosting

If you plan to host your Zend-based web-application on a 1&1 ( 1and1 / 1und1 ) server, you should consider the two following special features in the .htaccess-file:

  • The first one is to define the RewriteBase for your project which is simply the root directory /. Otherwise you will get an HTTP error 500 (or something like that).
  • And the second one is to disable the Multiviews option. Otherwise you will get the HTTP error 404 (or something like that).
1
2
3
4
5
6
7
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php 
 
RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
Options -MultiViews

Btw: PHP5 is not enabled by default. So that’s why I inserted the AddType and the AddHandler statements at the beginning. ;)

Using the Windows Search API From a MFC Application

Download (ca. 235 KB)

There exists a good article on CodeProject that explains the usage of Windows Search API from a WPF application. However for my own purposes I needed an option using Windows Search in an unmanaged application (like MFC) and tapping it in a way like CRecordset (with its “lovely” Move()-methods) as well. So I wrote a new C++ class called CWindowsSearch that capsules the whole COM-stuff (retrieving the connection string and the SQL statement from ISearchQueryHelper) and the OleDB-mechanism (querying and fetching the data):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CString lsSearch = _T("the search keyword");
CWindowsSearch lkWindowsSearch;
 
// open search
if ( !lkWindowsSearch.Open(lsSearch) )
	return;
 
// get results
while ( lkWindowsSearch.MoveNext() )
{
	// do something
	CString lsName = lkWindowsSearch.GetItemName();
	CString lsPath = lkWindowsSearch.GetItemPath();
}
 
// close search
lkWindowsSearch.Close();

I packed a demo application in this post that takes a search keyword from a CEdit and “prints” the results (found file name and path) as items into a CListCtrl. Double-click on an existing item and the application will open the corresponding file. You can download the ZIP archive above to get an idea of the internal functionality, espescially about the CWindowsSearch class.

AdBlock for Safari and Firefox

Many years ago Webwasher was the first tool for blocking ad’s within Web Browser’s. It’s been a long time :) As you know, Webwasher used a proxy server installed on your machine for filtering all the incoming HTML data. Nowadays there’re a lots of plugins for Browsers that can block ad’s as well – without a proxy server and for free. Here I’d like to give you two links for those kind of tools both for my favourite Web Browsers:


AdBlock for Safari


Adblock Plus for Firefox

Converting Data From CLongBinary To CString

Regarding my recent post I’d like to give you the following 2 code snippets. The first one converts a long binary into a string. And the second takes a string and delivers a long binary.

1
2
3
4
5
6
7
8
9
10
11
12
CString CStringFactory::LongBinaryToString(const CLongBinary &pkLongBinary)
{
	CString s;
 
	if ( pkLongBinary.m_dwDataLength > 0 )
	{
		s = (LPSTR)GlobalLock(pkLongBinary.m_hData);
		GlobalUnlock(pkLongBinary.m_hData);
	}
 
	return s.Left(pkLongBinary.m_dwDataLength);
}
1
2
3
4
5
6
7
8
9
void CStringFactory::StringToLongBinary(const CString &psString, CLongBinary &pkLongBinary)
{
	pkLongBinary.m_dwDataLength = psString.GetLength();
 
	HGLOBAL lhGlobal = GlobalAlloc(GPTR, psString.GetLength());
	pkLongBinary.m_hData = GlobalLock(lhGlobal);
	CopyMemory(pkLongBinary.m_hData, (LPCTSTR)psString, psString.GetLength());
	GlobalUnlock(lhGlobal);
}

UMTS-Flatrate mit T-Mobile’s MultiSIM-Karte

Seit einiger Zeit bietet T-Mobile seinen Kunden eine sogenannte MultiSIM-Karte an. Das bedeutet, dass man mit einem Vertrag und einer Rufnummer bis zu drei Handys nutzen kann. Die Kosten belaufen sich einmalig auf 30,- EUR pro bestellte Karte.

Eine interessante Sache – wie ich finde. Die Frage, die ich mir jedoch gestellt hatte war, ob meine UMTS-Flatrate aus dem iPhone-Paket auch mit einer MultiSIM-Karte funktioniert? Beim Kundenservice von T-Mobile bestätigte man mir telefonisch, dass dies tatsächlich im Zuge des Verkaufsstarts des iPhone 3G ab 11. Juli 2008 möglich sei!

Eine tolle Sache – wie ich finde. Denn jetzt ist es möglich, mit dem iPhone und zusätzlich ohne weitere Kosten mit dem Notebook im Internet zu surfen – ein entsprechendes UMTS-Modem vorausgesetzt.

Vielleicht könnte man sich in Zukunft sogar den DSL-Festnetz-Anschluss sparen!? Vorausgesetzt, dass das UMTS-Netz weiter ausgebaut wird.

Update 12.08.08:
Der Kundenservice von T-Mobile teilte mir heute leider mit, dass die Data-Option nun doch nicht für die MultiSIM-Karten gilt. Irgendwie schade, dass die Bonner hier zurückgerudert sind. :(

Bootcamp – Reading and Writing on NTFS and HFS+ partitions

Apple’s Bootcamp is a fantastic feature for running both Mac OS and Microsoft Windows on a single harddrive side by side. In the setup wizard you’ll mostly put Windows on a NTFS filesystem even if you install Vista/XP on a large-scaled partition > 32GB. However this offers a nasty problem because Leopard is incapable of writing on NTFS filesystems. And on the other hand Vista/XP cannot natively read/write on HFS+ partitions.

A solution for this nerdy dilemma is the usage of additional software that makes Mac OS able to write on NTFS filesystems (NTFS for Mac) and teaches Windows to map a HFS+ partition as a seperated drive letter (MacDrive). The good news are that the range of functions as well as the software’s quality is fine. Unfortunately both tools are only offered under a proprietary closed source license – so the total costs are 58,- EUR :(

Hierarchical IMAP Mailboxes in Apple Mail

Mailbox doesn’t allow inferior mailboxes

If you come face to face with this silly error message in Apple’s Mail application you can simmer down again! I guess you would like to create a new mailbox, right? Often this does not mean that your IMAP server cannot handle hierarchical mailboxes.

If you would like to create a new mailbox that can contain sub-mailboxes, you have add one slash-sign “/” behind the name of the mailbox. Basically this means that the particular IMAP folder may contain subfolders. If you leave the slash out you’ll not able to create sub-mailboxes anymore. That’s it! :)

Parameterized SQL-INSERT’s Using OdbcCommand

Here I’d like to give you an idea about inserting data into a table using parameters within an ODBC command. The reason is that I didn’t find a concrete sample at the MSDN yet :( The following code snippet was written C#:

1
2
3
4
OdbcCommand insertCommand = new OdbcCommand("INSERT INTO table VALUES(?,?)", connection);
insertCommand.Parameters.AddWithValue("param1", "Hello");
insertCommand.Parameters.AddWithValue("param2", "World");
insertCommand.ExecuteNonQuery();