Let’s note about Java

July 5, 2009

Java has never been my programming language until this week. I registered the Distributed System class just to fulfill my curiosity. Professor asked students to register for some class project. Among the topics, I find this one is quite strange: Trust in P2P network. As an engineering student, I am quite fascinate about calculation and if it related to programming, then scientific programming! This topic, however, actually pushes me out of my comfort zone. I simply reasoned that I could  learn most by working hard on something completely new. This is exactly the reason why I chose the topic. Along the class, I find the algorithm of EigenTrust yields impressive results.

S. D. Kamvar, …, “The EigenTrust Algorithm for Reputation Management in P2P Networks”, Twelfth International World Wide Web Conference,  2003

OK, this is my target for the project. Go a litle further, we could find that this paper is actually quite popular. Wiki has an entry for it. CiteSeerX informs us that it has 331 citations, impressive! S. D. Kamvar, the principal investigator of this work, even goes further to claim that this paper has 1171 citations, according to Google Scholar. I do not know who to trust in this case, but I do know that either number we pick, it still shows that this paper has significant impact to the research community.

Let’s come back to my main topic of this post, the environment of choice for this project is NetLogo. To me, NetLogo seem to be a fun toy environment with cute little turtle animations. How could it help me to reproduce the results of this paper? Luckily, the authors provide web demo version and download-able source code. The web version is painfully slow. So I rule it out and turn to the Java source code. I now have an excellent incentive to learn JAVA.

Regarding to basic Java introduction for scientist, go no further than Programming for Scientists blog. This blog provides much more than this basic introduction. It also has some interesting articles:

  1. Links to some great articles on programming
  2. The basics of … C\C++
  3. The 4 levels of making code work
  4. 4 ways to become a better programmer

OK these are enough for warming up section. Next step should be reading:

A. B. Downey, How To Think Like A Computer Scientist in Java – 4th

we have web version and pdf version depend on your taste. I myself use both because they all taste good ;) . So far, those material is more than enough to me. Further on the road, I may consider the following books:

  1. S. J. Chapman, Java for Engineers and Scientists – 2nd, Prentice Hall 2003
  2. B. Hahn, K. Malan, Essential Java for Scientists and Engineers, Butterworth-Heinemann 2003

Restoring deleted files from Vista

July 4, 2009

I have to state that I am not satisfy with the way Vista manage files. I have two accidents of deleting wrongly in Vista. I am quite certain that I only selected the unused files and then press Shift + Del. Then the whole directory kissed me goodbye. Outch! I could not believe that. The only solution is using third party undelete programs. I am happy to find Recuva. It is free, simple  and fast. Although it could not recover all of my lost files, I could still extract quite a lot of them. Here is the protocol:

1. Keep the system as it is. Do not open or close any programs. This will prevent further damage.

2. Set the sleep mode to never as the process may take quite a long time.

2. Plug an USB key in and dowload Recuva to this USB.

3. Install Recuva to this USB key. The key point here is not writing anything to the hardisk.

4. Do the deep scan.

5. Recover all the available files to the USB. Again, no writing to hardisk.

That’s it. My leason from Vista is:

Never ever ever never do Shift + Del in Vista

Install Chrome in Vista behind Proxy

July 4, 2009

It has been a problem in installing Chrome browser of Google in Vista behind my school proxy. Actually I have no such problem in Windows XP. My experience with Chrome is very impressive. It is lightening fast, simple and technical superior. Although I do not have a feeling of solid and mature product like Firefox, it does not mater anyway. Returning back to our main theme for this post, I could not install it no matter how hard I try. Some Google for this problem reveals that there is no actual solution for this. Hell! 

Then today, I happened to circumvent this problem by installing RealPlayer. Real Installer just casually ask me if I am allow it to install with Chrome. Surprise, isn’t it? It actually works. Don’t ask me why, cause I do not answer at hand, but one thing I know for certain, it WORKS. The proof is I am posting this article by Chrome!

PDF graphic and animation

June 26, 2009

I find that the first step is to read PGF manual. It meticulously teaches us from each every detail of drawing. This is quite enough for a simple presentation.

However, the PGF manual has error in header setting:

%% Plain TeX file
\input tikz.tex
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,placments,fit}

we have to replace “placement” by “positioning” as suggestion in here.

One of common mistake  in writing paper is we prepare figures from other packages, say Matlab or Mathematica, and then scale them down (or up) in the paper body. This will subsequently change the figures’ text size! If we want to have a consistent font sizes throughout long paper or thesis, then we must follow a well pre-defined workflow.

Regarding to animation, there are several options:

  1. TikZ + overlay / pause commands
  2. Use the animate package of Alexander Grahn. To me, it just like Mathematica’s Manipulation command. The result is stunning presentation in pdf file, of course with the cost of very long time study in order to master this technique.

Some cute examples:

  1. Animated distributions. It would be quite a challenging task for Visio. We, however, have to download the packet from CTAN, and put animate.sty and animfp.sty to the working directory.
  2. Inertial navigation system. Ironically and unexpectedly, one of the advantages of learning TikZ is to improve my presentation by Visio. Especially the way we handle color and structuring the figure.

Presentation in Latex – Beamer

June 6, 2009

Beamer Presentation

The presentation in Latex is quite different with Power Point environment. We, however, have the advantage of inputting equation beautifully to the slides. Disadvantages, of course, are not so intuitive and stiff learning process. The following are some tips that I gathered along the way of working with Beamer.

Prof. Norm Matloff provides a nice introduction to Beamer package.

I, however, find the presentation of Prof. Rouben Rostamian are exceptionaly useful. It collect almost everthing I need for the implementation. The only tutorial that I need here is the way to do animation with graph.

Gilles Bertrand maintains a good set of techniques for LaTex. He also includes suggestion for drawing programs. Personally I find that Microsoft Visio is the best. It has everthing I ever need.

University of Hyderabad maintains a very good set of examples with beautiful animation graphs. I still wonder how could they create those presentations?

Prof. Nakazato likes PowerDot, but I did not find any clear advantage of this packeage over Beamer. The only clear difference is it has some more styles.

There are other package called TeXPower with different flavor.

Graphic

Perhaps the widely adopted graphical package for Beamers is PGF/TikZ. It provides very helpful examples for graphical manipulations. Playing with is package around a day, it actually changed the way I see on scientific graphical presentation. Just look at some books such as:

G. Bolch, …, Queueing networks and Markov chains, 2nd, Wiley 2006

and you will immediatly understand and appreciate the capability of PGF/TikZ. I do not mean that this book use PGF/TikZ. In fact I do not know how they creat those figures. But here is the thing, if we know PGF/TikZ well enough, we could generate most of the figures like in this book while maintaining consistency throughout the book/thesis without much difficulty. This is certainly not a trivial task for Visio at all. The key point here is the consistency in the graphical presentation while preserving font size though the whole book.

High Energy PhDs has a very nice review about this package.

Overlay techniques for presentations with xfig is a very good technique for doing animation with beamer.

Presentation Techniques

F. C. Langbein has a very useful presentation of using LaTEX for mathematical expression.  The technique of using array is supper.

Trinity University hosts a wealth of LaTEX examples. We could download presentation in pdf as well as tex source file from here. The tip for using split is helpful for writing multiple lines equations. I, however, find that the way to include logo in the cover page is the most exciting:

\institute[Trinity University]{%

\includegraphics[width=1.0cm]{ltr-logo}\\%remove this line if no logo.

\textcolor{Maroon}{{\Large Trinity University}}\\

Mathematics Department

}

They seem to prefer Frankfurt theme. It is a nice theme, but personally, I find the Boadilla theme with Trinity colortheme in Knot Theory Talk is much more attractive. We can download the source tex file from the above site. The only thing I find not so fit is the style of theorem is too colorful to my taste. It may not fit well to research community. A darker color, or no shadow may work.

Amber M. Smith use beautiful Warsa theme, with attractive enumerate color. Some special effects that I learnt from her:

\documentclass[compress,red]{beamer}

\mode<presentation>

\usetheme{Warsaw}

\hypersetup{pdfpagemode=FullScreen} % makes your presentation go automatically to full screen

\useoutertheme[subsection=false]{smoothbars}

KiJoo
Kim

Ki-Joo Kim explained how to use figures inside ‘columns’ environment:

\begin{columns}

\begin{column}{0.65\textwidth}

A\\B

\end{column}

\begin{column}{0.35\textwidth}

\rput[lt](0,0){\includegraphics[clip=true,width=\textwidth]{tiger}}

\end{column}

\end{columns}

Interrupting enumerated lists

Usually we will have a list that span for several frames. \LaTeX, however, will re-set all the counter for each frame. Therefore we will have a broken list. To prevent this, it is better to store the list counter from the previous frame, and then set the list’s counter of the next frame to that value.

\newcounter{saveenum}

\begin{enumerate}

\setcounter{saveenum}{\value{enumi}}
\end{enumerate}
<Commentary text>
\begin{enumerate}
\setcounter{enumi}{\value{saveenum}}

\end{enumerate}

Simple isn’t it. The above solution come from this web site.

Window XP – 100% CPU usage

May 28, 2009

It is generally OK for me to work with Window XP. It is small, fast and has no problem so far. However so time I find it quite annoyingly slow. CPU fan becomes noisy and all programs become stagnant. What is the problem? My first thought is virus. OK anti-virus program. AVG, let’s go.  After 40 min or so diligently scan, no virus!! outch.  That must be spy-ware.  Now is the time for Ad-Aware. This program is awesome but my problem is still there!

It is fun time now. Bring up Windows Task Manger and kill all the unneccessary tasks. CPU load is around 3%. Good, very good.  I hit the Print Screen key to have a copy image of  the Task Manager. Put it in Paint, and wait impatiently for the problem comes back. After 10min or so, CPU suddenly become 100%.  Another Print Screen hit for comparative study, I have isolated the problem. It is actually the cidaemon.exe, an indexing service of Windows. Turning it off will solve this problem one and for all:

- Run services.msc and set indexing service to Disabled.

My happy day.

CPU_100_Percent_Usage

High Performance Computing

January 15, 2009

Ruud van der Pas from Sun provide a brief introduction on Sun Studio & Sun HPC ClusterTools. It also includes MPI performance analysis capabilities. Sun HPC ClusterTools 8.1 can be freely download from Sun’s website. He also has a presentation on An Introduction Into OpenMP in IWOMP 2005. It may be dated but quite suitable for introduction.

Dbx Debugger Screencasts: A new standalone lightweight GUI debugging solution, dbxtool, is introduced. Debug skill is essential for any programmer, therefore this screen cast is quite helpful.

Prof. Norm Matloff provides a quick tutorial on the Eclipse. He is also kind enough to include detail instruction on how to use gdb for debugging job in Guide to Faster, Less Frustrating Debugging.

Research@Intel posted a very interesting article “Exploring programming models with the Single-chip Cloud Computer research prototype” which may serve as a changing paradigm for HPC. The main foundation idea is in this paragraph:

The super-computing community has used massive parallelism for years, with message-passing programming models based on APIs such as MPI. The newest generation of super-computers use huge numbers of ordinary processors connected in high performance networks as the computer with the same programming model – with proven scaling to thousands of nodes. Cloud computing centers have moved to the same architecture with greatly simplified programming models such as Google’s MapReduce that abstract the messaging from the programmer – applying thousands of processors on large data sets to problems such as sorting, machine learning and statistical machine translation. What might we apply to parallel programming for mainstream desktop and laptop processors from what has been learned in these areas?

Photography

January 13, 2009

Today I happen to find a great photo website. It hosts so many stunning photos. For instance:

  1. Albert Giordan’s Album
  2. Robert Charbonnet’s Album
  3. Sergey Kovalev
  4. Mamuka Kikalishvili
  5. Craig McDean
  6. Peter Callesen
  7. Romain Laurent
  8. August Bradely
  9. MSNBC
  10. Mario Testino
  11. Lukasz Murgrabia
  12. Tyler William Parker
  13. Gavin Bond
  14. Rory Lewis
  15. Vogue Paris November 2009

C++ for engineering

January 5, 2009

C++ is quite a huge subject that I struggle for a long time. It is difficult to master the whole subject, and then apply to engineering area. So I try to collect some relevant links and material for quick reference:

Comparison of C++ and Fortran 90 for Object-Oriented Scientific Programming: This is an excellent reviews of C++ in the context of Scientific Programming. Although I have never usu Fortran and have no intention to learn it, I still find that the information of C++ is quite relevant and helpful.

For general overviews, www.cplusplus.com does quite a good job.

C++ for Particle Physicists:  Series of 13 lectures that was presented at CERN in Geneva by Paul Kunz from Stanford University. The lectures are very clear and start with the basics in an attempt to teach C++ to Particle Physicists. I actually learn from these lectures more than from any other sources.

Bjarne Stroustrup’s Video Lecture on C++0x Standard: Dr. Bjarne Stroustrup is the original designer and implementer of the C++ Programming Language. It is quite interesting to hear about C++ directly from its creator. This talk has been reiterated at various places like: CERN Geneva where we could download, Google Tech talk or 2nd version, youtube.

Books

  1. A First Course in Computational Physics and Object-Oriented Programming with C++, David Yevick, CUP 2005
  2. Scientific and Engineering C++, J. J. Barton and L. R. Nackma, Addison-Wesley 1994
  3. The C++ Programming Language, Bjarne Stroustrup, Addison-Wesley 2000
  4. Design Patterns: Elements of Reusable Object-Oriented Software, E. Gamma, R. Helm, R. Johnson, J. M. Vlissides, Addison-Wesley 1994
  5. C++ and Object-oriented Numeric Computing for Scientists and Engineers, Daoqi Yang, Springer 2000
  6. Numerical Recipes in C: The Art of Scientific Computing, 2nd, W. H. Press, B. P. Flannery, S. A. Teukolsky, W. T. Vetterling, CUP 1992
  7. Edward Scheinerman, C++ for Mathematicians,  CRC 2006 [158488584X]

Low Density Parity Check Codes

January 5, 2009

This LDPC (Low Density Parity Check) Codes was invented by R. G. Gallager in his PhD dissertation at MIT in early 1960. The result was published in IEEE Information Theory (1962). At that time, this invention had no practical application as it required huge computation capacity that did not exist these days. The introduction of other powerful codes, such as Reed-Solomon, also contributed to the ignorance of research community to this excellent code.. This idea was re-invented by David MacKay (1999) and Richardson/Urbanke(1998).

There are some good resorce for LDPC from internet:

  1. Wireless Communications Research Laboratory of West Virginia University. It contains various internet links as well as brief introduction to LDPC and a longer introduction in “Handbook for Coding and Signal Processing for Recoding Systems, CRC 2004″.
  2. LDPC using Matlab: This site contains Matlab code for LDPC. It runs quite well, rather slow however, in my desktop. This site also provides Matlab code for Turbo and Convolution codes. Very helpful.
  3. Radford M. Neal provides LDPC in C. Quite good for learning programming, but not as intuitive as Matlab code. I expect that it might run a little faster than Matlab version. But these days who care about running time as the total: development time + running time is indeed the most important measure. And in this respect, Matlab is the king.
  4. LDPC toolkit for MATLAB: it is quite dated (2002) however working steps are quite easy to follow.
  5. LDPC over GF(2^m) by Igor Kozintsev.
  6. Prof. Ruediger Urbanke at EPFL on irregular LDPC.
  7. Malab Central: is the place to get practical codes for doing research.

It maybe more intuitive to have Simulink code for LDPC simulation. I am now working on that homework.


Follow

Get every new post delivered to your Inbox.