I am trying to imitate a certain notification on a Mac using the dialog box of AS. I know how to make a simple dialog box with buttons and such, but I want the box to display text in front of the answering area.

It would be like this:

               Name:____________
           Password:____________

P.S. Sorry I cant post pictures I need "10 reputation"

I develop enterprise apps and one of the key feature that we depend on is dynamic library injection. Until iOS 7 everything was fine. But in iOS 8 when I try to inject a dynamic library and resign using an enterprise certificate then the app crashes. When i resign the app using developer certificate then it works fine in iOS 8. And this happens only in iPhone 4s but works fine in iphone 5, 5s and iPad. Can someone shed some light on this issue.

Is there a way you can reload parse data without using PFQueryTableViewController. I have used the [self loadObjects] command and it works for tables created using PFQueryTableViewController but not for tables that retrieve parse data without using PFQueryTableViewController. Sorry if this is confusing. Id be happy to clarify it. Please help. Thanks!

I am getting following error when try to build xcode project using xcodebuild command.

I have written this script under build phase of project to build my library for different architecture. I am following this link to build universal library.

I have integrated one library using cocoapods. enter image description here My Static library is using that library.

Why? Any idea...

If I try to run the same command on terminal I am getting following error - The following build commands failed: Libtool /Users/USERNAME/Library/Developer/Xcode/DerivedData/MYPROJNAME-gfxfnyljssfzaphblnapnusfvpse/Build/Products/Debug-iphoneos/libMYPROJNAME.a normal armv7

I have an IBOutlet to UIImageView called attachmentImage. By default it has a placeholder image added through storyboard.

If image is already present it is displayed using setImageWithURL. This works and displays image. Called from viewDidLoad

[self.attachmentImage setImageWithURL:[NSURL URLWithString:attachmentImageURL]];
self.attachmentImage.contentMode = UIViewContentModeScaleAspectFill;
self.attachmentImage.clipsToBounds = YES;
[attachmentImage setNeedsDisplay];

If image is not present it is chosen from library and added like so;

- (void)takeController:(FDTakeController *)controller gotPhoto:(UIImage *)photo withInfo:(NSDictionary *)info {
    [attachmentImage setImage:nil];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    self.attachmentImage.contentMode = UIViewContentModeScaleAspectFill;
    [self.attachmentImage setImage:photo];
    self.attachmentImage.clipsToBounds = YES;
    [attachmentImage setNeedsDisplay];
}

The upload works if there was no image already added (apart from the placeholder). But if image view has image set with setImageWithURL that image is not replaced.

Why is this happening? HELP!

I have an app which uses a WebView to display text and images. On iOS 8, I have set the margin and padding to 0px to correctly layout the HTML page. However to view correctly on iOS 7, the margin and padding have to be set to 4px.

How can i have it so that it has the two different formats for both iOS versions.

I want it to automatically have the padding and margin set to 0px on iOS 8 and 4px on iOS 7. This is my current stylesheet (which is in an NSString).

   NSString *stylesheet=@"<html><head><style>body { margin: 0; padding: 0; }h1{font-weight:normal;font-family: HelveticaNeue-Thin; padding: 7px; margin-bottom: 3px;}p{font-family: HelveticaNeue-Light; padding-top:0px; padding-left: 7px;paddin-right: 7px; margin-top:10px;}imgcenter {display: block; margin: 0 auto;}b{font-weight:normal;font-family: HelveticaNeue-Medium;}</style></head><body>";
    NSString *footer=@"</body></html>";

    [super viewDidLoad];
    NSString *fullURL = [NSString stringWithFormat:@"%@%@%@",stylesheet, self.SelectedProduct.content, footer];
   NSString *path = [[NSBundle mainBundle] bundlePath];
    NSURL *baseURL = [NSURL fileURLWithPath:path];
    [_webview loadHTMLString:fullURL baseURL:baseURL];

In the follow up of my previous question, I concluded that I do have a memory leak. To sum up, memory starts at 9.7MB and goes up 0.1MB every 10 runs of the animation, or so it seems. I tested this to about 12MB.

Using Instruments, I run a test that consisted of:

  1. Register an initial generation
  2. Run the animation 10 times
  3. Register another generation
  4. Repeat a few times

Here's what I got:

enter image description here

So the memory does grow. However, inspecting these generations it seems that I'm not responsible for these leaks. For instance, inspecting the Statistics panel, listed categories seem to indicate CF, CG, NS, etc, and Malloc and __NSMallocBlock__.

I also inspected the Call Trees and followed the branches with highest memory consumption.

enter image description here

Again, most memory consumption seems to be CoreGraphics related. In Allocations List, I can see more clearly what those Mallocs are. The conclusion is the same.

enter image description here enter image description here

Providing full source code would not be practical as the application already reached a few thousands of lines. As such, I'll give an overview of what seems to be important:

- (void)animateViewDidAppear
{
    NSArray * buttons = @[self.registrationButton, self.facebookButton, self.twitterButton, self.linkedInButton];

    // [...] A bunch of GLfloat calculations here

    __block HyAnimationCollection * collection = [[HyAnimationCollection alloc] init];

    for (int it=0 ; it < [buttons count] ; ++it) {

        UIButton * button = [buttons objectAtIndex:it];

        // [...] More GLfloat stuff

        // Ease out back
        __block HyAnimation * easeOutBack = [[HyAnimation alloc] init];
        HyAnimationUpdateFunction easeOutBackUpdate = ^(id frame, BOOL done) {
            [button setFrame:[frame CGRectValue]];
        };

        [easeOutBack setDelay:it * kHyAuthenticationViewControllerAnimationDelayFactor];
        [easeOutBack setDuration:kHyAuthenticationViewControllerAnimationDuration];
        [easeOutBack setEasing:^(GLfloat t) { return [HyEasing easeOutBack:t]; }];
        [easeOutBack addRectAnimation:CGRectMake(origin.x, from, size.width, size.height)
                                   to:CGRectMake(origin.x, to, size.width, size.height)];
        [easeOutBack addUpdateFunction:easeOutBackUpdate];
        [collection addAnimation:easeOutBack];
    }

    [collection addLock:self.animationLock];
    [collection start];
}

self.animationLock is a locking mechanism so animations don't overlap, but it's pretty much self contained and I can't imagine why it would be the source of the leak. However, those blocks do get sent to HyAnimation, which in turn is added to HyAnimationCollection, and that troubles me more and that's where I have been focusing. In sum, maybe these closures might be creating a circular retain, so lets take a look. The addUpdateFunction in HyAnimation is actually very simple:

- (void)addUpdateFunction:(HyAnimationUpdateFunction)update
{
    [self.updateFunctions addObject: update];
}

As self.updateFunctions is an NSMutableArray, it retains strong references to these blocks. So if HyAnimation is not freed, neither are those blocks, which means that the initial scope in which they were created isn't either. But, HyAnimation is declared inside a method so, so far, I see no reason why it wouldn't be released.

Which is why I think it should be because of the animation itself, that is HyAnimationCollection's [collection start];. Here's the interesting part:

for (HyAnimation * anim in self.animations) {
    [anim start];
}

So far so good. Here's HyAnimation's start:

- (void)start
{
    [NSTimer scheduledTimerWithTimeInterval:self.delay
                                     target:self
                                   selector:@selector(scheduleAnimationWithTimer:)
                                   userInfo:nil
                                    repeats:NO];

    // Send an udate notification
    if ([self shouldUpdateImmediatly]) {
        [self animateAt:0.0f done:NO];
    }
}

Which pretty much delays the run and delegates to scheduleAnimationWithTimer:. This method, however, sets a timer that repeats, and therefore will be around until the animation ends (and no further, I hope).

- (void)scheduleAnimationWithTimer:(NSTimer*)timer
{
    NSTimer * scheduled = [NSTimer scheduledTimerWithTimeInterval:self.frameRate
                                                           target:self
                                                         selector:@selector(animateWithTimer:)
                                                         userInfo:nil
                                                          repeats:YES];

    // Trigger immediatly
    [self setInitialDate:[NSDate date]];
    [scheduled fire];
}

Now animateWithTimer:

- (void)animateWithTimer:(NSTimer*)timer
{
    NSTimeInterval gone = [[NSDate date] timeIntervalSinceDate:self.initialDate];
    GLfloat t = gone / self.duration;
    BOOL done = gone >= self.duration;

    // Ease
    if (self.easing) {
        t = self.easing(t);
    }

    // Make sure the last position is exact. This does not mean that t does not go over 1.0f during the animation, just the end
    if (done && t > 1.0f) {
        t = 1.0f;
    }

    // Animate
    [self animateAt:t done:done];

    // Finish
    if (done) {

        // Stop the timer
        [timer invalidate];

        // Notify completion
        [self broadcastCompletion];
    }
}

And finally animateAt:done:

- (void)animateAt:(GLfloat)t done:(BOOL)done
{
    for (HyAnimationFunction anim in self.animations) {
        anim(t, done);
    }
}

That is, this last method calls the blocks I defined earlier in animateViewDidAppear.

First of all, I believe that the HyAnimationCollection and HyAnimation instances are trapped inside the blocks, and HyAnimation has strong references to those blocks. Would you agree? How can I solve this? I tried using __block to declare both variables, but it seems to have no effect, for this matter.

Anyway, I'm also having trouble relating Instrument's memory analysis with this issue, which is why this post is so long.

Thank you for bearing with me, and I apologise for the long read.

UPDATE:

It seems I was right. Following @Stephen Darlington's post on my previous question, I overrode the dealloc method in HyAnimationCollection. Contrary to his suggestion, I did not setup a break point, but instead wrote an NSLog. Never logged anything, until now.

- (void)dealloc
{
    NSLog(@"dealloced");
}

What I did was add another property to HyAnimation, shouldCleanUpOnCompletion. If true, animateWithTimer: calls this on completion:

- (void)cleanUp
{
    // Get rid of everything
    self.animations = [[NSMutableArray alloc] init];
    self.updateFunctions = [[NSMutableArray alloc] init];
    self.completionFunctions = [[NSMutableArray alloc] init];
}

I immediately saw logs on the console, so there's definitely a retain cycle. The question is, how can I solve it? Isn't __block supposed to solve this??

UPDATE 2

I just realised this is enough:

- (void)cleanUp
{
    // Get rid of everything
//    self.animations = [[NSMutableArray alloc] init];
//    self.updateFunctions = [[NSMutableArray alloc] init];
    self.completionFunctions = [[NSMutableArray alloc] init];
}

Which means that the completionFunctions are the ones creating the closure, after all. The only place I'm currently using those is in HyAnimationCollection, more specifically here:

- (BOOL)addAnimation:(HyAnimation*)animation
{
    @synchronized(self) {

        if (self.isRunning) {
            return NO;
        }

        [self.animations addObject:animation];

        __block HyAnimationCollection * me = self;

        // Self-subscribe for updates so we know when the animations end
        [animation addCompletionFunction:^(HyAnimation * anim) {

            static unsigned int complete = 0;

            // We are only interested in knowing when the animations complete, so we can release the locks
            ++complete;

            if (complete == [me.animations count]) {

                // Reset, so the animation can be run again
                complete = 0;

                @synchronized(me) {

                    // Release all locks
                    [me.locks setLocked:NO];

                    // Done
                    me.isRunning = NO;
                }
            }
        }];

        return YES;
    }
}

That is, the retain cycle must be here, right? But where? Could it be the first @synchronized block?

It seems that using glPixelStorei with GL_UNPACK_ROW_LENGTH and GL_PACK_ROW_LENGTH is not supported on iOS.

Is is possible to somehow simulate them to get the same effect for memory stride when using glTexImage2D and glReadPixels respectively (without an extra prior copy to aligned memory)?

I'm trying to draw a 3D ellipse with a 2.5D graphics engine (Core Animation layers) which allow me to only compose my ellipse with line segments that must be moved into place using rotations and translations. I'm having trouble with the order of operations and can't get it to draw properly. Any graphics gurus or game programmers out there who can help me?

Here's an image describing my current approach:

enter image description here

For each segment in the ellipse polygon, I'm first creating a line segment with the correct length, then translating it to the point P1, then rotating the point by the PI/2+theta, but this is clearly not working.

It's been 10 years since I took a graphics class in university, can someone please jog my memory as to what I'm doing wrong?

I am trying to map the json to model in Swift using JSONModel.

Everything works if model doesn't have properties that are JSONModel subclasses.

So in example this works, and it maps the properties successfully:

class Person: JSONModel {

    var name: NSString?
    var gender: NSString?

}

But if I put JSONModel subclass City, this property is not initialized, and it crashes the app when I try to access the city property later (I can successfully access person.name, and person.gender, but on person.city it crashes without any info):

class Person: JSONModel {

    var name: NSString?
    var gender: NSString?
    var city: City? // City is JSONModel subclass
}

It looks like JSONModel cannot map/parse property if it is a JSONModel subclass. Did anyone experienced this and solved it?

I am in need of detecting changes to my app's permission to access Photos using PhotoKit on iOS 8. It is easy to know the status via PHPhotoLibrary.authorizationStatus(), but I need to know when this status is changed so that I can update the UI in my application to display/remove a message that informs them they need to grant access to use the app.

If the user launches the app, I check the authorizationStatus in viewDidLoad, then display the message if the status is .Denied or .Restricted. But if the user then goes to Settings and grants access, when they return to the app it is still showing that message. I need to handle those status changes - if it changes to .Authorized I need to remove the message and reload my collection view.

I couldn't find any notification I could subscribe to, how does one accomplish this?

all, We are developing a game for platforms iOS and Android on Unity3D and we have come across the following problem: We want players "like/become a fan" of the facebook account in our game, but we have not found this option in your API. For Unity, we use the Facebook SDK for Unity 6.0. Maybe you can help us find a solution to this problem?

I am suffering trying to wrack my head around this. I created another object with a category called ContactEnemyCategory and I want it to never collide with anything so I set the collisionBitMask to 0 and yet my Player Character is able to move it instead of just passing through it. It seems like a minor problem but in all honesty its just plain stressful. Any advice would be great.

My Object

contactLines = [SKSpriteNode spriteNodeWithImageNamed:@"contact-Lines"];
contactLines.hidden = NO;
contactLines.physicsBody.dynamic = YES;
contactLines.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:contactLines.size];
contactLines.position = CGPointMake(variaPlatform.position.x, variaPlatform.position.y + 30);
contactLines.physicsBody.categoryBitMask = fContactEnemyCategory;
contactLines.physicsBody.contactTestBitMask = fEnemyCategory;
contactLines.physicsBody.collisionBitMask = 0;
[self addChild:contactLines];

My Player

_Hero = [SKSpriteNode spriteNodeWithTexture:i1];
_Hero.name = @"Hero";
_Hero.zPosition = 2;
_Hero.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:_Hero.size];
_Hero.physicsBody.categoryBitMask = fPlayerCategory | fEnemyCategory;
_Hero.physicsBody.contactTestBitMask = fPlatformCategory | fEnemyCategory | fScoreCategory | fMainPlatformCategory |fPitOfCertainDoomCategory;
_Hero.physicsBody.collisionBitMask = fEnemyCategory | fPlatformCategory | fMainPlatformCategory;
_Hero.physicsBody.usesPreciseCollisionDetection = YES;
_Hero.physicsBody.affectedByGravity = YES;
_Hero.physicsBody.dynamic = YES;
_Hero.physicsBody.friction = 0.3;
_Hero.physicsBody.linearDamping = 0.7;
_Hero.physicsBody.allowsRotation = false;
_Hero.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
_Hero.position = CGPointMake(_Hero.position.x - 253, _Hero.position.y + 50);
[self addChild:_Hero];

Their Respective Categories

static const uint32_t fPlayerCategory = 0x1 << 0;

static const uint32_t fContactEnemyCategory = 0x1 << 6;

I'm using the Facebook iOS SDK in Swift to access Facebook and I would like to work with the FBGraphUser (or FBGraphPlace, FBGraphLocation) protocols rather than with a pure Dictionary. The request completes successfully but I cannot cast the result to the FBProtocol

FBRequestConnection.startForMeWithCompletionHandler { (connection: FBRequestConnection!, result: AnyObject!, error: NSError!) -> Void in
     // this does not work
    if let fbGraphUser = result as? FBGraphUser {
        NSLog("\(fbGraphUser)")
    }

     // this works
    if let fbGraphUserDict = result as? Dictionary<String, AnyObject>{
        println("\(fbGraphUserDict)")
    }
}

How am I supposed to unwrap the optionals to get the FBxxxx objects ?

cheers

I'm trying to add an underline to some text in my Swift app. This is the code I have currently:

let text = NSMutableAttributedString(string: self.currentHome.name)

let attrs = [NSUnderlineStyleAttributeName:NSUnderlineStyle.PatternDash]

text.addAttributes(attrs, range: NSMakeRange(0, text.length))
homeLabel.attributedText = text

But I get this error on the text.addAttributes line:

NSString is not identical to NSObject

How can I add an attribute contained in an enum to an NSMutableAttributedString in Swift?

Until now I was trying to set the hardcoded data as

self.transactions = @[@"Transaction 1", @"Transaction 2", @"Transaction 3"];  

and everything seem to work out fine. Now I changed this to get the data from JSON file and it crashes the app. The relevant part that I changed is

- (id)initWithStyle:(UITableViewStyle)style {
    self = [super initWithStyle:style];
    if (self) {
        NSDictionary *transactionsDictionary = [TransactionAPI getTransactionsForYear:2014 AndMonth:9];
        NSLog(@"Transactions:%@", [transactionsDictionary valueForKey:@"transactions"]);
        NSLog(@"Transactions Is Array:%@", @([[transactionsDictionary valueForKey:@"transactions"] isKindOfClass:[NSArray class]]));
        self.transactions = [transactionsDictionary valueForKey:@"transactions"];
        [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];
    }
    return self;  

and the delegate code is

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.transactions.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    cell.textLabel.text = self.transactions[(NSUInteger) indexPath.row];
    return cell;
}  

The log I see is

2014-09-01 11:43:53.798 pennyapp-ios[51286:70b] Transactions:(
        {
        amount = "25.0";
        category = "Food & Drink";
        debit = 1;
        name = "White Elephant Thai";
        "transaction_date" = "Mon, 01 Sep 2014 03:01:52 -0000";
        uuid = "5fe79315-1378-4b3f-90b7-e820d5c786d8";
    },
        {
        amount = "2.0";
        category = "Food & Drink";
        debit = 1;
        name = "Apple Juice";
        "transaction_date" = "Fri, 29 Aug 2014 22:02:02 -0000";
        uuid = "1c4f3931-2de8-4791-b2b7-34fc1bb113a5";
    },
        {
        amount = "4.99";
        category = "Food & Drink";
        debit = 1;
        name = "India Bazar";
        "transaction_date" = "Fri, 29 Aug 2014 21:59:26 -0000";
        uuid = "bdcdd72f-f46b-47c1-b6fb-ba877e9ef1ce";
    },
        {
        amount = "48.59";
        category = "Food & Drink";
        debit = 1;
        name = Costco;
        "transaction_date" = "Mon, 25 Aug 2014 01:37:32 -0000";
        uuid = "153a4ca7-1a6e-471a-80a4-d5d087e18bef";
    },
        {
        amount = "1.0";
        category = "Food & Drink";
        debit = 1;
        name = "Patel Brothers";
        "transaction_date" = "Sun, 24 Aug 2014 21:34:11 -0000";
        uuid = "8e351586-00eb-41ef-8429-189ef31c3bad";
    },
        {
        amount = "60.81";
        category = Utilities;
        debit = 1;
        name = Comcast;
        "transaction_date" = "Sun, 24 Aug 2014 20:23:37 -0000";
        uuid = "36f24ec4-b906-425c-8983-b07f10dc2d63";
    },
        {
        amount = "8.82";
        category = Personal;
        debit = 1;
        name = "Samsung Tablet Case";
        "transaction_date" = "Sun, 24 Aug 2014 20:17:13 -0000";
        uuid = "2ee4a1fe-47b9-4b47-b908-e7eb9647e4e9";
    },
        {
        amount = "320.0";
        category = "Gifts & Donations";
        debit = 1;
        name = "Harit Gift";
        "transaction_date" = "Sat, 23 Aug 2014 00:01:27 -0000";
        uuid = "e070e9d1-7439-4169-a5d1-71e637723e1f";
    },
        {
        amount = "9.0";
        category = "Gifts & Donations";
        debit = 1;
        name = "Patel Brothers";
        "transaction_date" = "Sat, 23 Aug 2014 00:00:02 -0000";
        uuid = "8b8af28a-c679-411c-806a-52c35d0267c8";
    },
        {
        amount = "9.63";
        category = "Food & Drink";
        debit = 1;
        name = Sprouts;
        "transaction_date" = "Mon, 18 Aug 2014 00:23:10 -0000";
        uuid = "ea5624fe-8e76-4133-9f4b-238e9f823474";
    },
        {
        amount = "51.01";
        category = "Health & Medical";
        debit = 1;
        name = Vitamins;
        "transaction_date" = "Sun, 17 Aug 2014 01:25:31 -0000";
        uuid = "101d16e3-cc95-41e5-ba44-1c9ee0a6a2ce";
    },
        {
        amount = "23.0";
        category = "Food & Drink";
        debit = 1;
        name = Costco;
        "transaction_date" = "Sun, 17 Aug 2014 01:23:35 -0000";
        uuid = "33b495c1-fe7c-4a70-b8fa-8198c377f00b";
    },
        {
        amount = "11.47";
        category = "Health & Medical";
        debit = 1;
        name = Kaiser;
        "transaction_date" = "Thu, 14 Aug 2014 21:47:23 -0000";
        uuid = "8863196c-cb10-4f64-ab8c-cbf068ad05df";
    },
        {
        amount = "31.47";
        category = Transportation;
        debit = 1;
        name = Chevron;
        "transaction_date" = "Thu, 14 Aug 2014 21:47:04 -0000";
        uuid = "8422f5de-5733-4d81-9081-f5c69d8a629a";
    },
        {
        amount = "10.0";
        category = Personal;
        debit = 1;
        name = Laundry;
        "transaction_date" = "Tue, 12 Aug 2014 03:20:52 -0000";
        uuid = "7773fe4b-ee18-4343-9bb3-0e3072c3c56e";
    },
        {
        amount = "10.5";
        category = "Food & Drink";
        debit = 1;
        name = "India Bazar";
        "transaction_date" = "Sun, 10 Aug 2014 23:18:13 -0000";
        uuid = "409bd274-5f2d-4ba4-86c6-90f5f5014fe0";
    },
        {
        amount = "8.0";
        category = Home;
        debit = 1;
        name = "Dollar Tree";
        "transaction_date" = "Sun, 10 Aug 2014 23:17:49 -0000";
        uuid = "eaf23fca-8f5b-4e7a-93dc-1c4e29274351";
    },
        {
        amount = "12.98";
        category = "Food & Drink";
        debit = 1;
        name = "Patel Brothers";
        "transaction_date" = "Sun, 10 Aug 2014 16:20:11 -0000";
        uuid = "3dfba99b-7278-450e-8e82-ee9761181294";
    },
        {
        amount = "18.47";
        category = Personal;
        debit = 1;
        name = "Payless footwears";
        "transaction_date" = "Sun, 10 Aug 2014 01:05:08 -0000";
        uuid = "925d9cf1-9fc7-4062-99ad-4fdfb6eaf225";
    },
        {
        amount = "8.28";
        category = "Food & Drink";
        debit = 1;
        name = "India Bazar";
        "transaction_date" = "Thu, 07 Aug 2014 04:17:18 -0000";
        uuid = "6cab973d-7641-467c-9284-ebd441e97750";
    },
        {
        amount = "17.59";
        category = "Health & Medical";
        debit = 1;
        name = Kaiser;
        "transaction_date" = "Tue, 05 Aug 2014 18:25:33 -0000";
        uuid = "eb23dc2d-276e-4bc6-8fd5-bd952558465a";
    },
        {
        amount = "28.0";
        category = Transportation;
        debit = 1;
        name = Chevron;
        "transaction_date" = "Tue, 05 Aug 2014 04:17:44 -0000";
        uuid = "a34e57f3-0877-4763-a7fe-955f00a36ec3";
    },
        {
        amount = "1818.0";
        category = Home;
        debit = 1;
        name = Rent;
        "transaction_date" = "Mon, 04 Aug 2014 03:20:19 -0000";
        uuid = "df2047a3-112e-4d82-b1ba-c09a66bb69cd";
    },
        {
        amount = "49.5";
        category = "Food & Drink";
        debit = 1;
        name = Costco;
        "transaction_date" = "Mon, 04 Aug 2014 03:19:04 -0000";
        uuid = "9599590e-d8e1-4cdd-a81f-3d6bbac79f66";
    },
        {
        amount = "64.36";
        category = "Food & Drink";
        debit = 1;
        name = "India Bazar";
        "transaction_date" = "Mon, 04 Aug 2014 03:18:54 -0000";
        uuid = "44d30643-bba3-471a-a8f8-2f71aa2e5f1d";
    },
        {
        amount = "35.0";
        category = Utilities;
        debit = 1;
        name = "Phone Metro PCS";
        "transaction_date" = "Sat, 02 Aug 2014 21:48:45 -0000";
        uuid = "2fb93a75-69f9-49cf-a93a-f7343dcba59f";
    },
        {
        amount = "60.81";
        category = Utilities;
        debit = 1;
        name = Comcast;
        "transaction_date" = "Sat, 02 Aug 2014 14:36:46 -0000";
        uuid = "112c43eb-6e5e-4b4d-9079-6d896fa11b01";
    }
)
2014-09-01 11:43:53.801 pennyapp-ios[51286:70b] Transactions Is Array:1
2014-09-01 11:43:53.809 pennyapp-ios[51286:70b] -[__NSCFDictionary length]: unrecognized selector sent to instance 0x10bf65a50
2014-09-01 11:43:53.811 pennyapp-ios[51286:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary length]: unrecognized selector sent to instance 0x10bf65a50'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001023c7495 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010212699e objc_exception_throw + 43
    2   CoreFoundation                      0x000000010245865d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00000001023b8d8d ___forwarding___ + 973
    4   CoreFoundation                      0x00000001023b8938 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x00000001009b259d -[UILabel font] + 34
    6   UIKit                               0x0000000100b320cc -[UITableViewCellLayoutManager layoutSubviewsOfCell:] + 5307
    7   UIKit                               0x0000000100a593be -[UITableViewCell layoutSubviews] + 71
    8   UIKit                               0x0000000100891993 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 354
    9   QuartzCore                          0x0000000104fbd802 -[CALayer layoutSublayers] + 151
    10  QuartzCore                          0x0000000104fb2369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363
    11  QuartzCore                          0x0000000104fb21ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    12  QuartzCore                          0x0000000104f25fb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252
    13  QuartzCore                          0x0000000104f27030 _ZN2CA11Transaction6commitEv + 394
    14  QuartzCore                          0x0000000104f2769d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
    15  CoreFoundation                      0x0000000102392dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    16  CoreFoundation                      0x0000000102392d37 __CFRunLoopDoObservers + 391
    17  CoreFoundation                      0x0000000102372522 __CFRunLoopRun + 946
    18  CoreFoundation                      0x0000000102371d83 CFRunLoopRunSpecific + 467
    19  GraphicsServices                    0x00000001036e4f04 GSEventRunModal + 161
    20  UIKit                               0x0000000100831e33 UIApplicationMain + 1010
    21  pennyapp-ios                        0x00000001000013f3 main + 115
    22  libdyld.dylib                       0x00000001033665fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

What is the issue? I could not debug this. Thanks

trying to filter files with formats such as pdf file names the following structure: Items number + Revision + lot number

  • 1109093-A2 (85806S) pdf
  • 1109093-A3 (85806S) pdf
  • 1109092-A1 (85806S) pdf
  • 1109092-A2 (85806S) pdf

Items number: 1109093

Revision: -A2

End item number: (85806S)

or A1, A2, A3, A..N (revisions) represents the selection criterion of I should use. i wrote the following function for this job.

 private string[] GetFiles()
    {

        strSourcePath = textBox1.Text;
        strTargetPath = textBox2.Text;
        string fileName = string.Empty;
        strExtension = /*!string.IsNullOrEmpty(textBox3.Text) ? textBox3.Text :*/ "*).pdf";
        string[] files = null;


        if (System.IO.Directory.Exists(strSourcePath))
        {

             files = System.IO.Directory.GetFiles(strSourcePath, strExtension, SearchOption.AllDirectories); 

            var Result = 

            string joined = String.Join("# ", Result);
            files = null;



            Result = joined.Split('#'); 
            files = Result.Where(file => Regex.IsMatch(Path.GetFileName(file), "^[0-9]+")).ToArray();

           }

        else
        {
            MessageBox.Show("Source path does not exist!");
        }

        return files ;
    }

As far as I understand the Actor Model and the Reactive Programming are separate concepts. Actor Model does not seem to be inherently reactive to me.

However the Akka framework which is an Actor Model implementation is being described as reactive:

"Java and Scala program logic lives in lightweight Actor objects, which send and receive messages in a reactive fashion."

"We Are Reactive"

Is it a case of misusing the term or they are completely correct? Is any actor model implementation (e.g. Erlang) already reactive? Is simply generating messages as a response to other messages considered reactive as well?

Some related reading where the approaches are contrasted:

http://stackoverflow.com/questions/20740114/rx-vs-messaging-queues-like-rabbitmq-or-zeromq

http://cs.stackexchange.com/questions/9038/how-do-functional-reactive-programming-and-the-actor-model-relate-to-each-other

http://lambda-the-ultimate.org/node/2203

I'm not sure how I should have worded the question.

If I have a Student and Classes database, and I have queries that involve both. Where do I put my queries? In one case, someone wants student information, and I query Students and Classes in my Student class, if I put it in Classes, I cross over to the Students, [edit] violating single responsibility.

I thought I should only have queries for Students and queries for Classes in each class of this part of the Model layer, each utilized by services.

Also, What do I do when I need new queries? I have this set of queries, then someone comes along and wants some special query. I then copy and paste and change one thing or add an if then or a switch, this gets multiplied across the class in my model layer in multiple objects, giant switch statements, etc. That does not seem to be what Model layers should be composed of, giant Models with code everywhere, violating DRY.

I have a service in one object in Students, findAllClassesByStudent($student_id) I call in my View perhaps, and another in Classes, findAllStudentsInAParticularClass($class_id). Those are pretty close.

I realize I can abstract yet more layers and isolate logic in some other layer, but I can't abstract forever, sooner or later I have what appears as some violation of OOP's encapsulation. ViewModel View, Abstracted Data Access Layer, the services, etc. and so on. If I do too little, then my objects are anemic.

I've been reading a lot and while there is a lot of interpretations, I'm assuming I'm leaving all the business logic in the Model layer, not on the controller or the View.

EDIT:

Pseudo examples:

class Student extends Model {

private $student

public function __construct() {

}

public function getStudentByID($student_id){
...SQL
}

public function getStudentClasses($student_id){  //first time

}



}

class Classes extends Model {

public function __construct(){

}

public function findAllStudentsInAParticularClass($class_id){  //feels like bloat
...SQL
}

}

This seems like duplication to me. Perhaps I haven't thought it through enough. I just know from experience there's always someone that wants slightly different queries, and I end up copying and pasting.

I'm interested in the best approach to adding auto update functionality to a web application.

Currently

  • The patches are downloaded from the softwares support site
  • Uploaded to the host server(s)
  • Extracted
  • The patch process is run

The patch process needs to know a few things, specifically the webroot of the application and the database host, name and user in order to run migrations between the point releases.

What I would like to see happen if implement a module inside the application which using some technology similar to cURL fetches the latest package, extracts it and runs the necessary command to apply the patch. However I don't think the end user should be expected to know the specifics of the server. e.g. the location of the application, the database host, user and password.

I'm thinking the best way to secure this information would be a separate database table accessed by the update module using the users existing login credentials (provided they had necessary privileges to update the installation)

What other considerations do I need to take into account?

Are there any factors I have overlooked?

I'm developing a (php) Web App which will sell dynamically generated real time cell phone numbers for cellular companies. A company will ask for, say, a thousand numbers and this app will check for available numbers and provide them.

The number will be an 8 digit figure. The first numbers will mostly be fixed as specific codes for a particular company, rest of the digits will be dynamically generated.

My question is whether

a) I should store all the sold numbers in database, if yes then:
   i)  Separate number in separate row or
   ii) All the numbers in a single row

b) Should store range of numbers i.e 32500001-32510000

Keeping performance and ease of handling the algorithm in mind, kindly suggest me your solution.