Articles

Fixing FreeNAS Currently unreadable (pending) sectors error

In Uncategorized on February 14, 2017 by hoxide

very useful

dekoder

If you have redundancy, one or two bad sectors can be fixed even without any downtime.

The error message might look something like this:

10-06-2014 16:25:20 Daemon.Critical storage2 Oct  6 16:25:21 smartd[1560]: Device: /dev/ada2, 2 Currently unreadable (pending) sectors

You can see that the faulty device is /dev/ada2. Now, login to console and run long SMART test:

smartctl -t long /dev/ada2

It should tell you that the test is started and when it will finish. After it finishes, check test results:

smartctl -a /dev/ada2

The output will tell you two important things. In information section there is sector size:

Sector Size:      512 bytes logical/physical

Near the end there is SMART Self-test log which tells you whether it failed and what’s the faulty sector number (LBA_of_first_error column)

# 1  Extended offline    Completed: read failure       90%     25166         892134344

Now we have all the…

View original post 104 more words

Articles

HACKING HT4TEX TO ADD GOOGLE ANALYTICS TRACKING CODE

In latex on June 29, 2012 by hoxide

Define myconfig.cfg


\Preamble{html}
\begin{document}
\ScriptEnv{vvvv}{}{}
\begin{vvvv}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'your tracking code']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
\end{vvvv}
% redefine Link such that google can track any links you clicked
\LinkCommand\Link{a,\noexpand\jsref,name}
\def\jsref="#1"{href="#1" onClick="javascript: _gaq.push(['_trackPageview', '#1']);" target="_blank"}
% redefine title\Configure{TITLE}{\HCode{<title>} the titile }{\HCode{</title>}}% jpg with link
\Configure{graphics*}
{jpg}
{\Link[\csname Gin@base\endcsname .jpg]{}{}
\Picture[pict]{\csname Gin@base\endcsname .jpg}
\EndLink
}
\EndPreamble

Now use following command to compile

htlatex file.tex "myconfig,html,word"

Articles

Personal webpage lunched

In Uncategorized on April 21, 2012 by hoxide

The following link is my personal webpage in NUS

http://graduate.math.nus.edu.sg/~g0701232/

It is build by TeX4ht.

Articles

Form a document by several files with each part Compliable by latex

In emacs, latex on February 8, 2012 by hoxide

This is a needs when I begin to write my thesis. Still didn’t write any thing yet 😦

The macro file (bookmacro.tex):

\def\booksectionbegin{
\ifdefined\thebook
\empty
\else
\documentclass[12pt]{amsart}
\include{mypackage}
\include{mymacros}
\begin{document}
\fi
}
\def\booksectionend{
\ifdefined\thebook
\empty
\else
\end{document}
\fi
}

The main file (thesis.tex):

\documentclass[12pt]{book}

\def\thebook{\empty}

\begin{document}
\input{thesisintro}
\end{document}

a file contain some “part” (thesisintro.tex):

\input{bookmacros}

\booksectionbegin
si
abcd

\booksectionend
% Local Variables:
% mode: latex
% End:

Note that the last line of the “thesisintro.tex” if for auctex to recognize it as latex file not tex file (other whiles it will not compilable).

Articles

Use bash to change file name

In unix/linux on February 7, 2012 by hoxide

I have to change the name of 2011*.jpg into 2012*.jpg, now I use following code:

for f in 2011*.jpg
do
mv ${f} ${f/2011/2012}
done

Articles

Elisp to generate a list of macros in latex

In emacs, 计算机与 Internet, latex, softwares on November 12, 2011 by hoxide Tagged:

I just write following code in emacs to generate a list of macros in latex:

(mapcar '(lambda (x) (insert (format "\n\\def\\s%s{\\mathscr{%s}}"
                                (string x) (string x))))
                                (concatenate 'list 
                                 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))

Now press C-x C-E, it will insert following latex codes.

\def\sA{\mathscr{A}}
….
\def\sZ{\mathscr{Z}}

Articles

AucTeX + sumatra PDF

In softwares on August 10, 2010 by hoxide

The main problem is how to config the AucTeX. There is no any other posts talking about the new AucTeX.

After 3 hours+ struggle, I decided to read the manual. Then every thing is clear. In the new version, it’s TeX-view-program-selection not TeX-output-view-style determine the viewer. But it’s still preserve these options. So if you want to use the “old” one, set “%vv” instead of “%V” for the View command in TeX-command-list.

For the new version,
1. Insert a new item of Tex-View-Program-List, with name sumatraPDF or any think you like. choose command and the command is : sumatrapdf %o.
2. save and restart EMACS,
3. change the viewer for predicate output-pdf to sumatraPDF in TeX-view-program-selection.
4. save and restart EMACS.

Now every ting works.

Problem, inverse search for new vesion of sumatraPDF. In fact I can not find the “File/Set” menu mentioned in this post.
Except this problem, I just follow him.

Articles

Macaulay 2 Emacs setup in Cygwin

In Math, softwares on July 28, 2010 by hoxide

I followed the official documents, but got a error when press F12:

spawning child process: invalid argument

The point is it doesn’t set “Shell” correctly.
By reading M2.el, I find “M2-shell-exe” also need to set.
For example in my computer add

(setq M2-shell-exe “e:/cygwin/bin/bash”)

in to the .emacs file.

Then F12 works.

My setting for Macaulay 2:

;; Macaulay 2
(setq load-path
(append
‘( “e:/M2/usr/share/emacs/site-lisp” )
load-path))
(global-set-key [ f11 ] ‘M2-send-to-program)
(load “M2-init”)
(global-set-key [ f12 ] ‘M2)
(setq M2-exe “e:/M2/usr/bin/M2”)
(setq M2-shell-exe “e:/cygwin/bin/bash”)

Articles

Great World City

In Uncategorized on July 9, 2010 by hoxide

两周之前去Great World City 看玩具总动员3~~~

这个传说原来是老新加坡的中心。 可是现在由于不再MRT的范围内,确切的说是在各条MRT围成的区域的中间,就不怎么繁华了。

所以虽然是市中心,却非常安静。

IMG_3527

这个样子好傻~~~

 IMG_3545 IMG_3581

还是老婆美~~~

IMG_3538

IMG_3541 IMG_3549

IMG_3559

然后吃了晚饭~~~

这个叫Rojak, 其实感觉是烤面包+烤油条+水果黄瓜等等用甜面酱拌一下。

IMG_3575

老婆喜欢吃的虾面~~

IMG_3577

接着就逛了一下去电影院了, 之前有个DBS的活动。虽然Buffet已经结束,但是周围的小装饰还是很漂亮的

IMG_3583 IMG_3599

Articles

O(1,1)

In Math on June 29, 2010 by hoxide

This is too simple to write in a notes, but it is still interesting.
O(p,q) preserve the quadratic form with signature (p,q).

Then what is O(1,1). The conclusion is that O(1,1)\cong \mathbb{R}^+\rtimes ( \mathbb{Z}_2\times \mathbb{Z}_2)

To see this, it is clear that
\begin{pmatrix}\pm 1 & 0 \\ 0& \pm 1\end{pmatrix}
form a subgroup K of O(1,1) isomorphic to \mathbb{Z}_2 \times \mathbb{Z}_2

\lambda \in\mathbb{R}^+ correspond to matrix
\frac{1}{2} \begin{pmatrix}\lambda+\lambda^{-1} &\lambda-\lambda^{-1} \\ \lambda-\lambda^{-1}& \lambda+\lambda^{-1}\end{pmatrix}
which form subgroup N in O(1,1).
K act on N by \lambda \mapsto \lambda^{\det(g)}.

The way to see this is by the consideration of nill-cone In fact, O(p,q) preserve the nill-cone. For O(1,1), the nill-cone is x^2-y^2=0, just two lines. Now let \lambda act by scaler on the line x=y, then the action on the other line has no choice to be scaler by \lambda^{-1}. K just permute the lines or inverse the direction of line. Or we can say O(1,1) \cong \mathbb{R}^\times \rtimes \mathbb{Z}_2 by choice of the permutation between lines.