Full backup:
echo "============================================================"
echo "Backup $dbName database to $dbFile"
# The following commands will be put to the beginning of the database dump file.
echo " 1. Creating header.tmp temporary file"
echo "SET AUTOCOMMIT = 0;SET FOREIGN_KEY_CHECKS=0;" > $dbDir/header.tmp
# Dumping the database.
echo " 2. Creating $dbName.tmp temporary file"
mysqldump --opt --user=$dbUSER --password=$dbPASSWORD $dbName > $dbDir/$dbName.tmp
# The following commands will be put to the end of the database dump file.
echo " 3. Creating tailer.tmp temporary file"
echo "SET FOREIGN_KEY_CHECKS = 1;COMMIT;SET AUTOCOMMIT = 1;" > $dbDir/tailer.tmp
echo " 4. Create today's backup file : $dbFile"
cat $dbDir/header.tmp $dbDir/$dbName.tmp $dbDir/tailer.tmp > $dbDir/$dbFile
Backup Schema Only:
$ mysqldump --no-data --user=$dbUSER --password=$dbPASSWORD $dbName > Schema20081003.sql
Friday, October 3, 2008
Tuesday, August 26, 2008
Tuesday, August 19, 2008
Jim Cramer's HOG vs Leonard the Wonder Monkey
How good is it if it's down, Cramerwatch.org? In case you don't know what Cramerwatch.org does, the following is a copy of how they track the performance:
’We record his Lightning Round recommendations as he makes them on TV, and then we have our monkey make recomendations at random on the same stocks. We then wait 30 days, and see who came out on top.‘
Do you really believe their tracking results? If you do, then you'll be a "PIG" or a "HOG". Because Jim Cramer never told us to buy and hold on any stocks for 30 days. He told us to do your homeworks and make your own trading decision on buying more or jumping out of a train.
Cramerwatch.org does not compare Jim Cramer with the Monkey. After Jim Cramer's Lighting Round in his Mad Money show, Cramerwatch.org is doing a comparison between a "PIG"/"HOG" and Leonard the Wonder Monkey.
Thursday, July 31, 2008
vi commands
Switch to command mode <ESC>
Go to line number ## :##
Undo previous command: u
Undo all changes to line: U
Search backward for string: ?string
Search forward for string: /string
% (entire file) s (search and replace) /old text with new/ c (confirm) g (global - all): %s/oldstring/newstring/cg
Delete 5 lines (to buffer): 5dd
Delete lines 5-10:5,10d
ESC | start command mode ( it starts in command mode ) |
i | change to insert mode |
:q | quit |
:wq | write and quit |
:w | write the file |
:# | goto line # |
/str | search down for "str" |
?str | search up for "str" |
dd | delete line |
x | delete character |
dw | delete word ( cut ) |
yy | yank line ( copy ) |
yw | yank word |
p | paste |
u | undo ( only limit is the last write ) |
. | repeat last change |
cw | change word |
Go to line number ## :##
Undo previous command: u
Undo all changes to line: U
Search backward for string: ?string
Search forward for string: /string
% (entire file) s (search and replace) /old text with new/ c (confirm) g (global - all): %s/oldstring/newstring/cg
Delete 5 lines (to buffer): 5dd
Delete lines 5-10:5,10d
string replacement
Sometimes you want to replace one string with another. This is done with the ex command "s". The form of the replacement is :: line_range s/old/new/gex ( replace foo with bar from line 10 to 20 ) :
:10,20s/foo/bar/gYou can use visual mode to select the lines, when you type the colon to start the command it will use symbols for the visual line range.
Wednesday, June 4, 2008
Increment a variable in for-each loop
No can do.
XSLT is a declarative programming language. You can bind a value to a variable only once, you cannot change it later. <link>
XSLT is a declarative programming language. You can bind a value to a variable only once, you cannot change it later. <link>
Search by Element and print RANum and position()
XML:
XSLT: Search by attribute RANum = 'RANumType_88'
HTML:
<InvoiceAdj>
<RAInfo RANumType="79">
<RANum>RANumType_79</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88</RANum>
</RAInfo>
<RAInfo RANumType="79">
<RANum>RANumType_79_1</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82_1</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85_1</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88_1</RANum>
</RAInfo>
</InvoiceAdj>
XSLT: Search by attribute RANum = 'RANumType_88'
<xsl:for-each select="InvoiceAdj/RAInfo">
<xsl:choose>
<xsl:when test="RANum = 'RANumType_88'">
<tr>
<td><xsl:value-of select="RANum"/></td>
<td><xsl:value-of select="position()"/></td>
<td></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
HTML:
<tr>
<td>RANumType_88</td>
<td>4</td>
<td></td>
</tr>
Search by Attribute and print RANum and position()
XML:
XSLT: Search by attribute RANumType = 79 or 88
HTML:
xsl:for-each sample:
<InvoiceAdj>
<RAInfo RANumType="79">
<RANum>RANumType_79</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88</RANum>
</RAInfo>
<RAInfo RANumType="79">
<RANum>RANumType_79_1</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82_1</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85_1</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88_1</RANum>
</RAInfo>
</InvoiceAdj>
XSLT: Search by attribute RANumType = 79 or 88
<xsl:for-each select="InvoiceAdj/RAInfo">
<xsl:choose>
<xsl:when test="@RANumType = 79 or @RANumType = 88">
<tr>
<td><xsl:value-of select="RANum"/></td>
<td><xsl:value-of select="position()"/></td>
<td></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
HTML:
<tr>
<td>RANumType_79</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>RANumType_88</td>
<td>4</td>
<td></td>
</tr>
<tr>
<td>RANumType_79_1</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>RANumType_88_1</td>
<td>8</td>
<td></td>
</tr>
xsl:for-each sample:
xml: <InvoiceAdj AdjType="CS" AdjNumType="BP">
1. <xsl:for-each select="InvoiceAdj">
2. <xsl:for-each select="InvoiceAdj[@AdjType='CS']">
3. <xsl:for-each select="InvoiceAdj[@AdjType='CS' and @AdjNumType = 'BP']">
Legal filter operators are:
1. = (equal)
2. != (not equal)
3. < less than
4. > greater than
Subscribe to:
Posts (Atom)