André's Blog

PHP, Zend Framework, Mac/Cocoa Programming

Phonebook/NSTableView Tutorial for Dummies(Xcode 3.1.3)

with 15 comments

Introduction

This tutorial explains how to create a simple phonebook with a search function which will look similar to this:

Phonebook Tut Step 1

The following things will be covered by this tutorial:

  • creating a window with a drawer
  • feeding a NSTableView with an NSArrayController
  • search in the table using NSPredicate to filter the array

Read the rest of this entry »

Written by andrehoffmann

September 3, 2009 at 3:02 pm

NumberStepper Tutorial for Dummies(Xcode 3.1.3)

with 4 comments

Introduction

This tutorial will show you how you can combine a NSTextField and a NSStepper to create a control that can both be typed into and stepped up/down.

NumberStepper Tut Step 4

Read the rest of this entry »

Written by andrehoffmann

August 29, 2009 at 10:19 pm

NSCollectionView Tutorial for Dummies (Xcode 3.1.3)

with 37 comments

Note: I wrote this tutorial since I believe that there are way too few resources on the net covering this topic and I would have been wasting way less time if I had found something like this. Please keep in mind that I’m a ObjC-beginner myself.

Introduction

This tutorial is written in a way that it doesn’t require much knowledge of cocoa/objective-c, but since I’m not explaining most of the code, programming experiences will be helpful to understand what you are doing.

The following things will be covered by this tutorial:

  • designing a user interface with buttons and a NSCollectionView
  • designing a Subview which should be displayed in the CollectionView
  • feeding the CollectionView using an ArrayController
  • making the items in the CollectionView selectable

This is what the final application at the end of the tutorial will look like:

NSCollectionView Tut Step 13

Read the rest of this entry »

Written by andrehoffmann

August 29, 2009 at 7:29 pm

Zend_Locale_UTF8: Functionality Update

with 2 comments

I finally found the time to add new functions to Zend_Locale_UTF8:

Still missing are: Unit-Tests, ctype functions, mbstring and PHP6 support.

So long.

Written by andrehoffmann

October 15, 2006 at 3:22 pm

Initial Release of Zend_Locale_UTF8

leave a comment »

I just released the first version of Zend_Locale_UTF8.It doesn’t come with all functions nor with the best performance, but it shows how the current state of development is.Missing features:

  • Unit-Tests
  • substr()
  • strrpos() (not such a big of a deal as it’s basically the same as strpos, I just wanted to make a cut at some point)
  • strtr()
  • strtok()
  • PHP6 support
  • mbstring support

Now that the basic functionalities are implemented it will be easy to code the other stuff.

Next draft: Unit-Tests

PS: Thanks to Willie and Andries Seuters who helped me to find a bug yesterday that’s been pausing the development for quite a long time.

Now I’ll give a little insight on how to use Zend_Locale_UTF8:
/*
* the api basically looks like the one of a java string object,
* so if you know java these examples should look very familiar
*
* @see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
*/

require_once ‘Zend/Locale/UTF8.php’;

//let’s create a string..
$string1 = Zend_Locale_UTF8::string(‘schön, señorita, ﻹډ, €’);

//let’s output it
echo $string1;

// and convert it to upper case
echo $string1->toUpperCase();

//to lower
echo $string1->toLowerCase();

//create another string
$string2 = Zend_Locale_UTF8::string(‘señorita’);

//and look where it can be found in string1
echo $string1->indexOf($string2);

//this works as well:
echo $string1->indexOf(‘,’);

//now lets check whether or not $string2 can be found in $string1
echo $string1->contains($string2);

//again, this works too
echo $string1->contains(‘señorita’);

//output the length of string1
echo $string1->length();

//let’s output the character at position 3
echo $string1->charAt(3); //ö

Written by andrehoffmann

October 3, 2006 at 3:56 pm

Zend_UTF8 – New API Design

leave a comment »

A while ago, I designed the API of Zend_UTF8 to be similar to PHP5′s string functions. So f.e. you just would have had to call Zend_UTF8::strlen() to get the length of a string. I actually wanted to do it that way for PHP6 compatibility reasons.

I gave up on that, as its performance is just too bad. Instead of that, there’s going to be a string object (basically the same API as the Java String Object, so Java developers should be familiar with it) which allows to perform way better, since a string becomes a constant and it won’t have to do the UTF-8 transformation over and over again. There is also going to be a string object for PHP6 which basically does the same while using the PHP6′s string functions.

That might result in more work once we raise the Zend Framework’s requirements to PHP6, but till then it will perform better, which in my opinion is way more important.

Written by andrehoffmann

September 27, 2006 at 11:42 pm

Welcome

with 4 comments

As certainly no one is reading this I’m just gonna take the chance and congratulate myself on the new blog I just set up ;-)

Written by andrehoffmann

September 27, 2006 at 5:21 pm

Posted in General

Follow

Get every new post delivered to your Inbox.