Wednesday, February 15, 2012

iOS App Store Validation Error

I was attempting to submit an update for Wordballs when I run into an archive validation issue:
iPhone/iPod Touch: Icon.png: icon dimensions (0 x 0) don't meet the size requirements.



The solution ended up being simple enough:
Select Project then go to Build Settings, select All, under Packaging set Compress PNG Files to NO.

I have no idea why this all of a sudden started on my 3rd update, just glad it was simple enough to solve

Sunday, January 29, 2012

Spring 3, Spring Web Services 2 & LDAP Security.

This year started on a good note, another one of those "the deadline won't change" / "skip all the red tape" / "Wild West" type of projects in which I got to figure out and implement some functionality using some relatively new libraries and tech for a change, well Spring 3 ain't new but in the Java 5, weblogic 10(.01), Spring 2.5.6 slow corporate kind of world it is all relative.
Due to general time constraints I am not including too much "fluff" in this post, just the nitty gritty of creating and securing a Spring 3 , Spring WS 2 web service using multiple XSDs and LDAP security.
The Code:

The Service Endpoint: ExampleServiceEndpoint
This is the class that will be exposed as web service using the configuration later in the post. The Code: CustomValidationCallbackHandler

This was my bit of custom code I wrote to extend the AbstactCallbackHandler allowing us to use LDAP. As per the comments in the CallbackHandler below, it's probably a good idea to have a cache manager, something like Hazelcast or Ehcache to cache authenticated users, depending on security / performance considerations.
The Digest Validator below can just be used directly from the Sun library, I was just wanted to see how it worked.


The service config:
The configuration for the Endpoint, CallbackHandler and the LDAP Authentication manager.
The Application Context - Server Side:
The Security Context - Server Side:

The Web XML:
Nothing really special here, just the Spring WS MessageDispatcherServlet.
The client config:
To test or use the service you'll need the following:
The Application Context - Client Side Test:

The Security Context - Client Side:

As usual with Java there can be a couple little nuances when it comes to jars and versions so below is part of the pom I used.
The Dependencies:

Saturday, January 28, 2012

Wordballs Release

Finally, Wordballs is live! 
My latest physics based word game. Please check it out if you have an iOS device, and let your friends know. 

It's Free (with ads) and 16mb to download. 
Please take a couple seconds to rate it as well, it will be much appreciated


This game actually took me some time to do. Crazy deadlines and some nasty hours at work meant for some slow going and some very late nights at times. 

I would just like to thank the teams from:

Chipmunk Physics
Cocos 2D

Without their awesome libraries / code this Wordballs would have been impossible.





Free Universal Version - In App Purchase available to remove ads
http://www.wordballs.com/

Saturday, December 17, 2011

ccColor3B constants.... A whole bunch of them.

This is bound to save everyone some time when looking at defining custom colors for cocos2d. Found this list on the cocos2d forums (thanks to a member there called Yeti):

Tuesday, December 6, 2011

Cached Property File Enum

We had a little need to dynamically enable and disable features on our current project and I sorta left it for the last day, came up with a simple little solution that ended up quite neat.

A cached property file enum:


 How it looks being used:
Code:
Test:
The .properties file:
FEATUREA=true
FEATUREB=false
FEATUREC=true

How it works:

The Pragmatic Programmer - Review / Summary Notes.

I recently finished The Pragmatic Programmer, to be completely honest this had been the 3rd attempt to read it, although the book is good and well worth the read, I had unfortunetly learnt most of the lessons the hard way on my own over the last decade or so of being a software developer, so I found often myself easily distracted.

I have to add, had I read this when it was published it would have undoubtedly saved me some pain, but even with that it's always good to reaffirm some of your good habits, and keep your bad ones in check. It covers 46 sections with 70 different tips that are generally useful to any programmer. Jeff Atwood - coding horror made a list of all 70 tips.

As with most things some tips are "more equal" than others, the ones that really stick out and probably can't be emphasized enough are:

  Care About Your Craft
Why spend your life developing software unless you care about doing it well?
  Think! About Your Work
Turn off the autopilot and take control. Constantly critique and appraise your work.
  Don't Live with Broken Windows
Fix bad designs, wrong decisions, and poor code when you see them.
  Invest Regularly in Your Knowledge Portfolio
Make learning a habit.
  DRY - Don't Repeat Yourself
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
  Make It Easy to Reuse
If it's easy to reuse, people will. Create an environment that supports reuse.
  Prototype to Learn
Prototyping is a learning experience. Its value lies not in the code you produce, but in the lessons you learn.
  Don't Panic When Debugging
Take a deep breath and THINK! about what could be causing the bug.
  "select" Isn't Broken.
It is rare to find a bug in the OS or the compiler, or even a third-party product or library. The bug is most likely in the application.
  Design with Contracts
Use contracts to document and verify that code does no more and no less than it claims to do.
  Crash Early
A dead program normally does a lot less damage than a crippled one.
  Minimize Coupling Between Modules
Avoid coupling by writing "shy" code and applying the Law of Demeter.
  Don't Program by Coincidence
Rely only on reliable things. Beware of accidental complexity, and don't confuse a happy coincidence with a purposeful plan.
  Refactor Early, Refactor Often
Just as you might weed and rearrange a garden, rewrite, rework, and re-architect code when it needs it. Fix the root of the problem.
  Design to Test
Start thinking about testing before you write a line of code.
  Some Things Are Better Done than Described
Don't fall into the specification spiral at some point you need to start coding.
  Don't Be a Slave to Formal Methods.
Don't blindly adopt any technique without putting it into the context of your development practices and capabilities.
  Don't Use Manual Procedures
A shell script or batch file will execute the same instructions, in the same order, time after time.
  Test Early. Test Often. Test Automatically
Tests that run with every build are much more effective than test plans that sit on a shelf.
  Coding Ain't Done 'Til All the Tests Run
'Nuff said.
  Test State Coverage, Not Code Coverage
Identify and test significant program states. Just testing lines of code isn't enough.
  Find Bugs Once
Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on.

Friday, November 25, 2011

Determining iOS Hardware / Device

I am currently working on my second iOS game in which I am creating dynamic Open GL ES reflections, and noticed on the older devices it would cause a drop in frames per second. It doesn't on the iPad 2, I do not have iPhone 4S yet, but I assume it won't have a visible effect there either with the new CPU.

So to not diminish the user experience I decided to remove those reflections, on the interactive CCSprite, on the older devices.

I went searching and found : UIDeviceHardware - Determine iOS device being used

I ended up just using: (platformString wasn't useful to me) I then just created a convenience method for myself to check for the version that have the Dual-core Apple A5 processor.

Sunday, October 16, 2011

Cocos2d CCSprite Reflection

With yet another 2 months of Wild West Development behind me, I can hopefully get back to a somewhat normal life again, blogging, learning and a little iOS game development.

What I want to share today is my little hack to reflect a CCSprite used in to cocos2d. I say hack because it does feel a little dirty, i didn't go and learn about the details of Open GL and the like, simply patched things together to get a working solution.

Below is the code for my ImageReflector, the basic idea and how it got it work was simple:

The best looking reflection example I found was Apples' example. So the methods createBitmapContext, createGradientImage and reflectedImage are directly from the above example. I wanted to use it in cocos2d so I used CCRenderTexture to create a UIImage, passed that to Apples' example code and then simply converted back to a CCSprite with the help of the CCTexture2D class.

Usage: Class:

Friday, September 2, 2011

iPhone Gmail Username / Password Error

This morning, I all of a sudden could not get my gmail mails on my iPhone, constantly got:
Cannot Get Mail - The user name or password for imap.gmail.com is incorrect.

After a bit of searching, I found the solution to be simple, logon and input the Captcha phrase.

Link Below:
https://www.google.com/accounts/UnlockCaptcha

Wednesday, August 31, 2011

Mac OSX Global Git Ignore - XCode Project and State Files.

With my recent switch to Mac, Objective C and XCode and XCode using Git as it's default VCS (Version control system), I figured it would probably be a good time to switch over to using Git. I registered with GitHub purchased the base 5 private repo plan and uploaded my projects and images. I didn't realize at the time then what pain I would cause myself.

A little later, my wife joined me in working with those projects only to discover that under certain scenarios we could never actually merge or sync the branches from XCode. There were always couple files that would be "uncommited" in XCode. Nasty XCode project state files.

I had not worked with Git before this actually, so after reading up a bit about project files and the like and how a ".ignore" file would do the trick.
After I little bit of struggling, I realized that for ignore to work, the files needed to be removed from the repository first. Thankfully I did not have any important history so I could simply recreate them. You can also remove them from git with: git rm --cached

To go about creating, editing configuring a global ignore file on OSX I did the following:

First problem on a Mac, any "." files are seen as system files and those are automatically hidden from you.

To get around that open "Terminal" and use the commands below to show and hide system files (you'll need to either restart or force quit Finder for the changes to take effect).

Show:
defaults write com.apple.finder AppleShowAllFiles -bool true

Hide:
defaults write com.apple.finder AppleShowAllFiles -bool false


Once I had done that I simply went searching for a couple example ignore files and combined them into the example below.

Create a file in your user directory called ".gitignore_global", populate it with the contents required, (below is mine, that does take care of the XCode problem files)
Then in Terminal run:
git config --global core.excludesfile ~/.gitignore_global

My global ignore file:

Wednesday, August 24, 2011

Java / XML UTF-8 marshalling and validating pains

This is a post on the little pains I am sure most people have endured while working with Java and XML from different sources, with 'funny' characters...

If you use a FileWriter instead of a FileOutputStream it will use your OS encoding (So cp1252, ISO-8859-1 or US-ASCII and not UTF-8... ):

A way to ensure that you are using UTF-8 is:

If you are reading XML from a stream, it is probably safer to do something like:

When validating a schema note the .getBytes("UTF-8"):


When marshalling (Use a stream rather than a writer):


Lastly if you are getting XML from some unknown source there are some chars that are outside the legal XML Unicode limits that you can not encode. To remove those:
Code below from another blog :





Building KubeSkippy: Learnings from a thought experiment

So, I got Claude Code Max and I thought of what would be the most ambitious thing I could try "vibe"? As my team looks after Kuber...