convenience-methods

Dealing with objects returned from cocoa convenience methods

I'm having a lot of issues with NSDate objects being prematurely deallocated. I suspect that the issues may be related to the way that I deal with the objects returned from NSDate convenience methods. I think that my showDate property declaration in the JKShow class should be "retain", but changing it to assign or copy seems to have no e...

Memory Usage on convenience method vs init method

Recently when I looked into iPhone memory management, I tried to compare the convenience method and init method on the same object. For example, I have UIImageView where it displays a downloaded NSData: Convenience method: imageView.image = [UIImage imageWithData:[downloads dataAtIndex:0]]; init method: UIImage *aImage = [[UIImage a...

Is it possible to type style sheets in Firebug fast and convenient ? (as in Aptana)

For example, when I type the first of the parenthesis in Aptana, the second appears immediately, then I need only to press enter, it makes some white space, and I can type further. A small feature that saves a lot of time! But in Firebug it is not. So, is it possible to use that feature in Firebug? Is there any Firebug's plugin that all...

Class design: allow a class to be used both as an object and also supply public static methods

I have a silly, little class "FileSystemSize" which can be used both as an object and also via public, static methods. The output is similar, but not identical in each case. The class was intially static, but I added the possibility to initialize it as an object to allow extending with new "convenience methods" in future versions, witho...

How to normalize a NumPy array in Python?

After doing some processing on an audio or image array, it needs to be normalized within a range before it can be written back to a file. This can be done like so: # Normalize audio channels to between -1.0 and +1.0 audio[:,0] = audio[:,0]/abs(audio[:,0]).max() audio[:,1] = audio[:,1]/abs(audio[:,1]).max() # Normalize image to between...

Simple/Direct/Heredoc way of constructing a HTML string in Java

In python I can construct a HTML string without worrying about escaping special characters like < or " by simply enclosing the string in triple quotes like: html_string = """ <html> <body> <p>My text with "quotes" and whatnot!<p> </body> </html> """ Is there a similar way to do this in Java? ...