gcc -dM -E test.cor
g++ -dM -E test.cpp
Software, web, and programming tips: C++, Java, C, Linux, Windows, Cygwin, Firefox, Vim, WWW, RSS
gcc -dM -E test.cor
g++ -dM -E test.cpp
It appears that resource limits (which include the maximum size of a core dump file) are set by PAM on login. The settings for these limits are in /etc/security/limits.conf, which on my system (which is unmodified) is comments only. A quick look at the source code suggests that the default core dump limit is 0 (zero), which means no dump at all is created (even though the message suggests otherwise).
In summary: edit /etc/security/limits.conf, set the core limit to be non-zero (measured in kilobytes), and log in again.
I hope that works!
autocmd BufNewFile,BufRead,BufEnter *.cpp,*.hpp set omnifunc=omni#cpp#complete#Main
"ctags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
"omnicppcomplete
imap <C-Space> <C-x><C-o>
let OmniCpp_MayCompleteDot = 0
let OmniCpp_MayCompleteArrow = 0
"NERDTree Toggle
noremap <Leader>][ :NERDTreeToggle
"/usr/bin/xvkbd -xsendevent -text "\[Return]""
m:0x0 + b:8
"/usr/bin/xvkbd -xsendevent -text "\[Alt]\[Left]""
m:0x0 + b:7
"/usr/bin/xvkbd -xsendevent -text "\[Alt]\[Right]""
m:0x0 + b:6
.bashrc
:function proml
{
local BLACK="\[\033[0;30m\]"
local RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local YELLOW="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local PURPLE="\[\033[0;35m\]"
local CYAN="\[\033[1;36m\]"
local WHITE="\[\033[1;37m\]"
case $TERM in
xterm*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
ansi*)
local TITLEBAR='\[\033]0;\h:\w\007\]'
;;
*)
local TITLEBAR=''
;;
esac
PS1="${TITLEBAR}
${GREEN}[\$(date +%r)] ${RED}\h:${YELLOW}\w\
${WHITE}\n$ "
PS2='> '
PS4='+ '
}
proml
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 30.0 - 110.0
VertRefresh 50.0 - 150.0
Option "DPMS"
Modeline "1920x1200" 154.128 1920 1968 2000 2080 1200 1203 1209 1235 -hsync -vsync
EndSection
Section "Device"
Identifier "Device0"
Driver "nv"
VendorName "NVIDIA Corporation"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1200" "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
/search phrase/e
gqq | Format a single line |
{Visual}gq | Format visual selection. (ctrl+v to get to visual mode then use hjkl to navigate) |
sudo apt-get install gettext libglib2-dev libgtk2.0-dev libxml2-dev
sudo apt-get install libnss-dev libnspr-dev
./configure
make
sudo make install
make install clean
Input | Result for page 1 |
---|---|
&[Page]+5& | 6 |
-&[Page]+5- | -6- |
[&[Page]+5] | [6] |
(&[Page]+5) | (6) |
"MINIBUFEXPLORER Stuff (Enter "\mbe" minus quotes quickly to bring it up)
""Commands:
" Ctrl-PgDown - goto next buffer
" Ctrl-PgUp - goto prev buffer
" \-Backspace-= - toggle minibufexplorer
"let g:miniBufExplMaxSize = 3 "allow up to 3 lines of buffers
let g:miniBufExplModSelTarget=1
"mapmbo :MiniBufExplorer
noremap:bn
inoremap:bn
cnoremap:bn
noremap:bp
inoremap:bp
cnoremap:bp
noremap= :TMiniBufExplorer
noremapu :UMiniBufExplorer
set hid "Hide abandoned buffers in order to not loose undo history
# get default system bindings
$include /etc/inputrc
# ignore case on tab complete
set completion-ignore-case On
# prefer visual bell
set prefer-visible-bell
find . -name "*.[ch]pp" -type f | xargs perl –i.bak –p –e 's/old/new/g;'
perl -pi -w -e 's/search/replace/g;' *.php
-e means execute the following line of code.
-i means edit in-place
-w write warnings
-p loop
Usage | Effect |
---|---|
inside a function | remains even after the function call is long gone |
modify a global variable | private to a certain file |
modify a function | making those functions visible only to the file itself |
xorg-x11-f100: Cygwin/X 100 dpi fontsIn your C:\cygwin\usr\X11R6\bin\startxwin.bat, near the bottom of the file, append "-dpi 100" to this line:
%RUN% XWin -multiwindow -clipboard -silent-dup-error
xhost +You can add this to your .bashrc
C:\cygwin\usr\X11R6\bin\startxwin.batin your startup folder (e.g. Start->All Programs->Startup)
%RUN% xterm -e /usr/bin/bash -l
rm -rf dir_name
cscope -Rb
.vimrc
to" Recursively set the path of the project
set path=$PWD/**
sudo apt-get install build-essential
set expandtab
orset et
set shiftwidth=4
orset sw=4
set tabstop=4
orset ts=4
~/.vimrc
:autocmd BufNewFile,BufRead *.java,*.pl,*.c,*.h,*.cc,*.cpp,*.hpp set sw=4 ts=4 et
find . -name <file-pattern> -exec <command> {} \;
find . -name *.txt -exec grep -Hn hello {} \;
#!/bin/bash
find . -name *.[ch]pp -exec grep -Hn "$1" {} \;
@echo off
C:
chdir C:\cygwin\bin
rxvt -e bash --login -i
.Xdefaults
rxvt*foreground:whiteOther rxvt options can be found here.
rxvt*background:black
rxvt*font: Lucida Console-14
rxvt*scrollBar_right: true
~/.inputrc
# Home Key
"\e[7~":beginning-of-line
# End Key
"\e[8~":end-of-line
# Delete Key
"\e[3~":delete-char
# Insert Key
"\e[2~":paste-from-clipboard
~/.bashrc
export INPUTRC=$HOME/.inputrc
vimrc
:let g:load_doxygen_syntax=1
:help doxygen
Command | Description |
---|---|
du -hs dir | Displays disk usage of dir . -h gives human readable format (e.g. 12M) and -s suppresses every recursive directory's output |
echo $? | Displays the return code of the previously exited program |
pgrep -lf process_name | Displays pid of all running processes named process_name . -l lists the process name and -f matches in the full command line |
//Forward declarations
class OtherClass; // defined in otherClass.h
struct OtherStruct; // defined in otherStruct.h
class MyClass
{
private:
OtherClass *mMyOtherClass; //pointer
OtherStruct &mMyOtherStruct; //reference
public:
MyClass(OtherStruct &_struct);
~MyClass();
};
#include "myClass.h"
// include headers of forward declarations
#include "otherClass.h"
#include "otherStruct.h"
MyClass::MyClass(OtherStruct &_struct)
: mMyOtherClass(new MyOtherClass),
// references can only be initialized in
// constructor initialization list
mMyOtherStruct(_struct)
{
// Empty constructor body
}
MyClass::~MyClass()
{
delete mMyOtherClass;
}
const
Keyword
const
to signify (to developers, not just the compiler) that a variable does not change)./**
* This method doesn't change its object
* @param[in] obj Reference to a constant MyObj
* @return A constant reference to obj
*/
const MyObj& MyObj::myMethod(const MyObj &obj) const
{
return obj;
}
void func(BigObject obj) // Use copy of obj
{
...
}
void func(BigObject &obj) // Uses reference of obj
{
...
}
MyClass::MyClass()
{
member1 = 1;
member2 = 2;
member3 = member2;
}
MyClass::MyClass()
: member1(1),
member2(2)
//, member3(member2) // No guarantee member2
// was set before here
{
member3 = member2; // need to assign here
}
Command | Description |
---|---|
:%s *$== | Delete end of line spaces |
:'a,'bs/str1/str2/g | Replace "str1" with "str2" from marker a to marker b |
:%s/\(.*\):\(.*\)/\2:\1/g | Replace the first field (\1) with the second field (\2) separated by the : |
zf | Fold a selected block of code |
zd | Unfold a block of folded code |
:make | Run Makefile |
:w|make | Write (save) current file and then run Makefile |
:grep regexp files | Find regexp in files |
:copen | Open quickfix list. Helpful after doing :make or :grep. Press Enter on entry in quickfix list to jump to that location |
:cclose | Close quickfix list |
:colder | Display contents of previous quickfix list |
:cnewer | Display contents of next quickfix list |
:!cmd | Run cmd as if on command line. Example: :!ls |
:bw | Close current buffer |
ctrl+o | Go back once through visited lines |
ctrl+i | Go forward once through visited lines |
:h topic | Get help for topic |