Archive for category Regular Post

XCode 4 – Stopping in the Debugger on NSAssert

I’m not sure if XCode 4 makes this technique unnecessary. Since I originally wrote this, I’ve seen XCode 4.0.2 stop at NSAssert on its own, without me setting this breakpoint. But it may be helpful to someone somehow. So here it is:

Xcode 3: Run Menu -> “Manage Breakpoints”
XCode 4: Go to the breakpoint navigator.

Click the + button at the bottom of the navigator, select “Add Symbolic Breakpoint…” from the contextual menu that appears.

In the “Symbol” box, enter

Then click “Done”. (NOTE: this is the default assertion handler. If you are using a custom assertion handler, you probably need to specify a symbol for its object and method.)


Now execution will break immediately on assertion failure. And very usefully, XCode shows the nearest source code of the stack, not the assembly of the assertion handler.

Tags: ,

Online Stores and Capped ISP’s; Conflict Looming?

One thing struck me when Apple announced that Mac OS X 10.7 (Lion) would be download-only:  its size.

When they said how many Gigabytes it was, it sounded like a huge chunk of, or more than, many ISP’s bandwidth caps.

And when you add automatic online backups, and uploads and downloads of synced files, I have to wonder how many people will begin getting upset about going over their caps without realizing it.

Update 6-19-11: David Pogue conjectures about the same thing:  http://nyti.ms/mHz4oW

Something about this struck me since I first wrote: many cable providers are now offering access to shows over the internet.  How are they now going to keep their own customers from breaking bandwidth caps with their own services?

If a cap-battle does loom, there is one thing that may be spotlighted they don’t want:  how do they even measure bandwidth in the first place?  Are re-transmitted packets counted twice?  How do customers even know how much they use? And for what?    If a virus starts eating up bandwidth will customers complain that they didn’t know and should not be charged?  What about bandwidth used by programs without customer knowledge?

If you have to know how much you use,  you are going to have to learn a lot about how the internet works.   How many of an ISP’s customers want to do that?

 

XCode 4 and Little Snitch and GitHub

Today was my first try using XCode 4 with GitHub.  When I tried to clone a repository,  Little Snitch dutifully reported it and asked me to approve the connection.  I gave it “forever” permission for GitHub and the git port number.

Just after I clicked it,  I saw that XCode was reporting that permission was denied.

Just pressing “Try Again” got it going, but I noticed that it had created the folder for the repository.  When I clicked the same outer folder, it asked about replacing it and I chose “Replace”.

After it spun for a while, it gave an error about a missing folder for the checksum.  When I looked, the entire repository folder did not exist.  So I tried yet again, choosing the same outer folder.

Finally it completed and my work can go forward.

XCode 4.0.2,  Build 4A2002a

iOS Developers of Orlando Meetup

Meet fellow iOS developers.  April 26th, 2011 at 7:00 pm.

See the Meetup site for details. http://www.meetup.com/Orlando-iOS-Developer-Group/events/17295761/

Free Graphics Editing for iOS Apps: Text

How much of graphics need can I solve with the free apps that come with the Macintosh?  A challenge I had to take up recently when I did not have my trusty laptop and software.

There are of course free downloadable apps out there, but it should still be worthwhile to find a way.

I needed some text on a clear background.  If needed text on a colored background, it would be easy to make it in TextEdit and just take a screen shot.  An application that can do text and  can save as a PNG file can handle this, but what in the standard Mac apps will do it?  Preview. Apple’s free application for viewing images and PDF files. (Surprised? I was.)

Preview’s menus won’t just make a new file, except to paste what was copied into the clipboard. But you can make files of any size easily.  Just start with a bigger file and crop it down (or resize it).  Or, take a screen shot of something with the Mac’s screen capture and use that.  Command-shift-3 is good, but Command-Shift-4 will let you select any part of the monitor while showing you the resulting size.  It can be helpful to capture and image of the layout you want to put the text into. Then you can fit it right the first time.

If you don’t want to accidentally change your base file, make a copy of it in Finder first. Or use Preview’s “Save As” to set the new file and its location.

To get a clear background in Preview, select all or part of the image and hit the delete key.  Poof! Transparent background.

To get text into your file, start by showing the annotations toolbar. You can:

  • Click the “Annotate” button.
  • Use the menu View -> “Show Annotations Toolbar”
  • Use Tools -> Annotate -> “Add Text”

Drag out a text box and layout your text. You can’t set a shadow on the text, but you can do most other kinds of simple text editing.

CAUTION: when you save, all annotation item become images. Preview doesn’t really do layers even though it will keep separate items until you save (none of the formats saved layer information for me. If it does, please tell me.)

If you need layering in the originals to make changes easier, you’ll need a different program. For Preview, you can make new images by pasting original text from another source.

Opening the Inspector will tell you many things about your file. The right-most tab (pencil icon) will let you set colors and other attributes of the annotation items. There’s more, but perhaps that’s for another post.

Enjoy

Quick Tip for Mac VNC

Have you found the Mac’s built-in “Screen Sharing” application?  But you are a bit tired of going through the motions of typing the address, then username and password? Have you noticed that “Screen Sharing” won’t save a file with the destination?

Go to Safari and type the URL,  “vnc://targetComputer” and press return.  Safari will start “Screen Sharing” and make it open the connection to targetComputer.   Now you can drag the URL icon out to the desktop.  If you double-click that icon, screen sharing starts up and connects to the server.

You can add usernames and port numbers like this:   “vnc://username@targetComputer:portnumber”

Quick and Easy.

Enjoy

Re-ordering arguments in a format string.

Here’s a point I had to dig out while trying the “positional specifiers” from the “String Programming Guide”.

I was creating strings using “stringWithFormat” and needed to change a string being sent to a server and wanted to avoid changing code if possible.  But after many tries at changing parameters to things like “%2$@,  %3$@”, the result was not changing.

It turned out that for re-ordering to work, you must use all of the arguments supplied in the method call. I was trying to leave out argument 1 (on purpose) and that caused the order numbering to be ignored.

Since my result was XML,  I just put the unneeded string into an XML comment at the end of the result and that worked.

(I have not tried to find out what happens if I use an argument more than once.  But I have seen that giving less arguments than in the format string can make an app crash.)

Orlando Business Expo for Users of Apple

If you use Apple equipment in your business near Orlando or Central Florida, or you develop software for iOS devices like iPhone or iPad, then Loop Business Expo may be for you.

It will be held December 8, 2010 at the Hilton near SeaWorld and the Orange County Convention Center.

There are meetings for iPhone developers,  maybe I’ll see you there.

Idea: Better Compression by Organizing Input?

Well, probably lots of people have thought of this, but since I was remembering thinking about it, I thought I’d post it.

Compression has been described to me as the art of removing redundant information or as the art of finding patterns and using them to reduce redundancy.   Since I’ve been archiving some information lately,  I wondered if the compression could be influenced by gathering up similar files while compressing groups of them.

For instance, if all the Word documents in the folder being compressed were taken together, would the compression algorithms achieve better results than if the files were presented in some random order with other file types?

Well, long-time compression utilities like ZIP, GZip, and StuffIt  probably already do this. But its always good to keep looking for a better way. (Maybe I’ll call it  “looking for n – 1” or “n -= 1” ).

Compile!  (Just struck me as sounding like Klingon “Qapla'”. )

Happy and Disappointed

Update 2: The Kindle For Mac application has been updated with the ability to search the books.  I presume the same is true for the other platforms. With the ability to search, the book’s index is not needed.

Two sections are still missing from the Kindle book: “Notes” (presumably end-notes) and  the Bibliography. Both of these do provide good information, clarifications and source information.

—————

Update: Dorset House publishing responded to my email expressing all this.  They offered me a refund and I accepted it.  They also expressed many things and seemed to consider my suggestions very nicely.  I do have good feelings about the company and feel that my purchases with them are safe. It seems both odd and reassuring to work with real people in an online purchase.  I have gotten spoiled a bit by the instant gratification of buying from machines, but it is nice to get some human attention when I needed it.  I hope to see more from them in future.

—————

A few days ago, I found out that one of my favorite industry books was released as an eBook.  “Peopleware: Productive Projects and Teams”  (2nd edition) was a lucky find for me a long time when my wife gave me the audio version as a gift.

I’ve since bought paper copies of both editions and marked them up pretty well (with highlighters, marker tabs, etc.  You can tell the book belongs to an engineer.)

I’ve looked for an eBook version for a while. Recently, when I was trying to reference the book’s principles for a discussion on employee reviews, I happened to look back on the Dorset House website. They finally released it as an eBook for $9.99. And they accept PayPal. (Credit card only by phone.) Well, that was the high-point.

As it turns out, once you make your Paypal payment, a human will eventually send you an email for the download on the next business day. (I sent my payment on a Saturday. I got my email on Monday. Very disappointing for electronic markets. Sadly ironic, given the nature of the publisher’s content.)

Once I got my PDF file, it turns out that only a few pages contain actual text.  The large majority of the pages are images.  The images are quite fine.  You can zoom in quite a bit. However, the individual characters are some kind of screened black-and-white dots, not grey-scaled images.  It may be that the scans came from the original press files. Or it may just be they rendered the book out to this format for some kind of copy-protection.

So, a great book, but delivered a bit slowly, and it is not searchable. Also annoying, the table of contents doesn’t even link to other parts of the book and the page numbers in that TOC don’t align with the PDF page numbers. (The book’s page 3 is the PDF’s page 20.)  Using images for all the pages makes the file bloated too.  It weighs in around 70 megabytes. An eBook on iPhone development that I purchased from O’Reilly, for comparison, was fully searchable, and only required 6.5 megabytes of space.

So, the eBook is good if you are just reading the book.  I do recommend this.  But for a reference, there is little advantage over the paper book. The price is lower than the paper though.

PeopleWare $9.99 purchase link: http://www.dorsethouse.com/books/PW-ebook.html

Looking for a contrast while writing this, I looked at the Kindle we use.  A few moments later, I realized the book is available for Kindle.  I’m kicking myself now, because I looked for a Kindle version the same day I found the PDF version at DorsetHouse.com.  I thought it was NOT available as a Kindle book.  And it is the same price on Kindle.

In contrast, now that I’ve purchased the Kindle version too, it seems to be a full eBook.  The Kindle reader on my Mac still suffers from a lack of search, but the table of contents does link to the targeted page and the type is fully resizable. And since the Kindle device is able to search the text of the books, I will assume that the Kindle book will be fully searchable when the reader in use can search.  That’s MUCH better.