Tuesday, July 10, 2007

Grave errore di stampa del OR logico nel libro C++ di Dietel (Apogeo)

(An English version of this post follows at the end)



Se anche voi, come me, avete ottenuto un errore di compilazione del tipo

stray '\166' in program

...sicuramente state seguendo la versione italiana del libro di Dietel & Dietel "C++ Fondamenti di Programmazione" (seconda edizione, delle altre non so) !!!!! ;-)

In tutto il libro, dopo aver introdotto in modo corretto l'operatore OR logico "||" a pag. 202, si trova il simbolo "¦¦" al posto del "||" !!!!!

E il codice Unicode del simbolo "¦" e' proprio il "166" del messaggio di errore.

Cambiate "¦¦" con "||" e tutto funzionera' a meraviglia! :-)

Ciao!

English:
If you get an error like the red above, you probably input a character "¦" in your code. "166" is the Unicode code of the symbol "¦".
In an italian version of the Dietel book "C++ How to Program" there's a bad typo: in the whole book the logical OR operator is written like "¦¦" instead of "||"!! And if you compile the examples you get the error above.

Tuesday, May 15, 2007

Ganga Job submit() over Grid ... could have never started!! :-D

He he he!!! :)

It was some hours that I tried to submit an Athena job over the Grid with Ganga...

...the job was "loaded" fine, but it remained always in the "new" status.

In the end...I discovered that I mispelled the submit command into my python job script....

....in the last line I used

job.submit

instead of

job.submit()

Ah ah ah!!!! :-D ;-) Hence the numerous jobs I launched...never started!!!!!!! :-D Ah ah ah!!! :-P

Ehy Ma, Pay attention!! ;-)

How to fix "cannot access parent directories" shell error. (Also with Ganga,DQ2 on Grid)

If you are working in a shell and you get an error like this:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

probably you are working in a directory you have deleted from within another shell. I.e. you are in shell A and you are working within /home/Joe/test/ folder. After a while you open a new shell B and you work there. After completed your work you delete the folder /home/Joe/test/ folder and close the shell B. After a while you come back to shell A and start to work there...and you get the Mistery error message, because actually you are working in a deleted directory! ;-)

Try this at the prompt [trust me, it's ugly but safe! :-) ] :

ls $(pwd) && ls /etc/
cd /

first you get an error like "No such file or directory", because the working folder has been previously deleted and doesn't exist anymore. But then, if you move to an existing directory, the problem is fixed! :-)

P.S. You can get this error also working with Ganga and DQ2. If you are working in a .../Local/jobid directory (e.g. in order to read the 'stdout' file) of a Job that you have deleted from withing Ganga CLIP (Command Line IPython Interpreter) with the command jobs[jobid].remove() and try to use dq2_get in order to retrieve an output from the Grid, you get exactly the same error above. Try the same solution.

Good work! :-)

Tuesday, May 8, 2007

How to fix the TortoiseSVN "invalid port number" problem

I waste a while to find the solution to this problem, searching the web and trying and melting various recipes. The following solution worked fine for me, both for plain TortoiseSVN under Windows.

Problem: When you try to connect to the repository hosted by another machine over a network (LAN or Internet) with SSH protocol, using PuTTY as client, you get an error like this:

"Invalid Port Number"

and after that the connection hangs or falls down.


Solution: Right-Click into a whichever folder; a pop-up menu shows up. Open the "TortoiseSVN" and then the "Settings" menu. Check the "Network" section: the "SSH client" field must be empty.

Now open PuTTY.exe and check the name you give to the session for connecting the machine where your SVN repository is. Assume you named "mysvnhost" the session to connect the "host.example.net" machine.

Now you have to use this name at the place of the machine name, when you set the address for the "svn+ssh" access protocol. For example like this:

svn+ssh://username@mysvnhost/folder/folder/svn/repository/trunk/

Friday, May 4, 2007

How to safely use backspace with VI editor under linux?

Sometimes, when you log on a linux machine and try to edit a file with VI editor, you get characters like '?>' when you click on backspace in order to delete a string. How to fix it?

Solution:

In your HOME directory (if you don't know where is it, just type 'cd' at the prompt) edit your .bashrc (or your .bash_profile) file and add these lines:

#Let VI work with Backspace
echo "I run 'stty sane'"
stty sane
echo "Done"

The .bashrc file is loaded (and sourced) every time you log in the machine or you start a shell; so your VI will properly work for ever since now on! : )

P.S. I like to know what my .bashrc does, but if you prefer you can delete the echo lines, of course.

Thursday, May 3, 2007

how to show the MAC address, IP, Host Name and Gateway on Windows with ipconfig

Do you want to know your MAC address (the physical address of your Ethernet LAN card) on your Windows machine?

Open a Command Prompt window and type:

ipconfig /all

You'll get many parameters; among them the most useful are:

  • Host name --> Your machine name. You can use this name to connect to your machine from within other machines in your LAN;
  • Physical address --> Your Ethernet card MAC-address;
  • IP address --> The IP address for your machine. If you are connected in a company or university LAN, your IP should not change. And normally it doesn't change even if you connect your desktop or laptop via a router in a domestic LAN. If you use a Ethernet or USB modem (and not a Router) to connect your PC or notebook to your Internet provider (both Dial-Up via telephone or ADSL), your IP should change every time you connect to your provider server;
  • Default Gateway --> The IP address of the machine it's physically connected to the Internet and is used like router/filter between the private LAN and the external Internet. In a big LAN the Gateway is usually a physical machine; in small or home LAN it's usually the router box.


Wednesday, May 2, 2007

PyDev + Eclipse Error Message. How to configure the Python interpreter

If you installed the PyDev plugin into Eclipse, you may get this message when you start up Eclipse:

An internal error occurred during: "PyDev code completion: rebuilding modules"

It means that, during the rebuilding of the Code Completion Tool, the Python interpreter has not been found. It happens when your Python system was not installed on the default folder (c:\Python); for example mine is installed in D:/Programs/Python. Yes I know, it's not a good practice and it's not suggested in the Python documention.


Solution:

How to set the Python system PYTHONPAT

Being into Eclipse you have to enter in "Window" menu, than "Preferences", "Pydev", "Interpreter-Python" and here you can configure your path. Click on "New..." on the left of "Python interpreters" window, and then choose your right python folder. In the shown up list, check every folder within your main python folder and go on.
Restart Eclipse.

P.S. You could also disable the "Code Completion Tool" rebuilding, but you loose this nice feature. Anyway, if you want to disable it, you can look into "Window-Preferences-Pydev-Builders" menu.

Sunday, April 29, 2007

I discovered an extraordinary Tango singer: Giovanna!

By chance yesterday night I discovered the song "Trenzas" by Giovanna; it was played on a myspace.com site.

I was fascinated by the warmth of her voice, by the music and by the guitar ....

...Amazing!! I listened it six or seven times in a row!! :-D


Giovanna (Giovanna Facchinelli) is born in the "La Plata" region, between Argentina and Uruguay. She starts singing tango in 1994 and in these years became a phenomenon in her Country.

I found Giovanna's page, where you can listen some songs of her...included "Trenzas"!! :-)

And here it's her Label page (Tonos Records) where you can find more info and listen some excerpts.

Show Character Entities on a web site or blog post

Do you want to know how to show something like "<" too on your web site page or blog post? They are called character entities, and you can't show them "as is" because, if you just type them into your HTML code, the browser convert them into ">" symbols.

But you can use this notation:

"&-amp;lt" (without the minus sign!!) to show "&lt"

P.S. You can visit http://www.w3schools.com/ to read more about character entities.

PP.S. On this same blog you can see also: http://pelerin-voyageur.blogspot.com/2007/04/how-to-show-html-code-in-web-page-or.html

How to show HTML code in a web page or blog post

Have you ever wanted to show some HTML code in your web site or in a post of your blog? For example in order to publish an HTML or web development tutorial.

If you just type the code, you get errors or the code is not displayed.

Solution: you have to use the "&-amp;lt" string (without minus sign!) instead of the "<" symbol in your code; and the "&-amp;gt" string (without minus sign!) instead of ">".
(Note. "lt" stands for "less than" while "gt" stands for "grater than") .

Searching the web I discovered a very nice, easy and light freeware program that automatically convert your HTML code in order to show it in a web site or blog. It's called "sHTMLc" and you can find it at:

http://hjem.get2net.dk/fec/shtmlc/shtmlc.html

Note! The program convert the content of the clipboard; so you have to highlight the code you desire to convert, copy it (CTRL-C on Windows), than choose the conversion options within the program screen, push to "Convert" and then paste (CTRL-V) the converted code on your web site or post.

P.S. On this same blog see also http://pelerin-voyageur.blogspot.com/2007/04/show-character-entities-on-web-site-or.html

How change the 'author' name on your blogs (Blogger - .blogspot.com)

Do you have different Blogger (blospot) blogs and you want to use different author names for your posts?

Open the "Template" options page and go to "Edit HTML". Check "Expand Widgets" and look in the code for the "class=post-footer-line" string (you can use CTRL-F in Firefox to find it). You will look at this code:

<p class="post-footer-line post-footer-line-1">
<span class="post-author">
<b:if cond="data:top.showAuthor">
<data:top.authorlabel> <data:post.author>
</data:post.author></data:top.authorlabel></b:if></span></p>


Now you can delete the string <data:post.author></data:post.author> and replace with the name or the nickname you want to use, i.e.

from:
<data:top.authorlabel> <data:post.author>
</data:post.author></data:top.authorlabel>


to:
<data:top.authorlabel> myname
</data:top.authorlabel>


You can do that for every blog you want to customize.

Enjoy! :)

A nice article on ROOT, Python, PyROOT, C++, C# and IronPython and perfomaces

While I was searching the web to get information on PyROOT, I get this nice article written by another particle physicist guy :)

He also did a little performance comparison about ROOT calls wrapped in C++, pure Python and IronPython code.


http://gordonwatts.wordpress.com/2007/02/25/root-python-and-net/

Carlos Paz "Tarareando" (Orchestra di Piazza Vittorio)...is becoming a drug for me!! :)

The "Orchestra di Piazza Vittorio" big band.

One of the song is Carlos Paz's "Tarareando" . You can listen it at the MySpace of the band:

http://www.myspace.com/orchestradipiazzavittorio

When you open the page you'll find a player on the right side. Click on "Tarareando".....and SING LOUD!!!!!!! :-D ;-D


P.S. You can visit the official site of the band at: http://www.orchestradipiazzavittorio.it/eng/home.html
And you can buy the cd's at: http://www.orchestradipiazzavittorio.it/eng/discografia/discografia.html