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

Tuesday, 2 July 2019

adding a good resolution image/figure in ACM paper

Problem:

If you use \includegraphics in Latex and the included thing is a pdf file or a png/gif file, both will cause problems. Any image in pdf file has a clear resolution but upon uploading camera-ready paper on ACM, it throws an exception about fonts not being embedded. The png file is supposed to have at least 300 dpi resolution but it renders blurry on the pdf.

Solution:

The best thing is to have Inkscape installed. Use inkscape to create a new file and copy your Visio diagram in it. Then go to Edit -> Resize page to selection to make the image fit to paper. Before that, you can stretch the image until it is the desirable size. Then, Save as eps file. Check the option to embed fonts while saving eps. It is easy to include an eps file using the \includegraphics tag.

Using an eps file makes sure that the image is crystal clear and does not become blurry on zooming pdf.

There is also an issue of dotted lines becoming solid lines. To handle this first copy the image from Visio and paste as bitmap in Excel. Then copy from excel and paste in Inkscape. This way the dotted lines will be preserved.

Wednesday, 20 March 2019

Box and whisker plot in excel

For detailed method:
https://www.dummies.com/education/math/statistics/box-and-whisker-charts-for-excel/


Some bullet points:

Calculate

  • min
  • q1
  • median
  • q3
  • max

of each data column for which a box plot is desired

Then calculate

  1. q1-min 
  2. q1
  3. median-q1
  4. q3-median
  5. max-q3

Select calculated values 2, 3 and 4 for each data column and insert stacked column chart

To add whiskers, select lower half of each stacked column, select error bars, select minus, cap, choose custom, for -ve error value select all q1-minimum values
Then select the upper bars, select error bars, plus, cap, custom, for +ve value specify max-q3 values
Hide the lower bars using formatting options and you are done.

Count LOC of a project

Use the cloc command line tool.

http://cloc.sourceforge.net/

if you want to get the LOC of projects in a folder E:/projects_folder

then you may write the following command

cloc E:/projects_folder

It will begin calculating the metrics and report in command line

More advanced command is:

>cloc f:/testme --force-lang=Java --skip-uniqueness  --csv   --report-file=stats.csv

Friday, 15 March 2019

How to run R script on Codec server(private server) through command line

Please make sure that the R scipt file that you want to execute are transferred to codec server using WinSCP. The input file that the script operates on and the script itself should be on the root server path for your ease. This way, you can specify the file name directly in the script and there will be no need to specify the full path.

On codec server, you have to use putty to login and once logged in, you have to make sure the packages are installed for your code.

1) write R and press enter
2) write install.packages('yourpackagename')
3) q()
Now you are back to normal command line.

You can open the script file on server and change the paths to ones on codec server. e.g. library("tictoc", lib.loc="~/R/x86_64-pc-linux-gnu-library/3.5")

Suppose the name of your script file is a.R

4) Write the following command: Rscript a.R

Your R script will start executing.


Wednesday, 23 January 2019

Latex bibliography error missing item and references

When you change the name of a latex file for some reason and recompile it, new files will be created with the new name. However, the bib file will not change. You can change the name of the bib file, update its reference in the latex file and then ....this is the important step...click on the bib file in explorer panel on the left and press F8 to compile it...this way the errors will be resolved.

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...