All posts by admin

My Happily Ever After

When you grow up reading lots of fairy tale chances are high that you will turn out to be a hopeless romantic. So here am I, eternally smitten by the love bug and constantly waiting for my “Happily Ever After”. So now how do you attain your “Happily Ever After”?

In my case there are many potential instances when I believed I had reached my “happily ever after” only to realise that I am still on my way. Was it when my the then boyfriend (currently my husband) Akash said he has fallen in love with me ? It was exactly what I wanted to hear having myself fallen head over heels in love with him. In fairy tales this was exactly where the story ended and I was fooled in to believing “That’s it … I have got my happy ending as well.” But it seemed fate had some other plans for me and we ended up breaking up just a week before we could celebrate our first anniversary.

I cried buckets and hated everything romantic around me. I became a sorry figure and realised I hadn’t yet reached my “Happily Ever After”. Now after a few months Akash came back to me again and thus started our second innings. Now this time around I became cautious and though I was on cloud 9, I didn’t think it was my “Happily Ever After” yet. This is how we spent 9 long years together secretly waiting for my “Happily Ever After”. In between we fought bitterly , stopped talking to each other then again came back.

In the whole process I carefully nurtured my dream of achieving “Happily Ever After”. I would often eat up Akash’s head saying how long will it take for us to be there? Our parents finally met and decided on our wedding date. Was I close to my happy ending? I waited with bated breath when I signed my marriage registry papers. Finally we became ours legally on this date 3 years ago. 5 months later we got got married socially. But we were far from our “Happily Ever After”.

For one whole year we stayed apart as Akash wasn’t able to get a transfer to Mumbai and I couldn’t go to Jamnagar leaving everything behind. While I waited for Akash’s transfer my dream of our happy ending seemed bleak as we were not getting any ray of light. Finally Akash got his transfer and so did I. While I was on my flight to Mumbai from Kolkata I finally thought I have attained my “Happily Ever After”. I stepped into Mumbai to begin a new chapter of my life and thus ended my story.

But wait a minute was it really my “Happily Ever After”? Actually our story just started. The little guy with twinkle in the eyes who managed to steal my heart without doing anything is now my husband and that we were staying together under one roof was actually unreal for me. It took me a couple of early mornings when I would wake up and find him sleeping beside me to realise that we were really together now. The feeling of happy ending was finally sinking in.  Gone were those days when I would just be content by holding his hands and taking a stroll on those bustling roads. Now we lived together and not only lived but we shared a life together helping each other in household chores , handling crazy office schedules to take out some time for each other, having dinner together after making it together.

Our late night food cravings , constant struggle to keep the house liveable, my weird recipes, his constructive criticism – Life couldn’t be happier. It was utter relief when your husband made Khichdi  after you had come home dog tired both emotionally and physically drained. Those weekends seemed to be the happiest times when I could simply toss and turn in the bed doing absolutely nothing and having takeout biriyani in lunch thereafter realising the huge calorie content and making dinner in the evenings.

While all this happened my husband expressed his desire to study further and started preparing for his GMAT exam. To study is one thing and to see somebody studying with their heart and soul to fulfil their dream is another thing. As I witnessed my husband studying I could sense the outcome as well. He was preparing for one year MBA which meant we would again be separated for another year.

Now where did my “Happily Ever After” go ? As I saw my husband coming back from his MBA interview I was torn apart between what to pray to God? Should I pray that he succeed and follow his dream or should he just stay with me happily just like the way we did ? I decided not to pray at all leaving it to God to decide.

So God decided that I need to renew my quest for attaining my “Happily Ever After “. While I was bidding good bye to my husband I felt like my heart would explode. But my heart didn’t explode as my tears defused the bomb.

Now that I am waiting for my husband to come back I find solace in the memories that we created together. The late night movies , our constant bickering , our rented apartment , his pillow , his side of the bed , his shirts and t-shirts everything just reminds me of him.

I understood that “Happily Ever After” is not one thing. Its actually those times when he would come running to meet me after a long time, his taking a stand for me when I desperately needed someone by my side. It was when he would console me that its just a matter of time that we again found our marital bliss. It was when he would let me sleep endlessly in the weekends not just for me but so that I don’t nag him to clean the house. It was when his face would light up seeing me after a long day. It was when he would give me a reassuring hug that everything would fall into places. It is when despite of hating him so much I would hopelessly fall in love with him  again.

Wasn’t it happiness that I felt when my husband ran to catch my office bus so that I wouldn’t miss it or when his egg curry tasted better than mine after learning how to cook from me?

I know when he reads it there will be more grammatical mistakes to discuss than wishful thinking. But isn’t it why I love him so much ? He is fussily fuss free if you know what I mean.

So Mr Basu , here’s Cheers to our 3 years of being legally bound to each other. Don’t think I won’t complain any more. I plan to enjoy my journey to the “Happily Ever After” while eating your head on the way.

 

Mumbai Darshan and Lonavala – Lavasa Diaries

What do you do when your best friends turned family come to visit you for the first time after marriage ? You plan an epic getaway. Our friends turned family consists of my husband’s cousin Sam and my best friend cum classmate Suchi who are coincidentally very happily married to each other. Sam and Suchi are very good drivers as well. So when these two genius decided to visit us I knew this will be a road trip  to remember. Away from home we were like free birds just waiting to take the flight.They landed on 24th January 2017 night and boy you should have seen us planning and plotting our great escapade. Unfortunately the next day I had office so with a heavy heart I went to office thinking that one day was getting wasted. But these guys were smart they rented a car from “Zoom Car” and picked me up from Powai while having a small snack break at “K3”. If you ever visit Powai don’t forget to gorge on their hot lip smacking jalebis. After that we headed straight towards Bandra Band Stand where all the celebrities stay.

First stop was definitely Mannat. Even on a weekday people like us come to visit Mannat to get a glimpse of Shahrukh. Standing in front of Mannat we felt unreal. After recovering from our awe we next headed towards Bandstand where we enjoyed the nice walk along the promenade. After promenade we zoomed past the Bandra Worli sea link. It was a long pending wish of mine that came true that night.

sitting in front of Mannat

 

Posing away at Bandra Promenade
tired from all the walking
The view behind Promenade
dinner at chillies
Whiling away till our order arrived

Finally we crashed at the Chillies in the InOrbit Mall Vashi , had a hearty dinner , went to sleep with the hope of waking up early to leave for Lonavala the next day.

Though my post is not sponsored byZoomCar still ZoomCar was really one of the reasons of our smooth trip. It made me and my husband want to learn driving badly.

The best thing about being in Mumbai is you have a number of places to visit in the vicinity. So our genius Sam guided by Google Maps drove us along the beautiful picturesque Mumbai – Pune highway. The hills here and there and the lush greenery soothed our eyes. Coming from the plains of West Bengal the road trip proved to be a treat for us. As we neared Lonavala , everywhere there were big posters of Wax Museum. There is a strange competition going on in Lonavala between various wax Museums like Sunil’s Celebrity Wax Museum then there is Lucky’s Wax Museum and many more. I can’t say how good they are because we didn’t get the time to visit them rather zoomed past them on the way to our hotel. We booked our hotel through Zomato which was a little outside Lonavala all thanks to the crowded houseful Republic Day.

We literally dumped our bags in the hotel , freshened a bit and again hit the road. Since our hotel was in the outskirts of Lonavala we drove back inside Lonavala to have lunch at the famous German Bakery. If you are at Lonavala then don’t forget to visit the German Bakery. I can’t explain my delightfulness in having their simple salads.

 

IMG-20170126-WA0013

Brunch at the famous German bakery @ Lonavala

 

 

One of my happiest memories of Lonavala was the lunch at German Bakery. The continental lunch consisted of Chicken Caesar Lunch , Chicken Stroganoff, Chicken Chilly Dry , Pasta Alfredo blueberry cheesecake, mango cheesecake which melted in my mouth.

 

After having lunch we turned to Google Maps and found out we can visit Carla Caves , Bushy Dam  and Tiger Point. Carla Caves however would be closed by then. So we kept it to next day’s plan. Bushy Dam and Tiger Point are on the same way with Bushy Dam coming first. On the way to Bushy Dam we came across a very beautiful valley sort of place. We stopped a while at this place to take pictures.

After this we headed off to Bushy Dam. There is a nice little trek on the way to the base of the Dam. Since we visited Lonavala during winters I think we missed Bushy Dam in its full glory.

From Bushy Dam we started ascending towards Tiger Point. The road is steep and winding. Better to start early and climb down while there is light. I think in winters its stays open till 7pm. It is one of the most breathtaking places I have ever visited. Though the circuitous roads instilled fear in my heart but still the view from there is totally worth it.

My overzealous family couldn’t help themselves but go at the edge of the Tiger Point. I being a self proclaimed timid person couldn’t muster enough courage to go beyond the railing and enjoyed myself by taking their snaps.

DSC00862DSC00878DSC00869

Having had an eventful day we headed back to our hotel and on the way back planned for the next day. We were torn between Lavasa or Aligarh. We had to go Karla caves anyways. So next morning we finally decided that we will go to Lavasa no matter what and return back home. So our day started with a quick breakfast and we started for the Karla Caves. I wasn’t expecting much but I was pleasantly surprised after reaching the top of the mountain.

It gave us a feeling of a mini trek as we climbed up the narrow steep steps soaking in the morning sun and the humdrum of the shops that sat on the sides of the stairs.

At the top of the stairs is the famous Karla Caves and a temple.

 

 

After our Karla Caves expedition we started our journey to Lavasa , the first planned Hill station since independence. We crossed bustling Pune in between which was like burning hot. After crossing Pune we started ascending following the winding road to Lavasa. In between we stopped for a while at a solitary eatery for a cup of tea but instead had pitla and jowari roti.

The road to Lavasa is as picturesque as the place itself. I had seen Lavasa in a number of movies and longed to visit those colourful buildings. It was like a long pending wish that came true. Finally even I could take a picture standing on that little bridge with the colourful buildings in the backdrop.

DSC00958

I would have loved to stay at Lavasa for a day to just spend the night taking a stroll around the place but alas the hotels were too costly to ruin my plans.

We found a dainty little popsicle shop which makes awesome cold coffees. I could just spend hours sipping the coffee and selecting the variety of popsicles.

 

The Lavasa Lake gives the perfect spot for shooting those candid car shots or bike rides.

After a long ride we were hungry as hell even the cold coffee didn’t help so we went searching for a restaurant and found ourselves here @ All American Diner.

The trip couldn’t have ended better without us getting a glimpse of the beauty of the sunset while returning back. It made all the effort worth while when we just drank all the gorgeousness of the mellowed sun over the Lonavala Lake.

DSC_0316
P.C Sam .. The wind added to the romantic view
DSC_0321
P.C Sam … I can’t explain how gorgeous the scene was
DSC_0324
P.C Sam or Suchi

We came home with truck load of memories of a good time. My only regret is I couldn’t take them to Colaba. I badly wanted me and Suchi to have a haul at Colaba but alas not all dreams come true at the same time. But we ended the trip with a visit to Starbucks that kind of made up for the loss.

 

How to create your own custom NSOperation subclass

Hi Guys,

Sometimes what happens is you are using a third party library to perform a particular task. Now you need to perform this task on an array in a sequential manner. Now comes the challenge how would you track the completion because it may end in some other thread.

At this point I feel a custom NSOperation really helps.

I got inspiration from AFNetworking custom operation “AFURLConnectionOperation.m”

First you need to implement

  1. start
  2. operationDidStart
  3. cancel

Then you need to maintain the states of the operation like

  1. Paused State
  2. Ready
  3. Executing
  4. Finished

So in my custom operation .h file I would create an enum like this

typedef NS_ENUM(NSInteger, ResourceDownloadOperationState)
{
 ResourceDownloadOperationPausedState      = -1,
 ResourceDownloadOperationReadyState       = 1,
 ResourceDownloadOperationExecutingState   = 2,
 ResourceDownloadOperationFinishedState    = 3,
};

After this I would create my own set of success , failure and progress block which I would need to pass in the custom init method of the NSOperation subclass say ResourceDownloadOperation.

typedef void(^NetworkManagerFailureBlock) (id errorMessage);
typedef void(^NetworkManagerProgressBlock) (id progressMessage, CGFloat progress);
typedef void(^NetworkManagerSuccessBlock) (id responseObject);

In the interface of my ResourceDownloadOperation class I would need the following properties

typedef NS_ENUM(NSInteger, ResourceDownloadOperationState)
{
    ResourceDownloadOperationPausedState      = -1,
    ResourceDownloadOperationReadyState       = 1,
    ResourceDownloadOperationExecutingState   = 2,
    ResourceDownloadOperationFinishedState    = 3,
};


#define DOC_DIRECTORY  [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]


@interface ResourceDownloadOperation : NSOperation

@property (nonatomic, copy) NetworkManagerSuccessBlock successBlock;
@property (nonatomic, copy) NetworkManagerFailureBlock failureBlock;
@property (nonatomic, copy) NetworkManagerProgressBlock progressBlock;

@property (nonatomic,strong) NSMutableURLRequest *request;
@property (nonatomic,strong) NSURLSessionDownloadTask *downloadTask;
@property (nonatomic,strong) AFURLSessionManager *urlManager;

- (instancetype)initWithRequest:(NSMutableURLRequest *)request successBlock:(NetworkManagerSuccessBlock)successBlock progressBlock:(NetworkManagerProgressBlock) progressBlock failureBlock : (NetworkManagerFailureBlock) failureBlock;

In the implementation file we will be declaring the private methods of the class like this

@interface ResourceDownloadOperation ()

@property (readwrite, nonatomic, assign) ResourceDownloadOperationState state;
@property (readwrite, nonatomic, strong) NSError *error;

- (void)operationDidStart;
- (void)finish;
- (void)cancelConnection;
@end

@implementation ResourceDownloadOperation

- (instancetype)initWithRequest:(NSMutableURLRequest *)request successBlock:(NetworkManagerSuccessBlock)successBlock progressBlock:(NetworkManagerProgressBlock) progressBlock failureBlock : (NetworkManagerFailureBlock) failureBlock
{
    if (self = [super init])
    {
        // 2: Set the properties.
        self.request  = request;
        self.successBlock  = successBlock;
        self.progressBlock = progressBlock;
        self.failureBlock  = failureBlock;

        AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
        securityPolicy.allowInvalidCertificates = YES;
        [securityPolicy setValidatesDomainName:NO];
        
        NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
        self.urlManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
        self.urlManager.securityPolicy = securityPolicy;


        
    }
    _state = ResourceDownloadOperationReadyState;
    return self;
}

- (BOOL)isReady {
    return self.state == ResourceDownloadOperationReadyState && [super isReady];
}

- (BOOL)isExecuting {
    return self.state ==ResourceDownloadOperationExecutingState ;
}

- (BOOL)isFinished {
    return self.state == ResourceDownloadOperationFinishedState;
}

- (BOOL)isConcurrent {
    return NO;
}

//This method is called automatically
- (void)start
{
    if ([self isCancelled])
    {
        
        [self cancelConnection];
    }
    else if ([self isReady])
    {
        self.state = ResourceDownloadOperationExecutingState;
        [self operationDidStart];
        
    }
    
    NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
    while(self.state != ResourceDownloadOperationFinishedState){
        [runLoop run]; 
    /* 
     to keep the thread running till the operation is finished 
     If you don't write this line the control doesn't return to the 
     completion handler of the block. 
     As a result in an array of operations only the first one executes rest don't.

    */
    }
    
}


- (void)operationDidStart
{
    if (![self isCancelled])
    {
        NSURLSessionDownloadTask *downloadTask = [self.urlManager downloadTaskWithRequest:self.request progress:^(NSProgress * _Nonnull downloadProgress)
        {

            NSString *resourceName = [[[self.request URL] absoluteString] lastPathComponent];

            if (downloadProgress.fractionCompleted == 1) {

                NSLog(@"Percentage Completed of %@ : %f",resourceName,downloadProgress.fractionCompleted);
            }
            _progressBlock( resourceName, downloadProgress.fractionCompleted);
        } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response)
        {

//here we specify a path for the resource to be downloaded temporarily and after completion the resource will no longer be at that temp location
            NSString *docpath = [DOC_DIRECTORY stringByAppendingString:@"/doc/"];

            NSURL *docUrl = [[[NSURL alloc] initFileURLWithPath:docpath] URLByAppendingPathComponent:[response suggestedFilename]];
            
            return docUrl;
        }
            completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error){
                if (error == nil) {
                    
    NSString *docpath = [DOC_DIRECTORY stringByAppendingString:@"/doc/"];
                    
     NSString *resourceName = [[[self.request URL] absoluteString] lastPathComponent];

       NSString *downloadPath = [[docpath stringByAppendingPathComponent:resourceName] stringByAppendingPathExtension:@".pdf"];
                                
   NSLog(@"File is downloaded to: %@", filePath);
    //moving the file from temp location to app's own directory
      NSFileManager *fileManager = [NSFileManager defaultManager];
      NSURL *downloadURL = [[NSURL alloc] initFileURLWithPath:downloadPath];
                                
    BOOL fileCopied = [fileManager moveItemAtURL:filePath toURL:downloadURL error:&error];
    NSLog(fileCopied ? @"Yes" : @"No");
                    
        [self finish];
        _successBlock (self.request);
                    
        NSLog(@"Download Completed for : %@",resourceName);
         
                }
                else
                {
                    NSString *resourceName = [[[self.request URL] absoluteString] lastPathComponent];

                    NSLog(@"Failed : %@",resourceName);
                    NSLog(@"download error%@ ",error.description);
                    [self finish];
                    _failureBlock (resourceName);
                    
                }
            }];
        [downloadTask resume];     
        if (self.isCancelled)
            return;
    }
}
//
- (void)finish
{
 self.state = ResourceDownloadOperationFinishedState;
}
//The cancel methods are totally inspired from the AFNetworkingRequestOperation
- (void)cancel
{
    if (![self isFinished] && ![self isCancelled])
    {
        [super cancel];
        
        if ([self isExecuting])
        {
            [self cancelConnection];
        }
    }
}

- (void)cancelConnection
{
    NSDictionary *userInfo = nil;
    
    if(self.request.URL)
    {
        userInfo = [NSDictionary dictionaryWithObject:self.request.URL forKey:NSURLErrorFailingURLErrorKey];
    }
    NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo];
    
    if (![self isFinished])
    {
        if (self.downloadTask.state == NSURLSessionTaskStateRunning)
        {
            [self.downloadTask cancel];
            self.failureBlock (error.description);
        }
        else
        {
            // Accomodate race condition where `self.connection` has not yet been set before cancellation
            self.error = error;
            [self finish];
        }
    }
}

AFNetworking 3.0 Custom Batch Request Examples

Hi Guys,

If you are like me completely smitten by AFNetworking , then probably you may have noticed that in 3.0 they have removed the batch request using “AFHTTPRequestOperation“. So when I went to migrate my code from 2.0 to 3.0 , I got stuck. I googled , went to stack overflow and then I realised there isn’t a readymade solution to this. So I pulled up my sleeves and started thinking of my own implementation.

My use case was something like this I had a list of documents that I needed to download from the server. And in the meantime I need to show the  progress of the overall download operation to the user so that he can get an idea when the operation is finished and all his documents are now ready to be read.

So in AFNetworking 2.0 I could do like this ,

@interface ViewController ()

@property (nonatomic,strong) NSMutableArray *downloadArray;
@property (nonatomic,strong) NSMutableArray *failedArray;

@property (nonatomic,strong) NSOperationQueue *queue;
@property (nonatomic,strong) UIProgressView *progressView;

@end


-(void) downloadResource
{
    NSMutableArray *allOperations = [[NSMutableArray alloc] init];
    
    if(!_queue)
    {
        _queue = [[NSOperationQueue alloc] init];
    }
    else
    {
        [_queue cancelAllOperations];
    }
    
    [_queue setMaxConcurrentOperationCount:1];

     for (NSString *requestUrlString in self.downloadArray) { 


    NSMutableURLRequest *downloadURLRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestUrlString]];

    AFHTTPRequestOperation* operation = [[AFHTTPRequestOperation alloc] initWithRequest: downloadURLRequest]; 

    [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long   long totalBytesExpectedToRead) {
    //you can track the progress of individual resources

 }]; 
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { 
     NSMutableURLRequest *request = (NSMutableURLRequest *)operation.request; 
    
   //do whatever you would like to do with the responseObject since this is the resource that you downloaded 

   //you write it to a filePath in document directory 

  //may be reload a table

    NSLog(@"Completed no of operations :  %lu",self.downloadArray.count - _queue.operations.count); 
     if (_queue.operations.count == 0) { 
      [self queueDidFinishSelector:_queue]; 
    } 

   [self.progressView setProgress:(_queue.operationCount/_queue.operations.count) * 100.0]; 

} failure:^(AFHTTPRequestOperation *operation, NSError *error) 
{ 

   NSLog(@"Complete But Failed: %lu",self.downloadArray.count - _queue.operations.count); 

   NSMutableURLRequest *request = (NSMutableURLRequest *)operation.request; 
   [self.failedArray addObject:[request.URL absoluteString]];
       if (_queue.operations.count == 0) {
          [self queueDidFinishSelector:_queue]; 
      } 

     [self.progressView setProgress:(_queue.operationCount/_queue.operations.count) * 100.0]; 

    }]; 

    [allOperations addObject:operation]; 

} 

NSArray *operations = nil; 

     if (allOperations.count) { 
           operations = [AFURLConnectionOperation batchOfRequestOperations:allOperations   progressBlock:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) { 

 self.progressView.progress = (float)numberOfFinishedOperations/totalNumberOfOperations;

 } completionBlock:^(NSArray *operations) { 

     NSLog(@"All operations in batch complete"); 
     self.progressView.hidden = YES; 
 }]; 

} 

    if (operations) {
     [self.queue addOperations:operations waitUntilFinished:NO]; 
    } 

} 

- (void)queueDidFinishSelector:(NSOperationQueue *)queue 
{ 
     [self.progressView setHidden:YES]; 

   if (self.failedArray.count > 0)
    {
        [self showAlert:@"Sync Failed" error:nil];
    }
    else
    {
        [self showAlert:@"Sync Completed" error:nil];
    }
    
}

-(void)showAlert:(NSString*)title error:(NSString*)err
{
    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title message:err delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [alert show];
    
}

But now that we have moved to AFNetworking 3.0 ,  “AFURLConnectionOperation” is no longer available.

So that leaves us to create our own operation.

Firstly replace your old AFNetworking code with the new 3.0 code. You can either use CocoaPods or simply like the good old days , copy the AFNetworking folder to your project folder. As soon as you do it you will realise the following things start showing compilation error.

  1. AFURLConnectionOperation
  2. AFHTTPRequestOperation

After that I am going to show you to rewrite the same piece of code in 3.0.

-(void) downloadResourceUsingNewCode

{

//redundant now
NSMutableArray *allOperations = [[NSMutableArray alloc] init];

if(!_queue)  {
_queue = [[NSOperationQueue alloc] init];
}else{
[_queue cancelAllOperations];
}

[_queue setMaxConcurrentOperationCount:1];

for (NSString *requestUrlString in self.downloadArray) {

NSMutableURLRequest *downloadURLRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:requestUrlString]];

DownloadOperation *downloadOperation = [[DownloadOperation alloc] initWithRequest:downloadURLRequest successBlock:^(id responseObject)
{

NSMutableURLRequest * request = responseObject; //success block sends back the request

NSLog(@"Completed operation");

} progressBlock:^(id progressMessage, CGFloat progress) {

} failureBlock:^(id errorMessage) {

NSLog(@"failed operation");

}];

[self.queue addOperation:assetDownloadOperation];
}

[self.queue addObserver:self forKeyPath:@"operationCount" options:0 context:NULL];
}

- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object

change:(NSDictionary *)change context:(void *)context

{

if (object == self.queue && [keyPath isEqualToString:@"operationCount"])

{

if ([self.queue.operations count] == 0) {

// Do something here when your queue has completed

NSLog(@"queue has completed");

dispatch_async(dispatch_get_main_queue(), ^{

// code here

[self queueDidFinishSelector:self.queue];
});
}
else
{

NSLog(@"Completed no of operations : %lu",self.downloadArray.count - _queue.operations.count);

dispatch_async(dispatch_get_main_queue(), ^{

// code here

self.progressView.progress = (float)(self.downloadArray.count - _queue.operations.count)/self.downloadArray.count;

});

}

} else {

[super observeValueForKeyPath:keyPath ofObject:object

change:change context:context];

}
}

Now the question is what do you write inside your custom operation?

I created my custom operation primarily for the reasons like

1. Put them in a queue and fire them away and there goes your own batch of requests .
2. You get a hold of when all the operations are finished so that you may want to do some UI changes ; in my case it is to hide the progress view.
3. To track which resource is currently getting downloaded and how much progress has it made so that in a tableview of list of resources I can add a progress view to show its individual progress and when it finishes I can reload the table and show the progress going on in the next resource.

Now to fulfil all these, in each operation I created a “NSURLSessionDownloadTask” which will download the resource that I intend to download. If the request returns success response then move the file to the desired file path.

If you want to know how to create your own custom operation , please refer to my next post as this one is getting too long.

Let me know if you have also implemented the batch operations or requests with AFNetworking and let’s find out the best approach.

 

Best Friend’s Wedding

1st Jan 2017

So the fact is my best friend Jyoty is getting married,  and it gives me ample reasons to get excited. Excited is a little word … actually I’m thrilled. When you grow up together and see your best friend getting all decked up and married , it makes you emotional. And you want no leaves unturned. This being the case I am getting ready for d-day. Not only she but I have to look my best as her wedding might be the last time we all friends will come together and celebrate. Now  in a Marwari-Bihari wedding there has to be lots of oomph and that needs to reflect in me as well.

Being a four day affair at least I would need 4 outfits one each for

  1. Sangeet
  2. Mehndi
  3. Haldi
  4. Wedding

Haldi and Mehndi being  home affair I am not that stressed about my outfits. But sangeet and wedding sure are giving me the jitters.


19th Jan 2017

19 days have passed and I don’t know what I am wearing for the sangeet which is the prime cause of my concern. The good news is that – I got myself a lehenga for the wedding. Will reveal it soon. I am having million doubts whether its a little too simple for the wedding. But as you know I am the bride’s best friend so I will probably have to do a lot of running so keeping it light is a safe bet.

In my last bestie’s wedding I couldn’t master the art of posing for the perfect shot. End result being my never ending regret of not prepping for the photoshoot. So this time around I am leaving no stones unturned. Let me give you a glimpse of what poses we friends are going to strike at Jyoty’s wedding.

https://in.pinterest.com/pin/527695281323750056/

 

Travel Packing Checklist for Women in Leh & Ladakh

Our trip to Leh & Ladakh was a very hastily planned getaway. I didn’t know whether I would get leaves but as soon as I got confirmation, me and my husband jumped right into it. We were supposed to join my parents at Leh and Ladakh from Mumbai. Since time was short I started rummaging through the ‘n’ number of sites that provided checklist. While I found many, I wasn’t sure if something specifically catered to girls. So after coming back from my trip I thought it would be helpful if I could share my experience with my readers.


Absolute Must Haves


  1. Photo ID with address proof

Passport is the best bet but if don’t want to carry your passport you can carry your Aadhar card or voter id. Pan card is not accepted as valid Photo id in some places. You will need your ids when you will go to Pangong Lake and Khardungla Pass.

2. Cash

Though you will find many ATMs near the market place but you can never be sure if they have money. So its better to carry enough cash for atleast your street shopping.

3. Water Bottle & Food

Always carry some chocolates and water bottle with you as you never know when you will feel restless. Chocolates and dry fruits are quick snacks because journeys in Leh & Ladakh are quite long. It took us 5 hours just to reach Pangong Lake and trust me the roads are under construction and your chances of getting any food while on the journey are very slim.


Clothes


Weather is very unpredictable at Leh and Ladakh. When I went in the last week of July, it was quite warm in the morning when I didn’t not need any warm clothes but as the day passed by, temperature dropped and I felt the need of putting on warm clothes. So as always layering is the best bet. Besides if it starts to get windy, you will surely feel cold.

  1. Jacket – A jacket is a must and more than enough – I thought it would be very cold and got a quilted jacket from Myntra sale but sadly it was not that cold. A regular wind cheater kind of jacket will suffice if you visit in last week of July. 
  2. Jeans – You can do with 2 – 3 pairs of Jeans.
  3. T-shirts and Tops – Keep in enough numbers. All your synthetic tops will really come handy in this trip. Layer it with scarves, jackets, shrugs.
  4. Socks – You should take at least 3-4 pairs minimum as these are essential. Even if it is hot while you are going out, chances of the temperature dropping while coming back is pretty high and warm legs maintain the body heat.
  5. Cap – The sun is pretty bad here so better take a trendy cap. Good for posing and sun protection.
  6. Gloves – This is like optional. If you are like me visiting in july you won’t be needing these but still for safety one pair will be more than enough.
  7. Comfortable shoes – There will be quite a bit of walking around the monasteries in Leh. So a pair of good shoes will keep motivated for the long roads ahead.
  8. Scarf – A scarf will keep your neck snug which is the most vulnerable place to get cold.
  9. Woollen Cap – When I visited Pangyong Lake the weather was quite bearable but suddenly out of nowhere there was a strong wind making my hair go haywire. So better go for a woollen cap. What’s added is cute pictures. 
  10. Sunglasses – there is something very painful about the sun in Leh. It hits you bad and without a good pair of sunglasses you will be left with a bad headache.
  11. Umbrella – If you are that kind of a person who can’t withstand sunlight then better to carry an umbrella. It will provide you comfort under the scorching sun.

Medicines


  1. Diamox 250mg

This medicine helps you to acclimatize in the high altitude of Leh Ladakh by preventing the body from storing excess water and thus helps in breathing. So keep it and take it at night or when absolutely essential as it will increase your no of visits to the washroom. You may not find clean and usable toilets everywhere specially while going to Khardungla. If you like me are flying directly to Leh then take one tablet some hours before boarding the flight so that when you reach Leh you are not thrown off balance.

  1. Coca 30 or Coca 6

This is the homeopathic alternative to Diamox

3.  Norflox TZ

For stomach upsets

4. Camphor

 Trust me this works. Keep some camphor in a small medicine box and always carry it with you. I didn’t know about it and learnt it from an Aunty who was kind enough to lend me some. Whenever you feel nauseated or dizzy or breathless, sniff the camphor, it will make you feel better.

5. Crocin or Calpol

Paracetamol for fever and body aches.

6. Bandaids


Cosmetics


  1. Moisturizer – Take a bottle with you as your skin soaks up all the moisture and craves for more.
  2. Face cream – Since humidity is very less your skin will become dry very easily.
  3. Vaseline Petroleum Jelly – sometimes due to very dry weather the inner lining of your nose becomes taut. You can always apply some Vaseline to soothe the irritated skin.
  4. Lip balm – Lip balm is a must else chapped lips can be a pain.

Food


  1. Dry Fruits
  2. Chocolates

 

Simplifying Packing with Wildcraft Bag Organisers or Packing cubes

Hi Guys,

Today I wanted to share with you my experience of using packing cubes. We at India mostly pack our clothes in our suitcases, sky bags or rucksacks so packing cubes are not really popular here. For me packing for a vacation or even a small trip is like an event. I keep fretting and planning and some more planning but still the fact that I need to pack my stuff does give me night mares. So to ease that anxiety I tried to learn from my Youtube Travel Guru Sonia Gill from Sonia’s Travel. Basically I search each and everything in Youtube , sometimes to learn a new way of doing it or to gain knowledge on the existing one. So while going through Youtube I came across this concept of packing your stuff in packing cubes. Globally  Eagle Creek Packing cubes are very famous for their durability and flexibility. But poor me ! Where do I get them in India so while browsing through Amazon I came across 2 reputed brands that make packing cubes

  1. AmazonBasics Packing Cubes – which is available in a set of 4 pieces of different sizes and serving different purposes priced around 1095. Sometimes they are in sale and you’ll get them for around 949 and they come in 6 different colours.

  2. Wild craft – which comes with individual packing cubes with different sizes.

 

 

 

So after deliberating a lot … you know how we girls keep on thinking , rethinking and finally come up with a decision and even after executing the decision we wonder whether we made the right choice. Sorry for drifting away but the point is I chose the following packing cubes from WildCraft each for me and my husband.

I chose WildCraft mainly because I have already used its big bag pack which my husband gifted me and I have literally abused it. Still it didn’t  disappoint me. That’s why I trust WildCraft for their quality. The packing cubes were orange in colour and I love orange.

    • Wildcraft Orange Bag Organizer (2 Compartment Travel Cube Orange) – Priced at Rs 499
    • Wildcraft Orange Bag Organizer (Travel Cube Orange) – Priced at Rs 349
    • Wildcraft Grey Bag Organizer (Travel Cube Mini Grey) – Priced at Rs 249

So if you are like my mother, you will obviously become sceptical of the fact whether it actually works or I simply wasted my money on some random online stuff. I have to deal with this quite often so I weigh the pros and cons.

Pros

1. Organizability –  Saves space in your luggage and also you can use them at home like I do to keep the smaller stuff like inners and handkerchiefs in place.

2. Practicality –  Saves time and effort to pack and unpack

3. Quality – Quality is very good. The mesh in wildcraft one is quite strong and not at all flimsy. Further the material of the cube itself is also sturdy and not stiff at all. You can squash them in the corners of your suitcases.

4. Flexibility – Sometimes in the smaller ones I pack my travel chargers, adapters , electronics items and when I need them I know which cube to pick up and done.

Especially I am a very “only hand baggage sort of person” and I hate rummaging through my clothes and stuff in my backpack to  grab something essential while am travelling.I remember once in security check-in I was asked to show a facial brush cleanser which was tucked deep inside my clothes and just imagine dealing with the clutter and retrieving it under heaps of clothes.

Cons

1. I don’t know whether it counts as a con but  when you carry ironed clothes in these cubes after unpacking , these may not remain intact and may get some creases.

My Experience 

In my bid to attain  perfection in packing I started using my packing cubes and boy did it save a lot of hassle and space for me !

Not only when you pack but also when you unpack you will really feel the difference.While travelling to Leh and Ladakh I used these cubes for the first time. When I reached my hotel, I just took out my cubes and laid them on the cupboard shelves and voila !! I was done with my unpacking. I am very fussed about clutter and these cubes have made my life easier. I take all my husband’s inner wear and pack them inside the smallest one and I am sorted. So do I with my ones as well. These small items are very prone to get scattered inside your luggage.

In the smallest cube I can keep upto 6 briefs which I feel is quite sufficient for both small and long trips.

Now coming to the 2 compartment cube, you can pack all your vests and night wear in one side and all your t-shirts in another.

 

The single cube has more depth than the dual compartment one and apt for keeping shirts , trousers or thick clothes.

What is even more handy is while coming back from your vacation you can use these to store your dirty laundry.

Pic Courtesy : Amazon.in

 

 

Travel Diary – Rutugandh Resort & Sinhagad Fort

The entire team was bored and it was about time that we packed our bags and set out for some exploring. So started our frantic search for a good resort. I being new in the city I was super excited to go absolutely anywhere as long as my team members are there. Having a husband at home who was preparing for exam and amidst a whole lot of household chores I was feeling overwhelmed. It was like my big escape with new set of people , their families and me. For me who’s a little sceptical about going alone anywhere it was a big move trust me. But my team was a friendly one. They took me in like I was there all along.

dsc00557
While searching for the perfect getaway that suited our budget we came across Rutugandh resort. I may warn the non vegetarians that its has pure veg restaurant so if you are the one who can’t survive a day without non veg this place is not for you. The Funny thing about this place is all the villains in Bollywood have visited the resort.

This place is beside the Khadakwasla dam near Sinhagad Fort.

Kha

We started our journey on the 1st of October 2016 in a tempo traveller along the Pune highway. With the kids around us cheering us on it couldn’t have been better. On our way to Pune we stopped near the …. to grab some breakfast and tea.

I was quite apprehensive about the Rutugandh Resort but it really turned out to be a nice retreat especially if you have an energetic team with you who can make the stay worthwhile. It was like a small place tucked away from the humdrum of city life . The air changed to a lighter one and the greenery around soothed our eyes. Our flats were also nice and cozy which felt more like home rather than hotel rooms.

We reached around afternoon so soon after we headed for lunch and were greeted with a scrumptious veg spread. It was quite chilly given the rainy weather and the hot dal and paneer gave us new energy. We spent the entire afternoon and evening playing carrom and table tennis. The swimming pool however was closed for the day.

20161001_153657

20161001_154121

By late evening it had started raining heavily so after having snacks I retired back to our room while others tried going to the Khadakwasla dam which was just 5 mins walk behind the resort. However given the rain and the muddy roads even they had to come back.

Rain having dampened our mood we decided to make most of our time indoors. We played non stop card games and non stop “Chor Police”. It was damn funny when we were suspecting our manager being the thief he tried hard to ward off our suspicious looks.
It was past midnight when we finally hit our beds. The weather by then had turned to that of a winter night and we snuggled under our blankets.

Next morning we woke up to a pleasant sunny morning. After having tea I had a very refreshing round of badminton with my manager Shrirang and his son Tanay.

Having finished our breakfast we headed for our next destination The Sinhagad Fort. I didn’t know that Sinhagad fort was one of the popular security posts of the Legendary Shivaji. Though the place is in ruins but the trek to the top really gives you a glimpse of the Maratha Empire. From the base of the Sinhagad fort big vehicles are not allowed so we hired an open jeep which took us the gate of Sinhagad fort.

The weather being lovely cool we gorged on the vada pao with chillies – my first time finding out why Marathi people are obsessed with Vada Pao and bhajia and I could not agree more. The journey to the top began with lots of knickknacks like singhdana which are peanuts actually and raw mango with chilly powder , cucumber etc. The slippery steps and the foggy weather were adding to the mystery of the place.

While climbing we came across the memorial of famous Maratha general Tanaji who won a vicious battle against the Mughals.Visiting his memorial was like witnessing a part of Indian history.
Kaundinyeshwar temple is also worth mentioning. We even got to see a lake which I am not sure is temporary due to the heavy rains or a permanent one.
We walked for around 3-4 hours after which we got tired and started descending. While descending we came across a hut where an aged Aunty served us hot lunch consisting of Bhakri, Pitla, baigan ka bharta , bhajiya and homemade yoghurt which are made in clay pots. It was my first time trying out Marathi cuisine and I am not sure if the clay oven added even more taste to our simple lunch. I absolutely fell in love with Pitla the simple gram flour dish which is like the local fast food.

After the lunch affair we got down to the entrance of the Sinhagad Fort where we enjoyed ice creams. While going back to the base we felt our trip had come to an end so quickly.