Mathieu Tozer's Dev Blog

Cocoa, the development of Words, and other software projects (including those dang assessment tasks).




Me, a little managedObject

0 comments

I spent last night as a peaceful managedObject in his managedObjectContext, without worrying one little bit about all the programming and structure that I was being subjected to in the middle of the night.

I never used to be able to sleep after a serious bout of code, but it seems like as you do more code, you become more content with a nights sleep as an object being pushed around by while loops, being enumerated, and being smothered in objective-C wrappers, or as previously, spending the night as a well formed ascii file.

Has anyone done any reasearch into this thing? I know it's not a programming only thing, but it's when I get it the worst. I'd like to think that it has something to do with the brain learning tings subconciously.


Revolutionary new Asset Downloader!

0 comments

I need to bind something to all the words, so what about (yet
another) NSArrayController that always has in it all the words, and
knows about the changes within, so that it can do the stuff like
unpack the definitions for me, and update the UI as needed. Such an
object specifically designed for this purpose might be handy.

Rubbish all the above. All I needed to do was unpack it in the
WordMO. The distributed objects system did all the thread switching
for me!

Moving right along, I need to fix stardicts, because they're kind of
powerful and a major plus for users.

Because it's late, and because I want to, I'm going to work on my web
view downloader. Let's get dictionaries to the people, baby.

Yay! It's 2.40 AM, but I whittled away at it and I can now drag and
drop from a web view to download files. There's a really neat class
called NSURLDownload which is like fully threaded and sick man and
you can even have like progress meters and shit.

Ok bed time.


Threading Issues

0 comments

Turns out my sneakly little plan to squeeze information back through
the managedObjects attributes into the main thread is working out. I
AM using a NSMutableDictionary and NSArchiver in the thread, but the
other thread isn't actually working on the objects I create with
those classes, so I'm hoping that will be ok?

I create a dashboard for each word, then archive it up and pop it in
the dashboardData attribute in the managedObject, which has been
passed to the thread through the communications port set up when the
worker thread is instantiated.

The information seems to get though the thread wall ok. My next job
is to unarchive it on the other side and put it where it belongs, as
blob managedObjects in the managedObjectContext proper.


Ahh Finally some progress!

0 comments

I'm trying to think of a way to deal with the bloat in my
NSArrayController subclasses, particularly to deal with the issue of
fetching and updating... although it might not actually deal with the
issue... but it would certainly cut down on bloat in those array
controllers.

Here are the symptoms
Words are inserted into the moc
'old' smart lists don't update themselves
'new' smart lists will

So it's almost certainly an issue with the predicates save/refresh
cycle.

I think it has to do with my SmartGroup class. It's a bit of a hack
really. And it also might have something to do with the way I
identify smartgroups and tie them to languages, and how the simple
name value of the language is what is used to fetch words. I think it
would me more intelligent and better design to use the objectID as
the key across the system for language, and to get the name of the
language as needed.

I designed it this way because back then I didn't even realise the
all objects had an ID (well it's obvious NOW) that I could use to
identify the languages uniquely.

I had the idea of doing this, but I found I couldn't set an entire
entity object into a predicate field, but now I can get an object ID
string which will do the same thing as having the object itself.

So while I'm fixing this, I'm also going to try and iron out a few of
those warnings and things which also might be stuffing me around.

Nope, even forcing object directly into the ManagedObjectContext
doesn't fix the problem (it actually causes problems with updating).

What about this idea. What if all I store is a predicate string, and
then when the group is loaded, all it does is force a filter on the
words array controller, so that it filters out the words that I want.
Filtering works nicely. And I can set filter predicates programatically.
So bind the filter predicate of the words array controller to the
selected group of the group array controller. But let's test this now
with that playgroud tableview I set up.

Woah if this thing works, then I have a big lesson to learn about
chucking one's own hard earned code away. I DID have this idea
several times in the past... I hope to high heaven it works!

Tough Titties!
Bad code is bad code.

Hey, it actually feels good to delete it all! And guess what, most of
it was complicated scwisseling code from the CoreRecipesApp anyway.

It IS noticeably slower, so I won't delete that caching thing just
yet. Well it worked just then. Perhaps it's tempremental.
Nevertheless, I have fixed a major bug anyway. Now I have to hook the
other stuff up again and hope it keeps on working!


+RSS | dev blog | Portfolio

About me

My status

Last posts

  • my del.icio.us
  • my flickr