Thursday, June 30, 2016

SVN list recently added files

example:

svn log -r{2016-06-06}:{2016-06-30} --verbose | grep '   A'

Src:http://stackoverflow.com/questions/27275375/how-to-retrieve-files-in-subversion-svn-recently-added-to-the-repository

Monday, March 14, 2016

bibtex medphys missing book title

For now medphys.bst is bugged. If a book title is missing, remove the "year" field from .bib and append it to the "publisher" field

Tuesday, February 23, 2016

bash kill process by name

pkill -f csp_build.py
 
src: http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex

Tuesday, January 26, 2016

How to use svn merge to preview svn update

How to use svn merge to preview svn update
  1. Change to the root directory of your working copy.
  2. Run the command:
    svn merge --dry-run -r BASE:HEAD .
    Note: The trailing “dot” is the path of the working copy, and it is required even if you are already inside the working copy, which you should be after step 1.
  3. The above command requests a “dry run” of what will happen if we receive all changes that occurred after our working revision (BASE) and the most recent revision in the repository (HEAD). This is what svn update does, too.
  4. Review the output of svn merge and check for conflicts. If you spot any, try using svn diff to determine what is causing the conflict, or just prepare yourself to fix the conflict ASAP! :-D
  5. Now that you know how friendly or destructive update will be with your working copy, run svn update to let the fun begin!
SRC: http://translocator.ws/2005/10/12/svn-update-dry-run

Thursday, December 24, 2015

bash console GUI popup notification

The following script allows for GUI popup display for Ubuntu and the likes:

#!/bin/bash

# basic script to display a GUI popup box
# requires libnotify-bin (for command notify-send)
notify-send -t 4000 "Take a look at the console !" $(eval pwd)"\n"`date +%Y/%m/%d-%H:%M:%S`

Thursday, December 10, 2015

c++ change pointer passed as argument

To change the pointer passed in argument you need something like this:
void foo(int **ptr) //pointer to pointer
{
    *ptr = new int[10]; //just for example, use RAII in a real world
}
or
void bar(int *& ptr) //reference to pointer (a bit confusing look)
{
    ptr = new int[10];
}
 
Original thread:  http://stackoverflow.com/questions/11842416/function-does-not-change-passed-pointer-c

C++ headers and sources, templates

Original thread:  http://stackoverflow.com/questions/23962044/multiple-definition-of-first-defined-here-in-the-same-line-in-a-data-struc



If I understand you correctly, you are doing things like this:
// C.h

class C
{
   void f(); // declaration of f; ok to include in many modules
};

// definition of f; must not exist in more than one module
void C::f()
{
}
 
That doesn't work because the definition of f() will wind up in every module that includes C.h, leading to exactly the linker error you describe. You can fix this by either marking f() as inline, or by moving the definition of f() to a separate cpp file.
There is one special case where this is allowed, and that's when f() is a template (either directly or because C is a template). In that case, the definition must be in the header so the compiler can know how to instantiate it for whatever type(s) you specify. This does make life difficult for the linker since you can and often do end up with the sorts of redundant definitions that would normally be errors (e.g if you use f() in more than one module). Special behavior is needed to handle this.
Incidentally, the reason things work when you move the function bodies inside the class definition is because that has the effect of making them implicitly inline.