Wednesday, October 22, 2014

Raspberry Pi B+ boot up and connect to laptop

Just received B+ and could not wait to power it up!

1. Put into the case

I also ordered a Vilros clear case for the B+ model from Amazon. I thought this should be a fairly easy process, but it turned out to take more than 25 min! I think the case is simply too tight, at least for the case and Pi I received. I tried various ways and realized that unless I pressed it really hard, it just would not fit. But I was afraid to break my Pi!

After trying some more time I was able to click the Pi into the case. What I did was to seat the HDMI side on the bottom case, and press really hard on the GPIO side, all the way down through the two slide-shaped bumps. Of course I could not press on the GPIO pins, so I had to press a little below the pins. It was uncomfortable, and excessive force had to be used. And I guess there is no way I can get the Pi out of the case in future unless I break the case.


2. Boot up

I ordered a micro SD card Kingston Digital 16 GB Class 4 microSDHC Flash Card with SD Adapter (SDC4/16GBET). I followed the procedure on this link to install the Raspbian Wheezy 2014-09-09 on the SD card using a Ubuntu laptop. After that, if I inserted the micro SD card into the laptop, it showed two devices, one "boot" with files such as bootcode.bin, cmdline.txt, *.elf, etc., and the other "3 GB Volume" which should be expandable using the Pi.

The micro SD card was then inserted to the Pi. Even if it "clicked", I could still pull it out. It seems there is nothing really locking it into the slot. But it does make good contact.

Then I connected the Pi to USB mouse, USB keyboard, Edimax nano-size USB WiFi adapter, and a DVI monitor using a HDMI-DVI cable. It booted up!

The setting up of WiFi was super easy in the desktop. I tested IDLE, Pi Store, Mathematica, Wolfram Language, web browser, installing vim, etc. It was very smooth.

I enabled ssh during the booting up. Then I could try the "headless" way, removing the connections of keyboard, mouse, and the monitor!

3. Connect to laptop

After enabling ssh on the Pi, I wrote down the IP address of the Pi, something like 192.168.0.???. I bundled the MAC and IP in the router so that I will always use the same IP address to access the Pi.

I removed the keyboard, mouse, and monitor from the Pi. In my Ubuntu laptop, I opened Xterm and typed:
sudo ssh -X pi@192.168.0.15
Then entered the password, and the connection was made. In the above, the "-X" is for allowing x windows.

To start the desktop, type
lxsession &

The Pi's window would then merge into the Ubuntu's desktop. All the software worked fine on the merged desktop, except that I found I could not get Scratch to open in this headless way.

To terminate the lxsession, type the following in the terminal running ssh:
lxsession-logout

Thursday, January 16, 2014

Ubuntu backup deja-dup

http://www.howtogeek.com/108869/how-to-back-up-ubuntu-the-easy-way-with-dj-dup/ 

Can recover the whole system, a selected file (right click Revert to Previous Version ...), and a deleted file (right click Restore Missing Files ...)

However some users complained about its unreliability
https://apps.ubuntu.com/cat/applications/deja-dup/

Sunday, January 12, 2014

Tools/procedures for generating high-quality PDF/EPS files with LaTex math

Without using pricey licensed softwares, you can generate high-quality PDF/EPS files with LaTex math expressions, as shown in the following. Other procedures may work as well, but the following have been tested and may save some time.

1. Drawing tools and procedures

To make your own figures with LaTex math, you may use LibreOffice Draw. To enable LaTex, in Tools --- Extension Manager..., add TexMaths (http://roland65.free.fr/texmaths).

You may also use Inkscape. For math expressions, use Extensions --- Render --- LaTex formula ...

Both LibreOffice Draw and Inkscape are free.

On the other hand, if you have MS Office, you may use Powerpoint to draw, with TexPoint ($30~$45) or IguanaTex (free) for math expressions.

After drawing, export or save as a PDF file and embed all fonts. Converting to other file formats may be not preserve all formats/information.


2. PDF tools and procedures

This PDF file should have all fonts embedded. To check, use:
pdffonts a.pdf

to make sure all fonts are embedded correctly.

To generate an EPS file with a bounding box or a PDF file with only the drawing area kept, do:
pdfcrop a.pdf b.pdf

This removes the white space around the drawing area in a.pdf and generates an output file b.pdf.

If EPS format is desirable, perform:
pdftops -eps b.pdf

This is generate b.eps with the bounding box.

If Adobe Acrobat Professional is available, you may also crop the pdf using it, and save as another PDF file or save as an EPS file.

3. Include the drawing file in LaTex document

The b.pdf file or b.eps file can be included in a LaTex document using e.g.:

\begin{figure}[h]
\begin{center}
\subfigure[]{\scalebox{.6}{\includegraphics{b1}}}
\subfigure[]{\scalebox{.6}{\includegraphics{b2}}}
\end{center}
\end{figure}


If no file extension is specified, PDFLaTex will look for b1.pdf, b2.pdf, etc., and LaTex will look for b1.eps, b2.eps, etc.


If LaTex --> dvi2ps --> ps2pdf procedure is to be followed, make sure the option
-Ppdf 
is used for dvips, and the options
-dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress 
are used for ps2pdf.

If PDFLaTex or the like is to be used used, set the following option:
updmap --setoption pdftexDownloadBase14 true 


The produced PDF file should have all fonts embedded and high-quality figures. You may use pdffonts to verify.


Wednesday, August 28, 2013

Immanuel Kant

Two things fill the mind with ever new and increasing admiration and awe, the more often and steadily reflection is occupied with them: the starry heaven above me and the moral law within me. Neither of them need I seek and merely suspect as if shrouded in obscurity or rapture beyond my own horizon; I see them before me and connect them immediately with my existence

All natural capacities of a creature are destined to evolve completely to their natural end.

Rules for Happiness: something to do, someone to love, something to hope for.

Have the courage to use your own reason- That is the motto of enlightenment.

Enlightenment is man’s emergence from his self-imposed immaturity. Immaturity is the inability to use one’s understanding without guidance from another. This immaturity is self-imposed when its cause lies not in lack of understanding, but in lack of resolve and courage to use it without guidance from another. Sapere Aude (Dare to think/know/be wise)!

Live your life as though your every act were to become a universal law.

We are not rich by what we possess but by what we can do without

All our knowledge begins with the senses, proceeds then to the understanding, and ends with reason. There is nothing higher than reason.

To Be is To Do.

Saturday, August 17, 2013

Friedrich Nietzsche quotes

Man's maturity: to have regained the seriousness that he had as a child at play.

That which does not kill us makes us stronger.

The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.

He who has a why to live can bear almost any how.

All things are subject to interpretation whichever interpretation prevails at a given time is a function of power and not truth.

Without music, life would be a mistake.

To live is to suffer, to survive is to find some meaning in the suffering.

You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.

And we should consider every day lost on which we have not danced at least once. And we should call every truth false which was not accompanied by at least one laugh.

All truly great thoughts are conceived by walking.

The reality

The so called reality is an illusion. The so called illusion is a reality.
The world is a simulation with ever-increasing complexity.

Friday, August 16, 2013

Socrates quotes

To know the good is to do the good.
Beware the barrenness of a busy life.

The unexamined life is not worth living.

All men's souls are immortal, but the souls of the righteous are immortal and divine.

Wisdom begins in wonder.

Having the fewest wants, I am nearest to the gods.
I know nothing except the fact of my ignorance.
He is richest who is content with the least, for content is the wealth of nature.

Let him that would move the world first move himself.

Remember that there is nothing stable in human affairs; therefore avoid undue elation in prosperity, or undue depression in adversity.

Remember what is unbecoming to do is also unbecoming to speak of.

The only good is knowledge and the only evil is ignorance.

The shortest and surest way to live with honour in the world, is to be in reality what we would appear to be; and if we observe, we shall find, that all human virtues increase and strengthen themselves by the practice of them.

Get not your friends by bare compliments, but by giving them sensible tokens of your love.
If a man is proud of his wealth, he should not be praised until it is known how he employs it.
Regard your good name as the richest jewel you can possibly be possessed of - for credit is like fire; when once you have kindled it you may easily preserve it, but if you once extinguish it, you will find it an arduous task to rekindle it again. The way to gain a good reputation is to endeavor to be what you desire to appear.
Death may be the greatest of all human blessings.
Do not do to others what angers you if done to you by others.
Envy is the ulcer of the soul.
Think not those faithful who praise all thy words and actions; but those who kindly reprove thy faults.
Thou shouldst eat to live; not live to eat.
There is only one good, knowledge, and one evil, ignorance.

I am not an Athenian or a Greek, but a citizen of the world.
I decided that it was not wisdom that enabled [poets] to write their poetry, but a kind of instinct or inspiration, such as you find in seers and prophets who deliver all their sublime messages without knowing in the least what they mean.
The hour of departure has arrived, and we go our ways - I to die, and you to live. Which is better God only knows.

I do nothing but go about persuading you all, old and young alike, not to take thought for your persons or your properties, but and chiefly to care about the greatest improvement of the soul. I tell you that virtue is not given by money, but that from virtue comes money and every other good of man, public as well as private. This is my teaching, and if this is the doctrine which corrupts the youth, I am a mischievous person.
Be as you wish to seem.

Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for.
I am the wisest man alive, for I know one thing, and that is that I know nothing.
It is not living that matters, but living rightly.

Our prayers should be for blessings in general, for God knows best what is good for us.