Sunday, January 26, 2014

Long distance relation sucks

I had been in two long distance relations, both of which didn't work at all. The idea of being in love is lovely only in initial stages. And actually its stupid, there is no thing called a long distance relation, its just an illusion of love. Even when I made the mistake for the first time, I again fell for the second time.

I have seen a couple of long distance relation in my friends which seem to be worked (at least when you see as an outside person). But actually there are a lot of problems. It actually doesn't make any sense. Its bullshit..

A friend of mine was in love with a girl, then the friend went to US for his post grad, then after 4 years I guess, they are getting married. I really appreciate that couple, it really takes a huge amount of patience, to make the relation work. And I mean it, as I have had the experience.

I really have decided that I will never fall for this kind of relation again, it just frustrate you in the life.
 

Thursday, October 31, 2013

Xcode 5 third party libs, frameworks Linker Error

Hi There,

I am currently working on a project which was developed by someone else.
When I cloned the project for the first time, I was getting linker errors for the third party libs, frameworks like FacebookSDK.framework, flurry etc.
Thought I could see these libs were there in the project navigator and also in the Finder, I really couldn't understand why it was showing the linker errors.
I did few things like Cleaning the project, restarting Xcode, restarting even the mac, which didn't at all work.
Finally found the solution, which I really couldn't thought about and I should have thought about.
Just remove the libs and then re-add them again. (Face-palm).
I know, this should be the obvious first try. Anyway.

Happy Coding.



Thursday, October 24, 2013

Making Vodafone K3800 dongle on Mac OSx Mavericks

Hey,
I just updated the MacBook Pro to OSx Mavericks.
i use Vodafone K3800 stick.
Before the update the dongle was working fine, but after the update of course, it stopped working.
I thought I need to update the Vodafone Mobile Broadband (VMB) software, then it should work.
But unfortunately, it was not that straight forward.
I went to Vodafone support web site and downloaded and installed all the possible versions of VMB from 4.0.7 to 4.0.9. (of course restarted the mac many times).
I was assuming, installing one of these should do. But nothing worked.

But after trial and error, got a way to make it work.

1. Install VMB 4.0.9.17, which is supposed to be the latest version.
2. Install Vodafone K3800 software, which is there in the stick itself.
That's it.
Then the Vodafone K3800 stick will work properly.

Both the softwares need to be installed. Only one of them will never work.

Happy Surfing.





Monday, October 21, 2013

In UITextView subclass for iOS 7, UITextView contentSize.Height returns wrong value

Hello,

When the UITextView is subclassed, contentSize.height works very well in iOS 6 downwards, but in iOS 7 it fails and returns the value which is far less than the actual value.

Here is the fix.

Replace the float height=textView.contentSize.height by

float height=[self measureHeight];

-(void) measureHeight
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    if ([self respondsToSelector:@selector(snapshotViewAfterScreenUpdates:)])
    {
        CGRect frame = internalTextView.bounds;
        CGSize fudgeFactor;
        // The padding added around the text on iOS6 and iOS7 is different.
        fudgeFactor = CGSizeMake(10.0, 16.0);
        
        frame.size.height -= fudgeFactor.height;
        frame.size.width -= fudgeFactor.width;
        
        NSMutableAttributedString* textToMeasure;
        if(internalTextView.attributedText && internalTextView.attributedText.length > 0){
            textToMeasure = [[NSMutableAttributedString alloc] initWithAttributedString:internalTextView.attributedText];
        }
        else{
            textToMeasure = [[NSMutableAttributedString alloc] initWithString:internalTextView.text];
            [textToMeasure addAttribute:NSFontAttributeName value:internalTextView.font range:NSMakeRange(0, textToMeasure.length)];
        }
        
        if ([textToMeasure.string hasSuffix:@"\n"])
        {
            [textToMeasure appendAttributedString:[[NSAttributedString alloc] initWithString:@"-" attributes:@{NSFontAttributeName: internalTextView.font}]];
        }
        
        // NSAttributedString class method: boundingRectWithSize:options:context is
        // available only on ios7.0 sdk.
        CGRect size = [textToMeasure boundingRectWithSize:CGSizeMake(CGRectGetWidth(frame), MAXFLOAT)
                                                  options:NSStringDrawingUsesLineFragmentOrigin
                                                  context:nil];
        
        return CGRectGetHeight(size) + fudgeFactor.height;
    }
    else
    {
        return self.internalTextView.contentSize.height;
    }
#else
    return self.internalTextView.contentSize.height;
#endif

}

This should work.




Tuesday, August 28, 2012

Sportsmanship.. Bullshit..Sydney Test 2008 Ind Vs Aus

After 5 years also, my anger has not subsidized.
It is sad that the Boxing day test played between India and Aus in 2007 will not remembered for the cricketing context, but for controversies, umpiring errors.
After winning the boxing day test of 2007, Australia was all set for the 16th successive win in a row, matching their own record.
Though Aus won this test by 122 runs and a min to spare, this test will be remembered for major umpiring mistakes by umpires Steve Bucknor and Mark Benson and the show of poor sportsmanship by Aus.
The fantastic contest between bat and ball is overshadowed by anything to win attitude of Australia and very low umpiring standards.
The first incident of poor umpiring struck India when Ricky Ponting was given not out by umpire Mark Benson, when he clearly nicked the ball down the leg side. Ponting himself knew that he was out. Later on he scored half century. However later, Ponting dismissed by Harbhajan for the seventh time in his career.
When Ponting got out, Aus's score was 3/119. Micheal Clarke and Adam Gilchrist soon got out leaving Aus on a score of 6/135. India cleared had an upper hand at that stage of the match.
But again, a mistake by Mr. Steve Bucknor changed the course of the match. At that stage Andrew Symond was the only recognized batsman for Aus. In an over, when Ishant Shrama was bowling, he clearly nicked a ball to wicketkeeper MS Dhoni. The decision turned down by the umpire. This shifted the pendulum to Aus side, because Symonds made 162 and remained not out.
The umpiring errors were continuously flowing for the entire match.
eg In the second Aus inning Micheal Hussey was given not out when he was on 22 and 45, off Anil Kumble and R.P. Singh resp.
Later on Hussey went on to score 145, which shifted the course of the match to Aus side.

In the second Inning, Rahul Dravid was given out caught behind, when his bat was clearing hiding behinds the pads. This incident shocked Rahul, but not the umpires.
Saurav also given out caught behind, when the replays also were inconclusive. So umpire Benson asked Ricky Ponting the clarification. I really don't understand, if a player is not honest while batting, then how can you trust his words. Also later, when the same player claims a catch, when the replays clearly show that the ball has grounded. So I think umpires had made some terrible mistakes here.

At the end Aus won the match. But the question is did they deserve it?

The reactions of some of the players.
We start with Mr. Sunil Gavaskar
He words were,
Why is Mr. Benson asking a person who didn't walk off when he was caught behind at 14, and it couldn't be possible that you are lying when you are batting and true while you are fielding, That is Nonsense! Utter Nonsense! I am sorry Mr. Benson, you got it all wrong."


Tony Greig one of my fav commentator talked about ethics of walking, he said,

"Ponting got an edge down the leg-side and was out (but didn't walk). Then he got a bad decision for an lbw and carried on about it. There are double standards. At the same time Ponting is trying to persuade opposition captains to take his word on catches ... they are all over the place. All I can tell you is the best umpiring I have ever experienced and the best relationships between umpires and players was in England in county cricket where we had former first-class players like Mark Benson umpiring. You were considered to be a cheat if you didn't walk"

After this test both the captains met to ensure proper behavior from both the team (ie bullshit spirit of the game). India won the next test and succeeded to draw the last one. But Sydney test was pivotal in the context of the series.

Tuesday, July 24, 2012

SVN Commands

For those who like to use svn from command line, these are the useful commands to remember.
As you use them regularly, you don't need to see this post again.. :D

1) Checkout a project:
    svn checkout url

2) Update and revert:
    -To update local files in a repository:
      svn update filename1, filename2,.
    -To update the entire repository
      svn update

3) revert to the previous version
    svn revert filename1, filename1, ...

4)Difference
   cd folder_name
   diff filename

5)How to commit files:

- Perform an svn diff to check the changes you made-  svn diff
- Then update the file- svn update . There might be conflicts. Then again perform svn diff to check   the conflicts. 

-This diff now shows up the differences between your current file and what's there now in the repository. 
-Check that only the new code you have added is the sum total of the differences. 
svn commit -m "Commit message"


svn diff filename1, filename2, ... , filenamen
svn update 
filename1, filename2, ... , filenamen
svn diff 
filename1, filename2, ... , filenamen
svn commit 
filename1, filename2, ... , filenamen


6)Adding a  new file to the repository:

    svn add filename
    svn commit -m "Commiting the new file that is added" filename



7)Deleting a file from the repository
   svn remove -m "Deleting the file which is not required" filename
 

8)Conflicts and resolving them
-If, when doing an "svn status" of a folder you find any files marked with a C, then it means such    files are in conflict with their corresponding versions in the svn repository.
 

-Doing an "svn update" may indicate files are in conflict as well. If you performed an "svn update" on some files (or on a folder) and one or more came up with the status C then you have a conflict. It means that changes to the same file on the same lines had been committed to the svn repository as what you have been working on. The update could not successfully merge the corresponding lines as it didn't know which lines to keep and which to overwrite: the lines are in conflict.
 

-If you ever encounter a file in conflict and you view it in an editor, you will see that conflicted lines will be marked with ===== and >>>>>. Both the changes you made and the conflicting changes in the repository will be embedded inside such special marks. 
(If you had done an "svn update" on files that turned out to conflict, the action would have created a couple of additional versions of the file: conflict-filename.mine and conflict-filename.. The first is your local version containing the changes you made. The second is the file as it is in the svn repository.)

To resolve conflicts in a file marked with a C
1.    Open up the file that's in conflict in an editor.
2.    Search for all occurrences of >>>> or ===. Each occurrence marks a conflicted section and needs to be resolved.
3.    Deal with marked sections as appropriate: decide which parts you want to keep, which should be removed or how to combine (the best of) both.
4.    Once you've finished editing out the conflicts in the file, you have to set the file's status to resolved for it to be up to date (and updateable with svn):

5.    svn resolved


9)To check the log
    svn log



10) SVN import
If you want to put this project folder into the repository, inside http://svn.abc/other-projects/trunk/ then you would type the following in your x-term:
 

cd my_program
svn import -m "my message" . http://svn.abc.org/other-projects/trunk/my_program



11) Blame
To get the info about which user has committed the code line by line for a particular file

svn blame filename


Happy coding,

Kaustubh



Thursday, October 27, 2011

Comparing Apples and Mangoes


On 5th OCt 2011 the Co-Founder and CEO of Apple Inc. died becasue of Pancreatic cancer.
After a few days, on Oct 12, 2011 the creator of C programming language and Co-inventor of Unix operating system died at the age of 70.
     People say Steve Jobs's death tops the news agenda and when Dennis Richtie died, nobody except only a few geeks notices. But that doesn't mean that Sir Dennis Ritchie has not done anything or he was not as great as Steve Jobs. So this speculation is completely ridiculous.
As a cricket fan I will see this comparison as comparing Sachin Tendulkar to Anil Kumble, which is totally rubbish. Dennis Ritchie was great, there is no doubt about that. He invented C language, unix OS, without this no other OS could evolved. But that doesn't mean that Steve Jobs's vision, marketing priciples are meaningless.
The fact that very less people (which is not the actual case though) noticed Dennis Ritchie's death becasue he was not a person who always be in the limelight like Jobs. Sachin is famous in cricketing world becasue in this world the batsmen always take the glory, unlike bowlers. That doesn't mean that Kumble was not a good cricketor.
The only point I want to raise is a person's credibility doesn't depend upon how famous he is in public but depends upon what work he has done. And people do different kinds of work which can't be and should be compared. That's all.