Ctrl+Shift+O | organize imports |
Ctrl+Shift+M | Add imports |
Ctrl+Alt+H | Show call hierarchy |
Ctrl+T | Show type hierarchy |
Ctrl+1 | quick fix |
Alt+Shift+J | Add comments |
Ctrl+I | correct indentation |
Ctrl+Shift+Space | show parameter hints |
Ctrl+D | delete a line |
Ctrl+Shift+Delete | Delete to the end of line |
Alt+Up/Down | move current line |
Ctrl+Q | jump to last-edit place |
Alt+/ | auto-completion |
Ctrl+Alt+J | Join lines |
Shift+Alt+Up | Select Enclosing Element |
Shift+Alt+Left | Select Previous Element |
Shift+Alt+Right | Select Next Element |
Ctrl+O | open outline dialog |
Ctrl+Shift+R | open resource dialog |
Ctrl+E | show opened files |
Ctrl+Shift+E | open a dialog showing opened files |
Ctrl+Shift+P | jump to matching parenthesis |
Monday, March 18, 2013
Eclipse shortcuts
Saturday, October 13, 2012
Git cheatsheet
My random notes on Git use.
g checkout path | for path, reset WT to Index (change WT) |
g checkout tree-ish path | for path, reset WT and Index to tree-ish (change WT and Index) |
g checkout branch | switches branch by updating the index, working tree, and HEAD to reflect the specified branch (current branch is switched) |
g checkout commit_id | check out a commit for inspection and discardable experiments. (current branch is switched) |
g checkout -p commit_id | don't switch branch; update working tree and Index interactively. E.g. g checkout -p HEAD |
g checkout -b branchname\ start_point | create a new branch from start_point and switch to it. (current branch is switched) |
g checkout | not sure yet! |
g reset path | for path, reset index to HEAD (WT and branch are not touched) |
g reset commit path | for path, reset index to commit (WT and branch are not touched) |
g reset --option commit | reset HEAD to commit, and reset index or WT according to option (http://www.kernel.org/pub/software/scm/git/docs/git-reset.html) |
--soft | only reset HEAD |
--mixed (default) | reset HEAD and index |
--hard | reset HEAD, index, and WT |
--merge | reset HEAD and index; for each file: HEAD != commit, then reset WT; Index != WT, then don't reset WT; HEAD != commit && Index != WT, then abort. |
--keep | reset HEAD and index; for each file: HEAD == commit, then don't reset WT; HEAD != commit && WT == Index && Index == HEAD, then reset WT; HEAD != commit && has local changes, then abort. |
git rebase -i upstream | interactively rebase. You can choose to squash commits. E.g. git rebase -i HEAD^4, git rebasei HEAD@{4} |
Friday, September 14, 2012
Jabberd2 and OpenFire notes
Resources:
http://www.24100.net/2009/11/federate-google-wave-sandbox-with-your-own-fedone-server/
If you have a pkcs12 that contains your private key and certificate chain, use following command to convert it to pem:
openssl pkcs12 -in startssl.p12 -out startssl.pem –nodes
Maybe you need to manually adjust order of certificates in the generated pem file. You client cert should appear first, then certs from intermediate CAs, and root CA cert.
Read comments in file http://codex.xiaoka.com/svn/jabberd2/trunk/etc/c2s.xml.dist.in
<id register-enable='true'
require-starttls='true'
pemfile='/home/gerald/ongoing/jabberd2/startssl.pem'>129-79-49-197.dhcp-bl.indiana.edu</id>
Don’t put it this way for readability:
<id register-enable='true'
require-starttls='true'
pemfile='/home/gerald/ongoing/jabberd2/startssl.pem'>
129-79-49-197.dhcp-bl.indiana.edu</id>
You will get “Host Unknown” error :-(
FedOne
router.xml
local –> secret
run-config.sh
XMPP_SERVER_PORT=5347
sm.xml: sm->id
c2s.xml: c2s->local –>id
Certificate for you domain
openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out wave1.example.com.key
openssl req -new -nodes -sha1 -days 365 -key wave1.example.com.key -out wave1.example.com.csr
Note: Common Name (eg, YOUR name) []: wave1.wave.zhenhua.info
DNS
SRV
Settting
_xmpp-server._tcp.wave1.example.com wave1.example.com 5269
_xmpp-server._tcp.wave.wave1.example.com wave1.example.com 5269
Priority and weight are not so important in our SRV settings.
Testing
dig +short -t SRV _xmpp-server._tcp.wave1.example.com
dig +short -t SRV _xmpp-server._tcp.wave.wave1.example.com
A
wave1.example.com your_server_ip_address
FedOne server config
WAVE_SERVER_DOMAIN_NAME=wave1.example.com # not wave.wave1.example.com
XMPP_SERVER_PING=initech-corp.com
Use ./check-certificates.sh to check your certificate settings.
Hostname used set in OpenFire and FedOne server should match (wave1.example.com in our example).
edit /etc/openfire/openfire.xml, change <setup>true</setup> to <setup>false</setup>. restart the server.
Server Manager –> Server Information, section “Server Properties”:
Server Name: wave1.example.com
OpenFire
Add a user named “username”. Your users will have accounts like username@wave1.example.com
Test
Open client console: ./run-client-console.sh username
type /new, /open 0, /add your_wavesandbox_account, then type a message. You should see the message in your wavesandbox page. There is delay (for me about 1 minute).
In google wave sandbox, add user@wave1.example.com to your address book
windows migration notes
Bakcup
Following is the default profile/configuration file locations for some programs. It may vary because of your customized setting during installation.
- Messenger
c:\Users\gerald\Documents\My Received Files\jenvor381158107\ - WLW
c:\Users\gerald\Documents\My Weblog Posts\
c:\Users\gerald\AppData\Roaming\Windows Live Writer\ - Skype
c:\Users\gerald\AppData\Roaming\Skype\ - Filezilla
c:\Users\gerald\AppData\Roaming\FileZilla\ - Totalcmd
c:\Users\gerald\AppData\Roaming\GHISLER\
Change file wincmd.ini: to add a section for your resolution (like [1024 x 768]) - Firefox
c:\Users\gerald\AppData\Roaming\Mozilla\ - SecureCRT
c:\Users\gerald\AppData\Roaming\VanDyke\Config\ - Outlook
pst files: c:\Users\gerald\AppData\Local\Microsoft\Outlook\
Accounts: go to registry Current_User/Software/Microsoft/WindowsNT/Messaging Sub Systems/Outlook/Profile, export and import it - FileZilla server
The installation directory. cert
Thursday, May 03, 2012
Vim Latex Suite Reference Card
Found a great reference card at http://michaelgoerz.net/refcards/vimlatexqrc.pdf. I made a picture out of it so that you can direct read it.
Sunday, April 29, 2012
Wrap acronyms with \ac in Vim
:s/\(\W\)\(\u\{2,10\}\)\(\W\)/\1\\ac{\2}\3/g
:s/\(\W\)\(\u\{2,10\}\)$/\1\\ac{\2}/g
:s/^\(\u\{2,10\}\)\(\W\)/\\ac{\1}\2/g
:s/^\(\u\{2,10\}\)$/\\ac{\1}/g
Sunday, February 19, 2012
implement readLine using read
char *readLine() { int bufSize = 1024; static char *buf = malloc(sizeof(char) * (1 + bufSize)); static int bytesAfterNewLine = 0; // number of bytes left from last call static int lastpos = 0; // where the leftover starts int totalBytes = 0; // total number of bytes in the array int foundLineBreak = 0; if (bytesAfterNewLine != 0) { memmove(buf, buf + lastpos, bytesAfterNewLine); totalBytes = bytesAfterNewLine; lastpos = 0; } while (true) { for (; lastpos < totalBytes; ++lastpos) { if (buf[lastpos] == '\n') { buf[lastpos] == '\0'; bytesAfterNewLine = totalBytes - lastpos - 1; foundLineBreak = 1; lastpos = (last + 1) % bufSize; break; } } if (foundLineBreak) break; if (bufSize == totalBytes) { bufSize *= 2; buf = realloc(buf, bufSize + 1); } int bytes = 0; while (true) { bytes = read(buf + totalBytes, bufSize - totalBytes); if (bytes != 0) break; } if (bytes == -1) { buf[totalBytes] = '\0'; break; } totalBytes += bytes; } if (totalBytes == 0 && foundLineBreak == 0) { return NULL: } else { return buf; } }
Saturday, February 18, 2012
How to delete the blank page after a table in Microsoft Word
This stupid and simple problem has been bugging me for ages!!! There is a simple workaround for me.
Select the blank paragraph, go to Font dialog, in tab "Font", select "Hidden", then the annoying blank page just disappears.
Note: if you turn on "Show paragraph marks and other hidden formatting symbols", the hidden text will be shown.
Monday, December 12, 2011
RabbIT
Configure values for sector rabbit.filter.ReverseProxy.
httpinfilters=rabbit.filter.ReverseProxy,rabbit.filter.HttpBaseFilter,rabbit.filter.DontFilterFilter,rabbit.filter.BlockFilter,rabbit.filter.RevalidateFilter
......
[rabbit.filter.ReverseProxy]
# This filter is not enabled by default, add it to httpinfilters if you want it.
# This Filter makes rabbit work as an accellerator for one web site.
# Change requests
transformMatch=^/(.*)
transformTo=http://<target_host>:<port>/$1
# Deny proxy requests, you probably want this.
# deny=^http(s?)://.*
deny=
# If we want to allow admin access.
allowMeta=true
java -jar jars/rabbit4.jar -f conf/rabbit.conf
Resource: http://www.khelekore.org/rabbit/
Friday, December 02, 2011
Memory allocation settings in Hadoop
Edit file conf/mapred-site.xml to change amount of memory allocated to sorting:
<property>
<name>io.sort.mb</name>
<value>300</value>
</property>
Edit file conf/mapred-site.xml to change amount of memory allocated to each map/reduce task:
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx800m</value>
</property>
Edit file conf/hadoop-env.sh to change amount of memory allocated to Hadoop daemons:
export HADOOP_HEAPSIZE=1000