Posts Tagged 'Programming'

XML Interchange: Fremont

So let’s say you’ve got XML parsing needs more complex than RSS reading, or even worse, you actually have to exchange data with some back end service in XML format. Lot of work ahead? Well, maybe not, check this out:

Fremont XML Library – “The best XML code is code that you don’t have to write.”

If you are developing software programs that integrate with external systems, be they client/server or web-service based applications, it is highly likely you’ll cross paths with XML as a data interchange format. As the number of XML messages that must be exchanged grows, the need to write XML parsing and generating code becomes very redundant. After encountering this XML coding requirement in app after app, we decided to eliminate this repetitive coding task. The result: Fremont XML Library.

Built for iOS, Fremont is an Objective C static library which provides serialization and deserialization capability between XML documents and Objective C object hierarchies. Development requires declarative definition of the mapping between XML document structure and Objective C class structure in XML format. Fremont uses this mapping, or model definition to do all of the work in translating between structures.

Eliminate the need to do XML coding, and save countless hours of development time!

Well, that sure sounds appealing, doesn’t it now? Source is on github, go wild!

h/t: @osxdevel!

Continue Reading →
1

SSToolkit

Here’s a nice collection of UI classes and category additions for all kinds of little conveniences: SSToolkit. Fairly straightforward most of them, some particularly interesting ones like SSCollectionView for a selectable grid,

Screen shot 2011-02-18 at 10.40.48 PM.png

and SSPieProgressView for cute little round progress indicators,

Screen shot 2011-02-18 at 10.40.58 PM.png

so grab the code off github and check out the goodies!

h/t: @dylan_beadle, @ray_wenderlich, ManiacDev!

Continue Reading →
1

applitude

This is kinda interesting: Ever heard of the Xtext language development framework?

With Xtext you can easily create your own programming languages and domain-specific languages (DSLs). The framework supports the development of language infrastructures including compilers and interpreters as well as full blown Eclipse-based IDE integration…

Well, there’s a project called Applause to apply it to creating mobile apps, and applitude is its iPhone-only version:

applitude comes with a domain specific language (DSL) to express commonly used elements of iPhone applications in a very dense format. This language is made-to-measure to express iPhone apps, so instead of keywords like if, then, while it has keywords like contentprovider, tableview or cell…

The upshot is that you can write out a high-level description of your program components and get a functional Objective-C project spit out, like the example of 59 lines flat to produce this JSON data loading example:

applitudedemo.png

So if you really wish you could write iPhone programs in Eclipse, and have a good bit of free time on your hands,

… applitude is intended as a tool for developers who like tinkering with own tools and languages. Please don’t use applitude if you don’t feel comfortable with solving issues around such a tool yourself …

– hey, looks like fun!

h/t: @iPhoneDevGuy, ManiacDev!

Continue Reading →
0

Tip: NSDateFormatter Localization

So you’re checking out the Japanese localization on your latest project, and hey that’s odd — your NSDateFormatter that you set to [NSLocale currentLocale] is producing output rather unJapaneseish:

defaultlocale.png

Turns out, as described here on Stack Overflow, [NSLocale currentLocale] on a system with a Japanese calendar returns en_US@calendar=japanese even if the user language is set to Japanese. That seems like a rather strange and probably incorrect default behaviour, does it not?

The solution is to set it to the locale of the user’s preferred language,

[dateFormat setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]] autorelease]];

which produces the rather more Japanese appearing

japaneselocale.png

So … apparently if you want your localizations to actually work as a local user is likely to expect, you should adopt that language-based locale creation scheme. Anybody have any clue why the default works that way and if this scheme actually is the best practice?

UPDATE:

And if you’re wondering why your NSDateFormatter date code breaks in iOS 5, why yes your NSLocale may be at fault there too:

… This is an intentional change in iOS 5. The issue is this: With the short formats as specified by z (=zzz) or v (=vvv), there can be a lot of ambiguity. For example, “ET” for Eastern Time” could apply to different time zones in many different regions. To improve formatting and parsing reliability, the short forms are only used in a locale if the “cu” (commonly used) flag is set for the locale. Otherwise, only the long forms are used (for both formatting and parsing). This is a change in open-source CLDR 2.0 / ICU 4.8, which is the basis for the ICU in iOS 5, which in turn is the basis of NSDateFormatter behavior…

Now you know!

Continue Reading →
1

AppKit Drawing

Good post over at Cocoa with Love on doing pretty drawing using AppKit:

iconapp.png

In this post, I’ll look at drawing a detailed image in code by combining multiple visual elements. Unlike previous posts I’ve done on drawing in Cocoa, this will focus on the AppKit classes. The code will use NSGraphicsContext, NSBezierPath, NSAffineTransform, NSGradient, NSGlyph and show you some simple ways to export the contents of an NSView to a file…

Most of it ought to be somewhat straightforward to adapt to Core Graphics on iOS as well, for when you want your interface to look just that shiny. Oooh, shiny!

Continue Reading →
0

cocos2d AI: Troll Boss

So you may recall that we’ve been reasonably impressed with The iPhone Game Kit as an introduction to game programming in general and the iPhone with cocos2d in particular, especially the community development project they started with their customers; seems that’s coming along nicely, and they wrote recently to give us a heads up on a piece they’re putting out there for everyone:

AI: What cocos2d Cannot Do

The iPhone Game Kit has always provided the basic framework for creating artificial intelligence. Since day one, we’ve been showing you how to make skeletons seek, attack, and even dance. Now we will show you a few more advanced tricks, like how an enemy can perform ranged attacks, special attacks, flee, teleport, and yes, burp out crazy windstorms which send the player spinning…

And of course they pretty much guaranteed a mention here by making the example a Big Troll.

Screen shot 2011-02-14 at 11.37.31 PM.png

Fear the mighty TROLL! ARRRR!

Any-ways, it’s a nice walkthrough of adding moods, special attacks, and so forth to your cocos2d actor objects, definitely worth a read through and considering more seriously picking up that iPhone Game Kit thing if you haven’t already!

Continue Reading →
0

Resource Checking: Cong

Here’s a handy tool for running over your OS X apps to look for resource issues — Cong:

What is Cong?

To check for leaks, you use leaks or Instruments. To check for obvious (or less obvious) bugs, you use gcc and LLVM options, or you use the Build and Analyze feature of Xcode. To check that your code works, you test it. But what do you use to check the resources of the bundle of your application? Say hello to Cong.

Checking what is obvious to stop being oblivious

Cong checks multiple points and details that can seem obvious but which are not always known by everyone. Your application may be running fine, may have won Awards and still be not perfect. For instance, did you know that there is a limited set of characters allowed for a bundle identifier and that ‘_’ (underscore) is not one of them? Did you know that the recommended encoding for .strings files is UTF-16? Did you know that the CFBundleGetInfoString key is deprecated for Info.plist files?

Looks handy, yep. So we ran it over our last OS X release, and …

Screen shot 2011-02-13 at 11.57.22 PM.png

… and so it actually is handy. Fancy that. OK, straight into our regular toolchest that one goes!

h/t: xcode-users!

Continue Reading →
1

RSS Parsing

So today we had a little trifle to knock off that features reading a blog feed and a Twitter feed … from accounts written to in Japanese. So rather than repurpose some of the XML parsing code we’ve used before for that kind of thing, especially since said code was written in an, ah, expedient fashion that required some knowledge of the feed’s contents, figured we’d look around a bit and see what we could find in a dedicated and reusable feed parser. And why yes, yes here is a very nice one indeed:

MWFeedParser — An RSS and Atom web feed parser for iOS

MWFeedParser is an Objective-C framework for downloading and parsing RSS (1. and 2.) and Atom web feeds. It is a very simple and clean implementation that reads the following information from a web feed:

Feed Information

  • Title
  • Link
  • Summary

Feed Items

  • Title
  • Link
  • Date (the date the item was published)
  • Updated date (the date the item was updated, if available)
  • Summary (brief description of item)
  • Content (detailed item content, if available)
  • Enclosures (i.e. podcasts, mp3, pdf, etc)
  • Identifier (an item’s guid/id)

Nicely done bit of work it is too. Very easy to integrate indeed, compiles cleanly, helpful example source for displaying feed and items, handles — as far as we can tell — Japanese text in both a Feedburner blog feed and a Twitter feed with perfect aplomb. Highly recommended as a start for your RSS parsing needs.

And hey, if you’d like more of a walkthrough on how to go about constructing your project, or rather than using the standard SDK networking and XML parsing classes you’d prefer something that uses ASIHTTPRequest and GDataXML, of course Ray Wenderlich has a tutorial for that!

How To Make A Simple RSS Reader iPhone App Tutorial

Continue Reading →
5

Tutorial: Chat App

Here’s a tutorial worth looking at if you’re as unfamiliar as we are — that’s “pretty darn unfamiliar indeed”, that is — with server programming:

Building an iPhone chat app from the ground up

In this article, work through the entire process of building an iPhone chat application from the server all the way to the user interface on the front end…

The iPhone side is all completely bog standard SDK you’re probably familiar with, so it’s a nice example of how a very little bit of PHP server code can be used to handle some realish-time communication needs with PHP and just a dash of SQL and XML. Nifty!

And if this is indeed something that would be handy for you, check out the author’s other articles while you’re there. Lots of XMLy and PHPy and so on webby goodness there, looks like.

h/t: ManiacDev via @rwenderlich!

Continue Reading →
2

Tip: Image Highlighting

So you want to have a highlight effect on an image like the one UIButton does? Hey, here’s a handy function to create a highlighted version of an arbitrary UIImage:

UIButton graphics highlighting

uibutton_highlight.png

… On the left, you’ll see an image that is similar to the icon for the Calendar program on the iPhone. Next is that same image, highlighted by UIButton. The third image is highlighted with the function shown below. The two highlighted versions are almost exactly the same. You can tell the difference with a color-dropper tool, but I doubt you could tell them apart with the naked eye…

Yep, that looks pretty darn close to the real thing. Handy little addition for your bag of tricks!

Continue Reading →
1
Page 40 of 90 «...1020303839404142...»