Displaying articles with tag theunboundword

coarse granularity can be a good thing

Posted by matt, Fri Jan 18 23:34:00 UTC 2008

Every so often a bug comes along that ends up being a pain to get around. Unfortunately there are even those out there which have very little documentation on the correct use of the api required. So, many days were spent devouring internet sources for any and all documentation on NSURLDownload. All I could find though was sparse bits of open source code and apples documentation. The open source code is usually a gold mine for figuring out what I wanted, but alas that wasn't the case. The code was either undocumented or so convoluted that following it would be a week long effort of itself.

So, I turned to the Cocoa development lists provided by Apple. These guys are top notch in the majority of cases and often rather helpful. In this case, not many of them had the expertise in using the api calls I was. This then caused me to be left with playing around on my own.

Having some experience with Mathematics, I placed in that part to get what I wanted. This though caused values which were often ridiculous. I couldn't figure out why. I even went to the extent of making the method thread safe so that values weren't overwritten. This though proved to be futile.

My second attempt at fixing it was to place in if statements so that the value was reset after a certain time interval. This still proved the same results.

So, what was wrong?

I then thought that I should, just for the fun of it, see the values that I'm actually getting back from the method. And this is where I found the problem to be. The values that I was getting were very close to zero. They were that small.

So, as it happens when you divide a large number (number of bytes received) by a small number (time between packets received) you get something that is ridiculous. It all started to make sense. I was doing the calculations way too fast. This became a relief and I could simply place in an if statement that delayed the calculation until the duration was longer than one second.

 

Now since there is very little documentation of calculating the rate of a download I will place in the required method here.

- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(unsigned)length

{

bytesReceived += length;

tempBytesReceived += length;

[self setPercentageComplete:[[NSNumber alloc] initWithDouble:((bytesReceived / (double)expectedLength) * 100.0)]];

duration = [lastPacketReceived timeIntervalSinceNow] * -1;

if(duration > 1) {

bytesPerSecond = tempBytesReceived / duration;

kilobytesPerSecond = bytesPerSecond / 1024;

tempBytesReceived = 0;

lastPacketReceived = [NSDate date];

}

}

 

God bless,

Matt.

0 comments | Filed Under: | Tags: theunboundword

40 degrees, a couch and air conditioning

Posted by matt, Thu Jan 10 09:55:00 UTC 2008

Melbourne unfortunately has a rather unique weather pattern. One day it can be a mild 25 degrees and the next an unbearable 42 degrees. Thankfully, there is but one room in my house with air conditioning and it just happens to be the one with a nice comfy couch.

So, this day has turned from something that could have been rather uncomfortable into one whereby I have been surprisingly productive. I have spent much of the day getting data presented properly in TheUnboundWord. That is, there was a lot of information relating to the podcasts that hadn't been handled properly, so today was spent generating the code required to populate that data.

So, for today's efforts there are two nice new screenshots.

 

God bless,

Matt

0 comments | Filed Under: | Tags: theunboundword

Why and when coding is fun

Posted by matt, Wed Jan 09 06:27:00 UTC 2008

For me, work should always be fun. If it isn't fun, it just doesn't get done.

So with a total of $0 raised so far, many people would call it crazy that I still sit in front of my mac each day and code. So in order to clear up any perceived misconceptions about what Reformed Software is all about I will reveal how spending time working on the projects such as TheUnboundWord is fun.

 

When solving a problem: this is the joy of any engineer or programmer. When an engineer is solved with a problem, they don't rest easy until that problem is solved. I don't just mean a quick hack to solve the problem, I mean a proper solution that involves design, testing and investigation.

When the software has a purpose: many times, developers work on projects that they simply don't want to use or will never use themselves. At Reformed Software, the software developed is actively used by the developers. TheUnboundWord started as a need that I had whilst listening to podcasts, and though it is in the early stages of development I actively use it.

When the software is well designed: A good design is always needed and this is pivotal to creating a solution. The design allows for problems to be mitigated before they occur and results in coding being about implementing features rather than fixing bugs.

When the software is documented: When working in a group, documentation always seems tedious, yet when it comes to working with code written by other developers if it isn't documented then all fun gets taken away as you have to figure out their mindset.

 

So, just a couple of thoughts about why and when it is fun coding at/for Reformed Software.

In more general news, testers are still required particularly if you live in Melbourne Australia. Contact Matt at ReformedSoftware dot com for details.

 

God bless,

Matthew Delves.

0 comments | Filed Under: About | Tags: theunboundword

When a long time is really #defined as a short time

Posted by matt, Sat Dec 29 00:30:00 UTC 2007

As it turns out, my troubles were due to the way in which I was using growl rather than anything else.

Thankully, the helpful developers for growl (well, adium) were willing to look over some sample code and pointed out to me what is was doing wrong. As it happens, I was under the impression that GROWL_NOTIFICATIONS_DEFAULT was needing to be passed as @"GROWL_NOTIFICATIONS_DEFAULT" to the key argument of [NSDictionary setObject: forKey:]. I unfortunately forgot that ANYTHING_SPELT_LIKE_THIS_IS_USUALLY_A_DEFINED_STATEMENT.

Once this was pointed out to me, I was then able to get growl working properly.

My hat comes of in regard to the developers who helped me out. This is one of the many things I do love about the mac developer community.

This now means that the alpha release is going to be up and running during early January.

God bless,

Matt.

0 comments | Filed Under: | Tags: theunboundword

The last task may take a while

Posted by matt, Fri Dec 28 06:36:00 UTC 2007

So development of The Unbound Word has progressed to a stage whereby it is almost ready for an alpha release. Though there is still one task left to go.

That task is growl notifications. This may be a rather trivial task, though unfortunately as The Unbound Word uses garbage collection, growl notifications are a no go. This is simply due to the growl.framework not being compiled with -fobjc-gc or -fobj-gc-only.

Though growl.framework can be recompiled to use -fobjc-gc or -fobjc-gc-only, the default notifications aren't picked up by growl. This makes me sad, though as I'm not involved in the development or maintinance of growl I have no right to complain. This does though leave me at the mercy of the growl developers to some extent with what features I want available in the alpha release.

Things are still looking up for an early January release which makes up for it to some extent.

God bless,

Matt

0 comments | Filed Under: | Tags: theunboundword

Appcasting and spelling mistakes

Posted by matt, Mon Dec 24 09:52:00 UTC 2007

As development progresses full steam towards a release, I have been putting in some bells and whistles that will make TheUnboundWord just that little bit easier to maintain with regards to having the app tested by a wide range of people.

Though things are moving forward, there is still a fair bit of administrative work that I need to do before releases are ready for testing. With any luck, trust is warranted and disappointment lacking.

Today's fun though came in the form of spelling mistakes whilst playing around with the Sparkle framework that makes appcasting a possibility. I unfortunately had incorrectly copied the example from the documentation which resulted in sparkle not identifying where to pick up the rss feed from. This resulted in a lot of frustration as I scoured documentation and setup logging on my dev server so that I could try and track everything. Eventually, the erroneous character was a double u.

After clearing this up, sparkle worked like a charm.

 

As the season is upon us, a merry Christmas to you all as you remember the birth of the Lord Jesus Christ and to all a good night.

God bless,

Matt.

0 comments | Filed Under: | Tags: theunboundword

Downloading bugs is a bad idea

Posted by matt, Fri Dec 21 06:32:00 UTC 2007

NSProgressIndicators are notorious things, particularly when trying to shove them inside of an NSCell. This has been a thorn in my side since working on managing downloads and also giving feedback as to how they are going.

Problem number one is that there is no easy way to implement an NSProgressIndicator inside of an NSCell. In order to do this, the instance of the NSProgressIndicator needs to be added as a subview to the control view of the NSCell.

This though took many times to figure out with regards to just how to draw the NSProgressIndicator properly and more importantly who had ownership of the NSProgressIndicator.

Though the fun doesn't end there.

The biggest fun came when I tried to remove rows of completed downloads from the NSArrayController subclass. This proved a huge problem as though the rest of the row were deleted, the NSProgressIndicator instances remained.

Eventually, after much frustration and headache, the culprate was found. Every time the drawWithFrame: method of the NSCell subclass was called, I was adding the NSProgressIndicator instance as a subview of the control view. This resulted in many redesigns and refactoring of the code till I found a way of only having one NSProgressIndicator for each row added and even removing it at the correct time.

The final result after many days was a working download window who's objects could be removed once downloaded.

God bless,

Matt.

0 comments | Filed Under: | Tags: theunboundword

The Unbound Word - teaser screenshots

Posted by matt, Sat Dec 15 03:05:00 UTC 2007

The Main window

The Download Window

The Media Window

0 comments | Filed Under: | Tags: theunboundword