mardi 26 novembre 2013

Setting GOROOT and GOPATH after installing Go with Homebrew

I successfully installed Go by using the simplicity of Homebrew. Installation was fine but some errors occurs with doing a go get command or simply compiling the simple "hello world" program.

After few seconds, I realized how I sucks and forget to set up the GOPATH and GOROOT variables.

With Homebrew, the base installation of Go rely under /usr/local/Cellar/go/1.1.2.

Simply set GOROOT to /usr/local/Cellar/go/1.1.2/libexec
In fact, you have to set GOPATH to the directory that contains the src directory that contains the source of go main packages.

Set GOPATH to whatever you want that is different from GOROOT.






mardi 29 janvier 2013

Apple Help Tutorial

I found this great video on how to implements Help Book within your Mac applications. The guy uses XCode 3 but there is no really difference with Xcode 4.

Source : http://www.apeth.com/writersua/implementAppleHelp.mov

samedi 19 janvier 2013

Ignore temporary files in Eagle 6.x in git

To ignore the temporary files created by Eagle in your git repository, add this line to your .gitignore file :
.gitignore
# This line ignore files named .s#1 .s#2 ...
*.s\#[0-9]
view raw gistfile1.txt hosted with ❤ by GitHub

jeudi 17 janvier 2013

Dynamic code injection with XCode 4

I discover this beautiful project on Github this morning that permits to inject dynamically code with Xcode4 without restarting the app. The project has a website where you can download the bundle for XCode 4. More explanation on how it's working could be found here.


Code Injection for Xcode (Plugin Version) from John Holdsworth on Vimeo.

Source : http://injectionforxcode.com/

samedi 12 janvier 2013

Geotagging JPEG with Core Foundation

I was searching a way to edit or add GPS metadata of JPEG files without using an external library inside a Mac Application. After looking on internet and reading the ImageIOKit documentation, I found an interesting post on the Apple Mailing List talking about this topic and an old bug related to it. It includes a code sample that is apparently working now (Mac Os X 10.8).  I just wanted to add some details about it :
  • The values corresponding to the kCGImagePropertyGPSLatitudeRef/kCGImagePropertyGPSLongitudedRef keys are expected to be of type NSString.
  • The values corresponding to the kCGImagePropertyGPSLatitude/kCGImagePropertyGPSLongitude keys are expected to be of type NSNumber.
  • CGImageSourceRef originalImageSource = CGImageSourceCreateWithURL((CFURLRef)imageURL, NULL);
    //get gps metadata
    NSDictionary *metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(originalImageSource,0,NULL);
    //make the metadata dictionary mutable so we can add properties to it
    NSMutableDictionary *metadataAsMutable = [[metadata mutableCopy]autorelease];
    [metadata release];
    //get mutable gps data
    NSMutableDictionary *GPSDictionary = [[[metadataAsMutable objectForKey:(NSString *)kCGImagePropertyGPSDictionary]mutableCopy]autorelease];
    if(!GPSDictionary)
    {
    GPSDictionary = [NSMutableDictionary dictionary];
    }
    //Upate latitude longitude
    // latRef and lonRef are NSString
    [GPSDictionary setObject:[NSNumber numberWithFloat:lat] forKey:(NSString*)kCGImagePropertyGPSLatitude];
    [GPSDictionary setObject:latRef forKey:(NSString*)kCGImagePropertyGPSLatitudeRef];
    [GPSDictionary setObject:[NSNumber numberWithFloat:lon] forKey:(NSString*)kCGImagePropertyGPSLongitude];
    [GPSDictionary setObject:lonRef forKey:(NSString*)kCGImagePropertyGPSLongitudeRef];
    //add our modified GPS data back into the image's metadata
    [metadataAsMutable setObject:GPSDictionary forKey:(NSString *)kCGImagePropertyGPSDictionary];
    NSLog(@"Updated metadata: %@", metadataAsMutable);
    // Create a new image source that reads the TIFF data that we get from our NSImage.
    NSData *imageData = [newImage TIFFRepresentation];
    CGImageSourceRef finalImageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL);
    // Create an image destination. This will take the image data from our source, and write it along with the metadata we read above
    // into a file in the correct format.
    CGImageDestinationRef imageDestination = CGImageDestinationCreateWithURL((CFURLRef)imageURL, imageType, 1, NULL);
    CGImageDestinationAddImageFromSource(imageDestination, finalImageSource, 0, (CFDictionaryRef)metadataAsMutable);
    if (!CGImageDestinationFinalize(imageDestination))
    {
    // The sample code doesn't do any specific error handling in this case. This would be an appropriate
    // place to notify the user, put up an alert, etc.
    }
    view raw gistfile1.m hosted with ❤ by GitHub