Tuesday, March 29, 2011

MacOS File Compare (Free)

I was looking for a visual file compare utility and stumbled onto this free one from Apple which (I believe) came with XCode.  Its' located here: /Developer/Applications/Utilities/FileMerge.app and does a very nice visual file compare.  It also lets you merge the two files together.  I've have BeyondCompare for Windows at work which works a bit better than this, but for free, this is great.  Here's a screen shot of it in action:

Monday, March 28, 2011

NSDateFormatter


This link has all of the NSDateFormatter format variables which isn't in the Objective C documentation:
http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns


NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; 
NSString *format = @"EEE, MMM d, ''yy"; 
[inputFormatter setDateFormat:format]; 
NSDate *date = [inputFormatter dateFromString:sdate]; 
[inputFormatter release];

Here's the section from the standard:  Appendix F: Date Format Patterns

A date pattern is a string of characters, where specific strings of characters are replaced with date and time data from a calendar when formatting or used to generate data for a calendar when parsing. The following are the characters used in patterns to show the appropriate formats for a given locale. The following are examples:
PatternResult (in a particular locale)
yyyy.MM.dd G 'at' HH:mm:ss zzz1996.07.10 AD at 15:08:56 PDT
EEE, MMM d, ''yyWed, July 10, '96
h:mm a12:08 PM
hh 'o''clock' a, zzzz12 o'clock PM, Pacific Daylight Time
K:mm a, z0:00 PM, PST
yyyyy.MMMM.dd GGG hh:mm aaa01996.July.10 AD 12:08 PM
Characters may be used multiple times. For example, if y is used for the year, 'yy' might produce '99', whereas 'yyyy' produces '1999'. For most numerical fields, the number of characters specifies the field width. For example, if h is the hour, 'h' might produce '5', but 'hh' produces '05'. For some characters, the count specifies whether an abbreviated or full form should be used, but may have other choices, as given below.
Two single quotes represents a literal single quote, either inside or outside single quotes. Text within single quotes is not interpreted in any way (except for two adjacent single quotes). Otherwise all ASCII letter from a to z and A to Z are reserved as syntax characters, and require quoting if they are to represent literal characters. In addition, certain ASCII punctuation characters may become variable in the future (eg ":" being interpreted as the time separator and '/' as a date separator, and replaced by respective locale-sensitive characters in display).
Note: the counter-intuitive use of 5 letters for the narrow form of weekdays and months is forced by backwards compatibility.
Date Field Symbol Table
FieldSym.No.ExampleDescription
eraG1..3ADEra - Replaced with the Era string for the current date. One to three letters for the abbreviated form, four letters for the long form, five for the narrow form.
4Anno Domini
5A
yeary1..n1996Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. Example:










Yearyyyyyyyyyyyyyyy
AD 1101001000100001
AD 121212012001200012
AD 12312323123012300123
AD 12341234341234123401234
AD 123451234545123451234512345
Y1..n1997Year (of "Week of Year"), used in ISO year-week calendar. May differ from calendar year.
u1..n4601Extended year. This is a single number designating the year of this calendar system, encompassing all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0.
quarterQ1..202Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.
3Q2
42nd quarter
q1..202Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.
3Q2
42nd quarter
monthM1..209Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or five for the narrow name.
3Sept
4September
5S
L1..209Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.
3Sept
4September
5S
weekw1..227Week of Year.
W13Week of Month
dayd1..21Date - Day of the month
D1..3345Day of year
F12Day of Week in Month. The example is for the 2nd Wed in July
g1..n2451334Modified Julian day. This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields.
week
day
E1..3TuesDay of week - Use one through three letters for the short day, or four for the full name, or five for the narrow name.
4Tuesday
5T
e1..22Local day of week. Same as E except adds a numeric value that will depend on the local starting day of the week, using one or two letters. For this example, Monday is the first day of the week.
3Tues
4Tuesday
5T
c12Stand-Alone local day of week - Use one letter for the local numeric value (same as 'e'), three for the short day, or four for the full name, or five for the narrow name.
3Tues
4Tuesday
5T
perioda1AMAM or PM
hourh1..211Hour [1-12].
H1..213Hour [0-23].
K1..20Hour [0-11].
k1..224Hour [1-24].
minutem1..259Minute. Use one or two for zero padding.
seconds1..212Second. Use one or two for zero padding.
S1..n3457Fractional Second - rounds to the count of letters. (example is for 12.34567)
A1..n69540000Milliseconds in day. This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the offset field to obtain a unique local time value.
zonez1..3PDTTimezone - Use one to three letters for the short timezone or four for the full name. For more information, see Appendix J: Time Zone Display Names
4Pacific Daylight Time
Z1..3-0800Use one to three letters for RFC 822, four letters for GMT format.
4GMT-08:00
v1PTUse one letter for short wall (generic) time, four for long wall time. For more information, see Appendix J: Time Zone Display Names
4Pacific Time
All non-letter character represent themselves in a pattern, except for the single quote. It is used to 'escape' letters. Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.