setDefaultCloseOperation(EXIT_ON_CLOSE)
Software, web, and programming tips: C++, Java, C, Linux, Windows, Cygwin, Firefox, Vim, WWW, RSS
Thursday, October 9, 2008
Wednesday, October 8, 2008
Eclipse - Tabs to Spaces only
- Window menu → Preferences...
- Java → Code Style → Formatter → New... button
- Enter any name → OK
- Indentation tab → Under General settings, set Tab policy to Spaces only
Monday, August 18, 2008
Wednesday, July 16, 2008
Sunday, May 18, 2008
Saturday, April 12, 2008
Friday, April 4, 2008
Virtual functions performance cost
From Efficient C++ Performance Programming Techniques:
Virtual functions seem to inflict a performance cost in several ways:
- The vptr must be initialized in the constructor.
- A virtual function is invoked via pointer indirection. We must fetch the pointer to the function table and then access the correct function offset.
- Inlining is a compile-time decision. The compiler cannot inline virtual functions whose resolution takes place at run-time.
Thursday, March 13, 2008
Sunday, January 20, 2008
Use FireFox as the default browser to open links in Outlook
1. Open Explorer
2. Select Tools and then Folder Options
3. Select the File Types tab
4. Select Extension: (NONE), File Type: URL:HyperText Transfer Protocol
5. Click Advanced toward the bottom of the window
6. In the Edit File Type window, select open and click Edit
7. Clear the check for DDE above the DDE message box (which should contain "%1" or similar)
8. Click OK, Click OK
9. Repeat for File Type: HyperText Transfer Protocol with Privacy and FTP
2. Select Tools and then Folder Options
3. Select the File Types tab
4. Select Extension: (NONE), File Type: URL:HyperText Transfer Protocol
5. Click Advanced toward the bottom of the window
6. In the Edit File Type window, select open and click Edit
7. Clear the check for DDE above the DDE message box (which should contain "%1" or similar)
8. Click OK, Click OK
9. Repeat for File Type: HyperText Transfer Protocol with Privacy and FTP
Sunday, January 13, 2008
Wednesday, October 31, 2007
C/C++ Show macros
In gcc or g++, to show all of the macros that are defined for a given platform:
gcc -dM -E test.cor
g++ -dM -E test.cpp
Sunday, October 28, 2007
Ubuntu - core dump
From https://answers.launchpad.net/ubuntu/+question/10616
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!
Thursday, October 11, 2007
VIM - omnicppcomplete
I had to put these in my ~/.vimrc to get omnicppcomplete to work
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
VIM - NERDTree plugin
Good file explorer.
plugin: link
Add this to ~/.vimrc
plugin: link
Add this to ~/.vimrc
"NERDTree Toggle
noremap <Leader>][ :NERDTreeToggle
Tuesday, October 9, 2007
Tuesday, October 2, 2007
Linux - xbindkeys for Logitech G5
This is my ~/.xbindkeysrc for my Logitech G5:
Additional help: link
"/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
Additional help: link
Thursday, September 20, 2007
Monday, September 10, 2007
Wednesday, September 5, 2007
UNIX/LINUX - Customized bash prompt
If you want your bash prompt to look like this:
[10:27:57 AM] hostname:~/some_dir
$
Put this in your
You can change the colors and other properties as well.
[10:27:57 AM] hostname:~/some_dir
$
Put this in your
.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
You can change the colors and other properties as well.
Tuesday, September 4, 2007
X11 - Dell 2405fpw xorg.conf
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
Subscribe to:
Posts (Atom)