Jourdein

I code, I experienced, I blog and I share my enthusiasm

RSS
people

Array Controller bounded to an Array

I was scratching my head of why the heck does the my tableview does not automatically update its data.

My binding:

NSArrayController = ACIssues
Controller Class = Issue Controller (have NSArray property subviewControllers)

ACIssues has it contentArray binded to subviewControllers’s array in Issue Controller. Somehow, changes made to the array of subviewControllers in Issue Controller does not reflect on other table which I had it binded to ACIssues.

After searching the internet, I found this

http://boredzo.org/blog/archives/2008-11-26/how-to-work-with-a-bound-to-array (open in new window)

Very good one. What it said… There’re right and wrong way to bind.

The right way is by using indexed accessors. Then, your Array Controller will see any changes you’ve made. What I did was creating indexed accessor methods.

- (void)insertObject:(id)object inSubviewControllersAtIndex:(unsigned)index {
[[self subviewControllers] insertObject:object atIndex:index];
}


- (void)removeObjectFromSubviewControllersAtIndex:(unsigned)index {
[[self subviewControllers] removeObjectAtIndex: index];
}

and calling it where I wanted to change the array.

[self insertObject:obj inSubviewControllersAtIndex:(index + 1)];
[self removeObjectFromSubviewControllersAtIndex:index];

the structure of this indexed accessor:

insertObject:(id)object inKeyAtIndex:(unsigned)index

where key is the property or in my case array that is binded to the Array Controller.

No Comments | Tags: , , , , ,

301 or 302 or Meta refresh tag

I did a google search on which is the best one to use to redirect page from another. I had this in mind, whether to use meta tag refresh or 301 redirect in htaccess file. I was afraid that using meta redirect would be rank penalize by google.

After the search, the safest way to redirect is to use 301 redirect. To do 301 redirect you just need to add this code in .htaccess file in the root directory:

RewriteEngine On
Redirect 301 /index.html http://mydomain.com/blog/

You might be asking what is meta fresh tag… It just a simple html code put on the top of the html file that redirect user from that page to another page. It look like this:

<meta http-equiv="refresh" content="0;url=http://www.anotherdomain.com">

Here I’ve got some good illustration of the what those mean with other types or redirection.

redirection cartoon illustration

Here is the link which I referred to (all links open in new window):

No Comments | Tags: , , ,

Otai post on sweetcron modification

Azri has uploaded sweetcron modification code to change option.
http://codegenius.wordpress.com/2008/12/31/adding-new-option-in-sweetcron/#more-7

No Comments | Tags: ,