Monday, July 28, 2014

Why is Christian Despised?

Recently, I read an article (中国大学生为何信仰基督) about why Chinese college students are becoming Christians. I think it is a good article. It talks about how lost the young generation is and how they try to find belief in a society with all kinds of problems. Believing in Christianity has given them a new way to look at life and live their lives. The rapid growing young Christians in China actually owes to the China government. The no-religion policy throughout 1950s to 1970s cleared out all other religions and made a way for Christianity to prosper in China.

What shocked me is some of the comments for this article. Some people say that the college students who believed in Christianity are stupid or insane. Some say that only losers would believe in Christianity. Some say that Chinese christian are not truly believing but using Christianity as a pretense for following trend, or finding girls, or their worship of western culture. Clearly, the world is not very kind to Christians.

In the contrast, the world is becoming so tolerable with any other things: you can be gay, you can do abortion, you can be a playboy, you can live whatever life you want to. It is only a matter of choice. Many people would say: "I may not agree with such living style, but I respect other people's choices."

The reason that Christians are not respected, not understood is because Christianity is not a life style. It is much more radical. It says "whoever believes in Jesus will have eternal life, who do not believe will be condemned to hell."  This idea is simply too scary. They feel angry---who are you to say that I should go to hell? They feel judged---why you Christians feel you are better than me? So they resort to resent Christians. Surely, they find many ways to justify themselves. "Look at those weird Christians: they are believing in some stupidly insane stuff, they talks all about God, and they try to drag you to their church and conform you to be one of them." I personally felt judged by other Chinese students when I told them I am a christian. They look at me with contempt and think to themselves: "stay away from her, now she is a disease."

But all the judgement from the world is fine with Christian. The joy of knowing Christ prevails over all the sufferings in this world. The hope of being with God forever in heaven is so overwhelming that we can endure through pains and tears in this short life.

Wednesday, June 4, 2014

Hot topics?

In engineering, there are always hot topics and non-hot topics. Whenever there is a hot topic, it's like everyone is working on it. No one wants to be left behind. More precisely, everyone seems to want to get some money out of it. Hot topics come and go, leaving behind lots of people with knowledge and skills that are not valued anymore.

When I first started my PhD, I thought I was working on a relatively "interesting" area. But as I am close to graduation, everybody seems to despise this area. They already moved on to the current hot topics like big data. Everywhere you hear people say: "Oh, xx area is not worthwhile studying anymore." When you submit a paper, reviewers tell you that they are not interested in research in this old area anymore. When you submit a propose, funding agencies tell you that they definitely don't give funding to this dying area. When you try to find a job, companies emphasize that they are looking for people working on this and this hot topics. No one values your experience in the old non-hot area.

Now I see why mathematician is the best job in the world. No one tells a mathematician what he or she ought to work on. No one tells the mathematicians to work on some hot topics. Because saying this, it's like telling the mathematicians that maybe you are not too stupid to work on this famous problem, this long-open problem; it's an insult to the mathematician's intelligence.

Monday, April 7, 2014

C++ STL中Map的按Key排序和按Value排序

Very good explanation about how to sort map according to key and value, respectively.
http://blog.csdn.net/iicy266/article/details/11906189

Thursday, January 16, 2014

Add copyright notice in IEEE Latex conference class

http://www.stabeler.com/blog/541/

Add the following two commands before \maketitle

\IEEEoverridecommandlockouts
\IEEEpubid{\makebox[\columnwidth]{978-1-4799-3360-0/14/\$31.00~\copyright~2014 IEEE \hfill} \hspace{\columnsep}\makebox[\columnwidth]{ }}

Use the \IEEEpubidadjcol command somewhere in your second column text, which makes the relevant adjustments for the text. (didn't use in my paper, it seems to be okay without this command).

Monday, December 16, 2013

Copy-pastable ASCII characters with pdftex/pdflatex



Trying to get a pastable URL that has tilde in it, using \verb|~| to replay the tilde make the url working when you paste it from the pdf file to a web browser.

Learned it from here:

This document presents how to obtain fully copyable PDF documents from Latex. By fully, I mean that all ASCII characters are copied into the equivalent binary character with Ctrl-C in a PDF viewer (evince, xpdf, acrobat reader, etc.) or with pdftotext in command line. Indeed, by default certain characters are transformed, eg. ' becomes .

Let's list the printable ASCII characters:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[]^_`{|}~

Alphanumeric characters are always copyable. Many punctutation characters work out of the box if powerful fonts are correctly set up (e.g. with cm-super): . / : ; < = > ? @ [ ].

Many other characters just need to be escaped in order to be copy-pastable:
\#, \$, \%, \&, \{, \}

The problems start with " (double quotes), \ (backslash), ' (single quote, apostrophe), - (hyphen or minus), ^ (caret), | (pipe), ` (backtick, backquotes, accent grave), ~ (equivalency sign - tilde), _ (underscore).

It turns out that obtaining those characters is not straigthforward: it depends on your default fonts and on whether \usepackage[T1]{fontenc} is present.
Here are commands that might work:

  • " (double quotes): \verb|"|, \char34
  • \ (backslash): \textbackslash (with \usepackage{textcomp}), \verb|\|, \char124
  • ' (single quote, apostrophe): \textquotesingle (with \usepackage{textcomp}), \char"0D, \char39
  • - (hyphen or minus): \verb|-|, \texttt{-}, \char45
  • ^ (caret): \verb|^|, \char94
  • | (pipe): out of the box (sometimes), \texttt{|}, \char124
  • ` (backquote): \`{}, \char"0D, \char96
  • ~ (equivalency sign - tilde): \verb|~|, \char126
  • _ (underscore): \verb|~|, \char95
On my Debian Linux / TeX Live, with cm-super installed, and with \usepackage[T1]{fontenc} , the following produces a completely copy-pastable PDF:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\begin{document}
\tiny{
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ! 
\char34\#\$\%\& \verb|\|\textquotesingle()*+,
\verb|-|./:;<=>?@[]\verb|^|\verb|_|\`{}\{\texttt{|}\}\verb|~|
}
\end{document}
Without
\usepackage[T1]{fontenc}
: the following works:
\documentclass{article}
\begin{document}
\tiny{
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!
\verb|"|\#\$\%\&\verb|\|\char"0D()*+,
\verb|-|./:;<=>?@[]\verb|^|\verb|_|\`{}\{\texttt{|}\}\verb|~|
}
\end{document}

Wednesday, February 6, 2013

Compilation Error on inet-2.1.0 32/64 bit compat of MACAddress.h MACAddress.cc

  After I updated my OMNeT++ from 4.0 to 4.2.2, I also tried to update the inet to the newest version 2.1.0. According to the INSTALL file, I run the make command. I got the following errors:

linklayer/contract/MACAddress.h line 60: error: integer constant is too large for ‘long’ type
linklayer/contract/MACAddress.h line 120: error: integer constant is too large for ‘long’ type
linklayer/contract/MACAddress.h line 125: error: integer constant is too large for ‘long’ type

I found the following post by EZ.
https://groups.google.com/forum/#!msg/omnetpp/JF_BbiqQIWg/9wgJWoezgoEJ

Compilation Warning on inet-1.99.4 32/64 bit compat of MACAddress.h
1 post by 1 author in omnetpp
I have just moved to inet-1.99.4-development-03d5d15-src.tgz
I am running on Ubuntu i686:
2.6.35-32-generic #67-Ubuntu SMP Mon Mar 5 19:35:26 UTC 2012 i686 GNU/Linux

I get the warnings:
linklayer/contract/MACAddress.h:59: warning: integer constant is too large for ‘unsigned long’ type
linklayer/contract/MACAddress.h:119: warning: integer constant is too large for ‘unsigned long’ type
linklayer/contract/MACAddress.h:124: warning: integer constant is too large for ‘unsigned long’ type

It is clearly caused by the fact long int on my machine is 32bit...

AFAIK there is no "standard" way to write portable code that will know if the long int is 64bit or 32bit.
So I am not sure what to propose here. 
I think a best fix should go into OMNET configure script itself (could be coded as a simple test 
program that checks the sizeof(long int)). That would probably add -DIS64BIT or similar.

Meanwhile (for linux) we can simply add the following code to linklayer/contract/MACAddress.h:
#if defined(_WORDSIZE) && __WORDSIZE == 64 
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffUL
#else
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffULL
#endif
So I  opened file /src/linklayer/contract/MACAddress.h
In the head there is this line:
#define MAC_ADDRESS_MASK 0xffffffffffffL
I changed it to:
#if defined(_WORDSIZE) && __WORDSIZE == 64
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffUL
#else
#   define MAC_ADDRESS_MASK 0x0000ffffffffffffULL
#endif

Run make command again, I got one similar error:
linklayer/contract/MACAddress.cc line 137: error: integer constant is too large for ‘long’ type
In file /src/linklayer/contract/MACAddress.cc line 137,
uint64 intAddr = 0x0AAA00000000L + (autoAddressCtr & 0xffffffffL);
I changed it to:
uint64 intAddr = 0x0AAA00000000ULL + (autoAddressCtr & 0xffffffffULL);

Run make again, and compile inet-2.1.0 successfully.

Friday, July 27, 2012

Fixing "font not embedded" issue to pass the IEEE PDF eXpress check

Found the solution here: http://mohamednabeel.blogspot.com/2009/10/fixing-font-not-embedded-issue-to-pass.html

Issue #2: Font Times-Italic, Times-Roman, Times-BoldItalic, Times-Bold, Helvetica, Courier is not embedded.

You can see what fonts are embedded and what are not, by using "pdffont file.pdf" and looking at the "emb" column. In our case, it did show that some fonts are not embedded.

Fix: We searched the Internet [1, 2]and found that in order to fix this (i.e. to embed all the required fonts) we need to do the conversion from tex to pdf in two stages. This is a dirty hack; but it works.

latex file.tex
bibtex file
latex file.tex
latex file.tex (Now we have file.dvi)
dvips -Ppdf -G0 -tletter file.dvi (Now we have file.ps)
ps2pdf -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress file.ps file.pdf (Now we have file.pdf)