RSS Feed!

Recent Posts

Recent Comments

Posts Tagged ‘note to self’

Versionsapp (Subversion) and Static Libraries

Tuesday, June 1st, 2010

Ever since the kind people at versionsapp.com have given me a free license to use their awesome product I have been enjoying it a lot.

Today I imported an existing iPhone project and then checked it out again. To my surprise when I tried to build it I encountered an error. I checked  my SVN repository and discovered that a static library ( .a) was not there.

Apparently .a files are treated as hidden files and they don’t get added to the repository. If you want to “fix” this in Versions app then select View -> Show Ignored Items (⌘ + ⇧ + I) and then simply add and commit.

It’s not hard, you just need to know what to look for.

Cheers…

Solved: Mac OS X (Snow Leopard) and SVN (1.6.2)

Friday, November 6th, 2009

Today I spent a few hours trying to figure out why Eclipse was unable to connect to my locally running Subversion server. I was annoyed especially because Xcode and Terminal were not having any issues.

Some background information.
- SVN is running as a daemon locally. It gets started by:
svnserve -d –listen-host localhost -r /Library/Subversion/Repository

- trying to checkout stuff using the command below via Terminal works fine
svn co svn://localhost/Project1/trunk WorkingDirName

- trying to browse the svn repository from within Eclipse 3.5 Galileo using either Subclipse or Subversive always ends up with:
svn: connection refused by the server

I tried many things but none of them helped. I googled but failed to find something relevant. Just before giving up I thought I would check what ports were open on my machine, maybe there was some conflict. There was no conflict but…
netstat -anp TCP | grep LISTEN
returned this:
tcp6       0      0  ::1.3690               *.*                    LISTEN
That’s when it dawned on me: the svnserve was binding an IPV6 address and Eclipse could not handle that!

Solution:
ps -ef | grep svnserve
kill -9 (where proc_id is the process id of your svnserve, the second number on the line)
svnserve -d –listen-host 127.0.0.1 -r /Library/Subversion/Repository/ (or wherever you’ve placed your Repository)

Done! Now svnserve is bound to an IPV4 and Eclipse can play nice too.

Cheers…

p.s. please let me know if this worked with other Mac OS / SVN versions too

iPhone how to: center and horizontal align the contents of a UITextField

Friday, August 7th, 2009

It’s as simple as:

1
2
theTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
theTextField.textAlignment = UITextAlignmentCenter;

Basically this will ensure that no matter how tall your text field is the actual text will be centered both vertically and horizontally.

Cheers…

OpenJPA – LL

Sunday, May 17th, 2009

Note to self: when using OpenJPA and lazy loading just remember that the info is actually fetched when calling the getter. Direct access to fields will not load the associated entity.

EOM

iPhone: Adding Events to the Calendar

Tuesday, May 12th, 2009

Since you've reached this blog post then you already know that there
is no API for controlling the iPhone calendar.

IMHO this is because of a blend of security reasons, mobile me and
notification issues…

There might be a workaround though but I couldn't be bothered to test
it: what if you configure the iPhone calendar to sync with a CalDAV
capable server and then your app simply posts the events to that
CalDAV server?!
In this scenario the Calendar will eventually retrieve the entries and
you'd be set. Considering that Google's Calendar web app supports
CalDAV it should be fairly straightforward.

Has anyone tried this?

Cheers…

Note to self

Tuesday, March 3rd, 2009

Always let the controller load its view. Never try to load the view yourself. That's how MVC works. LOL. 

End embarrassing note to self.
Cheers… 

NSTimeInterval – milliseconds as in System.currentTimeMillis()

Tuesday, January 20th, 2009

So you are used to working with Java's long currentTimeMillis value to process time, but what do you do in Objective C?

First of all you need to read the NSDate API. You'll see that there is a timeIntervalSinceReferenceDate method that returns the number of seconds sine the 1970 (blah blah).
This method return a NSTimeInterval, which is no more than a typedef for double.

What you need to know is that the timeIntervalSinceReferenceDate that is returned to you has sub-millisecond precision (microsecond to be accurate). So if you are after the millisecond value just multiply by 1000 this value and discard the decimals.

[NSDate timeIntervalSinceReferenceDate] * 1000 is all you need…

Cheers…

Windows file paths on *nix systems

Thursday, December 4th, 2008

Yesterday I amused myself when I re-discovered that I had to deploy a web application that was pointing to external files using windows style absolute paths rather than relative paths.

Imagine this scenario:
1. You are running a *nix system. Mac OS, Linux (Ubuntu) etc
2. You have an existing web application that references some sort of external resource (e.g. logging configuration file), but the path to this resource is windows style. e.g. C:/logging/config.xml
3. This web application used to run just fine on a server running on Windows (e.g. JBoss) but now that you have deployed it to your new OS the path no longer makes sense…

You have three choices:
1. bitch at those who used absolute paths in the web application and ask them to fix it.
2. change the web application to reference some sort of relative path
3. WOW: create a c: folder in your JBoss bin folder.

I kid you not! This is actually possible… funny as hell, but still possible.

If you are on Mac OS, the trick is to create the c: folder from the Terminal rather than Finder. Finder will not allow ":" in the name of a folder. So fire up terminal, cd to the JBoss/bin folder and run :

>mkdir c:

Now copy into this folder the resources that you need. e.g. logging/config.xml and you are ready to go.

Let me know if this worked on your OS.

Cheers…