Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Monday, March 14, 2011

Regular expressions in Eclipse: some working examples

I found very useful the Regular Expressions support in the "Find and Replace" window of the Eclipse IDE.

Here some expressions I used. Mainly a reminder for me, of course; but I think they can be useful for others as well, as working examples.

Note that you can refer to groups within the regular expression in the "Search" field, with the symbol $ followed by an increasing number: $1 for the first group defined in the regular expression, $2 for the second and so on...

---

From: qDebug() << "Hello" << world.name() << "t_int32" << "!";
To: ERS_DEBUG(2, "Hello" << world.name() << "t_int32" << "!");

Search: (qDebug[(][)])(\s*[<]+\s*)(.*)([;])
Replace: ERS_DEBUG(2, $3);

---

Monday, May 3, 2010

How to change or clear your Subversion password used by eclipse plugins on Mac OS X

I assume that you are using Eclipse Galileo on Mac Os X Snow Leopard, with JavaHL SVN client.

It happened to me that once I updated the password of my account on the subversion server machine, Eclipse did not allow me to connect to the repository anymore; moreover it did not ask me for a new password, I merely got errors like "The folder does not exists on remote server" and authentication errors on the Eclipse SVN Console.

After googleing for a while, I did not find the solution yet, and so I started to play around. Finally I solved the problem and I post the solution here; I hope it can save you some time :-)

You have to open the "Keychain" application from "Applications" --> "Utilities" --> "Keychain"

There you will find an "application password" related to SVN: mine contains something like "https://svn.host.com/". You double click on it and you change your stored password with the new one.

Now if you close Eclipse and then you open it again, it will notice that the SVN password was changed and when you will try to access the repository again, Eclipse will ask you the username/password couple again. You can type the new password again, and you can "save" it if you want. The new password is set.

Hope that helped! :-)

Wednesday, April 1, 2009

Eclipse IDE: How to install and configure MinGW GNU C++ compiler for Windows

Eclipse IDE has the very nice CDT environment for C++ programming.

In order to use it under Windows, you have to install a C++ compiler.

Our suggestion is to install the MinGW compiler, "A MINimalistic Gnu for Windows" Gcc compiler.

Go to http://www.mingw.org/ and download the installer for Windows from here.

Then start the Installer and choose to install the basic package + the g77 compiler + Make for MinGW, as those are the tools needed for compiling C++ code with Eclipse... and not only with Eclipse ;-)

Once installed everything you have to add the MinGW path to your PATH environment variable, to make the compiler findable.

Let's say we have installed the MinGW package on C:\MinGW. Refer to the picture below.
You have to open Start --> Control Panel --> System. In the pop up window that appears select on the left side "Advanced System Settings" and then goes to the tab Advanced and choose "Environment Variables...". There look for the "Path" variable in the System Variables window below (look for PATH, instead, if you want to set the MinGW compiler only for you as user) and click on "Edit...". In the pop up window you'll find a long string to edit. Go to the end of that string line and add ";C:\MinGW\bin". Then "Ok" and again "Ok".





Now your new nice MinGW compiler is ready to be used.

To make a test open a new command prompt (Start --> All Programs --> Accessories --> Command Prompt) and try to type "mingw32-make --version". If everything worked fine you should see a window telling you the version of the newly installed package.

Now open your Eclipse IDE with CDT for C++. Eclipse now should see and should be able to use MinGW C++ compiler!! :-)

So...have fun programming C++! :-)

Eclipse: How to get rid of the squiggly orange line in C++ editor

Problem: Using the Eclipse IDE with C or C++ code I have an annoying orange squiggly line throughout my code

Solution: Changing the C/C++ Indexer Markers options


Using the Eclipse IDE to programming C++ code, when an "include file" statement is not resolved, it is marked with an orange question mark and the whole code in the file we are editing are understriked with an orange squiggly line, as shown in the picture below.



It's really annoying, in particular when we are editing a file outside the real environment where the code will be compiled, and we already know that the included files are not physically joinable in that moment ;-)

So, in order to get rid of this squiggly orange line, just open the menu Window --> Preferences --> General --> Editors --> Text editors --> Annotations, look for the orange question mark symbol called "C/C++ Indexer Markers" and check out the "Text as" option, as shown in the figure below




In this way you can keep the orange question mark warning symbol in the Eclipse C++ editor, telling you that the "include file" statement is not working; but you can get rid of this annoying orange squiggly line, as shown in the figure below, and you get back a clean code! :-)

Friday, October 24, 2008

Subclipse error: Svn can't create tunnel. Configuring SVN+SSH connection on Windows Vista

Good morning!

Yesterday I wanted to install the beautiful Eclipse IDE on my new Windows Vista laptop. Everything went fine. I also installed Subclipse, the interface to the "Subversion" Version Control System, in order to access my code in the repositories on the remote machines of my Insitute.
Everything went fine again, but then, when I wanted to set up a SVN+SSH connection to checkout my code from the remote machine, I got this error:

The system cannot find the file specified.
svn: Can't create tunnel: The system cannot find the file specified.

Looking on Internet I found a solution for Windows XP, that I had to modify a little bit. Here the solution.

The problem is that you have to specify the path of your SSH client. You can use the classical PuTTY or Plink, but I prefer to use the TortoisePlink, the modified version of Plink contained in the excellent TortoiseSVN package. Using the TortoisePlink client you will be prompted for your username and password without opening an ugly CMD window (the command line window) every time.

So, let's say you have already installed the SVN client, you have now to modify the config file.
In Windows Vista this file is stored in the hidden folder

C:\Users\[username]\App Data\Roaming\Subversion

There you find the file named config. Open it with an editor (for instance Notepad) and look for the string

[tunnels]

this line must be uncommented (no hash # symbol at the beginning of the line). Then you have to modify the line below, to set the right path to your SSH client

# ssh = $SVN_SSH ssh

Let's say you installed the package TortoiseSVN at C:\Program Files\TortoiseSVN
so you can leave commented the line # ssh = $SVN_SSH ssh and you can add this line just below it:

ssh = C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe

Done!! :-)

Now you should be able to connect to your remote site with SVN through a secure SSH tunnelling connection.

And, as always, let me know if you have some problems! ;-)

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.