Search Results

Search found 24 results on 1 pages for 'coneybeare'.

Page 1/1 | 1 

  • Imagemagick convert with resample option

    - by coneybeare
    I am creating thumbnails from much larger images and have been using this command successfully for some time: convert FILE -resize "64x" -crop "64x64+0+16" +repage -strip OUTFILE I also do some other processing that is not relevant to the question. I realized that this does not adjust the resolution at all, so if I use a 300dpi image, it ends up displaying really small on some devices. I want to resample it to 72x72 so I have been trying with this command: convert FILE -resize "64x" -crop "64x64+0+16" +repage -strip -resample 72x72 OUTFILE And expected the 64x64 image at 300dpi to be resampled to a 64x64 image at 72dpi, but instead, I am getting a very funny size and density. Here is "identify" output for the original and post-processed file WITHOUT the resample: coneybeare $ convert "aa.jpg" -crop "64x64+0+16" +repage -strip "aa.png" coneybeare $ for image in `find . -type f`; do identify $image; identify -verbose $image | egrep "^ Resolution"; done ./aa.jpg JPEG 1130x1695 1130x1695+0+0 8-bit DirectClass 1.492MiB 0.000u 0:00.000 Resolution: 300x300 ./aa.png PNG 64x64 64x64+0+0 8-bit DirectClass 7.46KiB 0.000u 0:00.000 Resolution: 118.11x118.11 And here is the "identify output for the command WITH the resample: coneybeare $ convert "aa.jpg" -crop "64x64+0+16" +repage -strip -resample 72x72 "aa.png" coneybeare $ for image in `find . -type f`; do identify $image; identify -verbose $image | egrep "^ Resolution"; done ./aa.jpg JPEG 1130x1695 1130x1695+0+0 8-bit DirectClass 1.492MiB 0.000u 0:00.000 Resolution: 300x300 ./aa.png PNG 15x15 15x15+0+0 8-bit DirectClass 901b 0.000u 0:00.000 Resolution: 28.34x28.34 So, the question is: What am I doing wrong and how can I fix it so the end result is a 64x64 cropped thumbnail image at 72dpi?

    Read the article

  • Rails, MySQL and Snow Leopard

    - by coneybeare
    I upgraded to Snow Leopard using the disc we got at WWDC. Trying to run some of my rails apps now complains about sql (in /Users/coneybeare/Projects/Ambiance/ambiance-server) !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. Importing all sounds in /Users/coneybeare/Projects/Ambiance/ambiance-sounds/Import 32/Compressed/ -- AdirondackPeepers.caf !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! dlopen(/opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle Reason: image not found - /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle (See full trace by running task with --trace) I could have sworn I fixed this once before. The problem is that sudo gem install mysql does not work and gives the error: Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /opt/local/bin/ruby extconf.rb install mysql checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out Has anybody gotten mysql to work with rails on snow leopard yet? If so, what is your setup and better yet, what can I do to reproduce it?

    Read the article

  • What is the most secure way to "Grandfather In" existing users of a paid iOS app that will go free?

    - by coneybeare
    The title pretty much says it all, but I can elaborate. I have a paid iOS app that has plenty of existing customers. I think i want to convert to a free app now, and allow full upgrade via in-app-purchase. The problem is, I don't want to make my existing customers buy the app again to use it, nor do I want to make it easy for hackers to just flip a switch and get the pro version. What is the most secure way to "Grandfather In" existing users of a paid iOS app that will go free?

    Read the article

  • Adobe Air apps on the Mac App Store?

    - by coneybeare
    Before you chastise me for asking this, I have an Adobe Air app that has a lot of investment in it, and if there is a way to utilize the existing code-base in any way, it is worth considering. I have heard news reports in passing about Adobe creating some kind of tool to allow flash or air apps to be ported to native objective-c code, but the information found in google is mostly commentary on the one-time Apple blockade. My question(s) is/are this: Is it even possible, at any level, to use an existing Air app to create a Mac Store app? If possible, what are the resources I can use to accomplish this?

    Read the article

  • How can I get Haproxy to not log local requests?

    - by coneybeare
    I am trying to clean out some of the log clutter from my machines and am starting by removing requests that are generated from the server themselves. I have cache warmers running around the clock and I don't want these polluting the logs. I was able to get apache to stop logging local requests by adding a dontlog for the local IP: SetEnvIf Remote_Addr "RE\.DA\.CT\.ED" dontlog CustomLog "|logger -p local3.info -t http" combined env=!dontlog and now I am looking for something similar to put in a configuration for the Haproxy log. How can I prevent 127.0.0.1 requests from writing to the Haproxy log? UPDATE: 2/15/11 I use the excellent loggly service to pull out logs in the cloud, but I am seeing tons of logs like this: 2011 Feb 15 06:09:42.000 ip-10-251-194-96 http: RE.DA.CT.ED - - [15/Feb/2011:06:09:42 -0500] "HEAD /search/Nevad/predictive/txt HTTP/1.0" 200 - "-" "Wget/1.10.2 (Red Hat modified)" 2011 Feb 15 06:09:42.000 127.0.0.1 haproxy[10390]: 127.0.0.1:58408 [15/Feb/2011:06:09:42] www i-5dd7a331.0 0/0/0/8/8 200 210 - - --NI 0/0/0 0/0 "HEAD /search/Nevad/predictive/txt HTTP/1.1" and I want them gone. This question focuses on how to remove that haproxy log line from writing to the server side log in the first place.

    Read the article

  • Apply SetEnvIf after Apache RewriteRule

    - by coneybeare
    I have a working apache rewrite rule: RewriteCond %{HTTP_HOST} ^.*foo.com RewriteRule (.*) http://bar.com$1 [R=301,QSA,L] and some working dontlog SetEnvIfs: SetEnvIf Request_URI "^/server-status$" dontlog SetEnvIf Request_URI "^/home/ping$" dontlog SetEnvIf Request_URI "^/haproxy-status$" dontlog SetEnvIf User-Agent ".*internal dummy connection.*" dontlog CustomLog /var/log/apache2/access.log combined env=!dontlog but I can't figure out how to stop the RewriteRule from logging a duplicate line. foo.com and bar.com are both on the same machine. I would expect this rule to work, but it did not: SetEnvIf Host "foo.com" dontlog I still get duplicates in the Apache Log: 10.250.18.97 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3" 68.194.30.42 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3" .... where 10.250.18.97 is the server's IP. How can I prevent that RewriteRule from logging?

    Read the article

  • Best Practices for persisting iPod Playlist (MPMediaItemCollection) across sessions

    - by coneybeare
    When using in-app audio in the iPhone SDK, it is possible to allow users to select a list from their ipod library and create an in-app local playlist. If I want to persist this choice, it is easy to serialize the data and write to file, then recover. Just vanilla like this, however, leads me to think there is going to be something wrong. For example, what if the user syncs and removes sounds? I can loop across them all and query the iPod DB at setup time, but with lists that could be 50,000 long, this could take some time. How are other people doing this and what are some gotchas that I haven't though about?

    Read the article

  • How to stop UITableView moveRowAtIndexPath from leaving blank rows upon reordering

    - by coneybeare
    I am having an issue where in reordering my UITableViewCells, the tableView is not scrolling with the cell. Only a blank row appears and any subsequent scrolling gets an Array out of bounds error without any of my code in the Stack Trace. Here is a quick video of the problem. Here is the relevant code: - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { return indexPath.section == 1; } - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { BOOL ret = indexPath.section == 1 && indexPath.row < self.count; DebugLog(@"canMoveRowAtIndexPath: %d:%d %@", indexPath.section, indexPath.row, (ret ? @"YES" : @"NO")); return ret; } - (void)delayedUpdateCellBackgroundPositionsForTableView:(UITableView *)tableView { [self performSelectorOnMainThread:@selector(updateCellBackgroundPositionsForTableView:) withObject:tableView waitUntilDone:NO]; } - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { if (fromIndexPath.row == toIndexPath.row) return; DebugLog(@"Moved audio from %d:%d to %d:%d", fromIndexPath.section, fromIndexPath.row, toIndexPath.section, toIndexPath.row); NSMutableArray *audio = [self.items objectAtIndex:fromIndexPath.section]; [audio exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row]; [self performSelector:@selector(delayedUpdateCellBackgroundPositionsForTableView:) withObject:tableView afterDelay:kDefaultAnimationDuration/3]; } And here is the generated Stack Trace of the crash: Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000002, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: iPhone Simulator 3.2 (193.3), iPhone OS 3.0 (7A341) *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray removeObjectsInRange:]: index (6) beyond bounds (6)' Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 CoreFoundation 0x302ac924 ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 4 1 libobjc.A.dylib 0x93cb2509 objc_exception_throw + 56 2 CoreFoundation 0x3028e5fb +[NSException raise:format:arguments:] + 155 3 CoreFoundation 0x3028e55a +[NSException raise:format:] + 58 4 Foundation 0x305684e9 _NSArrayRaiseBoundException + 121 5 Foundation 0x30553a6e -[NSCFArray removeObjectsInRange:] + 142 6 UIKit 0x30950105 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow] + 862 7 UIKit 0x30947715 -[UITableView layoutSubviews] + 250 8 QuartzCore 0x0090bd94 -[CALayer layoutSublayers] + 78 9 QuartzCore 0x0090bb55 CALayerLayoutIfNeeded + 229 10 QuartzCore 0x0090b3ae CA::Context::commit_transaction(CA::Transaction*) + 302 11 QuartzCore 0x0090b022 CA::Transaction::commit() + 292 12 QuartzCore 0x009132e0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 84 13 CoreFoundation 0x30245c32 __CFRunLoopDoObservers + 594 14 CoreFoundation 0x3024503f CFRunLoopRunSpecific + 2575 15 CoreFoundation 0x30244628 CFRunLoopRunInMode + 88 16 GraphicsServices 0x32044c31 GSEventRunModal + 217 17 GraphicsServices 0x32044cf6 GSEventRun + 115 18 UIKit 0x309021ee UIApplicationMain + 1157 19 XXXXXXXX 0x0000278a main + 104 (main.m:12) 20 XXXXXXXX 0x000026f6 start + 54 NOte that the array out of bounds length is not the length of my elements (I have 9), but always something smaller. I have been trying to solve this for many hours days without avail… any ideas? UPDATE: More code as requested In my delegate: - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleNone; } - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath { int count = [(UAPlaylistEditDataSource *)self.dataSource count]; if (proposedDestinationIndexPath.section == 0) { return [NSIndexPath indexPathForRow:0 inSection:sourceIndexPath.section]; }else if (proposedDestinationIndexPath.row >= count) { return [NSIndexPath indexPathForRow:count-1 inSection:sourceIndexPath.section]; } return proposedDestinationIndexPath; } …thats about it. I am using the three20 framework and I have not had any issues with reordering till now. The problem is also not in the updateCellBackgroundPositionsForTableView: method as it still crashes when this is commented out.

    Read the article

  • Ruby/Rails Audio Conversion Plugins?

    - by coneybeare
    I am looking for a good gem/plugin to convert user-uploaded audio files to different formats. One format in particular that I am interested in is converting to Apple .caf with ima4 compression for inclusion in an iPhone app. I have been using afconvert on my mac for this so far, but I need to do it on my linux box, server-side. Ideally, I would be able to work into paperclip. As an additional solution, ffmpeg could work, but I have not seen any .caf options for it. Anybody know of one?

    Read the article

  • NSStringWithFormat Swizzled to allow missing format numbered args

    - by coneybeare
    Based on this SO question asked a few hours ago, I have decided to implement a swizzled method that will allow me to take a formatted NSString as the format arg into stringWithFormat, and have it not break when omitting one of the numbered arg references (%1$@, %2$@) I have it working, but this is the first copy, and seeing as this method is going to be potentially called hundreds of thousands of times per app run, I need to bounce this off of some experts to see if this method has any red flags, major performance hits, or optimizations #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) @implementation NSString (UAFormatOmissions) + (id)uaStringWithFormat:(NSString *)format, ... { if (format != nil) { va_list args; va_start(args, format); // $@ is an ordered variable (%1$@, %2$@...) if ([format rangeOfString:@"$@"].location == NSNotFound) { //call apples method NSString *s = [[[NSString alloc] initWithFormat:format arguments:args] autorelease]; va_end(args); return s; } NSMutableArray *newArgs = (NSMutableArray *)[NSMutableArray arrayWithCapacity:NUMARGS(args)]; id arg = nil; int i = 1; while (arg = va_arg(args, id)) { NSString *f = (NSString *)[NSString stringWithFormat:@"%%%d\$\@", i]; i++; if ([format rangeOfString:f].location == NSNotFound) continue; else [newArgs addObject:arg]; } va_end(args); char *newArgList = (char *)malloc(sizeof(id) * [newArgs count]); [newArgs getObjects:(id *)newArgList]; NSString* result = [[[NSString alloc] initWithFormat:format arguments:newArgList] autorelease]; free(newArgList); return result; } return nil; } The basic algorithm is: search the format string for the %1$@, %2$@ variables by searching for %@ if not found, call the normal stringWithFormat and return else, loop over the args if the format has a position variable (%i$@) for position i, add the arg to the new arg array else, don't add the arg take the new arg array, convert it back into a va_list, and call initWithFormat:arguments: to get the correct string. The idea is that I would run all [NSString stringWithFormat:] calls through this method instead. This might seem unnecessary to many, but click on to the referenced SO question (first line) to see examples of why I need to do this. Ideas? Thoughts? Better implementations? Better Solutions?

    Read the article

  • Justifying UIVIews on the iPhone: Algorithm Help

    - by coneybeare
    I have been messing around with a way to justify align a collection of UIView subclasses within a containing view. I am having a little bit of trouble with the algorithm and was hoping someone could help spot my errors. Here is pseudocode of where I am now: // 1 see how many items there are int count = [items count]; // 2 figure out how much white space is left in the containing view float whitespace = [containingView width] - [items totalWidth]; // 3 Figure out the extra left margin to be applied to items[1] through items[count-1] float margin = whitespace/(count-1); // 4 Figure out the size of every subcontainer if it was evenly split float subcontainerWidth = [containingView width]/count; // 5 Apply the margin, starting at the second item for (int i = 1; i < [items count]; i++) { UIView *item = [items objectAtIndex:i]; [item setLeftMargin:(margin + i*subcontainerWidth)]; } The items do not appear to be evenly spaced here. Not even close. Where am I going wrong? Here is a shot of this algorithm in action: EDIT: The code above is pseudocode. I added the actual code here but it might not make sense if you are not familiar with the three20 project. @implementation TTTabStrip (JustifiedBarCategory) - (CGSize)layoutTabs { CGSize size = [super layoutTabs]; CGPoint contentOffset = _scrollView.contentOffset; _scrollView.frame = self.bounds; _scrollView.contentSize = CGSizeMake(size.width + kTabMargin, self.height); CGFloat contentWidth = size.width + kTabMargin; if (contentWidth < _scrollView.size.width) { // do the justify logic // see how many items there are int count = [_tabViews count]; // 2 figure out how much white space is left float whitespace = _scrollView.size.width - contentWidth; // 3 increase the margin on those items somehow to reflect. it should be (whitespace) / count-1 float margin = whitespace/(count-1); // 4 figure out starting point float itemWidth = (_scrollView.size.width-kTabMargin)/count; // apply the margin for (int i = 1; i < [_tabViews count]; i++) { TTTab *tab = [_tabViews objectAtIndex:i]; [tab setLeft:(margin + i*itemWidth)]; } } else { // do the normal, scrollbar logic _scrollView.contentOffset = contentOffset; } return size; } @end

    Read the article

  • NSString stringWithFormat swizzled to allow missing format numbered args

    - by coneybeare
    Based on this SO question asked a few hours ago, I have decided to implement a swizzled method that will allow me to take a formatted NSString as the format arg into stringWithFormat, and have it not break when omitting one of the numbered arg references (%1$@, %2$@) I have it working, but this is the first copy, and seeing as this method is going to be potentially called hundreds of thousands of times per app run, I need to bounce this off of some experts to see if this method has any red flags, major performance hits, or optimizations #define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) @implementation NSString (UAFormatOmissions) + (id)uaStringWithFormat:(NSString *)format, ... { if (format != nil) { va_list args; va_start(args, format); // $@ is an ordered variable (%1$@, %2$@...) if ([format rangeOfString:@"$@"].location == NSNotFound) { //call apples method NSString *s = [[[NSString alloc] initWithFormat:format arguments:args] autorelease]; va_end(args); return s; } NSMutableArray *newArgs = (NSMutableArray *)[NSMutableArray arrayWithCapacity:NUMARGS(args)]; id arg = nil; int i = 1; while (arg = va_arg(args, id)) { NSString *f = (NSString *)[NSString stringWithFormat:@"%%%d\$\@", i]; i++; if ([format rangeOfString:f].location == NSNotFound) continue; else [newArgs addObject:arg]; } va_end(args); char *newArgList = (char *)malloc(sizeof(id) * [newArgs count]); [newArgs getObjects:(id *)newArgList]; NSString* result = [[[NSString alloc] initWithFormat:format arguments:newArgList] autorelease]; free(newArgList); return result; } return nil; } The basic algorithm is: search the format string for the %1$@, %2$@ variables by searching for %@ if not found, call the normal stringWithFormat and return else, loop over the args if the format has a position variable (%i$@) for position i, add the arg to the new arg array else, don't add the arg take the new arg array, convert it back into a va_list, and call initWithFormat:arguments: to get the correct string. The idea is that I would run all [NSString stringWithFormat:] calls through this method instead. This might seem unnecessary to many, but click on to the referenced SO question (first line) to see examples of why I need to do this. Ideas? Thoughts? Better implementations? Better Solutions?

    Read the article

  • iOS 5 Audio Alarms Don't Sound Without kAudioSessionProperty_OverrideCategoryMixWithOthers On

    - by coneybeare
    I have an audio app that is having some problems with the way iOS 5 has changed audio behaviors. When my app's audio is playing (AVAudioSessionCategoryPlayback), and a Clock.app alarm or timer is fired from the OS, the UIAlertView notification pops up, but without the audio alert. My application sound ducks fine to get out of the way of the audio alert, but the alarm app's audio alert does not sound. Naturally, tons of support requests poured in over the iOS 5 change. I have solved this temporarily by setting kAudioSessionProperty_OverrideCategoryMixWithOthers which lets the alarm audio come through, but there are a few very undesirable side-effects when doing this: Other app's audio can play with/over mine. The remote control events are not routed to my app, but to iPod.app. None of the above drawbacks are acceptable for my app's requirements. I have been hacking away at this for some time now but haven't been able to crack it. How can I setup my audio such that: My app's audio still uses the AVAudioSessionCategoryPlayback category for background audio. The Clock.app alarms still have their audio alerts make sound The app still responds to remote control notifications

    Read the article

  • SKProductsRequest delegate methods are never called.

    - by coneybeare
    This used to work for me but is now not working anymore and I can't figure out why. I have in-app purchase setup in my app. I confirmed that I have a correct set of product identifiers, matched by corresponding in-app purchase items in itunesconnect. The call goes out to Apple view [productRequest start], but I never get a response back, despite setting the delegate to myself. What am I missing? NSLog(@"productIdentifiersSet: %@", productIdentifiersSet); if ([productIdentifiersSet count]) { SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiersSet]; [productRequest setDelegate:self]; [productRequest start]; } ……… - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { <never called> } - (void)requestDidFinish:(SKRequest *)request { <never called> } - (void)request:(SKRequest *)request didFailWithError:(NSError *)error { <never called> }

    Read the article

  • Weird Objective-C Mod Behavior

    - by coneybeare
    So I thought that negative numbers, when mod'ed should be put into positive space... I cant get this to happen in objective-c I expect this: -1 % 3 = 2 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 But get this -1 % 3 = -1 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 Why is this and is there a workaround?

    Read the article

  • Settings.bundle Not Appearing on Application Updates

    - by coneybeare
    I have an app that does not currently use a Setting.bundle to display setting in the iPhone Settings app. I am releasing an update that does. On a fresh install, the settings are added to the Setting App as expected, but upon updating from the old install, the bundle is not added. Is there some sort of trick to get the Settings App to show my Settings.bundle?

    Read the article

  • How to prevent a modal UIImagePickerController from rotating?

    - by coneybeare
    I have an app that fully support rotation. I am modally adding a UIImagePickerController for which there is no support for UIInterfaceOrientationLandscape and I cannot get the controller to stay in portrait. In other words, I need to disable rotation for the UIImagePickerController so it stays in portrait, without removing rotation for the rest of my app. this seems basic, but I can't seem to locate it. How can I prevent this rotation? UPDATE As suggested, I tried subclassing with the following code: @interface UAImagePickerController : UIImagePickerController { } @end @implementation UAImagePickerController - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return UIDeviceOrientationIsPortrait(toInterfaceOrientation); } @end The line is not being hit at all with a breakpoint… i think there must be something funky about the UIImagePickerView

    Read the article

  • How to manually throw a compiler error in GCC and Xcode

    - by coneybeare
    In xcode, while compiling apps with gcc, I want to throw compilation time errors if things like NSZombieEnabled is on for a distribution release, thus ensuring that compilation will fail and I won't accidentally do something stupid. I did some googling, but could not figure out how to cause the compiler to bail if a certain condition is met. Surely it must be easy, am I just not finding it?

    Read the article

  • Advanced Localization with Omission of Arguments in Xcode

    - by coneybeare
    I have this formatted string that I am having a translator work on. ENGLISH "Check out the %1$@ %2$@ in %3$@: %4$@" = "Check out the %1$@ %2$@ in %3$@: %4$@" GERMAN TRANSLATION "Check out the %1$@ %2$@ in %3$@: %4$@" = "Hör Dir mal %2$@ in %3$@ an: %4$@"; These are passed to a [NSString stringWithFormat:] call: ////////////////////////////////////// // Share Over Twitter NSString *frmt = NSLocalizedString(@"Check out the %1$@ %2$@ in %3$@: %4$@", @"The default tweet for sharing sounds. Use %1$@ for where the sound type (Sound, mix, playlist) will be, %2$@ for where the audio name will be, %3$@ for the app name, and %3$@ for where the sound link will be."); NSString *urlString = [NSString stringWithFormat:@"sounds/%@", SoundSoundID(audio)]; NSString *url = ([audio audioType] == UAAudioTypeSound ? UrlFor(urlString) : APP_SHORTLINK); NSString *msg = [NSString stringWithFormat: frmt, [[Audio titleForAudioType:[audio audioType]] lowercaseString], [NSString stringWithFormat:@"\"%@\"", AudioName(audio)], APP_NAME, url]; NSString *applink = [NSString stringWithFormat:@" %@", APP_SHORTLINK]; if (msg.length <= (140 - applink.length)) { msg = [msg stringByAppendingString:applink]; } returnString = msg; With the desired and actual outcome of: ENGLISH desired: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app" actual: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app" GERMAN desired: "Hör Dir mal "This Sound Name" in My App Name an: link_to_sound link_to_app" actual: "Hör Dir mal sound in "This Sound Name" an: My App Name link_to_app" THE PROBLEM The problem is that I was under the assumption that by using numbered variable in the NSLocalizedString, I could do things like this, where the %1$@ variable is completely omitted. If you notice, the German translation of the format string does not use the first argument (%1$@) at all but it ("sound") still appears in the output string. What am I doing wrong?

    Read the article

  • RewriteCond to change displayed host, but not server

    - by coneybeare
    Typing out the title to this leads me to believe this might not be possible due to security concerns, but I will ask anyway. I have shortcode support running on my server, lets call it xx.yy I want it so when a user sends a request to xx.yy, it just changes the displayed host to another valid domain running on the same box. I have this so far (lets the server know to accept requests from xx.yy): RewriteCond %{HTTP_HOST} ^.*xx.yy [NC] RewriteRule ^/(.*)$ http://127.0.0.1:<PORT_OMITTED>%{REQUEST_URI} [P,QSA,L] RewriteCond %{HTTP_HOST} ^.*mysite.com [NC] RewriteRule ^/(.*)$ http://127.0.0.1:<PORT_OMITTED>%{REQUEST_URI} [P,QSA,L] It works, and it directs the traffic into my app, but the url says http://xx.yy when I would rather it say http://mysite.com I know i could redirect to http://mysite.com instead of 127.0.0.1, but I have 4 parallel boxes of mysite.com and going back out to DNS to maybe go to another box seems like a waste when I am already here. Also, I am not sure how POST requests would work like that. What can I do?

    Read the article

  • Autoselect, focus and highlight a new NSOutlineView row

    - by coneybeare
    This is probably just lack of experience with the NSOutlineView but I can't see a way to do this. I have a NSOutlineView (implemented with the excellent PXSourceList) with an add button that is totally functional in the aspect that I save/write/insert/delete rows correctly. I do not use a NSTreeController, and I don't use bindings. I add the entity using the following code: - (void)addEntity:(NSNotification *)notification { // Create the core data representation, and add it as a child to the parent node UABaseNode *node = [[UAModelController defaultModelController] createBaseNode]; [sourceList reloadData]; for (int i = 0; i < [sourceList numberOfRows]; i++) { if (node == [sourceList itemAtRow:i]) { [sourceList selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; [sourceList editColumn:0 row:i withEvent:nil select:NO]; break; } } } When the add button is pressed, a new row is inserted like this: If I click away, then select the row and press enter to edit it, it now looks like this: My question is: How can I programmatically get the same state (focus, selected, highlighted) the first time, to make the user experience better?

    Read the article

  • Black Corners On Grouped UITableViewCells Only After Navigation Pops

    - by coneybeare
    I am not graphics expert but I somehow managed to make some good looking custom grouped UITableViewCells by setting the background view to a backgroundView with some CG code. In all SDK's up to 3.1.3 (maybe 3.2... I haven't tested on the iPad) this was working great, but I think a more recent SDK has introduced a change in the way graphics are cached offscreen. Upon first render, everything is great: The drawing is fine and the corners are transparent. If I push a couple of view controllers on the navigation stack and come back, there are now black corners that appear in the views: BEFORE && AFTER I have tons of code, most of which is written up here. I have tried tweaking to the best of my ability, looking at the docs for applicable changes, but after at least 8 hours in I still cannot find what might cause this. I have tried setting every view I can think of to be backgroundColor=clearColor and opaque=NO What else am I missing? Any debugging tips? UPDATE: I have some debug code in viewDidAppear that prints the backgroundColor and class description of all the subviews. - (void)debugView:(UIView *)view { DebugLog(@"%@ - %@", view.backgroundColor, [[view class] description]); for (UIView* child in view.subviews) { [self debugView:child]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [DownloadController.networkQueue setSuspended:NO]; for (TTTableViewCell *cell in [self.tableView visibleCells]) { [cell debugView:cell]; } } With this code, I inspect the backgroundColor settings of the cell views on first load, when it is fine, and then again after coming back. There are some differences, but all the colors are still set to be clear. This leads me to believe the issue is underneath the UITableViewCell. UPDATE 2: I have created a simple sample application to highlight the problem here

    Read the article

  • Core Data Predicates with Subclassed NSManagedObjects

    - by coneybeare
    I have an AUDIO class. This audio has a SOUND_A subclass and a SOUND_B subclass. This is all done correctly and is working fine. I have another model, lets call it PLAYLIST_JOIN, and this can contain (in the real world) SOUND_A's and SOUND_B's, so we give it a relationship of AUDIO and PLAYLIST. This all works in the app. The problem I am having now is querying the PLAYLIST_JOIN table with an NSPredicate. What I want to do is find an exact PLAYLIST_JOIN item by giving it 2 keys in the predicate sound_a._sound_a_id = %@ && playlist.playlist_id = %@ and sound_b.sound_b_id = %@ && playlist.playlist_id = %@ The main problem is that because the table does not store sound_a and sound_b, but stored audio, I cannot use this syntax. I do not have the option of reorganizing the sound_a and sound_b to use the same _id attribute name, so how do I do this? Can I pass a method to the predicate? something like this: [audio getID] = %@ && playlist_id = %@

    Read the article

1