Friday 31 July 2015

Notes from Mangaging Project with GNU Make

Cited from the book "Managing Projects with GNU Make"

"The target is the file or thing that must be made. The prerequisites or dependants are those files that must exist before the target can be successfully created. And the commands are those shell commands that will exist before the target can be successfucreate the target from the prerequisites."

"When make is asked to evaluate a rule, it begins by finding the files indicated by the prerequisites and target. If any of the prerequisites has an associated rule, make attempts to update those first. Next, the target file is considered. If any prerequisite is newer than the target, the target is remade by executing the commands."

" To update a line: different target (or to update more than one target) include the target name with make. such as make target"

" --just-print (or -n) tells make to display the commands it would execute for a particular target without actually executing them."

" To set almost any makefile variable on the command line to override the default value or the value set in the makefile. For example:
make mytarget FOO=BAR"

"If no prerequisites are listed to the right, then only the target(s) that do not exist are updated."

"Each command must begin with a tab character. This (obscure) syntax tells make that the characters that follow the tab are to be passed to a subshell for execution. If you accidentally insert a tab as the first character of a noncommand line, make will interpret the following text as a command under most circumstances."

=================================================
Explicit Rules:

"Pattern rules use wildcards instead of explicit filenames. get file matching the pattern needs to updated. Implicit rule."

"Implicit rules are either pattern rules or suffix built-in database of rules makes writing makefile."

"A variable is either a dollar sign followed by a single character or a dollar sign followed by a word in."

Wildcards:

"Make's wildcards are identical to the Bourne shell's: ~, *, ?, [...], and [^...]."

================================================= 
the automatic variable $?: the set of prerequisites that are newer than the target.

$@: the name of the current target.

"You can look at make's default set of rules (and variables) by running make --print-data-base."

"The percent character can be placed anywhere within the pattern but can occur only once."















XSLT Notes

Cited from the book "XSLT for Dummies"

"apply-templates doesn’t include the tags of the element—only what’s inside the tags"

"Namespaces were developed to avoid this name collision by linking a namespace identifier with a URI (Uniform Resource Identifier)."

"the primary purpose of xsl:copy is to carry over the element tags. However, if you combine it with xsl:apply-templates, you copy both the tags and its content"

"xsl:copy-of duplicates everything inside the current node. "

 "The select attribute of the xsl:copy-of element determines what is copied to the result tree."

"<xsl:value-of select="expression"/>"

==================================================
matching element nodes
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>

matching text and attribute nodes

<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>

matching processing instructions and comments
<xsl:template match="processing-instruction()|comment()"/>

"An XPath expression for matching a namespace node doesn’t exist."
==================================================
child axis: child:: or omitted by default.

attribute axis: attribute:: or @ by shorthand.

node() is a node test that matches any node whatever kind it is.

chapter[position()=1]

chapter[last()]
==================================================







Monday 20 July 2015

Python: Static Method, Class Method and Instance Method

Cited from Really Understanding Python @staticmethod and @classmethod

Python: __slots__

Cited from Python __slots__

"The proper use of __slots__ is to save space in objects. Instead of having a dynamic dict that allows adding attributes to objects at anytime, there is a static structure which does not allow additions after creation."

Python: *args and **kwargs

*args and **kwargs in python explained

Python Underscore "_" in Method and Variable Names

Cited from Python: Why do some functions have underscores “__” before and after the function name?

One underline in the beginning:

"Python doesn't have real private methods, so one underline in the start of a method or attribute means you shouldn't access this method."

Two underlines in the beginning:

"So, when you create a method starting with __ it means that you don't want to anyone can override it, it will be accessible only from inside the own class."

Two underlines in the beginning and in the end:

"When we see a method like __this__, don't call it. Because it means it's a method which Python calls, not by you."


Friday 17 July 2015

ChIP-seq Plots

Metaseq

Data Structure in Python

Cited from What Are Linear Structures?

"What distinguishes one linear structure from another is the way in which items are added and removed, in particular the location where these additions and removals occur."

=================================================
Cited from What is a Stack?

'A stack (sometimes called a “push-down stack”) is an ordered collection of items where the addition of new items and the removal of existing items always takes place at the same end. This end is commonly referred to as the “top.” The end opposite the top is known as the "base."'

'The base of the stack is significant since items stored in the stack that are closer to the base represent those that have been in the stack the longest. The most recently added item is the one that is in position to be removed first.'

=================================================


 

Python: Pass Command Line Options

Argparse Tutorial

argparse option for passing a list as option

ArgumentParser

Friday 10 July 2015

Configure Custom Connection Options for SSH Client

Cited from How To Configure Custom Connection Options for your SSH Client

"The only difference is that depending on the option and value, using the equal sign with no spaces can allow you to specify an option on the command line without quoting."