# docker ip address
sudo docker inspect mongo_app | egrep "IPAddress[^,]+"
# git config
git config --global --edit
Neural Viva Hog Blog
Tuesday, 12 September 2017
Wednesday, 13 April 2016
Powershell script to open a project and an explorer window in the project root from powershell - cmd completion included
Idea pulled from the tutorial by Jim Christopher:
Pluralsight - Everyday PowerShell
Completed entirely using Martin Schvartzman's code:
# dynamic-validateset-in-a-dynamic-parameter
function push-project() {
[CmdletBinding()]
Param(
# Any other parameters can go here
)
DynamicParam {
# Set the dynamic parameters' name
$ProjectFolderPath = '[add projects folder here]'
$ParameterName = 'project'
# Create the dictionary
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
# Create the collection of attributes
$AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
# Create and set the parameters' attributes
$ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.Position = 1
# Add the attributes to the attributes collection
$AttributeCollection.Add($ParameterAttribute)
# Generate and set the ValidateSet
$arrSet = Get-ChildItem -Path C:\Users\Ollie.Vaughan\Projects -Directory | Select-Object -ExpandProperty Name
$ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet)
# Add the ValidateSet to the attributes collection
$AttributeCollection.Add($ValidateSetAttribute)
# Create and return the dynamic parameter
$RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParameterName, [string], $AttributeCollection)
$RuntimeParameterDictionary.Add($ParameterName, $RuntimeParameter)
return $RuntimeParameterDictionary
}
begin {
# Bind the parameter to a friendly variable
$project = $PsBoundParameters[$ParameterName]
}
process {
$ProjectFolderPath += $project
push-location $ProjectFolderPath;
Invoke-Item .;
Invoke-Item *.sln;
}
}
new-alias -name pp -value push-project
Monday, 4 April 2016
Thursday, 5 April 2012
Creating a PDF report with images in Latex using Texmaker
Key
: Actual working code
: Text content
I have been writing up a report using Texmaker in Ubuntu 11.10.
I was shown how to compile .tex and .aux from the command line which seems the most efficient method for me personally.
Firstly you need the compilers.
xeletex - for .tex file compilation
bibtex - for .aux file compilation
I know many will consider it lazy but I installed them using the synaptic package manager to get texlive-xetex (shown below in synaptic) which should get all the packages you need including texlive-base.

note: I may be wrong about that however as I am fairly new to this so you may need to tweak this a little.
Then I structured the basics of my document:
\documentclass[10pt,a4paper]{report}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\author{Oliver Vaughan}
\title{Information Retrieval and Data Mining}
\begin{document}
\section{Introduction}
This field encompasses categorising and retrieving information. This involves firstly being given a
<lots of very very interesting text entered here>
\newpage
\section{Precision and Recall}
Precision is the ratio of relevant documents retrieved to the total number of documents retrieve.........................................
Firstly I wanted to include a simple equation so under the section above I entered
\begin{displaymath}
Precision = \frac{Relevant Retrieved }{Retrieved}
\end{displaymath}
\begin{displaymath}
Recall = \frac{Relevant Retrieved }{Relevant}
\end{displaymath}
This provides the following upon compilation of the document
note: when I used the \begin{equation} tag the equations were numbered so I changed to \begin{displaymath}
I then wished to enter a simple graph (created in InkScape).
In order to do this I saved the graph as a .eps ( Encapsulated_PostScript ) file in the same folder as my latex and bibtex files.
In the pre-amble of the latex document I set:
\usepackage{graphicx}
Then in the section where I wanted the graph you simply enter: \includegraphics{precision-recall-curve.eps}
Where precision-recall-curve.eps = the name of your file.
When applied in the following manner:
the documents required.
Graphing this response is referred to as a precision/response curve. A typical curve is displayed here in figure 1.1
\includegraphics{precision-recall-curve.eps}
\label{precision-recall-curve}
Usually the higher the recall required the lower the precision due to the increased possibility of non relevant documents being included in the data.
It will yield the following result:
I also wished to add a bibliography to my document. The method I was shown involves using a separate .bib file (in this case with the same name as the project but you could just have a large file with loads of references in it).
Mine looks like this:
@Book{grossman04,
ALTauthor = {David A. Grossman and Ophir Freider},
ALTeditor = {•},
title = {Information Retrieval},
publisher = {Springer},
year = {2004},
OPTkey = {•},
OPTvolume = {•},
OPTnumber = {•},
OPTseries = {•},
OPTaddress = {•},
OPTedition = {•},
OPTmonth = {•},
OPTnote = {•},
OPTannote = {•}
}
note: It is a convention that you use the authors name and then the last two digits of the year for the reference.
Add the reference in the text:
using either:
\cite{name of reference} this inserts straight into the text
or
~\cite{name of reference} this inserts a space before the reference
e.g:
\newpage
\section{Precision-recall-curve graph}
To quote the example given in Information Retrieval~\cite{grossman04} if a system is queried and it returns ten documents form that query recall can be calculated at several points in the query.
and then including it at the end of the document as shown below.
\bibliography{Introduction_to_Data_Mining_and_IR}
\bibliographystyle{apalike}
\end{document}
This is the style the reference will be inserted using : \bibliographystyle{choose a style here}
You can find loads of styles here: http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html
You then have to run the command line compiler on the .tex file
cd to the folder containing the .tex and .bib files (I create a separate folder for each project)
I ran the following:
$ xelatex Introduction_to_Data_Mining_and_IR.tex
Which gave the following result:
Then I ran:
$ bibtex Introduction_to_Data_Mining_and_IR.aux
With the following result:
Once the .aux files are complied you need to run the xelatex complier again twice using:
$ xelatex Introduction_to_Data_Mining_and_IR.tex
The first complies the file and finds the references but may not add them correctly the second time round it will definitely add them, it is not always necessary but I do it every time anyway.
You should then up with a pdf of the same name as your project in your source folder.
I hope this may be useful, any better ways of doing it gladly received.
Subscribe to:
Posts (Atom)



