Search Results

Search found 11 results on 1 pages for 'unforgiven'.

Page 1/1 | 1 

  • Linq-to-SQL: How to shape the data with group by?

    - by Cheeso
    I have an example database, it contains tables for Movies, People and Credits. The Movie table contains a Title and an Id. The People table contains a Name and an Id. The Credits table relates Movies to the People that worked on those Movies, in a particular role. The table looks like this: CREATE TABLE [dbo].[Credits] ( [Id] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY, [PersonId] [int] NOT NULL FOREIGN KEY REFERENCES People(Id), [MovieId] [int] NOT NULL FOREIGN KEY REFERENCES Movies(Id), [Role] [char] (1) NULL In this simple example, the [Role] column is a single character, by my convention either 'A' to indicate the person was an actor on that particular movie, or 'D' for director. I'd like to perform a query on a particular person that returns the person's name, plus a list of all the movies the person has worked on, and the roles in those movies. If I were to serialize it to json, it might look like this: { "name" : "Clint Eastwood", "movies" : [ { "title": "Unforgiven", "roles": ["actor", "director"] }, { "title": "Sands of Iwo Jima", "roles": ["director"] }, { "title": "Dirty Harry", "roles": ["actor"] }, ... ] } How can I write a LINQ-to-SQL query that shapes the output like that? I'm having trouble doing it efficiently. if I use this query: int personId = 10007; var persons = from p in db.People where p.Id == personId select new { name = p.Name, movies = (from m in db.Movies join c in db.Credits on m.Id equals c.MovieId where (c.PersonId == personId) select new { title = m.Title, role = (c.Role=="D"?"director":"actor") }) }; I get something like this: { "name" : "Clint Eastwood", "movies" : [ { "title": "Unforgiven", "role": "actor" }, { "title": "Unforgiven", "role": "director" }, { "title": "Sands of Iwo Jima", "role": "director" }, { "title": "Dirty Harry", "role": "actor" }, ... ] } ...but as you can see there's a duplicate of each movie for which Eastwood played multiple roles. How can I shape the output the way I want?

    Read the article

  • Core Data migration failing with error: Failed to save new store after first pass of migration

    - by unforgiven
    In the past I had already implemented successfully automatic migration from version 1 of my data model to version 2. Now, using SDK 3.1.3, migrating from version 2 to version 3 fails with the following error: Unresolved error Error Domain=NSCocoaErrorDomain Code=134110 UserInfo=0x5363360 "Operation could not be completed. (Cocoa error 134110.)", { NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x53622b0 "Operation could not be completed. (Cocoa error 256.)"; reason = "Failed to save new store after first pass of migration."; } I have tried automatic migration using NSMigratePersistentStoresAutomaticallyOption and NSInferMappingModelAutomaticallyOption and also migration using only NSMigratePersistentStoresAutomaticallyOption, providing a mapping model from v2 to v3. I see the above error logged, and no object is available in the application. However, if I quit the application and reopen it, everything is in place and working. The Core Data methods I am using are the following ones - (NSManagedObjectModel *)managedObjectModel { if (managedObjectModel != nil) { return managedObjectModel; } NSString *path = [[NSBundle mainBundle] pathForResource:@"MYAPP" ofType:@"momd"]; NSURL *momURL = [NSURL fileURLWithPath:path]; managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL]; return managedObjectModel; } - (NSManagedObjectContext *) managedObjectContext { if (managedObjectContext != nil) { return managedObjectContext; } NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; if (coordinator != nil) { managedObjectContext = [[NSManagedObjectContext alloc] init]; [managedObjectContext setPersistentStoreCoordinator: coordinator]; } return managedObjectContext; } - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"MYAPP.sqlite"]]; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil]; NSError *error = nil; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) { // Handle error NSLog(@"Unresolved error %@, %@", error, [error userInfo]); } return persistentStoreCoordinator; } In the simulator, I see that this generates a MYAPP~.sqlite files and a MYAPP.sqlite file. I tried to remove the MYAPP~.sqlite file, but BOOL oldExists = [[NSFileManager defaultManager] fileExistsAtPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"MYAPP~.sqlite"]]; always returns NO. Any clue? Am I doing something wrong? Thank you in advance.

    Read the article

  • How to get rid of Drupal CSS stylesheets?

    - by unforgiven
    I am trying to accomplish the following. I need to use Drupal 6 as a project requirement, but I want to use it with my own HTML and CSS stylesheets for each node/view/panel etc. The problem is, whatever the theme, I always found that Drupal applies to my HTML content both my CSS stylesheets and the CSS related to the theme chosen. I have also tried, without success, using the stylestripper module (installed in sites/all/modules). No matter what I do, additional CSS stylesheets are applied to my pages, completely destroying my layout. What is the proper way to achieve this? Why stylestripper does not work at all? Is there a completely blank theme available? I have tried basic, mothership, zen etc, but I always see additional CSS stylesheets applied to my pages. This is driving me crazy, Drupal was chosen by someone else for its flexibility. Thank you in advance.

    Read the article

  • Xcode 3.2.2 and localization of Settings.bundle

    - by unforgiven
    I have just discovered that after upgrading to the latest Xcode 3.2.2, I am not able anymore to localize Settings.bundle. The "Make File Localizable button always appears grayed out, and the Settings.bundle files appear with "No Explicit File Encoding", instead of UTF-16. This happens not just for my old projects, it happens even for new projects. Any clue? Is the localization procedure changed? Thank you in advance.

    Read the article

  • How do i compile a static library (fat) for armv6, armv7 and i386

    - by unforgiven
    I know this question has been posed several times, but my goal is slightly different with regard to what I have found searching the web. Specifically, I am already able to build a static library for iPhone, but the final fat file I am able to build only contains arm and i386 architectures (and I am not sure to what arm refers: is v6 or v7?). I am not able to compile specifically for armv6 and armv7 and them merge both architectures using lipo. The lipo tool complains that the same architecture (arm, not armv6 or armv7) is present in both the armv6 and armv7 libraries. Can someone explain exactly how to build for armv6 and armv7, and them merge these libraries into a fat file using lipo?

    Read the article

  • iPhone Debugging: How to resolve 'failed to get the task for process'?

    - by unforgiven
    I have just added a provisioning profile to XCode (needed to support notifications and in app purchase), setup as needed the build configuration for ad hoc distribution, and tried to run the app on the device (I have done this several times in the past, without any problem). The app is installed, but it does not start. On the console, I see the following message: Error launching remote program: failed to get the task for process 82. Error launching remote program: failed to get the task for process 82. The program being debugged is not being run. The program being debugged is not being run. However, if I start the application on the device manually, it works as expected. I have recently installed the latest XCode 3.2 for Snow Leopard. Is this a known bug of this version of XCode or am I doing something wrong? EDIT: It works fine with release distribution using the development provisioning profile. I have checked again the ad hoc provisioning profile to make sure it includes the device I am using.

    Read the article

  • tabBarController and navigationControllers in landscape mode, episode II

    - by unforgiven
    I have a UITabBarController, and each tab handles a different UIViewController that pushes on the stack new controllers as needed. In two of these tabs I need, when a specific controller is reached, the ability to rotate the iPhone and visualize a view in landscape mode. After struggling a lot I have found that it is mandatory subclassing UITabBarController to override shouldAutorotateToInterfaceOrientation. However, if i simply return YES in the implementation, the following undesirable side effect arises: every controller in every tab is automatically put in landscape mode when rotating the iPhone. Even overriding shouldAutorotateToInterfaceOrientation in each controller to return NO does not work: when the iPhone is rotated, the controller is put in landscape mode. I implemented shouldAutorotateToInterfaceOrientation as follows in the subclassed UITabBarController: (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([self selectedIndex] == 0 || [self selectedIndex] == 3) return YES; return NO; } So that only the two tabs I am interested in actually get support for landscape mode. Is there a way to support landscape mode for a specific controller on the stack of a particular tab? I tried, without success, something like (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if([self selectedIndex] == 0 || [self selectedIndex] == 3) { if ([[self selectedViewController] isKindOfClass: [landscapeModeViewController class]]) return YES; } return NO; } Also, I tried using the delegate method didSelectViewController, without success. Any help is greatly appreciated. Thank you.

    Read the article

  • How do I create in Xcode an iPhone project specifying at project creation time the SDK version I wan

    - by unforgiven
    With the latest Xcode and SDK 3.0 beta when you create a new iPhone project, Xcode creates an SDK 3.0 project. If I want to revert to SDK 2.2.1 after the project has been created, I need to change something in the generated source code files since some of the APIs have changed. Is there a simple way to specify at project creation time the SDK I want to use explicitly? Thank you in advance

    Read the article

  • Is there a free XML viewer to do "pivot tables"

    - by FumbleFingers
    I have an *.xml file on a PC running Windows XP, with a structure something like... <movies id="my movies" <movie name="Unforgiven" <people star="Clint Eastwood" director="Clint Eastwood"/> </movie> <movie name="A Fistful of Dollars" <people star="Clint Eastwood" director="Sergio Leone"/> </movie> <movie name="J Edgar" <people star="Leonardo DiCaprio" director="Clint Eastwood"/> </movie> </movies> I want to open this file in a viewer utility which will show one line per movie, filtered by a condition such as director="Clint Eastwood", including the relevant value for movie name on each line. Note - that's just an example. My actual file has thousands of lines, each possibly several hundred bytes long, and there are many more levels and named values. The important thing is I want to apply a filter for a specified value of some field at some level. And I want to see one line for every case where that value occurs, showing the values for any fields I specify, even if they're stored at higher levels. I may be mistaken in saying what I want is a "pivot table" - I don't know what I should call it.

    Read the article

  • How to check for local Wi-Fi (not just cellular connection) using iPhone SDK?

    - by Michael
    I'm currently using the following to check whether Wi-Fi is available for my application: #import <SystemConfiguration/SystemConfiguration.h> static inline BOOL addressReachable(const struct sockaddr_in *hostAddress); BOOL localWiFiAvailable() { struct sockaddr_in localWifiAddress; bzero(&localWifiAddress, sizeof(localWifiAddress)); localWifiAddress.sin_len = sizeof(localWifiAddress); localWifiAddress.sin_family = AF_INET; // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0 localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); return addressReachable(&localWifiAddress); } static inline BOOL addressReachable(const struct sockaddr_in *hostAddress) { const SCNetworkReachabilityRef target = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)hostAddress); if (target != NULL) { SCNetworkReachabilityFlags flags = 0; const BOOL reachable = SCNetworkReachabilityGetFlags(target, &flags); CFRelease(target); return reachable && (flags & kSCNetworkFlagsReachable); } return NO; } This, however, does not return NO as it should when the iPhone is connected only to a cellular network but not a Wi-Fi network. Does anyone know how to fix this? Edit So this is what I ended up using: #import <arpa/inet.h> // For AF_INET, etc. #import <ifaddrs.h> // For getifaddrs() #import <net/if.h> // For IFF_LOOPBACK BOOL localWiFiAvailable() { struct ifaddrs *addresses; struct ifaddrs *cursor; BOOL wiFiAvailable = NO; if (getifaddrs(&addresses) != 0) return NO; cursor = addresses; while (cursor != NULL) { if (cursor -> ifa_addr -> sa_family == AF_INET && !(cursor -> ifa_flags & IFF_LOOPBACK)) // Ignore the loopback address { // Check for WiFi adapter if (strcmp(cursor -> ifa_name, "en0") == 0) { wiFiAvailable = YES; break; } } cursor = cursor -> ifa_next; } freeifaddrs(addresses); return wiFiAvailable; } Thanks "unforgiven" (and Matt Brown apparently).

    Read the article

1