Wednesday, December 30, 2015

Do you have any helpful habits or routines?

I felt it's very interesting write-up by Andrew Ng and which I can feel everyday in my life. Worth keeping in my notes!!

Do you have any helpful habits or routines?

I wear blue shirts every day, I don’t know if you know that. [laughter] Yes. One of the biggest levers on your own life is your ability to form useful habits. 

When I talk to researchers, when I talk to people wanting to engage in entrepreneurship, I tell them that if you read research papers consistently, if you seriously study half a dozen papers a week and you do that for two years, after those two years you will have learned a lot. This is a fantastic investment in your own long term development. 

But that sort of investment, if you spend a whole Saturday studying rather than watching TV, there’s no one there to pat you on the back or tell you you did a good job. Chances are what you learned studying all Saturday won’t make you that much better at your job the following Monday. There are very few, almost no short­ term rewards for these things. But it’s a fantastic long­term investment. This is really how you become a great researcher, you have to read a lot.

People that count on willpower to do these things, it almost never works because willpower peters out. Instead I think people that are into creating habits — you know, studying every week, working hard every week — those are the most important. Those are the people most likely to succeed. ­ 
                                                                                                                                           -Andrew Ng 




Tuesday, December 29, 2015

Eclipse popup dialog/ notification message blocked by model shell



In general, while we are working on any eclipse model dialog/wizard ,if any notification dialog appears that will be blocked until get it's the focus. 

Thursday, December 10, 2015

Benefits of using assertThat over assert Method in Unit tests


Here you can find some differences between assertThat and regular assert methods, and alsoon how to use JUnit 4 assertThat method with the hamcrest Matchers.

https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/


Wednesday, December 9, 2015

Git: Reverting multiple bad commits which are already pushed to a central repository

Here is the case:
I pushed multiple bad commits into a central repository and now I wanted to roll back all of them.

Step1 : check git log and identify your last good commit or till where you wanted to roll back.
$ git log --oneline
5ff2aee commit1 - bad commit
8516637 commit2- bad commit
64db1b7 commit3 - bad commit
6897d4b commit4 - bad commit
6974cb5 commit5 - this is my last good commit
79e63c6 commit6
6cd2939 commit7
d39ae18 commit8

Step2: Do reset hard till your last good commit.
$ git reset --hard 6974cb5

Step3: verify git log
$ git log --oneline
6974cb5 commit5 - this is my last good commit
79e63c6 commit6
6cd2939 commit7
d39ae18 commit8

Step 4: Do force push to central repo
$ git push origin <master repo> -f




Preferences sharing across all workspaces - Handling programatically

To share preferences across all workspaces in eclipse, you need to save preferences via ConfigurationScope.

What is configuration scope ?

Preferences stored in this scope are shared by all workspaces that are launched using a particular configuration of Eclipse plug-ins. On a single-user installation, this serves to capture preferences that are common to all workspaces launched by that user. On a multi-user installation, these preferences are shared by all users of the configuration.

How to save ?

IEclipsePreferences store = ConfigurationScope.INSTANCE.getNode(MyUIPlugin.PLUGIN_ID);
if (store != null)
{
store.putBoolean(MyFLAG_PREF, true);
try
{
store.flush();
}
catch (BackingStoreException e)
{
//Log exception
}
}


How to retrieve the saved preference value?

boolean isSet = Platform.getPreferencesService().getBoolean(MyUIPlugin.PLUGIN_ID,
MyFLAG_PREF, false, new IScopeContext[] { ConfigurationScope.INSTANCE });


Understand more about preference scopes:


Eclipse tips and tricks

Managing eclipse global preferences / eclipse installation level preferences

Where are the global preferences stored for eclipse? 
 eclipse\configuration\.settings folder

Here some plugins store their global preferences. For example: the recent workspace settings are in org.eclipse.ui.ide.prefs.

MAX_RECENT_WORKSPACES=5
RECENT_WORKSPACES=/Users/kondalkolipaka/development/workspaces/devbranch2\n/Users/kondalkolipaka/development/workspaces/devbranch
RECENT_WORKSPACES_PROTOCOL=3
SHOW_WORKSPACE_SELECTION_DIALOG=true
eclipse.preferences.version=1

Same way you can store your plugin global preferences in your own file.

Take a look at this.
http://mcuoneclipse.com/2012/04/06/eclipse-global-preferences/