O=$IFS
IFS=$(echo -en "\n\b")
for f in $(ls *)
do
echo "$f"
done
IFS=$O
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Perl debugger basics
start the debugger with perl -d script.pl
- n - next step
- s - step into
- c - continue
- b 100 - break at line 100
- b sub - break at sub 'sub' (must be in the right file)
- { v - display the surrounding lines before each step
- w $var - watch variable $var (displays changed $var and stops)
XSL data types
http://www.zvon.org/xxl/XSL-Ref/Tutorials/Built-in-Types/bt1.html
<xsl:stylesheet
xmlns:sch="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
exclude-result-prefixes=" sch">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="a" as="sch:integer" select="12"/>
<xsl:variable name="b" as="sch:float" select="12.123456789123456789"/>
<xsl:variable name="c" as="sch:double" select="12.123456789123456789"/>
<xsl:variable name="d" as="sch:decimal" select="12.123456789123456789"/>
</xsl:stylesheet>
<xsl:stylesheet
xmlns:sch="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
exclude-result-prefixes=" sch">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:variable name="a" as="sch:integer" select="12"/>
<xsl:variable name="b" as="sch:float" select="12.123456789123456789"/>
<xsl:variable name="c" as="sch:double" select="12.123456789123456789"/>
<xsl:variable name="d" as="sch:decimal" select="12.123456789123456789"/>
</xsl:stylesheet>
Subversion basics
# checkout / create a new project
svn checkout https://example.googlecode.com/svn/trunk/ example --username [username]
# submit a directory for the first time
svn import newdir/ https://example.googlecode.com/svn/trunk/
# see all modified files in project
svn status -v
# submit modified files
svn commit
# diff
svn diff --diff-cmd diff -x -wB [filename]
svn diff --diff-cmd diff -x --side-by-side [filename]
# move or copy, keeping history
svn mv [old file] [new file]
svn copy [old file] [new file]
# update your workspace to head
svn up /your-workspace
svn up /your-workspace
# update your workspace to a particular date
svn up -r {2010-11-14} /your-workspace
# ignore a file or directory
svn propset svn:ignore [file or dir] [parent dir]
svn up -r {2010-11-14} /your-workspace
# ignore a file or directory
svn propset svn:ignore [file or dir] [parent dir]
Labels:
basics,
software,
svn,
versioning
Parsing HTML with Perl
HTML::Scrubber has replaced HTML::Sanitize
XML::LibXML has a parse_html method and a toString method.
Debugging XSLT
...is not fun:
<!-- DEBUG -->
<xsl:if test="$debug">
<xsl:message><xsl:text>--------</xsl:text></xsl:message>
<xsl:message><xsl:text>FUNCTION display-pagination-links:</xsl:text></xsl:message>
<xsl:message><xsl:text>--------</xsl:text></xsl:message>
<xsl:message><xsl:text>direction: </xsl:text><xsl:value-of select="$direction"/></xsl:message>
<xsl:message><xsl:text>link_type: </xsl:text><xsl:value-of select="$link_type"/></xsl:message>
</xsl:if>
<!-- DEBUG -->
<xsl:if test="$debug">
<xsl:message><xsl:text>--------</xsl:text></xsl:message>
<xsl:message><xsl:text>FUNCTION display-pagination-links:</xsl:text></xsl:message>
<xsl:message><xsl:text>--------</xsl:text></xsl:message>
<xsl:message><xsl:text>direction: </xsl:text><xsl:value-of select="$direction"/></xsl:message>
<xsl:message><xsl:text>link_type: </xsl:text><xsl:value-of select="$link_type"/></xsl:message>
</xsl:if>
vim features
7.0.237 has highlighting of the text for which you're searching.
Labels:
text editor,
vi
Basic CSS
* basics
#id = ID (mnemonic: I'd like some *hash*)
.class = class (mnemonic: polka *dots* are classic and classy)
* margin direction:
top right bottom left
(clockwise, starting from top)
* comments
/* this is a comment */
// this is not a comment!
* debugging
border: 2px solid red !important
or
display: none !important
* specifying elements:
html:
<ul id="list">
<li>
<div class="d1">one</div>
<div class="d2">two</div>
<div class="d3">three</div>
</li>
</ul>
css:
#list li div.d1 { //css }
--------------------------
http://robertnyman.com/2007/10/18/dont-over-specify-your-css-code/
/* Instead of this: */
div#container p.pre-amble{
margin-top: 1em;
}
/* Write it like this: */
.pre-amble{
margin-top: 1em;
}
/* Or like this: */
#container .pre-amble{
margin-top: 1em;
}
/* Instead of this: */
div#container div#header ul#navigation li{
float: left;
}
/* Write it like this: */
#navigation li{
float: left;
}
/* Or like this: */
#header #navigation li{
float: left;
}
#id = ID (mnemonic: I'd like some *hash*)
.class = class (mnemonic: polka *dots* are classic and classy)
* margin direction:
top right bottom left
(clockwise, starting from top)
* comments
/* this is a comment */
// this is not a comment!
* debugging
border: 2px solid red !important
or
display: none !important
* specifying elements:
html:
<ul id="list">
<li>
<div class="d1">one</div>
<div class="d2">two</div>
<div class="d3">three</div>
</li>
</ul>
css:
#list li div.d1 { //css }
--------------------------
http://robertnyman.com/2007/10/18/dont-over-specify-your-css-code/
/* Instead of this: */
div#container p.pre-amble{
margin-top: 1em;
}
/* Write it like this: */
.pre-amble{
margin-top: 1em;
}
/* Or like this: */
#container .pre-amble{
margin-top: 1em;
}
/* Instead of this: */
div#container div#header ul#navigation li{
float: left;
}
/* Write it like this: */
#navigation li{
float: left;
}
/* Or like this: */
#header #navigation li{
float: left;
}
Subscribe to:
Posts (Atom)