Tuesday, February 18, 2014

Hide "Posted By" in Dynamic View Template of Blogger

Make change to following:

Dynamic View - Dashboard > Design > Template Designer > Advanced > Add CSS
  • Paste the following code
  • Preview before saving 
  • if happy - Apply to Blog:

  .publish-info {
     display: none !important;
  }







Sunday, February 16, 2014

UIAlertView

How many of you have faced this problem in iOS programming:

Assertion failure in -[UIKeyboardTaskQueue performTask:], /SourceCache/UIKit/UIKit-2903.23/Keyboard/UIKeyboardTaskQueue.m:388
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue performTask:] may only be called from the main thread.'
Recently, I faced this problem while trying to popup a UiAlertView after a success/failure of method sendAsynchronousRequest of Object NSURLConnection as described in THIS ARTICLE

After the problem, I concluded that the show method of UiAlertView has to be called from the main thread only.

So far as my understanding, after the success or failure of sendAsynchronousRequest method, the delegated methods are run in new thread. This is the reason for the exception I got.
Fortunately I found working solutions for this and I realized that there are more than one solution.

Solution 1


[alertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];

Solution 2


if(isSuceess){
    UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"Event" message:@"Event added in calendar" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    dispatch_async(dispatch_get_main_queue(), ^{
        [alertview show];
    });
}
else {
    UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"Event" message:[err description] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    dispatch_async(dispatch_get_main_queue(), ^{
       [alertview show];
    });
}








Saturday, February 15, 2014

Symlink Pointing to itself

Recently I came across a weird problem.

I created a symlink with the command
ln -s <source> <destination>

After the creation of the symlink what I noticed was that the symlink was pointing to itself and hence I had the problem "too many levels of symbolic link."

Solution

I am not sure whether this is the solution but it worked in my case.

When I ran the command, I was in the <source> directory.

Later when I changed the directory to the destination to run the command ln -s <source> <destination>, the output symlink actually pointed to the desired source.

Hope this works for others as well.

please comment if you have other solution.
Thanks






Copy-Paste Cut-Paste in Mac/OSX

Frankly speaking, I was only familiar with the Copy-Paste command in mac. i.e.
  • command + c for copy and
  • command + v for paste
I have always wondered why there was no so obvious Cut-Paste in mac.

Till now I always used to copy and then delete the original copy.

Even though there is option to move by dragging, it was not always convenient.

Then it was not long before that I have come to know the short cut for Cut-Paste and it has made my life far more easier. The command is:
  • command + c for copy as before
  • option + command + v for cut paste
Its really simple :), isn't it?