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

Working with columns in Emacs



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/09/working-with-columns-in-emacs/

You should be redirected in 2 seconds.



In Eclipse, I got a plugin called Columns for Eclipse to cut or paste a column of text. (See this previous post.) In Emacs, this functionality is built-in and columns are called rectangles. Here is how to insert a column of text in Emacs.

I had a list of function names and wanted to turn them into function prototypes by adding "static void " at the beginning and "(void);" at the end.
DoSomethingIntelligent
CalculateSomethingComplicated
DoHardWork
MakeOurCompetitorsBegForMercy
GiveNoMercyToCompetitors
BecomeAwareOfReality
DoSomethingBoring
WonderAboutTheMeaningOfLife
WishIWerePythonOrLisp
To do this, I put the cursor at the beginning of the first function name, pressed CTRL+SPACE to "set the mark" (see section 12 of the manual for more information about the mark), and moved the cursor to the beginning of the last function name. Then do M-x string-insert-rectangle <RET> static void <RET> and got:
static void DoSomethingIntelligent
static void CalculateSomethingComplicated
static void DoHardWork
static void MakeOurCompetitorsBegForMercy
static void GiveNoMercyToCompetitors
static void BecomeAwareOfReality
static void DoSomethingBoring
static void WonderAboutTheMeaningOfLife
static void WishIWerePythonOrLisp
I just realized now that I cannot add the "(void);" to the end with string-insert-rectangle because I do not want to insert the "(void);"s as a rectangle. If I did, it would look like this:
static void DoSomethingIntelligent         (void);
static void CalculateSomethingComplicated  (void);
static void DoHardWork                     (void);
static void MakeOurCompetitorsBegForMercy  (void);
static void GiveNoMercyToCompetitors       (void);
static void BecomeAwareOfReality           (void);
static void DoSomethingBoring              (void);
static void WonderAboutTheMeaningOfLife    (void);
static void WishIWerePythonOrLisp          (void);
But that is ugly and I don't like that. So I guess I'll have to learn how to write a Lisp macro to do this. To be continued...

Note, If you want to delete the "static" from all the prototypes, you can select the text in the same way and do M-x delete-rectangle. Or you could use C-x r d if you haven't rebound C-x like I have.

See also Section 16 Rectangles for more information.
[Read the full post...]

From Eclipse to Emacs



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/09/from-eclipse-to-emacs/

You should be redirected in 2 seconds.



I am trying to learn Emacs after about a year of using Eclipse 3.2/3.3. See this post for some reasons why. Below is a list of Eclipse keyboard shortcuts and their Emacs equivalents. I'm using Emacs 22.1 for Windows.
ECLIPSE COMMAND SIMILAR EMACS COMMAND
(Emacs manuals use C for the CTRL key and M for the Meta or Alt key. So, e.g. C-x means CTRL+X. For Emacs long commands, you can type TAB to complete the command name.)

Cancel a command
ESC
Cancel a command
C-g

Open resource
CTRL+SHIFT+R
Find file
Keybinding: C-x C-f
Command: M-x find-file
Notes: Type in the file to open. Hit TAB for filename completion. Hit up and down arrows for recently used files.

Save file
CTRL+S
Save buffer
Keybinding: C-x C-s
Command: M-x save-buffer

Close
CTRL+F4
Kill this buffer
Keybinding: none
Command: M-x kill-this-buffer

Undo/Redo
CTRL+Z / CTRL+Y

Undo/ Undo Undo
Keybinding: C-_, C-x u, C-/
Command: M-x undo

To redo, interrupt the undo sequence by entering any command (e.g. C-f), then undo again. This undoes what you just undid, which is like redo. See 21.1 Undo in the GNU Emacs Manual.

This behavior can be confusing so there is also a RedoMode which behaves more like Eclipse and other editors. See RedoMode on the Emacs Wiki.

Switch editors
Keybinding: CTRL+F6 or CTRL+SHIFT+F6
Command: CTRL+3 Next Editor or CTRL+3 Previous Editor

Switch buffers
Keybinding: C-x RIGHTARROW or C-x LEFTARROW
See also: 24 Using Multiple Buffers in the Emacs Manual

Switch views
Keybinding: CTRL+F7 or CTRL+SHIFT+F7
Command: CTRL+3 Next View or CTRL+3 Previous View

After splitting into 2 windows with C-x 2, use C-x o to switch between windows.

To scroll the other window, use C-M-v. This is useful to reference one window while editing in the other.

To close the other window, type C-x 1 in the window you want to keep.

Find and Replace
Keybinding: CTRL+F
Incremental Search
Keybinding: C-s

Unconditional Replace
Command: M-x replace-string RET string RET newstring RET

Regexp Replacement
Command: M-x replace-regexp RET regexp RET newstring RET

See also: 20.9 Replacement Commands

Show line numbers
Keybinding: none
Command: CTRL+3 Show Line Numbers

Look in your status bar for the line number or see http://www.emacswiki.org/cgi-bin/wiki/LineNumbers

Code Completion
Keybinding: CTRL+SPC

Dynamic Abbrev Expansion
Keybinding: M-/
Command: M-x dabbrev-expand

This command is much faster and simpler than Eclipse because it doesn't use the compiler/interpreter. However, I think it is less robust for the same reason. At this point, I think I like the Eclipse version better.

See also 34.6 Dynamic Abbrev Expansion in the manual.

Keys
Command: CTRL+3 Keys - General

Key Bindings
Keybinding: C-h b
Command: M-x describe-bindings

Comment
Keybinding: CTRL+/

Comment region
Keybinding: none
Command: M-x comment-region

Shift Right (or Left)
Keybinding: TAB (SHIFT+BACKSPACE)

Shift Region Right (or Left)
Keybinding: C-c > (C-c <)
Command: ???

Note: This doesn't work if you're in CUA mode (i.e. using C-x/C-c/C-v Cut and Paste)

Find text in Workspace
Keybinding: CTRL+ALT+G
Command: Find Text in Workspace

grep (and variants)
Command: M-x lgrep RET string RET filepattern RET directory RET.

See also 32.4 Searching with Grep under Emacs

I still miss this one in Eclipse. grep has more power than Eclipse, but the combination of pretty highlighting and searching across files is nice in Eclipse. I have created an Elisp function to at least grep for selected text with one key stroke. Put the following in your .emacs and you'll get something similar to CTRL+ALT+G in Eclipse.
;; my eclipse CTRL+ALT+G replacement
(defun grep-selected (start end)
  (interactive "r") 
  (grep (concat "grep -nH -e " 
                (buffer-substring start end)
                " * .*"))
(global-set-key "\C-\M-g" 'grep-selected)
I am just learning to customize emacs with Elisp so I'm sure there are improvements that can be made.

[Read the full post...]

My software tools list



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/08/current-configuration/

You should be redirected in 2 seconds.



Below is a table of my current software configuration. If you notice a lot of "I switched from ..." statements, keep in mind that I am a programmer who likes shiny things.

Category Currently using Comments
Operating System Ubuntu 8.04, Windows XP, Windows Vista Work Desktop: Ubuntu Hardy via coLinux on Windows XP and Cygwin when needed.
Home Laptop: dual-boot Windows Vista with Cygwin and Ubuntu Hardy
Home Desktop: Ubuntu Hardy

I am in the process of migrating from Windows to Linux. My first Ubuntu install was in 2007 (dual-boot) and I got my first Windows-free machine in 2008. Currently I am using Cygwin and coLinux when on Windows. Cygwin integrates better with Windows applications, but coLinux is super fast and allows you to run a full Linux distro on top of Windows. Windows does have some advantages, but overall I prefer Linux.

I don't have enough experience with OSX to draw any authoritative conclusions, though I think Mark Pilgrim has biased me against Apple. Also, I think Linux's free as in beer (and somewhat related free as in speech) characteristics vs. Mac's expensive (and somewhat related proprietary) characteristics resonate with the cheap engineer in me.

Additional Linux vs. Mac commentary from some A-list geeks:
Window Manager wmii Dynamic, tiling, scriptable window manager that doesn't require a mouse. It sucks less.

I switched from ratpoison at the same time I started using coLinux because running native Linux allowed me to use any Linux window manager as well.

Recently, some have switched from wmii to xmonad, the new Haskell tiling window manager. It has some nice features over wmii, including dual head support, but after a brief excursion, I slightly prefer wmii's way of doing things.

If you're a hard core Lisper, stumpwm is the window manager for you. It has a REPL. This one seems a little too hard core for me, especially since I don't know Lisp (yet).

Other options: ion, dwm, awesomewm

Editor/IDE GNU Emacs Switched from Eclipse in 2007. It was a slow transition, but worth it. I think Emacs is definitely worth the investment if you do a lot of coding.

Terminal urxvt +
screen
urxvt supports xft (anti-aliased) fonts, real transparency (not that I actually use transparency with wmii), and fading (which I do use with wmii) and it is much lighter than gnome-terminal or konsole. screen allows me to switch terminal sessions without ugly tabs, attach to remote sessions, search through the scrollback buffer, and more.

Version Control System Mercurial Switched from Subversion in June 2007. The merging in Mercurial is very nice and can be done without thinking. I do miss Subversion/Subclipse's revision history viewer, file compare, and ability to isolate files apart from changesets.

Compiled Language C Wouldn't mind learning C++. Although, Linus doesn't like it.

Dynamic Language Python 2.5 My love for python is strong. I switched from Perl in 2005 and have no regrets. Object-oriented, easy to read (no more TIMTOWTDI), and smart people use it. I also want to learn Javascript 2 becuase it is the "Next Big Language" and Lisp because it is the "most powerful language".

On Python vs. Ruby: from what I've read, I characterize Ruby as the more expressive language more similar to Perl (than Python is) and Python as the more regimented language. Since I like regimented, I like Python.

On Python vs. Lisp: I've concluded that I lack the intelligence to harness enough of Lisp's power to counteract its non-practicality (e.g. lack of libraries).

Some other links:
Paul Graham: Python is getting closer to Lisp (2002)
Paul Prescod: no it isn't

Web Framework Django I haven't tried much else, but Django is pretty cool.

Here are some links:
Ian Bicking: There's so much more than Rails (2005), What PHP deployment gets right (2008)

Web Browser Conkeror Not to be confused with Konqueror, Conkeror is an emacs-like, keyboard driven, scriptable, Mozilla-based web browser. I've used it almost full time since January 2008. It is still considered alpha stage software so there are a number of bugs. However, it is still pretty sweet. I use Firefox as a backup (and IE Tab for Launchcast and Netflix on Windows). Unfortunately, one of the annoying things in Firefox 2 is present in Conkeror as well-- memory leaks. Based on this Mozilla article and some brief personal experience, Firefox 3 has made fixes in this area. It would be nice if Conkeror could benefit from the Firefox 3 fixes.

Email/PIM Undecided Thunderbird?, Evolution?, Mutt?, Gnus?, Alpine?, Gmail?, Claws Mail?,

I currently use Microsoft Outlook with an Exchange Server at work. Evolution supports Exchange Server through Outlook Web Access (OWA), but I couldn't get it to work for me. Thunderbird (and I assume others) support Exchange through IMAP, but this is only available at work by special request.

Links:
Adam Gomaa chooses Claws Mail over Thunderbird, Evolution, Mutt, and Gnus (2007)

PDF Viewer KPDF Preferred over Gnome's Evince
Screen Capture KSnapshot Courtesy of Mark Pilgrim's essentials list
Graphical diff/merge KDiff3 I started using KDiff a while ago on Windows and have always liked it. I'm thinking, though, since I'm an Emacs person, I ought to use Ediff.
Updated 7/2/2008
[Read the full post...]

7 Eclipse Killer Features; 5 Eclipse Annoyances



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/07/7-eclipse-killer-features-5-eclipse/

You should be redirected in 2 seconds.



Here are my pros and cons after using Eclipse for about a year. I've been using mostly 3.2 and recently updated to version 3.3. For the most part it is great. There are some annoyances that hopefully can be fixed. Maybe I need to learn Java and start working on the code. I've also thought about switching to Emacs. I used Emacs for a short time on a Solaris box and liked it a lot. I can't seem to make the switch now, though, because a.) it's not pretty enough, and b.) I don't want to take the time to learn it again.

Eclipse Killer Features:

  • Search across entire workspace for selected text with CTRL+ALT+G. It's the fastest interface I've used for selected text, it organizes the search results, highlights all items, and shows pretty markers in the margin. (see below.)
  • Pretty markers to show search items, compile errors/warnings, modified text, bookmarks, etc.
  • Code completion with CTRL+SPACE. It is pretty.
  • Automatic variable renaming with ALT+SHIFT+R. It's faster and more reliable than search and replace.
  • Good keyboard support. "Quick Access" is a very nice addition in Eclipse 3.3. Hit CTRL+3 and then type the name of any Eclipse command. (See Quick Access (Ctrl+3) is bliss! for more info.) To open a file, hit CTRL+SHIFT+R and type in the name of the file. The dialog provides filename completion. Fast.
  • Good integration with SVN using Subclipse: allows me to compare revisions, view the repository history, open an old revision next to my working copy, and take a glance at pretty file icons to tell me the state of files. (This no longer applies since I switched to Mercurial.)
  • Put views almost anywhere you want (docked, detached, fast view). Switch between editors with CTRL+F6, switch between views with CTRL+F7, and switch between perspectives with CTRL+F7.

Eclipse Annoyances:

  • Can't open a file from the command line.
  • It is slow. In this article, Stevey Yegge even wrote a Eclipse haiku about it:

    startApplication()
    thenWaitFriggingForever()
    thenItGoesRealSlow()

    It's a great article, btw.
  • All the extra decorations take up a lot of screen real estate. (Can't completely customize everything. E.g. can't get rid of the scroll bars.)
  • No macros. (This is what Emacs is all about.)
  • No (good) Mercurial plugin.

Eclipse vs. Emacs conclusion: Sticking with Eclipse for now because it is prettier (and because I know how to use it.)
[Read the full post...]

Eclipse plug-in update sites



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/07/eclipse-plug-in-update-sites/

You should be redirected in 2 seconds.



Europa: http://download.eclipse.org/releases/europa/
Pydev: http://pydev.sourceforge.net/updates/
Anyedit: http://andrei.gmxhome.de/eclipse/
Columns: http://columns4eclipse.sourceforge.net/updates
Subclipse: http://subclipse.tigris.org/update_1.2.x

[Read the full post...]

Eclipse 3.3 cannot open a file from the command line



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/07/eclipse-33-cannot-open-file-from/

You should be redirected in 2 seconds.



I want to type "eclipse myfile" from the command line and have eclipse open myfile. As of version 3.3, Eclipse can't do this. See this post on the eclipse mailing list and bug report 60289.
 
I like Eclipse a lot, but am considering using emacs. It would be nice if there were a fast, keyboard driven editor/IDE with *functional* graphical decorations. Graphical icons are useful, but it shouldn't mean that the application is slow and requires a mouse.
 
sidenote: ratpoison with Cgywin/X, screen, rxvt, and bash are working great.

UPDATE 7/23/07: Padclipse is a lightweight editor based on Eclipse that allows you to open a file from the command line. You can add plug-ins to Padclipse like Eclipse, however, I could not get all of the Eclipse functionality to work.

[Read the full post...]

How to get code completion for PyQt using Pydev



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/06/how-to-get-code-completion-for-pyqt/

You should be redirected in 2 seconds.



Because PyQt doesn't come with the .py source files which Pydev needs for code completion, you need to add the PyQt modules as a "forced builtin lib". See the following FAQs at the pydev website: http://pydev.sourceforge.net/faq.html#ref_22 and http://pydev.sourceforge.net/faq.html#ref_15
 
Here are the steps:
  1. Go to "Window" -> "Preferences..." -> "Pydev" -> "Interpreter - Python"
  2. In the "Forced builtin libs" section, click "New..."
  3. Type in "PyQt4" and click "OK".
  4. Click "OK" to close the Preferences window.
Note: If you installed PyQt after installing Pydev, you will probably have to update the PYTHONPATH with the path to the PyQt libraries. You can do this easily by "Remove"ing the python interpreter and then re-adding it in again. (For reference, I am using Eclipse 3.2.2, Pydev 1.3.4, Python 2.5.1, and PyQt 4.2.3)

[Read the full post...]

"Pydev code completion: rebuilding modules" error



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/06/pydev-code-completion-rebuilding/

You should be redirected in 2 seconds.



This error took me a while to find a solution. I got the following error message when I tried to change the python interpreter in pydev: "An internal error occurred during: "Pydev code completion: rebuilding modules"". I was using Eclipse 3.3 RC4, Python 2.5.1, and had just updated to Pydev 1.3.4. I thought maybe there were incompatabilities between the versions so I tried many different combinations of versions going back to Eclipse 3.2 and Python 2.4. I even tried changing the JVM to the BEA JRockit version after the Pydev author mentioned it regarding another problem. (I may still go back to this because it is supposed to be faster.) Then I checked if my other plugins were causing a problem. I finally discovered that I won't get this error if I close my Pydev project. I'm not sure if this a Pydev bug or not.

[Read the full post...]

How to remove trailing whitespace in Eclipse



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/04/how-to-remove-trailing-whitespace-in/

You should be redirected in 2 seconds.



Actually, Eclipse has functionality to remove trailing whitespace, but
for some reason they don't expose it by default.

If you go to the key bindings, select modify and select File for the
category you will see that there is a Remove trailing whitespace that
can be bound to a key.

I don't see any way to actually add that to the menus.

To do it automatically check out the AnyEdit plugin:
http://andrei.gmxhome.de/anyedit/
I installed the AnyEdit plugin and it works great.

[Read the full post...]

How to create a split window in Eclipse



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/04/how-to-create-split-window-in-eclipse/

You should be redirected in 2 seconds.



Open the file. Go to the "Window" menu and select "New Editor". Drag the new editor wherever you like.
 

[Read the full post...]

How to show diffs with Subclipse



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/04/how-to-show-diffs-with-subclipse/

You should be redirected in 2 seconds.



I want to show revision history diffs in SVN/Subclipse/Eclipse. I looked in the "History" view, but this is not where to find it. Instead, right-click on your file in the "Navigator" view, select "Compare With" > "Revision...". Then double-click on a revision to compare to. The example screenshot is from Mark's blog.
[Read the full post...]

How to setup a subclipse project to branch/tag



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/03/how-to-setup-subclipse-project-to/

You should be redirected in 2 seconds.



I've read that branching/tagging is one of the nice features of SVN (See Mark Phippard's blog and the subversion book). However, it took me a little while to figure out how to setup my directory structure with the recommended "trunk", "branches", and "tags" folders. These are my basic step-by-step notes for how I setup my Subclipse project and then created a branch. This assumes you've already installed Subclipse and set up a repository. If you have not done that, see How to install Subversion (SVN) with Eclipse on Windows.
  1. Add your Eclipse project to the repository in a "trunk" folder
    • Start with an Eclipse project named "myproject"
    • In the "Navigator" window, right-click on your project, select "Team" > "Share Project..."
    • Select "SVN" and click "Next"
    • Select your repository. (This tutorial assumes it is located at "svn://localhost".) Click "Next".
    • In the "Enter Folder Name" dialog, select the "Use specified folder name" option and enter "myproject/trunk". The "URL:" box should show something like "svn://localhost/myproject/trunk". Click "Next".
    • Click "Finish". A new dialog will open. Select the files to commit, enter a comment, and click "OK". I got the following output in the "Console" window:
          Filesystem has no item
      svn: URL 'svn://localhost/myproject/trunk' non-existent in that revision
      
          Bad URL passed to RA layer
      svn: URL 'svn://localhost/myproject' non-existent in revision '234'
      
      mkdir -m "Initial import." svn://localhost/myproject
      mkdir -m "Initial import." svn://localhost/myproject/trunk
      checkout -N -r HEAD svn://localhost/myproject/trunk
          Checked out revision 236.
      add -N C:\path\to\myproject\.settings
          A         C:/path/to/myproject/.settings
      add -N C:\path\to\myproject\.settings\org.eclipse.cdt.core.prefs
          A         C:/path/to/myproject/.settings/org.eclipse.cdt.core.prefs
      add -N C:\path\to\myproject\.cdtbuild
          A         C:/path/to/myproject/.cdtbuild
      add -N C:\path\to\myproject\.settings\org.eclipse.cdt.managedbuilder.core.prefs
          A
      C:/path/to/myproject/.settings/org.eclipse.cdt.managedbuilder.core.prefs
      add -N C:\path\to\myproject\.cdtproject
          A         C:/path/to/myproject/.cdtproject
      add -N C:\path\to\myproject\.project
          A         C:/path/to/myproject/.project
      commit -m "Initial import." C:/path/to/myproject/.cdtbuild C:/path/to/myproject/.cdtproject C:/path/to/myproject/.project C:/path/to/myproject/.settings C:/path/to/myproject/.settings/org.eclipse.cdt.core.prefs C:/path/to/myproject/.settings/org.eclipse.cdt.managedbuilder.core.prefs
          Adding         path/to/myproject/.cdtbuild
          Adding         path/to/myproject/.cdtproject
          Adding         path/to/myproject/.project
          Adding         path/to/myproject/.settings
          Adding         path/to/myproject/.settings/org.eclipse.cdt.core.prefs
          Adding         path/to/myproject/.settings/org.eclipse.cdt.managedbuilder.core.prefs
          Transmitting file data ...
          Committed revision 237.

  2. Create "branches" and "tags" folders in the repository
    • Switch to the "SVN Repository Exploring" perspective. (From the "Window" menu, select "Open Perspective" > "Other...". Select "SVN Repository Exploring" and click "OK".)
    • In the "SVN Repository" window, expand the tree, and right-click on "myproject", select "New" > "New remote folder".
    • In the "Create a new remote folder" dialog, expand the tree and select "myproject". For "Folder name:", enter "branches". Click "Next".
    • Enter a comment and click "Finish".
    • Expanding the "myproject" folder now shows the "branches" and "trunk" subfolders.
    • I got the following output in the "Console" window:
      mkdir -m "Created branches folder." svn://localhost/myproject/branches
    • Repeat these steps to create a "tags" folder.

  3. Create a branch
    • Switch back to the previous perspective.
    • Commit any changes you want in the branch.
    • In the "Navigator" window, right-click your project and select "Team" > "Update"
    • Right-click your project and select "Team" > "Branch/Tag..."
    • In the "Copy (Branch/Tag) dialog, in the "To URL:" textbox, enter "svn://localhost/myproject/branches/mybranch". (The "From WC at URL:" box should read "svn://localhost/myproject/trunk".)
    • Leave the "HEAD revision in the repository" option selected, enter a comment, and click "OK".
    • I got the following output in the "Console" window:
      copy -rHEAD svn://localhost/myproject/trunk svn://localhost/myproject/branches/mybranch
  4. Switch your working copy to the branch
    • You can now switch your working copy between the trunk and the branch.
    • Right-click your project and select "Team" > "Switch to another Branch/Tag..."
    • In the "To URL:" textbox, enter "svn://localhost/myproject/branches/mybranch". Click "OK".
    • I got the following output in the "Console" window:
      switch svn://localhost/myproject/branches/mybranch C:/path/to/myproject -rHEAD
          At revision 239.
  5. You should now be able use the features discussed in Enhanced Support for Branches and Tags in Subclipse
Branching steps were taken from How to branch with Subclipse.

[Read the full post...]

How to do a global search/replace across files in Eclipse 3.2



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/03/how-to-do-global-searchreplace-across/

You should be redirected in 2 seconds.



The location of this command is not very intuitive. To search and replace in multiple files you need to select "Search" > "File...".

Step by step:
  1. Select the text in a file
  2. From the "Search" menu, select "File...". This will bring up the "Search" dialog box.
  3. At the bottom of the dialog, click "Replace..."
  4. This will bring up the "Replace" dialog box where you can type in your replacement text and replace individual occurrences or all occurrences.

[Read the full post...]

How to quickly switch between multiple files in the Eclipse editor



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/03/how-to-quickly-switch-between-multiple/

You should be redirected in 2 seconds.



If you have multiple files open in your Eclipse editor, you can quickly switch between them by pressing CTRL+E. This brings up a list of all your open files. Type in the beginning of the filename and press ENTER to switch to that file.

[Read the full post...]

How to install Subversion (SVN) with Eclipse on Windows



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/03/how-to-install-subversion-svn-with/

You should be redirected in 2 seconds.



Subversion looks to be the new version control system of choice in the open source community, supplanting CVS which supplanted RCS. This article, Why Subversion Over CVS, gives some reasons to choose Subversion over CVS. Many people also choose subversion over commercial products such as ClearCase and Visual Source Safe. The authors of "Windows Developer Power Tools" (O'Reilly 2006) write:

Subversion is our favorite version-control system, and we definitely recommend it above all others (including commercial products) in most scenarios. There may be certain areas where commercial systems excel, but for overall version control, it's tough to beat Subversion.

Step by step instructions
Here are my notes for installing Subversion, TortoiseSVN (a Subversion client which integrates with Windows Explorer), and Subclipse (the plugin for Eclipse integration) on Windows. This assumes you already have Eclipse installed. Also, these notes are geared towards version control for individual use as opposed to team use.
  1. Install Subversion and TortoiseSVN using SVN 1-Click Setup
    • Go to http://svn1clicksetup.tigris.org/, click "Download the latest version", run the installer, and accept all the defaults.
    • This is a Windows installer used "to simplify the process of setting up a Subversion repository on a Windows-based computer. Svn1ClickSetup takes a user through the steps necessary to install the Subversion command-line utilities and TortoiseSVN, as well as creating a repository and initial project." --from svn1clicksetup.tigris.org
    • To check that something went right, go to Windows Explorer and right-click on a file. You should see the "TortoiseSVN" context menu item.

  2. Install the Subclipse plugin using the instructions at http://subclipse.tigris.org/install.html.

  3. Define the SVN Repository
    • In Eclipse, from the "Window" menu, select "Open Perspective" > "Other...". Select "SVN Repository Exploring" and click "OK".
    • Inside the "SVN Repository" window, right-click in the big empty space, and select "New" > "Repository Location...".
    • In the "Url:" box, type "svn://localhost". Click "Finish". (Use this url to connect to the repository hosted on the SVN server on your local machine created using svn1clicksetup. I got this tip from http://james.cooley.ie/2006/12/01/version_control_with_eclipse_on_windows.html. If you want to use a repository on another server, then point to that location instead. "file://, http://, or https:// are the other protocols that can be used.)

  4. Add an Eclipse project to the repository
    • In the "Navigator" window, right-click on a project and select "Team" > "Share Project...".
    • Select "SVN" and click "Next"
    • Your repository, "svn://localhost", (which you added in step 3) should show up here. Click "Next".
    • Click "Next" again. Click "Finish". I got the following output in the "Console" window:
          Filesystem has no item
      svn: URL 'svn://localhost/my_project' non-existent in that revision
      
      mkdir -m "Initial import." svn://localhost/my_project
      checkout -N -r HEAD svn://localhost/my_project
          Checked out revision 5.
    • Select the files you want to add and click "OK". I got the following output in the "Console" window:
      add -N C:\path\to\my_project\test.py
          A         C:/path/to/my_project/test.py
      commit -m "Initial import." C:/path/to/my_project/test.py
          Adding         path/to/my_project/test.py
          Transmitting file data ...
          Committed revision 6.
    • See this article for more information: How to use Subversion with Eclipse

  5. Modify and commit a file
    • Edit one of the newly added files and save it.
    • In the "Navigator" window, right-click on the file, and select "Team" > "Commit...".
    • Enter a comment and click "OK". I got the following output in the "Console" window:
      commit -m "test" C:/path/to/my_project/test.py
          Sending        path/to/my_project/test.py
          Transmitting file data ...
          Committed revision 7.
      
  6. Show the history for a file
    • In the "Navigator" window, right-click on the file, and select "Team" > "Show History".
    • The "History" window should open showing the revisions of your file. Double-click on a revision to open it or right-click for other options.

Related posts:

Other resources

[Read the full post...]

How to hide .o files from the "C/C++ Projects" view in Eclipse 3.2 / CDT 3.1



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/how-to-hide-o-files-from-cc-projects/

You should be redirected in 2 seconds.



I got this tip from http://www.aspectprogrammer.org/blogs/adrian/2006/02/tips_for_using.html
  1. From the "C/C++ Projects" window, click the down arrow in the top right corner, and select "Filters..."
  2. Check the "Name filter patterns (matching names will be hidden):" checkbox and type "*.o" into the textbox. Click "OK".
  3. Now your .o files are hidden from view.

[Read the full post...]

How to use the mingw gdb debugger with Eclipse 3.2 / CDT 3.1



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/how-to-use-mingw-gdb-debugger-with/

You should be redirected in 2 seconds.



How to use the mingw gdb debugger with Eclipse 3.2 / CDT 3.1
  1. Go to http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=20507, download gdb-5.2.1-1.exe, and run it to install.
  2. Create a C Project and build it.
  3. From the "Run" menu, select "Debug..."
  4. Click on "C/C++ Local Application", then click the 'New' button (it is a button with a plus sign in the top left corner).
  5. Click the "Search Project..." button and select your executable.
  6. Click on the "Environment" tab, and click "New..."
  7. In the "Name:" field, enter "Path". In the "Value:" field, enter "c:\mingw\bin". Click "OK".
  8. Click the "Debugger" tab. From the "Debugger:" dropdown box, select "gdb Debugger".
  9. Click "Debug". Your gdb debugger session should now begin.
  10. If you get a "Confirm Perspective Switch" dialog, click on "Yes" to switch to the Debug perspective.
  11. You can now use the buttons in your "Debug" window to step through your code.
See also my post, How to setup the MinGW gcc tools for your Managed Make C Project in CDT 3.1 and Eclipse 3.2

Technorati tags:
[Read the full post...]

Eclipse 3.2 editor does not have word wrap



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/eclipse-32-editor-does-not-have-word/

You should be redirected in 2 seconds.



The Eclipse editor as of 3.2 does not have word wrap. See this article and this Eclipse bug report 35779. However, there is a plugin (which I have not tried)-- go to http://ahtik.com/blog/eclipse-word-wrap/.


[Read the full post...]

How to select/cut/paste a column in Eclipse



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/how-to-selectcutpaste-column-in-eclipse/

You should be redirected in 2 seconds.



Many popular text editors such as UltraEdit, SlickEdit, NEdit, etc., support text manipulation of columns such as selecting a column and cut/copy/paste operations on a column. As of version 3.2, Eclipse does not support these column based editing capabilities. (See this eclipse bug report) From the bug report, it looks like a patch was created on 1/29/2007 and this feature may be implemented in Eclipse version 3.3.

However, there is a plugin called Columns for Eclipse, which implements this functionality. I installed it, and it seems to work well. Note, this plugin didn't work with Java version 1.4.2. If you use this version, the icons and menu will install nicely, but you will get the error message: "The chosen operation is not currently available" when trying to use a feature. I installed Java 1.5 from http://www.java.com/en/download/manual.jsp and everything worked great after that.

Technorati tags:
 

[Read the full post...]

How to use Tornado GNU tools with Eclipse/CDT



This is my OLD blog. I've copied this post over to my NEW blog at:

http://www.saltycrane.com/blog/2007/02/how-to-use-tornado-gnu-tools-with/

You should be redirected in 2 seconds.



Configuration: VxWorks 5.5, Tornado 2.2, GNU toolchain, simulator target, Eclipse 3.2, CDT 3.1, Windows XP.

I've finally figured out how to use the Tornado GNU tools inside Eclipse/CDT as a Standard Make project. I believe the key was setting up the environment variables correctly. (I used the method in this previous post to determine the Tornado environment.) This approach still uses the Tornado project (.wpj) file and TCL scripts, so you need to start with an existing Tornado project. You will then copy the Tornado files into your Eclipse directory. This still beats editing in Eclipse and building in Tornado. Now I am able to edit and build in Eclipse. Note: this will work with both a downloadable or a bootable project.

Update 3/20/07: I now can start a Vxworks simulator, target server, and shell as an external tool in Eclipse. I've added those steps at the end of this guide.

Steps for building your project in Eclipse

  1. Assume your Tornado project directory is C:\sofeng\proj\Project0
  2. Open eclipse.exe and open the C/C++ perspective
  3. From the "File" menu, select "New" -> "Standard Make C Project"
  4. Enter the project name and the workspace location; click "Next" NOTE: Make sure these paths do not contain spaces. (e.g. "Documents and Settings")
  5. Click the "Make Builder" tab.
    • Uncheck "Use default" checkbox. In the "Build command:" textbox, enter "make"
    • Check the "Build on resource save (Auto Build)" checkbox. Delete the text "all" in the textbox. Delete the text "all" from the next textbox also.
  6. Click the "Environment" tab
    • Set the following environment variables using the "New..." button:
      • Path = C:\Tornado2.2\host\x86-win32\bin;
      • SHELL = C:\WINDOWS\system32\cmd.exe
      • TCL_LIBRARY = C:\Tornado2.2\host\resource\tcl
      • WIND_BASE = C:\Tornado2.2
      • WIND_HOST_TYPE = x86-win32
    • Select the "Append environment to native environment" option.
  7. Click the "Discovery Options" tab. Uncheck the "Automate discovery of paths and symbols" checkbox.
  8. Click "Finish"
  9. In the "C/C++ Projects" Window, right-click on your project and select "Import..."
  10. Under "General", select "File System". Click "Next"
  11. In the "From directory:" box, enter "C:\sofeng\proj\Project0"
  12. Select all the files including "Makefile" and "Project0.wpj". You do not need to select "SIMNTgnu"
  13. Select the "Create selected folders only" option
  14. Click "Finish"
  15. Your project should start building

Steps for using the Vxworks simulator and shell in Eclipse

These steps explain how to setup an "External Tool" in Eclipse to run a unix shell script. The shell script will run the commands to start the vxworks simulator, start the target server, and run the shell. Luckily you don't need any unix tools because the Tornado distribution already includes it. With this addition, now you can build your vxworks project with the method above and now start a vxworks simulator to download and run your project.
  1. Create a new text file and enter the following text. The ampersand's makes the process run in the background allowing the tools to run simultaneously. (Note the use of forward slashes is significant.)
    c:/Tornado2.2/target/config/simpc/vxworks &
    c:/tornado2.2/host/x86-win32/bin/tgtsvr -V -B wdbpipe -R c:/temp \
    -RW -c c:/Tornado2.2/target/config/simpc/vxWorks.exe vxsim &
    C:/Tornado2.2/host/x86-win32/bin/windsh.exe -q vxsim
    Save the file as "c:\sofeng\vxsim.sh".
  2. In Eclipse, from the "Run" menu, select "External Tools" > "External Tools..."
  3. Click on "Program", then press the 'New' button. (It is the button in the top left with a plus sign.)
  4. In the "Name:" field, type "vxsim_tool"
  5. In the "Location:" field, enter "c:\tornado2.2\host\x86-win32\bin\sh.exe"
  6. In the "Working Directory:" field, type whatever you want your working directory to be, e.g. "c:\"
  7. In the "Arguments:" box, enter "c:\sofeng\vxsim.sh"
  8. Click on the "Common" tab. Inside the "Display in favorites menu" box, check the "ExternalTools" checkbox. Also, make sure the "Allocate Console (necessary for input)" checkbox is checked.
  9. Click "Apply" and "Close".
  10. Now to run it, go to the "Run" menu > "External Tools" > "vxsim_tool". (Or use the "External Tools" button on the toolbar.)
  11. Your simulator should now start, the target server icon should appear in the system tray, and the Shell should appear as a "Console" window in Eclipse.
  12. To download your application, see How to download a Vxworks application from the command line
Related posts:
How to run the VxWorks Simulator from the command line
Tornado Tools Command Line Summary
Technorati tags: , ,
[Read the full post...]

About

This is my *OLD* blog. I've copied all of my posts and comments over to my NEW blog at:

http://www.saltycrane.com/blog/.

Please go there for my updated posts. I will leave this blog up for a short time, but eventually plan to delete it. Thanks for reading.