a git commit can have 2 parents and multiple descendants

Multiple descendant — very common…. branching scenario

2 parents — also common …. merging in a branch

Advertisements

list all(and only)commit hashes from branching point to a descendant commit

Background — Suppose you made 3 commits on your feature branch name “parix”, but meanwhile, someone added 4 commits in master branch. Therefore there is now a divergence in the commit history graph.

Often times you need to visualize the divergence. You need to exactly what 3 commits are on your branch after the common ancestor.

git log master..pairx # listing the 3 additional commits in pairx branch, right after the common ancestor i.e. the branching point

git log pairx..master # to show those 4 commits.

simple Windows c++ (python)set-up #Eclipse is better4java

See also easiest windows GCC installer #c++17

GitBash + StrawberryPerl is the best combo for me on Windows. I put g++ commands in bash scripts to automate my GCC build and test. Note my typical project has at most 20 source files.

GitBash + StrawberryPerl + Notepad++ is better for me than any c++ IDE like Eclipse CDT (4 installations), Bloodshed (4), CodeBlocks (1), NetBeans…

  • I don’t need code completion..
  • I don’t need jump into a type definition.
  • I don’t need my debugger to be visual. StrawberryPerl includes gdb
  • I use Notepad++ for text search across hundreds of files
  • I use Notepad++ for search/replace
  • I use diff and git-diff to see code changes
  • I used github for version history

I’m such a die-hard fan of command line that the only GUI development tool I use is notepad++ and it’s optional. Since 2015, my Linux c++ code editor has been VIM, which I used on large codebases consisting of 1000+ source files.

For about 2 years EclipseCDT was my default choice, then the simpler Bloodshed became my default choice as it is simpler than EclipseCDT. However they are still over-complicated. I didn’t have a favorite until 2017, when I discovered Notepad++/GitBash/StrawberryPerl

Q: why do I use Eclipse for Java but not for c++?
A: Eclipse is more problematic, more messy for c++ than for java. The benefits (convenience, automation..) is offset by the high TCO (total cost of ownership). For example, java debugger, java code navigation, java renaming/refactor all work better than c++.

Q: how about MS VisualStudio?
A: I managed a large c++ codebase on MSVS 2015 in 2015-2016, about a year+. Too complicated, worse than MSVS for c#. I would never prefer it over my command line set-up, if given a choice.

By the way, GitBash works well with a standard python installation, but I do recommend the tweak at https://stackoverflow.com/questions/32597209/python-not-working-in-the-command-line-of-git-bash

easiest MSWindows GCC installer #c++17

http://strawberryperl.com is an easy installer for Perl and it bundles GCC. I was able to compile in c++17 mode:

g++ -std=c++17 my.cpp

My experiences with cygwin and mingw were both horrible.

  1. cygwin — too bulky and unnecessary, and affected my existing Windows features. I tried sygwin once many years ago and quickly concluded that it was designed for people unlike me. Those people would have only positive experiences about cygwin that I don’t share.
  2. mingw — supposed to be minimalist, but I tried installing it at least 3 (up to 6) times and always painful.

In contrast, I installed strawberry about 3 times and once on a friend’s laptop … always quick and easy. No tweaking required. GCC works out of the box.

Through almost 10 installations of GCC on various windows laptops, I have come to the obvious conclusion.

git-stash survival guide

Two simple steps:

git stash #no args

# Now git diff will no longer show the uncommitted changes:) …later

git stash pop

# Now git diff shows the original uncommitted changes

If git-stash-pop hits conflict on 1 file out of 3

  • the one file content will show >>>>. I will leave it alone for now
  • the other 2 files would show the original uncommitted changes. git-diff-HEAD would show these changes.
  • now I can use git-reset-HEAD and git-diff

ways to create feature branch

A few ways to create new feature branch

If you want the branch to show up in Stash, then it is probably simpler to create it on Stash website (choose the correct parent branch …). After that

git fetch # no arg after "fetch"... will show the new branch downloaded to local repository as "remote branch"
git branch -a # list all (local and remote) branches
git checkout feature/new_br_from_stash # creates a matching local branch

Using command line without Stash

git branch feature/my_br # creates a brand-newbranch named feature/my_br, in the local repo only.
git branch # lists all available branches in local repo
git checkout feature/my_br # selects my_br as the default branch.
git branch -m feature/my_BR # renames the default branch to feature/my_BR, in the local repo only.
git push origin feature/my_BR # creates and copies branch to Stash, assuming branch doesn't exist there.

(Note Git branches are designed to be disposable. So in theory you could create a branch for a small change and then merge and throw it away. No best practice no recommendatation yet.)

All feature branches, including temporary throw-away branches, can be deleted from Stash.

git | fork auto-sync

https://confluence.atlassian.com/bitbucketserver/keeping-forks-synchronized-776639961.html says

Fork syncing helps you to keep your fork in Bitbucket Server up-to-date with changes in the upstream repository. Bitbucket Server can do this automatically for all branches (and tags) you haven’t modified in the fork.

I guess forking (and pull request) is not a feature of GIT per se but a feature of Bitbucket and GitHUB server. I think the server get notified upon a new commit and runs fast-forward git pull.

git | rebasing: basics

For me, rebase is the procedure to re-sequence commits… A simple form of history rewrite.

git pull --rebase # moves your local commits to the end of the linked list
How do I merge multiple Work-In-Progress commits into a single commit?

The following will take the last five commits and give you an interactive session that allows you to (optionally) merge them.

git rebase -i HEAD~4

More details are here http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

git | reverting a file: various ways

I didn’t like git-revert as it complicates history. See https://www.atlassian.com/git/tutorials/undoing-changes/git-revert

How do I revert a file to remove bad commits?

git checkout HEAD -- <file or directory>

This use of git-checkout is unrelated (as far as I know) to the commit-level checkout. This solution is officially /sanctioned/ … Some git commands would suggest …

(use "git checkout -- <file>..." to discard changes in working directory)

How to Revert non-commited changes

git reset --hard HEAD  # reverts tracked files back to the head
git clean -fxd .   # deletes untracked files in current dir. You may want to cd to the repository base first

[Victor] My vote for best explanation of git-reset goes to https://git-scm.com/blog/2011/07/11/reset.html. Detailed, but more readable than the manual. Many examples are useful to me.

Warning — if you want to temporarily play with an older version of file1.java, then be careful. Make sure you save the current tip of your branch. If you git-reset–hard then you may lose that tip!

How to Revert branches back to origin

git fetch origin
git reset --hard origin/yourBranch

git-cherry-pick commits to push to main branch

How to Cherry-Pick Commits to Push to main ‘develop’ branch

Say you are working on a feature branch with other people, with you all making commits and pushing to the remote replica of this branch. At some point you will want your commits merged with develop/production. Git does provide a method of choosing which commits you would like to push. The easiest way to explain this is with an example. We assume that all the following commands are run in a command line tool.

git checkout feature/commodity
git log -3 --pretty=oneline #look at the 3 most recent commits to the repository (includes all commits to all branches - in a nicely displayed format)
$ git log -3

Looking at this log, I want to push only the latest change to ‘develop’ branch (via a pull request), the commit associated with the e5a67d7088622dd8821dfdd8e2fafa2dc938b75c hash number. Keeping a record of this hash number I then create a new feature branch from ‘develop’ branch in Stash. Assume this new branch is called feature/cherry_pick

git fetch #update local repo to get this new branch info
git checkout feature/cherry_pick #switch to this new branch, at the moment is exactly the same as origin/develop
git cherry-pick e5a67d7088622dd8821dfdd8e2fafa2dc938b75c #where the hash number is the commit I actually want to merge into 'develop'
git commit #commit this change to the local feature/cherry_pick 
git push #push this change to the remote feature/cherry_pick branch

You can now create a pull request in Stash to merge this cherry-picked commit into ‘develop’

git | diff tools #BeyondCompare,Stash..

Git – diff tools (BeyondCompare, Stash …)

–Method: git diff

This is a basic but versatile tool. It looks at two commits you provide. Note each tag represents a commit. Each branch name also represents the commit at the tip of the branch.

–Method: Stash/bitbucket comparison between branches/tags

Stash supports a directional PR diff, distinct from the git-diff command. Based on the pull-request concept, Stash treats your two commits as a FROM and a TO and shows the sequence of commits between them, as if in a pull-request.
If you click the arrow to reverse the direction, then Stash will always show a different diff result!
  • If from A to B there’s a fast forward merge, then Stash PR diff from B to A would show zero commit, since such a pull request would be empty.
  • If between A and B there’s no fast-forward merge, this PR-diff would show fewer commits than git-diff.
In summary, PR-diff is directional; git-diff is directionless. This directional diff feature is kind of unique to Stash and therefore valuable.

–Method: have two local repos (clones) to check out different branches

Figure out how to clone two physical repos. After that you could use many conventional diff tools.

–Method: git diff using Beyond Compare 3

http://www.scootersoftware.com/support.php?zz=kb_vcs#gitwindows worked for me, including a 3-way merge GUI —

git mergetool feature/my_br6 origin/feature/my_br6 -- buildChoops.sh

–Method: git diff using Winmerge

see http://stackoverflow.com/questions/1881594/use-winmerge-inside-of-git-to-file-diff, updated June 2015

I hope there are similar solutions for other diff GUI tools.

–Method: download remote version as complete file, then diff that against local file

Here’s my favorite choice to diff a remote branch version vs a local branch version:

mv buildChoops.sh buildChoops.local
git checkout origin/feature/my_br6 buildChoops.sh # download the file from the remote branch into the current directory locally
... now run any diff tool between the two files

tidy up messy commits, for pull request

Git – tidy up messy commits, for pull request

A common situation: you make many incremental, quick and dirty commits on your branch, undoing and redoing changes. You don’t need to push the entire history to a shared branch like Develop.

Many solutions exist. Git offers many commands to rewrite history on a branch. Many git users use them regularly. We could use them to clean up the commits on a feature branch before pulling them into a pull request. Here are some of the methods.

This will rewrite the history of your branch, you should only do this if no one is sharing your branch (or you don’t care about them).

1st approach – rebase, if your history is clean

This example will let you interactively select from the last four commits.

git rebase -i HEAD~4
# Alternatively, specify the last-good commit:
git rebase -i e8a9cf093   # Rebase all subsequent commits

2nd approach – If your history is too complicated (many merges etc.)

git tag backup                      # we do this so that we don't lose our history
git checkout -B temp origin/develop # checkout a clean temporary branch from develop
git merge --squash <branch>         # merge our old branch in, squishing all the commits
git commit
git branch -f <branch> temp         # force the branch to point at the new commit

3rd approach – git reset and commit again

Suppose you have 5 commits to squash,

git reset --soft <a previous commit hash, or something like HEAD^5> # rollback to the named commit.
# reset --soft modifies only commit history, not work tree or index.
# Now you can look at the files involved in those 5 commits, staged for the next commit
git diff --cached --name-status
git commit -m 'your msg'
# git push ... and create pull request

All methods so far assume the complicated commit history is in local repo not on a Stash branch. If your Stash branch has stuff you want to pull into Develop, but your Stash branch has complicated history, then …

4th approach – create a pull-request candidate branch

# create the candidate_branch from Develop, on stash
git tag backup                      # we do this so that we don't lose our history
git fetch                           # will show the new branch
git checkout candidate_branch
git merge --squash old_branch       # merge our old branch in, squashing all the commits
git commit                          # the default msg shows list of files. you might want to uncomment that in the msg.
git push origin candidate_branch    # now the candidate branch is up-to-date on Stash. Ready for pull request.

5th approach – rewrite public history

Dangerous – Know what you are doing
# clean up your local branch as illustrated above
git push --force origin   your_Stash_branch    # overwrite the Stash branch and overwrite public history - Dangerous!

6th approach – edit commit message after many merges, using git-filter-branch

The git-rebase and git-cherry-pick commands often fail in the presence of a complicated history of merges, file deletes etc. Try filter-branch.

Dangerous – can modify many commit messages by accident
# clean up the branch xyz
git checkout -b xyzRewrite # Always do the rewrite on a cloned branch please
git filter-branch --force --msg-filter 'sed "s/addYENRates/[CFMQUANT-262] addYENRates/" ' e635d034ea8..HEAD

At end of the command, 1st hash is the parent of the flawed commit. 2nd hash must be HEAD (or perhaps the name of a branch).

Command should tell you the branch is rewritten. If no commit message matches the pattern, then the command would tell you the branch is left unchanged, so it’s safe if you have a typo that matches nothing.

In either case, you can then run git diff against the original branch and verify they are identical content-wise.

In this real example we were lucky the message “addYENRates” was rather unique. If it shows up on 2 commits, then both would be rewritten.

gdb: dump STL container %%experience

First let’s talk about custom containers. GDB would show the field names of an object, but frequently not the values. I guess integers values might show up but more than half the fields are pointers ( actually char-array field would be easy to print.)

If I call a function on the object, I have to be very lucky and very careful. q(->) has never worked for me so far, so I need to use q(*) to de-reference every pointer before calling a method on the pointee, and pray it works.

http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.03.txt works on std::map …

A simple experiment using https://github.com/tiger40490/repo1/blob/cpp1/cpp/88miscLang/containerDumpOperator.cpp

  • g++ -g theFile.cpp && gdb -iex ‘add-auto-load-safe-path .’ ./a.out
  • (gdb) print *(li._M_impl._M_start+1) # can print 2nd element if it’s std::string or double
    • Note before vector initialization, gdb already shows the addresses inside the vector, but some addresses are not populated. Just retry after the initialization.
  • std::unordered_map is doable:
    • (gdb) print **(tm._M_buckets) # prints first pair in a hash table bucket
    • (gdb) print *((**(tm._M_buckets))._M_next) # next pair in the same bucket
  • std::map content is harder
    • (gdb) print *(int*)(tm._M_t._M_impl._M_header._M_left+1) # prints one key
    • (gdb) print *(int*)(tm._M_t._M_impl._M_header._M_right+1) # prints another key in the pair
    • (gdb) print *(int*)((void*)(tm._M_t._M_impl._M_header._M_right+1)+sizeof(int)) #prints the value in the pair.
      • the (void*) is needed before we add sizeof(value_type). Without the cast, the pointer arithmetic would be different.
      • from the key field to value field, we move by 4 bytes (i.e. sizeof value_type) from  0x6050e0 to 0x6050e4. It’s actually easy to manually type .. print *0x6050e4
      • I suspect the _M_right pointer is seated at the “color” field. Increment to the key field?

loading .gdbinit

My experiments show that $HOME/.gdbinit is discovered. I actually changed the $HOME env variable:)

However, I hit

  warning: not using untrusted file "/v/global/user/b/bi/bint/.gdbinit"

, even though I added q(gdb -iex ‘set auto-load safe-path …’). I guess the warning come up before the -iex option takes effect

  gdb -ix '/path/to/.gdbinit' # also failed due to untrusted file
  g++ -std=c++0x -g dump.cpp && gdb -iex 'add-auto-load-safe-path .' ./a.out # working


gdb symbol-loading too time-consuming

After I attach gdb, it immediately starts a prolonged symbol loading process. It’s better to skip the loading, and selectively load some symbols.

https://ascending.wordpress.com/2007/09/02/a-couple-of-gdb-tricks/ describes how to use ~/.gdbinit, but I had no permission to write to the ~/

gdb -iex ‘set auto-solib-add off’ …. # worked

–loading a particular *.so file

I got “No loaded shared libraries match the pattern” and fixed it by

shar file.name.so #instead of /full/path/to/file.name.so.some.version

g++ q[-L] vs [-l] .. [-I] vs [-isystem]

-L and -l (i.e. the big and small "L") both affect the linker only.

See also MSVS linker option -L vs -l #small L

-L (similar to -I) and introduces a new search directory, for *.so or *.a file search.

Q: does the order of -l options matter?
A: yes. Recall the -liberty …

Q: does the order of -L options matter?


-I and -isystem both affect the preprocessor only.

There’s not “-i” option per-se.

 

github tips #basic

  • q(git config credential.helper store) is the command that finally fixed my git-bash forgetting-password problem on my win7 Dell. The github recommended command only worked in my win10 Lenovo and office win7:
    • git config --global credential.helper wincred 
      
  • –to comply with email privacy,
    • git config --global user.email {ID}+{username}@users.noreply.github.com
  • –to download an entire branch on the github web interface: CloneOrDownload button can download a zipfile
  • –to mass upload using drag-n-drop
  • I realize that the zipfile downloaded has a problem. When I open the zipfile (but not extract) and select the files, the drag-n-drop interface fails. I had to copy the files to a tmp directory.
  • –delete folder: not so easy
  • –file naming tips
    • ^ is slightly less ideal
    • I would use underscore as default and use dash sparingly (like 0-N). Camel case is even better.
  • –rename file @web interface is easy
    • checkout branch locally,
    • rename branch
    • commit
    • push, which triggered a login pop-up.–rename branch: no web interface. I had to
  • –rename folder: no web interface. I had to
    • git mv dir1 com/xx/dir1 # close MSWE if you get perm error
    • git commit
    • git push

g++ -D_GLIBCXX_DEBUG #impractical

This is a good story for interviews.

In a simple program I wrote from scratch, this flag saved the day. My input to std::set_difference was not sorted, as detected by this flag. Without this flag, the compiler didn’t complain and I had some unexpected successful runs, but with more data I hit runtime errors.

I had less luck using this flag with an existing codebase. After I build my program with this flag, I got random run-time crashes due to “invalid pointer at free()” whenever i use a std::stringstream.

 

gdb cheatsheet

#1 tip:
gdb –tui # starts an upper screen showing a moving marker against the current line. If you started gdb without “–tui”, you can still use Ctrl-X Ctrl-A.

#2 tip:
After hitting a breakpoint, you can use q(n) i.e. q(next) and just Enter to repeat previous q(n).

———-
I found it easier to use q(break filename:lineno) # Filename doesn’t need full path J

Other essential commands

  • · info break # or info b to list all breakpoints
  • · bt # or backtrace
  • · frame 0
  • · list
  • · p for print
  • · info variables
  • · info locals
  • · info args
  • · n # for step-over
  • · s # for step-in
  • · fin # for step-out
  • ctrl-L toclear gdb command screen

cvs rollback #basics

cvs -q update -D “2017-07-29” # will remove any file that’s “not in the universe” at that moment in history

The date means beginning of the day in GMT.  Here’s the more precise form:

cvs -q up -D “2017-07-29 00:00:01 GMT”

cvs -q up -D ‘2017/09/15 19:54:25 GMT’ # GMT make a difference. Default is … surprise.

–To verify the rollback

  • cvs log # is confusing and shows commits after the snapshot!
  • cvs stat path/to/file # shows the sticky tag

–To check the commits between two dates:

cvs diff -N -b -D “2017-10-20 22:00:00 GMT” -D “2017-10-20 23:00:00 GMT”

gdb –tui #split screen

You can also start gdb normally, then switch to split screen, with “ctrl-x  ctrl-a” (thanks to Gregory).

Upper screen shows the source code with a moving marker

–Here’s my full gdb command showing

  • –args to run the target executable with arguments
  • redirect stderr to a file so my gdb screen isn’t messed up — not always effective

gdb –tui –args $base/shared/tp_xtap/bin/xtap -D 9 -c $base/etc/test_replay.cfg 2 >

cvs update/checkout a file or dir

–retrieve an old version without sticky

cvs up -p -r1.17 CTFXdpIntgPlugin.C> CTFXdpIntgPlugin.C.1.17

–cvs update a dir or file:

cvs update –dA package/aida/common/script Bring working dir specified up to date with the repository (merge changes made to the repository into the local files).
cvs update –A package/aida/common/script/MakefileAida.sun4
Bring just the named file up-to-date with the repository

–cvs checkout a dir or file:

cvs checkout edu Checks out everything under edu, placing an edu directory, plus all subordinate subdirectories, in the working dir.
cvs checkout app/alh Checks out everything under app/alh placing an app directory in your working directory, but only the alh subdirectory of app.
cvs co package/aida/common/script/MakefileAida.sun4
Checks out only the single file MakefileAida.sun4, creating package/aida/common/script/MakefileAida.sun4 in the working directory, containing that one file.

q[g++ -g -O] together

https://linux.die.net/man/1/g++ has a section specifically on debugging. It says

GCC allows you to use -g with -O

I think -g adds additional debug info into the binary to help debuggers; -O turns on complier optimization.

By default, our binaries are compiled with “-g3 -O2”. When I debug these binaries, I can see variables but lines are rearranged in source code, causing minor problems. See my blog posts on gdb.

gdb q[next] over if/else +function calls #optimized

I used an optimized binary. Based on limited testing, un-optimized doesn’t suffer from these complexities.

Conventional wisdom: q(next) differs from q(step) and should not go into a function

Rule (simple case): When you are on a line of if-statement in a source code, q(next) would evaluate this condition. If the condition doesn’t involve any function call, then debugger would evaluate it and move to the “presumed next line”, hopefully another simple statement.

Rule 1: suppose your “presumed next line” involves a function call, debugger would often show the first line in the function as the actual “pending”. This may look like step-into!

Eg: In the example below. Previous pending is showing L432 (See Rule 2b to interpret it). The presumed line is L434, but L434 involves a function call, so debugger actually shows L69 as the “pending” i.e. the first line in the function

Rule 2 (more tricky): suppose presumed line is an if-statement involving a function call. Debugger would show first line in the function as the pending.

Eg: In the example below, Previous pending was showing L424. Presumed line is L432, but we hit Rule 2, so actual pending is L176, i.e. first line in the function.

Rule 2b: when debugger shows such an if-statement as the “pending”, then probably the function call completed and debugger is going to evaluate the if-condition.

424 if (isSendingLevel1){
425 //……
426 //……….
427 //……..
428 //……….
429 } // end of if
430 } // end of an outer block
431
432 if (record->generateTopOfBook()
433 && depthDb->isTopOfTheBook(depthDataRecord)) {
434 record->addTopOfBookMarker(outMsg);
435 }

#1 challenge if u rely@gdb to figure things out: optimizer

Background: https://bintanvictor.wordpress.com/2015/12/31/wall-st-survial-how-fast-you-figure-things-out-relative-to-team-peers/ explains why “figure things out quickly” is such a make-or-break factor.

In my recent experience, I feel compiler optimization is the #1 challenge. It can mess up GDB step-through. For a big project using automated build, it is often tricky to disable every optimization flag like “-O2”.

More fundamentally, it’s often impossible to tell if the compiled binary in front of you was compiled as optimized or not. Rarely the binary shows it.

Still, compared to other challenges in figuring things out, this one is tractable.

gdb stop@simple assignments #compiler optimize

Toggle between -O2 and -O0, which is the default non-optimized compilation.

In my definition, A “simple assignment” is one without using functions. It can get value from another variable or a literal. Simple assignments are optimized away under -O2, so gdb cannot stop on these lines. This applies to break point or step-through.

In particular, if you breakpoint on a simple assignment then “info breakpoint” will show a growing hit count on this breakpoint, but under -O2 gdb would never stop there. -O0 works as expected.

As another illustration, if an if-block contains nothing but simple assignment, then gdb has nowhere to stop inside it and will only stop after the if-block. You won’t know whether you entered it. -O0 works as expected.

MSVS linker option -L vs -l #small L

Linker option –l (small ell) for the lib file name; -L for to specify the search path

———-

Finally, you must tell the linker where to find the library files. The ST-Developer Windows installation contains programming libraries built for use with Visual C++ 2005 (VC8) and 2008 (VC9) with the /MD flag, as well as versions that are link compatible with other compilers. These are kept in different subdirectories under the ST-Developer “lib” directory. The library directories available for Visual Studio 2005 and 2008 are as follows:

  • $(ROSE)/lib/i86_win32_vc8_md (2005, 32bit platform, /MD)
  • $(ROSE)/lib/x64_win64_vc8_md (2005, 64bit platform, /MD)
  • $(ROSE)/lib/i86_win32_vc9_md (2008, 32bit platform, /MD)
  • $(ROSE)/lib/x64_win64_vc9_md (2008, 64bit platform, /MD)

Select the Linker category of properties and, pick the General options under that. In the Additional Library Directories property, add the appropriate ST-Developer library directory.

 

putty color

I tried various color schemes. None worked, so I found “monochrome with bold” good enough. That’s the fallback option. Now here’s one color scheme that might produce readable color on white background. In this case I turned on all the putty settings under Windows->colors:

  • tick AllowTerminaltoSpecifyAnsiColors
  • tick AllowTerminalToUseXterm256
  • tick AttempToUseLogicalPalettes
  • tick UseSysColors
  • radio group choose Both

Imperfection: in vi, I get yellow line number on white background 😦 so I had to go to Windows -> colors -> bottom scrolling list -> set ANSI YellowBold to 222:222:0

Whenever you turn on color support in terminal and in q(grep), you open a can of worm. Often LESS would need -R switch to cope with “ESC[01”

cvsignore troubleshoot`

gitignore  can be investigated. Git can tell you why a particular file is ignore. CVS doesn’t support that instrumentation.

If you need to confirm a file is explicitly ignored, then you can put a single “!” in ~/.cvsignore (as described in the official manual) to clear the ignore list.

%%first core dump gdb session

gdb $base/shared/tp_xtap/bin/xtap ~/nx_parser/core

### 1st arg is the executable responsible for the core dump. If this executable is correct, then you should not get “No symbol table is loaded. Use the file command.” If you do, then try

(gdb) file /path/to/xtap

I think “symbol” means the variable/function names. I think gdb sees only … address not names. To translate them, presumably you need *that* file.

In my case the “xtap” executable is a debug-build, verified with “file” and “objdump” commands, according to http://stackoverflow.com/questions/3284112/how-to-check-if-program-was-compiled-with-debug-symbols

Anyway, once the symbols are loaded, you should run “bt” to load the back trace (gdb) bt

Now choose one of the frames such as the 2nd most recent function i.e. Frame #1 (gdb) frame 1

Now gdb shows the exact line number and the line of source code. You can see before/after lines with “list”. Those lines may belong to other functions collocating in the same source file. (gdb) list

cvs cheatsheet

–top 10 how-to

  1. list modified files — 2 choices
    1. cvs -qn up # shows both untracked and uncommitted
    2. cvs status |grep # doesn’t offer a quick glance
  2. list untracked files in the current dir (git clean -fxd) —
    1. cvs -qn up | grep ‘^?’  # listing only
  3. cvs (git reset –hard)
    1. cvs up -C the/file
  4. checkout a single dir/file. First, cd into the parent dir , then 2 choices
    1. cvs up -d missingDir
    2. cvs co tp/plugins/xtap/missingDir # no leading slash. See http://www.slac.stanford.edu/grp/cd/soft/cvs/cvs_cheatsheet.html for explanation

–Tier 2 (Still useful):

  • cvs -H any command
  • the -l option: -l Local; run only in top of current working directory, rather than recursing through subdirectories. Available with the following commands: checkout, diff, log, status, tag, update..

github branch backup

I plan to use bighub branches for backup:

  1. pick a single most valuable directory, like cpp (or py)
  2. once a while merge it into another branch like perl1 or bash
    • Watch out for any deletion of a directory like cppProj. You may need to merge the cppProj branch

Note:

  • Do NOT rely on this back-up. It’s a low-cost back-up with unknown reliability
  • more frequent back-up doesn’t hurt and should be quick and simple

%%Git tips – CFM Quant team

  • Short Questions
    • How to rename a branch on Stash directly?
    • How to add a tag on Stash directly?
    • How to view the commit and annotation on one or multiple git tags?
    • How to add or edit the annotation of a tag on Stash?
    • How do I clean my external files?
    • How do I revert a file?
    • How do I get my local branch back to a remote?
    • Why is `git status` slow in Linux?
    • How do I list all branches that change a file?
    • How do I delete a local branch?
    • How do I merge multiple WIP commits into a single commit?
    • How do I get rid of obsolete remote branches
    • How to resolve pull request merge conflicts
    • A few ways to create new feature branch
      • Using command line without Stash
    • How to Revert non-commited changes
    • How to Revert branches back to origin
    • How to List names of modified files only
    • How to Cherry-Pick Commits to Push to develop
  • Using TortoiseGit
    • Overview
    • Some of the many convenience features
      • Feature: list of all uncommitted files (like git commit –name-status)
    • Installation
    • Using TortoiseGit
      • Setting up the Key
      • Clone the Stash repository (Workspace)
      • Interface 
      •  Commands
      • Enable icons in Win Explorer

Short Questions

How to rename a branch on Stash directly?

On your Stash page change base branch to the target branch (say BB) -> click on the “…” dropdown -> choose “Create a branch from here” -> specify new name (say NN) -> delete branch BB.

How to add a tag on Stash directly?

Navigate to the page of your chosen commit (such as this sample page), then find the link on the top right “Tag this commit”

How to view the commit and annotation on one or multiple git tags?

git show your_tag # look into one tag

The Stash page below also helps, provided the tag is published on Stash.

How to add or edit the annotation of a tag on Stash?

…  shows all tags, including the commit and the annotation. Choose one you want to edit and go to Actions column click the 3 dots and choose Edit.

Why is `git status` slow in Linux?

It might be due to the networked file system. We’ve found that doing the following might speed it up:

git config --global core.preloadindex True

See stackoverflow for details.

How do I list all branches that change a file?

FILENAME=<myfile>
git log --all --format=%H $FILENAME | while read f; do git branch --contains $f; done | sort -u

How do I get rid of obsolete remote branches

First remove it from Stash. Easy and safe to do on Stash web site. Go to the page listing all mod branches. Locate your branch you don’t want. Click on the “…” on the far right, to show the dropdown and find “Delete”. This would complete the deletion on the central repo. Next in your local repo, run

git fetch --prune

This command would sync up the local repo to match central repo on Stash. The deleted branch will now be deleted locally. Without this step, git branch -a would forever show the obsolete branch.

Remember each local repo or central repo holds a copy of all the branches. Deleting branch123 from one repo doesn’t automatically delete branch123 from another repo. Similarly, adding branch321 to one repo doesn’t automatically add branch321 to another repo.

How to resolve pull request merge conflicts

If possible, we use the Stash interface to merge. The resulting commit message on Develop branch looks like

Merge pull request #151 in CFMQUANT/mod from bugfix/tar to develop 

Merge pull request #147 in CFMQUANT/mod from feature/CFMQUANT-253 to develop 

Merge pull request #135 in CFMQUANT/mod from feature/CFMQUANT-243 to develop

Sometimes we get a conflict when merging the PR. For example, PR #153 has one file modified in the incoming branch release/0142c. Same file was very recently modified on Develop. Therefore this file had 2 concurrent changes, resulting in a merge conflict. This is what Victor did to resolve it, not necessarily optimal or recommended.

 

git fetch origin release/0142c
git branch -d develop
git checkout develop                    # check out latest from Stash
git merge FETCH_HEAD                    # one file in conflict, to be resolved
cd models/PyQXLModelsLib/ddl/
vi PyQXLModels_ddl_pycxx.cfg
git diff origin/develop PyQXLModels_ddl_pycxx.cfg    # ensure the diff is exactly what we expect
git add PyQXLModels_ddl_pycxx.cfg
git commit # see the comment message below
git log --simplify-merges               # verify
git push origin HEAD                    # may need special permission to push Develop to Stash

Here’s the commit message I used in the merge commit:

Merge pull request #153 manually from release/0142c to develop
[CFMQUANT-235] resolve minor conflict on one file

 

 

Using TortoiseGit

Overview

Another option for a visual interface for git under Windows is TortoiseGit.  This isn’t a GUI, as such, but a shell that sits on top of Windows Explorer.  Some people like it for this reason; some people dislike it for this reason.

It gives a convenient way to see the status of your files, and a convenient way (right-clicking) to select most commonly-used git commands (you can of course still use the command line whenever that is more convenient).  There is some pain involved in setting up the key for connecting to the server – scroll down to ‘Interface’ and ‘Commands’ below to see if you think the gain is worth the pain.

Git command line is rather rich and powerful, featuring hundreds (possibly thousands:) of commands + sub-commands + combinations of switches to those commands. (https://www.kernel.org/pub/software/scm/git/docs/ lists more than 100 top-level commands). It’s impractical for any GUI tool to emulate the command line. Tortoise provides a good information-radiator tool, that saves you lots of repetitive typing.

Some of the many convenience features

Convenience is where Tortise distinguishes itself from other software tools.

In WinExplorer, Tortise lets you right click any modified file (or multiple files) to commit to your local branch. After the commit, the dialog screen lets you push to the central branch on Stash.

Similarly, if you have a new file to commit, you can right click and add, then commit.

You can also right click and diff with previous version.

Feature: list of all uncommitted files (like git commit –name-status)

You can show in a window a list of all files modified locally but uncommitted. You can then double-click each file to pop-up a diff screen, such as BeyondCompare. You can click to select one or more of these files to commit. For me this is the most convenient way to keep track of a large number of code changes. Same feature exists in TortiseSVN.

You can limit the scope to one directory (AgModels for eg). Within the same screen, you get a checkbox to widen the scope to entire repo.

There’s another checkbox to include unversioned (i.e. newly created) files. You can then add them to git with very few clicks.

Installation

TortoiseGit is free, and can be downloaded from http://tortoisegit.org/download/  You’ll need to download the 64 bit version, and then run it (it will prompt for an x account password during the installation).  It does try to restart a lot of programs (so make sure you’ve saved everything), but doesn’t require a restart.  The default options in the install wizard worked fine for me.

Using TortoiseGit

Setting up the Key

For some reason, TortoiseGit only accepts keys in putty key format, so the key that works with Git needs to be converted to this different form (this should be a once-off).  An explanation of how is given here: http://develop-for-fun.blogspot.com.au/2013/12/configure-tortoise-git.html (basically you need to download puttygen.exe to convert the format of the key).

Clone the Stash repository (Workspace)

To create a new repository based on the stash repository, you can use Windows Explorer to create a new folder, move into that folder and then right click, and choose “Git Clone…” to bring up a dialog box.

Set the url to ssh://git@….. the directory to where you want it installed.  You’ll need to click on “Load Putty Key” and put the address of the putty key saved down from puttygen earlier, which could be any stable folder in your C: drive. Avoid moving this folder.

Interface

Once successfully installed, Windows Explorer in folders associated with a workspace will now look something like

  • A green circle with a tick: up-to-date. (Victor: based on my earlier TortoiseSVN knowledge, a folder marked green means everything in it is in-sync with remote, a valuable knowledge.)
  • A red circle with an exclamation mark: file on disk has been changed and not committed (or for a folder, a file somewhere in that folder – possibly several folders deep – has been changed).
  • A blue circle with a question mark: “external” ie have not been added to the list of committed files
  • A yellow triangle with an exclamation mark: “conflicted” ie the equivalent of “overlap” in AccuRev

A full list of icons is given at https://tortoisegit.org/docs/tortoisegit/tgit-dug.html#tgit-dug-general-dia-icons

 Commands

Right clicking on a file or folder brings up a menu of git commands.  Right clicking at the top of the directory tree means you can commit all changes, or click on merge to bring up a GUI interface to merge everything.

The full manual can be found at https://tortoisegit.org/docs/tortoisegit/

If you are using a workspace that you set up outside of TortoiseGit (e.g. via the command line), then before you push to, or pull from, the server, you will need to point TortoiseGit to the putty key, by selecting TortoiseGit->Settings, then under “Git”, select “Remote”, then click on “origin” in the “Remote” box, and then set Putty Key.

Enable icons in Win Explorer

Victor had to fix his registry to get Windows Explorer to show the (nice little) icons. In addition to http://martinbuberl.com/blog/tortoisegit-icons-not-showing-workaround/ , he had to kill all Explorer.exe processes in taskmgr before relaunching Explorer.

Explorer “overlay” (technical jargon) is no mature and stable technology. Victor estimates a few times a year the icons would disappear on (subset of) the version-controlled files, often for no obvious reason, and then reappear at a random time. In spite of frequent disappointments, many users love these little icons.

eclipse to exclude a source folder

There is a straight way to do it:

  1. Right-click a project folder in Project Explorer tree and go to “Properties”.
  2. Resource -> Resource Filters.
  3. Add as much exclusion filters for files/folders as you like.

P.S. If your project tree is not updated automatically you may have to press F5 while having input focus in Project Explorer window.

std::string is usable in MSVS but can’t cout without #include {string}

Many STL headers in Visual C++ (including iostream header) pull in a definition of the std::basic_string class (because they indirectly include the implementation-defined <xstring> header (never include that directly)). While that allows you to use the string class, the relevant operator<< is defined in the <string> header itself, so you must include that manually.

git-bash diff on win-word

beyond-compare… I haven’t configured it successfully.

–Pandoc

  • Pandoc shows word differences, whereas default shows entire paragraph even for a one-word change
  • minor imperfections in the display of words near table boundaries

I added this chunk into my .gitconfig file:

 [diff "pandoc"]
   textconv=pandoc --to=markdown
   prompt = false
 [alias]
   wdiff = diff --word-diff=color --unified=1

waste time@c++IDE

c++ IDE build is 20% (up to 50%) more complicated than java, partly because c++ compilation is more complicated than java. Another reason is my previous investment in learning java compilation.

It can take many hours to fix an IDE project, but the long term return and leverage is questionable, since I use c++ IDE much fewer than java IDE.

Eclipse is my choice, although there are many usability issues and apparent bugs. Far from ideal.

Experience — devcpp is simpler.

Experience — codeBlocks xx isn’t worth the effort

 

git | 3trees

Three trees are 1) workTree 2)staging i.e. Index 3)HEAD or any commit before

A change can be in three states (https://git-scm.com/book/en/v2/Getting-Started-Git-Basics#_the_three_states): 1) modified locally 2) staged 3) committed

http://blog.osteele.com/2008/05/my-git-workflow/ has a nice flow chart:

$ git diff HEAD # compares workTree vs HEAD
$ git diff # by default compares workTree vs staging
$ git diff –staged # compares staging vs HEAD, least useful.

https://www.atlassian.com/git/tutorials/undoing-changes/git-reset also describes the three trees of git, in the context of git-reset.

$ git reset #by default means q(git reset –mixed HEAD) and updates the HEAD ref + staging
$ git reset –hard # also modifies workTree

MSVS build (!!clean-build) unable to detect upstream changes

Let's avoid the confusing word “rebuild”. In MSVS it is name of a command to clean-build. In everyday English it means

1) An action to build again, or

2) The observation that a project built again, whatever the trigger

Therefore the word “rebuild” is vague and misleading.

Many of my 200 projects use boost 1.47. I kept the boost 1.47 files unchanged, and added 1.57 files in a brand new folder. I first changed the include path and linker path inside the shared property sheet, to use boost 1.57. Unknown to me, a few projects still reference boost 1.47 files outside the property sheets. Everything built fine.

Then I physically removed the 1.47 files. I thought all the 1.47-dependent /renegade/ projects would detect the upstream change and build themselves. We wish to avoid a lengthy clean-build at solution level, so we choose the incremental build.

Indeed as expected some projects “turned themselves in” as secret dependents of boost 1.47. But to my surprise, some projects didn't. So after build-all, these projects still use boost 1.47.

Lesson learnt – after removing the boost 1.47 files, we have to clean-build all. Cutting corners here could leave some 1.47 residuals in the artefacts.

git | branch sync – learning notes

Branching is different in git vs svn/cvs. By itself git branching isn’t too complex.

The git local/remote set-up is new to me. By itself, not too complex.

However, in reality we have to manage the combination of branching and sync – a higher level of complexity addressed in many online discussions. I would prefer to rely on the git commands (rather than GUI tools or Stash) to understand and manage it.

I like the philosophy in http://longair.net/blog/2009/04/16/git-fetch-and-merge/

–comparing the local branch vs remote branch

git diff feature/my_br6 origin/feature/my_br6 — path/to/your/file

— FETCH_HEAD:

http://stackoverflow.com/questions/1800783/compare-local-git-branch-with-remote-branch

–check out a remote branch? local branch to track remote branch?

http://makandracards.com/makandra/521-check-out-a-remote-branch-in-git

http://stackoverflow.com/questions/1783405/checkout-remote-git-branch

–delete a branch locally, then remotely:

http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html

openssh^putty key files

openssh key format is the one used in id_rsa / id_rsa.pub.

  • Proven tip: I actually took the pair of id_rsa files and used them in any windows or linux account. It’s like a single fingerprint used everywhere. The key is not tied to any machine.
    • The authorized_keys file in ALL destination machines have the SAME line containing that public key.
  • Proven tip: To support ssh support@rtppeslo2 with ssh key, I copy a standard authorized_keys to rtppeslo2:~support/.ssh. See https://superuser.com/questions/283216/ssh-key-authentication-with-another-user/

transformation — Puttygen can read the same “fingerprint” to generate ppk files, in putty’s format. Then a putty session can use the ppk file to auto-login, in place of a password

Note when my remote_host home dir permission was too open, then the ssh key was ignored by sshd. I had to enter password.

set up dependency between two c++ projects

I will mostly talk about MSVS but will mention linux build too.

The common methods to set up the dependency, all done inside project BB

1) specify project dependency in MSVS

2) define include path to cover the header from AA

3) define library path to cover the object file from AA

Suppose project BB uses “things” in project AA. Say a file in BB #-includes a header in AA. I think it's not necessary to have any. This is important when you debug the dependency. You may fail to find any trace of the dependency in any of those places. The file in BB can simply #-include the full/relative path to the header from AA.

http://blogs.msdn.com/b/vcblog/archive/2010/02/16/project-settings-changes-with-vs2010.aspx describes project reference vs project dependency….

….. much more to say.

a MSVS SOLUTION imt a folder of MSVS projects

label: IDE, book

I agree the project is a more important development concept, but the solution also has unique, important functionalities. I found many of these functionalities from [[MSVS 2010 unleashed]].

* project dependency is described in the sln file.

* you can build an entire solution, according to the predefined build order

* a solution can contain so-called non-project items such as documentation. All such files are by default put into the “Solution Items” virtual folder.

nant.build Rebuild ^ build

In nant.build,

A) if a compilation is Rebuild, then it could be slow for a large solution. This is similar to MSVS solution rebuild

B) If a compilation is Build, then it can make use of whatever you have already built in MSVS, but if one of the projects was cancelled half-way it may come up as corrupted and break the nant build. I guess you can clean that project and rerun nant.

[15]Eclipse C++11/mingw xp

The default mingw download is too old for c++11. I tried mingw-builds project. Hit some problems. Probably failed to install or something else.

mingw-w64 — I found some workaround using a gcc 4.9 build — good for c++11. This 32-bit version worked in win7 and winxp — http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-posix/dwarf/i686-4.9.2-release-posix-dwarf-rt_v4-rev2.7z/download\

Note this is not an installer. When I tried the installer of mingw-w64 , it could (!) compile my c++11 code on the command line, but CDT couldn’t detect mingw gcc. Even after I cloned mingw32-gcc.exe, i still faced issues with #include . These are all well-known issues on the internet. Clearly this mingw-w64 installer isn’t better than the 7z download.

Lessons learnt –
* no need to upgrade. If your installation is a few years outdated, it may still work perfectly.
* standard installers may be “proven” for common tasks only, and a non-standard download could be high quality.
* Consistent with my past experience, env set-up is time consuming, esp. on the bleeding edge. In this case, both CDT and mingw have more than a single unified, consolidated release stream. Some users download from stream ABC and follow the versions therein. Other users download stream XYZ. Hard to share technical problems. Many of my installation issues were complicated by this “proliferation”.
* java (and py, c#) are easier since a single vendor releases all the versions

Eclipse CDT + gdb setup

update

PATH is a per-project config, not optional.

CCB->settings->toolSettings->g++compiler->misc -> turn on verbose to see which g++.exe in use
–c++11 mingw
mingw-builds installer either errors out or was too old… I  used mingw-w64 instead

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-posix/dwarf/i686-4.9.2-release-posix-dwarf-rt_v4-rev2.7z/download

install mingw and fix %PATH%. Go to mingw\bin\ folder. In dos, verify
g++ –version // gcc is the C compiler !!
gdb –version
copy the *make.exe to make.exe // needed in some of my projects
make –version
Even without IDE, I believe mingw g++/linker can convert your c++ source into executable. Mingw is designed to be usable without IDE. Both codeBlocks and eclipse users generally favor mingw over cygwin.

(Note you need the eclipse view “C/C++ projects” to see the Binaries + related stuff)

project properties -> Builders — I didn’t change.
project properties -> c/c++ general (CCG) — no need to change.
project properties -> c/c++ build (CCB) — contains every important config for C++. Amidst the CCB config maze, #1 factor is tool chain ( CCB->toolChainEditor ). Eclipse often defaults to CrossGCC + CDT_InternalBuilder [3]. Leads to this Question

Q1a: is that enough? mingw unnecessary?
A: I thought “Sometimes Partially Usable”, but I guess it’s an illusion, and we still need mingw.

Q: does eclipse come with gdb, so we don’t need to install mingw?
A: probably not. Apparently, gdb.exe must be in %PATH%

[3] To remind you which builder is in use, build console says “…. builder is used”

Now that’s the preliminary. Let’s zoom into compiling and debugging your project.
Q1b: does eclipse come with g++ compiler?
A: probably not. Eclipse looks for g++.exe in %PATH%, failing which it always always always fail to build.

Fix 1) First install mingw. Usually you can but sometimes can’t build using default crossGCC, in which case change toolChain=mingw (usually not needed). Should build a [projectName].exe, just as msvs. Runnable in dos.

Surprise #1 — by default, there’s no debug config for your project. I think that’s why you can build a good executable but can only run it in dos, not F11 — you get BinaryNotFound. That leads to …

Fix 2) create a debug config [2], in Run->RunConfig->c/c++App->new. Mention your [projectName].exe. If it’s not recognized as IDE-runnable, You may need to mess with the CCB->Settings->binaryParser (PEWindowsParser?) and restart IDE, rebuild…. Now you can run it in IDE, but you may or may not have problem debugging it. That leads to another Fix and Q&A

Fix 3) –>
Q: Minimum effort to fix debugging?
A: CCB->ToolChainEditor->currentToolChain = mingw. You can leave InternalBuilder alone.

[2] a debugConfig is also a runConfig.

## c++ instrumentation tools

(Each star means one endorsement)

oprofile **
gprof *
papi
callgrind (part of valgrind)
sar *
strace *
(Compared to strace, I feel there are more occasions when ltrace is useful.)
systemtap
tcpdump
perf,
perf_events


libc
*Pin threads to CPUs. This prevents threads from moving between cores and invalidating caches etc. (sched_setaffinity)

See more http://virtualizationandstorage.wordpress.com/2013/11/19/algo-high-frequency-trading-design-and-optmization/

g++ frontends ^ JVM/CLR bytecode

Have you ever wondered how gcc can compile so many languages. We know various dotnet languages all compile to the same IL code; JVM similar. Now I know that gcc uses a similar technique —

gcc has a frontend for java
gcc has a frontend for ObjectiveC
gcc has a frontend for c++
gcc has a frontend for Fortran

All of them produce the same intermediate code that feeds the true compiler, which produces assembly code.

remote debugging MSVS@winxp; app@win2008 or 2003

http://www.atalasoft.com/cs/blogs/danbarvitsky/archive/2009/01/15/once-again-about-remote-debugging.aspx is the best guide I have found. Some comments —

Firewall – I didn’t need to change anything

— I ran the msvsmon.exe from a share. Just double click to run the exe
** msvsmon.exe need not run-as admin
** msvsmon.exe.config needs no change
** MUST add my name under msvsmon->tool->permission. Repeat in every msvsmon.exe session — Not saved.

— Attach to process
** transport = default
** qualifier = eqdpr@uwsamapos01, where eqdpr is the msvsmon.exe user on the remote
** refresh

Should see every process — Connected:) Once connected, before attach, msvsmon window will show who connected when.

You can start the remote app before or after Attach.

c# Release^Debug build – cheatsheet

Update – to the compiler, there’s no Release/Debug mode. I think this is really a MSVS feature. (The optimization diff between R/D is, ironically, less important to me. ) Each “mode” specifies a set of compiler/linker flags (+ env var). As a result, each mode has its own output directory for the build artifacts — they don’t overwrite each other.

Optimized – Release build could be faster, usually marginal difference. YMMV i.e. actual improvement depends on many factors.

Local debug – Release won’t hit breakpoints. Can it be fixed? Online says maybe but I feel YMMV.

Remote debug – Both Release/Debug builds supported. See http://syncor.blogspot.com/2010/12/remote-debugging-release-build.html

There’s a lot of discussion and Q&A on this.
* For our knowledge, it’s more relevant to know (at least a few of) the many optimizations.
* For practical coding, better know the restrictions on Release builds

http://msdn.microsoft.com/en-us/library/wx0123s5.aspx says
* The Debug configuration of your program is compiled with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.

* The Release configuration of your program contains no symbolic debug information and is fully optimized. Debug information can be generated in Program Database Files (C++), depending on the compiler options that are used. Creating PDB files can be very useful if you later have to debug your release version.

–Forum authors point out
Size of the release executable is smaller than a debug executable. In terms of execution speed, a release executable will execute faster for sure, but not always will this difference be significant.

One can expect to see funny errors in release builds due to compiler optimizations or differences in memory layout or initialization. These are referred to as Release-Only bugs.

books on MSVS

Most books are too thick and duplicates the very big MSVS documentation

[[ Mastering Visual studio .NET ]], available in Jurong East library, is one of the best but covers VS.net 2003. Covers debugging in-depth.

C++ and c# are the 2 implicit targets.

renaming folder in svn

C) Conservative approach – clone the folder, verify it, check in, observe [3], then schedule to remove obsolete folder.

** Caveat – Before removal, everyone needs to know the old folder is obsolete and not to be used.
** Caveat – history lost

[3] it can take months to uncover a problem induced by the renaming.

D) The tortise “rename” is convenient but potentially dangerous. Usually works. Acceptable on unimportant svn folders. Use your judgement.

MSVS project – Don’t include unversioned files

If a file is versioned and included in VS project, normal.
If a file is versioned and Excluded in VS project, then no real risk even if the file causes build errors.
If a file is un-versioned and included in VS project, then build will complain explicitly.
If a file is un-versioned and Excluded in VS project, then do you need to back up the file? If you do then better version it.

MSVS – adding x-proj reference within a solution

Say you are developing Project1. If you refer to stuff in a sister proj (Project “PROJA”) within the same solution, you must include PROJA in Project1’s References. You must see PROJA when you expand [1] Project1’s References list.

 

Now watch out. When you addReference -> Project, you may see PROJA. Now you must click OK. If you click Cancel, you will see PROJA not added to the References list.

 

[1] using that tiny “+” sign

 

single-stepping 4 stages of g++ compliation

First 3 stages are file-by-file; 4th stage merges them. You can use “file anyFileName” to check out each intermediate file, and cat it if ascii.
–1) preprocessor.
yourSourceCode => preprocessedSource — often 200 time larger.
Both ascii format.
to run this single step — gcc -E
–2) assembler. This is Before compiler.
preprocessedSource => assembledTextFile.
Both ascii format — yes for the assembler!
to run this single step — gcc – S
–3) compiler.
assembledTextFile => individualObjectFile
Ascii -> binary
to run this single step — gcc -c -x assembler
One object file for each original source file.
–4) linker.
individualObjectFiles => singleMergedObjectFile
Now executable.

Eclipse CDT copy-create project

Project Copy-create is easier than create-from-scratch. However, the new project is often broken, perhaps due to multiple CDT bugs:-(. Since CDT is buggy, i prefer external diagnostic tools.

* External — the exe file. ….\ideWorkspace\yourProject\Debug\*.exe. I call it “the EXE of the project”
Each clean-rebuild should recreate this file with a new timestamp. You can delete the file directly. If your main() ends with cin.get(), then you can run the EXE by double-click.

—– now, let’s look at how to copy-create —-
The copy actually copies the .exe as the EXE. I hate that name, so I run a text replace in
ideWorkspace\yourProject\.cproject. You need to reopen the project, clean and rebuild, then refresh the view to see the newly produced EXE.

You may need to create a run-config. To search for the EXE, use the browse button. However, CDT might say the EXE is not a recognized executable [1]. Occasionally You can ignore it and run the EXE externally, or through the run-config.

[1] If you prefer to fix that, change the project properties -> c/c++ build(CCB)->toolChainEditor->currentToolChain to minGW.

dev-cpp and mingw integration

My dev-cpp used to work. I later installed minGW and dev-cpp stopped working even when I compile the simplest program

Solution — http://www.computing.net/answers/programming/dev-c-compier-just-not-working-/24305.html
1. Download new MINGW compiler at http://www.mingw.org/ and install it in C:MinGW
2. in Dev c++. right click on menu Tools>Compiler options.
3. in tab “Directory”, right click on “Libraries” and change “C:Program FilesDev-CppLib” to “C:MinGWlib”
4. Compile!

requirements to debug into c++ from another language

The driver app (java, c#, MS-excel …) had better use dynamic linked library to access C++ code. (Not sure if a static library can suffice.) Before the app terminates, we attach our debugger (gdb, MSVC etc) to that process.

http://forums.codeblocks.org/index.php/topic,6419.0.html has a popular write-up about MSVC debugger. i guess if you use g++ to compile, then you may need gdb; if you used MSVC to compile, then you may need MSVC debugger.

Obviously We need source code used to compile the library. Of course, the library must be compiled with -G.

dbx commands

To start dbx, you can just type dbx without arguments

–the essential commands
print, stop

–critical but rarely used commands
attach your_pid # just a single argument
threads
thread t@8 # select thread “t@8”
where 5

–most frequent commands
# cont — (or “c”) command to resume program execution. Currently,
threads use synchronous breakpoints, so all threads resume execution.
# status # shows all breakpoints. You need this after a lot of “cont”
# dump — in suspension mode, shows a lot of variables at that point in
time
# assign

list # src
help

–if your c-string is too long to 'print',
print strlen(longStr)
print longStr+788 # will print from that position to the \0

–help any_command

–(18) What are the major MT features of dbx?

The `threads' command will give a list of all known threads, with
their current state, base functions, current functions etc.
You can examine stack traces of each thread.
You can resume (`cont') all threads.
You can `step' or `next' a specific thread.
The `thread' command helps navigating between threads.

where is the svn ignore-list physically saved

If you instruct[1] svn to ignore a dir, that instruction is physically saved in your local parent_directory/dir-props.

Now tortise will show parent_directory as “modified”. 

Tortise context menu -> svn property — will show it.
Tortise context menu -> check for modification -> look into “Status” column (one word) — will also show the exact change

[1] by IDE, Tortise or command line

basic eclipse c++ Q&&A

Q: project rebuilding — the exe is permission-denied
A: perhaps the debug shows the exe still in use.

Q: funny/weird characters in error messages and tooltips?
A: define environment variable LANG=en_US.ISO-8859-1 in Window->Preferences->C/C++->Environment
A: In toolchainEditor (TCE) if you chose cross GCC, you can get cleartext error messages. You also see Includes in Project view

Q: binary not found
Maybe there’s nothing for this Project under runConfig? Your *.exe (full path) should show up.

Q: basic includes for every *.c file?
A:
#include
using namespace std;

Q: “This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information.”
A: perhaps you access argv[1] without any command line arg?

Q: where’s the *.exe file generated for my project?
A: in the Debug folder

Q:’strlen’ was not declared in this scope
A: #include

Q: undefined reference to `WinMain@16′
A: no main()

eclipse mark-occurrence on vertical side ruler

One of the top 10 productivity features in Eclipse.

Preferences -> search for “occur” -> MarkOccurrences -> Annotations ->
Occurrences and WriteOccurrences -> Choose 2 distinct colors that are
easy to differentiate on the vertical rule and also as text highlight.

Q: How about Visual Studio?
A: I found that if I select a variable, move mouse away, then all occurrences are highlighted within the editor (not on vertical ruler). It’s known as “highlight reference” in MSVS. To change the highlight color, see http://connect.microsoft.com/VisualStudio/feedback/details/577553/inactive-selected-text-background-color-change-not-respected

10 cool features of notepad++

#1a) The UltraEdit feature — You can type “insert table_2 select” and see it showing on 5 lines as you type. http://stackoverflow.com/questions/3453151/notepad-multi-editing
#1b) select/remove a column of text. Contrast Alt-drag vs regular drag.

#2a) highlight open/close brackets across lines. See red dotted vertical line if you set tab size to 1 or 2. The missing Eclipse feature.
(View -> show symbol -> show indentation guide)
#2b) highlight open/close brackets on the same line
(Settings->Preferences->Misc->highlight matching tags)

#3) smart highlight (Preferences->Misc) highlights all occurrences once you select a word
#3b) permanently mark all occurrence of any string (partial word, multiple words..) See http://superuser.com/questions/567703/permanently-highlight-all-occurrences-of-text-in-notepad

#4) “update silently” and “scroll to last line after update” (preferences->Misc->File Status Auto-Detection)

#5) double click on a tab to close the document

7a) If you are at the closing tag of a long block, you can jump to the opening tag. (TextFX -> quick -> find matching bracket, with Shortcut Key)
7b) You can also highlight the entire block (TextFX -> quick -> mark)

) (View -> Hide Line) to hide a block of lines
) minimize to tray, to un-clutter the task bar
) to extend vertical space, hide toolbar or menu bar, put tab bar
) “reloadFromDisk” is nice but you can map a custom key (like F5) high latency
) vertical (Preferences->General)

mvn – which settings.xml is/are in effect@@

Q: when there are multiple mvn settings.xml files, which file(s) is/are in effect?

A: make the xml malformed and try a basic mvn command (see tutorials) to see which settings.xml file is picked up.

Eclipse mvn plugin actually merges global settings.xml + user settings.xml.

Stackoverflow says –

“Maven always uses either one or two settings files. The global settings defined in (${M2_HOME}/conf/settings.xml) is always required. The user settings file (defined in ${user.home}/.m2/settings.xml) is optional. Any settings defined in the user settings take precedence over the corresponding global settings.”

svn tagging^branching

Definition — A Tag in CVS can be read-write tag, but here we are ONLY interested in readonly tags ie snapshots.

The svn-book chapter [[cheating a simple tag]] (http://svnbook.red-bean.com/en/1.5/svn.branchmerge.tags.html#svn.branchmerge.tags.mksimple) addresses the common task of ROtag. A few key points —

* as long as nobody ever commits to a ROtag, it forever remains a snapshot/ROtag.
* If people start committing to it, it becomes a branch/RWtag.
* In Subversion, there’s no difference between a tag and a branch. Both are copy-on-write directory copies.
* when you create a ROtag, you can optionally specify a revision number. See The Chapter.
** a revision number is always a ROtag ie a snapshot of the filesystem after each commit.

* unix hard-link functionality
** copy on write
** cheap copy
** Make branches/tags as often as you want

When you copy a directory, you don’t need to worry about the repository growing huge—Subversion doesn’t actually duplicate any data. same concept behind a unix hard link. It duplicates data only when it is necessary to disambiguate different versions of objects — copy on write.

putty — save host-specific config

A host-specific config is saved in a so-called saved-session. To access the list of saved-sessions, go to, paradoxically, _New_Session.._

To see or modify a particular saved-session, you must first Load it. You may need to hit Load several times. Once you are in the “editor” mode on a saved-session,

  • * Navigate to a particular tree branch, like Window
  • * change a particular value there
  • * There’s no Save button. You must navigate back to the original Session page, and hit Save (repeatedly:). This Save button
    ** saves all the settings in the editor
    ** saves them under the session name.
  • * If a parameter has an unsavable value, system will _silently_ drop the change and rollback.

http://tartarus.org/~simon/putty-snapshots/htmldoc/Chapter4.html#config-saving seems to be a good FAQ for this.

How about the config file for each connection? Apparently putty uses registry…

–DefaultSettings as a template: save it if you repeatedly use this template.

launch -> select DefaultSettings -> LOAD -> change any setting -> come back and (click to) highlight DefaultSettings -> SAVE

MSVS ^ other c++ IDEs on windows

–regarding apps FOR linux
Options: eclipse, codeblocks? Well, I don’t trust the GUI on linux. I’d avoid all GUI IDEs. the Barcap FI c++ team basically uses visual studio + vi to develop c++ apps for Linux.

case closed — no IDE on linux for me.
———–
On windows, front runners are eclipse, codeblocks and msvs. I tried CB — too complex to learn. To be fair, these 3 IDEs are equally complex but I have prior experience with eclipse (due to java) and msvs (due to c#).

Msvs has the most books, online resources and user base — largest support network. Reason? I guess for anyone building apps for windows, msvs is the defacto standard. Many textbooks use msvs

http://www.boost.org/doc/libs/1_52_0/more/getting_started/windows.html shows Boost also supports VS as the primary windows IDE.

Msvs is not free, but some say the freeware MSVSE has c++ http://en.wikipedia.org/wiki/Microsoft_Visual_Studio_Express#Visual_C.2B.2B_Express

Both eclipse and CB uses mingw/gcc, but for apps running on windows, the microsoft compilier is the standard.

Compile a boost regex/thread-based project – minGW

You configure the -L under project -> properties –> CCG -> LibraryPath

You configure the -l under project -> properties -> CCB -> settings -> toolSettings tab -> MingwC++Linker -> library
— regex
cd C:xbakideWorkspaceec_boost1Debug
g++ -IC:boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrcec_boost1.o ..srcec_boost1.cpp
g++ -LC:boost_1_44_0stagelib -oec_boost1.exe srcec_boost1.o -lboost_regex-mgw44-1_44

— boost::thread is more complicated cos the lib file(s) you built with bjam seem to be a hybrid of static and dynamic lib. Perhaps a static import library used to pull in the dll file (yes there is a dll produced). In that case, at runtime the dll must be available on PATH.

cd C:xbakideWorkspaceec_boost1Debug
g++ -IC:boost_1_44_0 -O0 -g3 -Wall -c -fmessage-length=0 -osrcec_boost1.o ..srcec_boost1.cpp
g++ -LC:boost_1_44_0stagelib -Bstatic -oec_boost1.exe srcec_boost1.o -lboost_thread-mgw44-mt-1_44
C:xbakideWorkspaceec_boost1Debugec_boost1.exe

If you see error about missing dll, then copy the named dll to the location of your exe, or a %PATH% dir. Why the error? Dependency Walker shows LIBBOOST_THREAD-MGW44-MT-1_44.DLL is a dependency of your new born exe. Apparently, there’s no real static linking of the boost thread lib.

Build simple boost project]EclipseCDT^codeBlocks

http://www.boost.org/doc/libs/1_44_0/more/getting_started/windows.html has a simple program using Boost Lamda.

1) immediately clean the project. Eclipse will rebuild and fail due to include path

2) Project -> Properties -> CCG -> pathsAndSymbols -> Includes -> GNU_C++ -> Add -> file system …
…I took the laziest route and simply put in “C:boost_1_44_0” to ignore all checkboxes, and it worked. I used a forward slash and it worked too. However, I removed it and put in “C:boost_1_44_0” and checked all 3 checkboxes -> compiler can’t resolve “#include “

(msvc procedure is well-documented.)

codeblocks is easier with include path — Project -> BuildOptions -> SearchDirectories -> Compiler -> Add

eclipse features i learnt recently

* add source code to spring.jar
* limit Problem view (compile errors) to just the project i’m in
* you can remote debug even if your project has compile errors
* export libraries from a project
* launch configuration, using ant targets — clean, build
* search filter in Preferences
* suspend all threads upon an exception
* do not convert line delimiter when checking out from cvs
* change the order of libraries on a build path, to avoid loading a bad version of a class.
* switch between 2 JRE run-time libraries.
*To “show system threads” like GC thread in eclipse, Go to the thread view, look for a small triangle to the far right -> java -> you get a few options on thread listing.

* If you add this line to your method javadoc, then the mouse-over javadoc in eclipse will show a hyperlink to the replace() method javadoc

     * @see java.util.concurrent.ConcurrentMap#replace(Object, Object, Object)

* separate workspace dir from source code physical dir
* eclipse -clean
* refresh a project to fix incomplete build path
* show empty/parent directories in Package view
* Advantage of Outline view over Package view — If cursor is in method1(), then method1() will be highlighted in Outline view, not in Package view.
* show views -> error log

aqua studio tips

* Ctrl-D (menu bar -> Query -> Describe) — Quickly see table properties
* Ctrl-F12 (menu bar -> Window -> …many items..) — hide list of servers on the left to get more real estate. There are similar tricks to save real estate. See “many items” above.

* to copy paste many rows into a temp table, List of servers on left pane -> choose your server -> Choose your database -> choose your table -> Right click -> Edit Table Data (Top 1000). Works for muni but not tempdb

* to turn on auto-complete, try Ctrl-Shift-U and Ctrl-Shift-O repeatedly until 2 buttons near MaxResults are depressed. The 2 buttons are AutoComplete and AutoOnAllSchemas

* If you see too many databases along with “master”, try
** Server Property -> Filter -> Filter Databases -> Exclude all
** Included Databases -> enter “tempdb”
** List of servers on left pane -> choose your server -> Choose your database -> Ctrl-Q

Annoying trivial exceptions when debugging Eclipse/MSVS

My eclipse debugger always stops at URLClassPath$JarLoader. Solution – Try turning off Window>Preferences>Java>Debug>Suspend execution on uncaught exceptions?

For MSVS, I find it extrememly useful to turn on “break on exception” but some exceptions like System.TypeLoadException are useless. To disable them, Debug->Exceptions->Find and uncheck the specific exceptions

msvs – integrate boost into msvs

My worst initial fears in c++ dev are A) IDEs like visual studio, B)external libraries [1] and integration of A and B.

http://www.boost.org/doc/libs/1_52_0/more/getting_started/windows.html presents comprehensive tutorials showing
– How to add boost header files into include path
– How to add boost precompiled binary files into the link path

I feel in most projects, the compiler only need these 2 “locations” in order to use an External library.

Just a side note, compiler/linker needs to reference 2 types of external library content
– source code – by preprocessor copy-paste
– compiled code – by linker

[1] external meaning not built into the IDE, like boost library

make an autosys job start/stop@fixed days

Sometimes you might need to have a job start RUNNING at a fixed time (per Caldendar Cal1), and become success at a fixed time (per Calendar Cal2).

For now, let’s not dispute the requirement. (You might have a job that should not start in the window.)

Here’s a solution:
* Box b1 starts RUNNING per Cal1
* child file watcher w1 starts RUNNING right away
* a top-level job creates the file as per Cal2 => w1 becomes success.

local variables unavailable in eclipse debugger

If you can’t inspect a method argument (or local variable) object using Expressions/Watch/Inspect … Be creative and try Eclipse debug view -> Variables. It’s possible that local vars are not visible, but class fields are. Many fields of “this” are objects, so their fields are visible. Using a combination of fields you can often deduce the values of those local vars. Simple example — if a local var is set to someStaticMap.get( this.age%10 ), you can deduce that value.

Here’s the original context of this blog — During remote debugging one day, it turned out all these variables are non-viewable because we had built the project without including “debug information”. If your build-master allows, then the best solution is —

  javac -g:vars # Local variable debugging information added to byte code in generated *.class files

Other eclipse users had the same issue — http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg08356.html

hide a source folder from eclipse

Background: i want “hide” an arbiturary directory (such as a source folder) from eclipse.

Conclusion: No easy way to mark a directory “please ignore me completely”, but a few tips:

* searcher — try “derived”. Also you can remove read permission from a directory.
* package explorer — try the filters, such as the “.*”

http://www.plaintivemewling.com/articles/ignoring-darcs-directory is good

g++ removes a method if never called@@

I suspect the syntax checker in gcc effectively comments out an (potentially illegal) method if it's never called. In the example below,

1) modification of this->intVar is blatant violation of const “this” but this is invisible to the gcc syntax checker unless there's a call to the method.

2) More obviously, bad2() calls a non-existent method but condoned unless someone calls bad2().

using namespace std;
template struct J{
    J(T & rhs){}
    void violateConstThis(T a) const{
       this->intVar = a; // legal when method is const but no one calls.
    }
    void bad2() const{
        this->nonExistentMethod();
    }
    T intVar;
};
int main()
{
    int a=22;
    const J j1(a);
    //j1.violateConstThis(89);
    //j1.bad2();
    return 0;
}

eclipse Factory refactor — keywords

Background: you apply this operation “introduce factory” on an existing contructor.

* new factory class or same class — new factory method can be created in the same class as the contructor or in a new factory class. Both are standard practices.

* return interface — instead of classes. Eclipse can’t automatically.

* static — method. Usually the factory method is static, to allow everyone to call it.

* private — by default the original contructor gets privatized

autosys box vs command

Q: generally, should we put start-conditions (timing or job-dependencies) on the box or on a command-job?
A: box

Q: my box has a time condition such as calendar, day of the week, start_times. What if my child job has another time condition?
A: not best practice, but works

Q: How do I send repeated, half-daily alerts until a file (/tmp/abc.txt) arrives please? We want it from last Monday of each month till 3 days later.

Q: what happens I specify no start condition (timing or job-dependencies) on the box, only on the child jobs?

IDE step-through — tips

Background: Step-through is one of the biggest j4IDE.

ans = invoke( obj1.method2(obj3.method4)….)
Problem: impractical to step-through this code.

Solution: use local vars to ensure every line mentions a single method. You can now step through each method. You can also inspect the local vars!

Date d1=prcdate.getTime();
Date d2=DateTimeUtils.maxTime(prcdate.getTime());
TaskQueue ctq = getTaskQueue(d1, d2);
ans = invoke( ctq);

Even the last line would be “stepped on” twice (exactly?). The stepper would stop before the call, and stop again before assignment.

IDE features that i badly need

Resolve IDE issues or go without IDE? Justify your IDE-maintenance tcost!

(No time for details)

— 5pr
1) [n] step-through, break on access to a var
2) [n] refactor tools
“call hier” ie list every caller-method calling this method

# eor
highlight a variable or class -> right click -> references -> project, to see “where and how is this object used during the object interactions?”
compile prj — like ant
click inside an exception stack to open selected source file
[n] type hierarchy
unhide all inherited members
[n] method signature as tooltip, revealing types of arguments
[n=no alt]

autosys timing data won’t show on a Command

You want to see the exact timing data such as time of the day, etc.

Apparently, you can see it on a Box, not a Command.

When creating a job, you can specify the timing and system won’t complain! If you can’t see it later, then you can’t verify — perhaps the timing data is lost, silently.

–update:
Autosys trainer said yes you can have a /top-level/, /standalone/, /boxless/ command job with it’s own timing.

eclipse build-path

J4: 10% of the non-trivial but /tractable/ beginner eclipse problems are related [1] to build-path. If you don’t mind studying “too much” on a topic, study build path.

Each source folder can define an exclusion-filter to specify which resources inside the folder should be invisible to the compiler.

offline help > Java Development User Guide > Reference > Property Pages > Java Build Path page

[1] indirectly, perhaps in hind sight

Eclipse compiler warning — customize

— based on offline help:

“For some other types of problems you can, however, specify if you want the Java compiler to report them as warnings, errors or to ignore them. To change the default settings, use the Java > Compiler > Errors/Warnings preference page.”

Suggestion (untested): During rush phase, many of your colleagues would probably ignore the hundreds of warnings anyway. On the config window, Try to turn every listed item from “warning” to “ignore”. May reduce noise. When you want to work on your code quality, you may wnat to turn on specific items.

eclipse, randome learning notes

2 common practices
– src && class files in the same folder
– src && class files in separate folders, by default named
yourProject8/bin
yourProject8/src

When you encounter an existing body of source code (perhaps on a colleague’s system), recognize this common /pattern/

A project contains only files and folders. The notion of a Java package is introduced by a Java project’s class path.

Q: “How do I prevent having my documentation files from being copied to the project’s output folder?”

Q: Can I have an output or source folder that is located outside of the workspace?
A: Yes, you can create a linked folder that points to the desired location and use that folder as the source or output folder in your Java project.

Eclipse offline help

Eclipse offline help is (too) complex and often frustrating to a beginner.

Tip: remember there are 3 important “tabs” at the bottom when you are reading only one of them. Without this knowledge, you can easily get derailed by a search in the offline help.
– search results
– index
– table of contents — tree

Eclipse — dir for output/src classes

–to change default from src and bin to something else, like “classes”,
window -> preferences -> java -> build path

–to change per-project setting
project -> properties -> java build path -> source -> go to page bottom.

You can set “Default output folder” to “myproject1/classes” even though there’s no physical directory named “myproject1”. Instead, the ../classes/ directory will show up in the project’s root directory — confusing.

Similar confusion arises when you see an explorer-style directory tree with “myproject1” as the root (no such directory) and real directories as branches.

eclipse jargon: project

From the user’s perspective, there are three different types of resources: projects, folders, and files.

A project IS-A …
* a dir
* a logical grouping of things. Eclipse manipulates them as a unit

A project HAS-A …
* build path
* list of jars for build path

q: When creating a new project, can you create an empty project somewhere outside the workspace-directory?
a: yes

q: must src live in the project-dir?
A: i think so

eclipse jargon: workspace

Q: What exactly does it mean in the context of various texts generated by Eclipse?

#1 tip: call it “workspace-directory” whenever possible. For now, I call it “ecl_ws dir”

We see a z:\workspace created by Eclipse. I think “a workspace is a directory” more or less, even though eclipse documentation doesn’t put it so simply.

Eclipse usually (but not always) stores your projects in a folder called a workspace. Choose a workspace folder to use for this session. Without a workspace, I think you can’t proceed to create a project. A workspace can have any number of projects, each of which can be stored in a different location in some file system. workspace-dir can be on C: drive, and source dir (src-dir) can be on another (even samba share).

A workspace’s resources are organized into a *tree* structure, with projects at the top, and folders and files underneath.

http://www.darronschall.com/weblog/archives/000201.cfm seems to shed some light

eclipse perspective, view

J4: a new Eclipse user is a poor thing. Under a deadline, she had to figure out a ton of Eclipse jargons (in online help, config windows …) and get Eclipse to work, jargons like “perspective”.

A perspective IS-A “blanket layer” covering the entire Eclipse display window.
A perspective IS-A … basically a layout.

A perspective-layout HAS-A … panels (known as “views”) and menus.

When you switch to CVS perspective, you won’t see any java “panels”.

To refresh a “view”, click in the view first. Why refresh? U can make changes outside Eclipse !

eclipse time savers

— addiction to car, which may break down?

— mem intensive? lg2 in the future

—- ecl time-savers
line number? needed.
run tester without creating ant task?
1 key to run? n2h
multiple windows within a big window? n2h
click a java error message to jump to THE source? nice2have
click a var of type “mscope” to view its class source? nice to hav