»
S
I
D
E
B
A
R
«
Error: “CGGStackRestore: gstack underflow”
Nov 2nd, 2009 by Anish Kumar

Today while I was working with some CoreGraphics API’s, I encountered a error which I was seeing it for the first time. CG for dumping an error “CGGStackRestore: gstack underflow” in the console everytime I invoked a method that was doing some CG based operations. Googling around I found that in CoreGraphics, you can save (CGContextSaveGState) and restore (CGContextRestoreGState) the graphics state. When the  state is saved, a copy is put on the graphics state’s “stack”, and when it is restored, the top state on the stack is removed and used. If we restore the state more times than we save it and then when we try to remove and use the top item of the stack, the stack is empty, causing a stack “underflow” error. So just make sure you have enough save-restore state methods called and it will fix the issue.

CGGStackRestore

CGGStackRestore

Enable HTTPS On Apache Running On A Leopard
Jul 22nd, 2009 by Anish Kumar

SSL is a big part of building secure web services. The steps outlined below can help generate a certificate for Adobe AIR applications to be signed.

Quick note: This is a fairly detailed process, so take a firm hold of the wheel and be prepared for a lengthy ride. You are going to need your terminal and su access.
You will be generating encryption keys and certificates, and editing Apache conf files.
First, you need a certificate

Step 1

Open up a terminal window, and su root. Then, cd over to your Documents directory.

Add a new directory in there using mkdir and call it certs like so:

sh-3.2# mkdir certs

Then cd into it.

Type this command…

sh-3.2# /System/Library/OpenSSL/misc/CA.pl -newca

You’ll see a whole pile of stuff fly by, piece by piece:

CA certificate filename (or enter to create) (hit enter)
Making CA certificate ...
Generating a 1024 bit RSA private key
......++++++
...........++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase: [enter a passphrase]
Verifying - Enter PEM pass phrase: [enter the passphrase again]
-----

You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value, If you enter ‘.’, the field will be left blank.
—–

Read the rest of this entry »