Tuesday 27 August 2019

data lost after git reset --hard o/m

I had locally staged and committed some files and tried to push them online but it wasn't working because one folder was too large. I wanted to undo the commit of that folder and I ended up doing a reset which was a bad idea. It caused my working folder data files to disappear. I was having a mini heart attack. Then I gathered my senses and searched for a solution online to restore data to the earliest commit. The command git reflog saved my life as it displayed the commit ID of the very first commit I needed to revert to and resetting to that commit gave me back my data. Alhamdulillah.
Following is a snippet from the StackOverflow answer (https://stackoverflow.com/questions/5473/how-can-i-undo-git-reset-hard-head1) which helped:

$ git reflog
1a75c1d... HEAD@{0}: reset --hard HEAD^: updating HEAD
f6e5064... HEAD@{1}: commit: added file2

$ git reset --hard f6e5064
HEAD is now at f6e5064... added file2

Sunday 4 August 2019

sql script to add foreign keys

First change each table to InnoDB using Table Operations menu

ALTER TABLE `file` ADD FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `method` ADD FOREIGN KEY (`file_id`) REFERENCES `file`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `calls` ADD FOREIGN KEY (`host_method_id`) REFERENCES `method`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE `api_call` ADD FOREIGN KEY (`host_method_id`) REFERENCES `method`(`id`) ON DELETE CASCADE ON UPDATE RESTRICT;

find subtraction of two columns in excel

=IF(ISERROR(MATCH(B1,$A$1:$A$17,0)),B1,"")

Column A contains some strings and column B also contains some strings.
Column C will list only those strings of B which are not in A

what is a good PhD contribution?

When PhD candidates embark on their thesis journey, the first thing they will likely learn is that their research must be a “significant ori...