Friday 29 November 2019

Making an academic website using Academic

https://sourcethemes.com/academic/

The above link is the home page for the website that allows the creation of an academic website with the help of a template.

Installation requirements are git, hugo and hugo-extended and visual studio code for code editing.

Install with git using the instructions on this link: https://sourcethemes.com/academic/docs/install/#install-with-git
Then to customize the template, follow the instructions on the following link:
https://sourcethemes.com/academic/docs/get-started/#introduce-yourself

Change the menu as desired in the menus.toml file. Hide the widgets you don't need to be shown by setting the active variable in a page's code to false. Instead of the default avatar.jpg, put your own image and rename it to avatar.jpg. You can also add publication pages for each of your publication using the instructions here: https://sourcethemes.com/academic/docs/managing-content/#manually

Test the web site by running hugo server command and check http://localhost:1313/ in the browser. Deploy the website on GitHub by following these instructions:
https://sourcethemes.com/academic/docs/deployment/#github-pages
Once deployed, you can make future changes to your website and execute the following commands:
git add . git commit -m "Initial commit" git push -u origin master
hugo cd public git add . git commit -m "Build website" git push origin master cd ..


Here is mine :  https://shamsa-abid.github.io/

Thursday 7 November 2019

Excel Macro Code to change x axis maximum scale of chart

Sub setXAxisMaximumScale()
 ActiveSheet.ChartObjects("Chart 2").Activate
    ActiveChart.Axes(xlCategory).Select
    ActiveChart.Axes(xlCategory).MaximumScale = 1
End Sub


P.s. I first recorded a macro and viewed its code to get this

Sunday 3 November 2019

Creating boxplot in R

To create a boxplot pr box and whisker chart in R studio, we can use Excel csv file as the source of input data. We need two columns in the csv. In my case column1 contains precision and column2 contains the approach type.

The R code is as follows:
x <- read.csv("boxplotR2.csv",header=T, sep=",")
print (head(x))
boxplot(precision ~ approach, data = x, ylab = "Precision",
        xlab = "Related Function Recommendation Strategies")

and I get the boxplot

Thursday 24 October 2019

p-value and t-test statistical significance

To calculate the statistical significance, we use the t-test tool in Excel. It is available as part of the Data Analysis Add-Inn. You need to go to the Data tab and click the Analysis button. If the Analysis option does not show, you need to go to Excel Options in the Home menu and enable the Data Analysis add-in.

The following is taken from the Excel Help.

I need to compare the precision values reported for retrieved functions for two different strategies. The retrieved functions

t-Test: Two-Sample Assuming Unequal Variances
This analysis tool performs a two-sample student's t-Test. This t-Test form assumes that the two data sets came from distributions with unequal variances. It is referred to as a heteroscedastic t-Test. As with the preceding Equal Variances case, you can use this t-Test to determine whether the two samples are likely to have come from distributions with equal population means. Use this test when there are distinct subjects in the two samples.


references:

https://wallstreetmojo.com/p-value-in-excel/

Tuesday 22 October 2019

How to display images in Latex side by side

I got the solution from https://tex.stackexchange.com/questions/186615/how-can-i-arrange-multiple-figures-in-rows-of-3-in-a-two-column-document?rq=1



\usepackage{lipsum,graphicx,multicol}
\begin{document}
%\abovecaptionskip=0pt
\begin{figure*}[t]
\begin{multicols}{3}
    \includegraphics[width=\linewidth]{example-image-a}\par\caption{caption}
    \includegraphics[width=\linewidth]{example-image-b}\par\caption{caption}
    \includegraphics[width=\linewidth]{example-image-c}\par\caption{caption}
\end{multicols}
\begin{multicols}{3}
    \includegraphics[width=\linewidth]{example-image-a}\par\caption{caption}
    \includegraphics[width=\linewidth]{example-image-b}\par\caption{caption}
    \includegraphics[width=\linewidth]{example-image-c}\par\caption{caption}
\end{multicols}
\end{figure*}
\lipsum[1-10]

Friday 18 October 2019

Undefined control sequence error and can not find file error in includegraphics latex command

The solution was to update Miktex after installing it

I had issues with fixing a broken miktex installation

The proper way to install miktex is to Run As Administrator and Install for all users! And when the installation completes then immediately update MikTex.

Monday 7 October 2019

Editing the marker size of charts in excel using VB code based macro

Sub sizechangemarker()
Dim Count As Integer
For Count = 1 To 5
Worksheets(8).ChartObjects(4).Chart _
 .SeriesCollection(Count).MarkerSize = 4
Next Count
End Sub

There were 5 lines on the fourth chart in the eighth worksheet. The for loops repeats the marker size setting for each series or line.


Wednesday 2 October 2019

Tuesday 17 September 2019

How do I get a list of files in a folder?

Type "dir /b > filenames.txt" (without quotation marks) in the Command Prompt window. Press "Enter." Double-click the "filenames.txt" file from the previously selected folder to see a list of file names in that folder.

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

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