I’ve written a simple SQLite Wrapper with two Examples one for Mac and one for the iPhone. The Wrapper class has the same source code for both platforms.
In the last days I’ve played a bit with C libraries like OpenSSL and SQLite. The first post after Site downtime is dedicated to OpenSSL.
how do can you create your own license system for your application? With OpenSSL and less than 10 lines of code, you can do it. Take a look at the code below.
...
unsigned char checkDigest[SHA_DIGEST_LENGTH];
unsigned char shaDigest[SHA_DIGEST_LENGTH];
const char *userKey = "Matteo License";
unsigned char *signature = NULL;
unsigned int signatureLength = 0;
/* Generate Your RSA Key Pair */
RSA *rsa = RSA_generate_key(512, RSA_F4, NULL, NULL);
/* Generate SHA1 of User Key */
SHA1(userKey, strlen(userKey), shaDigest);
/* Create License Key for the User Key */
signature = OPENSSL_malloc(RSA_size(rsa));
signatureLength = RSA_private_encrypt(SHA_DIGEST_LENGTH, shaDigest,
signature, rsa, RSA_PKCS1_PADDING);
/* Check if User Signature is a valid License Key */
if (RSA_public_decrypt(signatureLength, signature, checkDigest,
rsa, RSA_PKCS1_PADDING) != SHA_DIGEST_LENGTH)
{
/* Valid License Key */
} else {
/* Invalid License Key */
}
free(signature);
RSA_free(rsa);
...
You need to store the RSA Public Key in your app and then give to each user a generated signature, and it’s all.
Ok, this is a really base example (less than 10 lines of code) if you don’t want reinvent a License Key system, take a look at AquaticPrime Framework (http://www.aquaticmac.com/).
Today I’m playing a bit with Quartz and Cocoa Drawing system (that is based on Quartz).
I’ve made a simple example that you can see below where I’ve used custom NSView that draws an Image and a Bezier Path with some text inside, and around the Bezier Path there’s a Shadow.
Cocoa Drawing Example
…And this is the drawRect method source code of the custom NSView.
It’s a couple of days that I’m searching for something like QHBoxLayout (Qt Horizonal Box Layout) in Cocoa. There’s NSMatrix that do something like this… but it uses NSCell and it sets the same size for all the cells, so this is not what I want. My solution is a simple NSView subclass…
Quick Look is a technology introduced in Mac OS X version 10.5 that enables client applications, such as Spotlight and the Finder, to display thumbnail images and full-size previews of documents.