Cheat Sheet

This page is a listing of things that I always forget, and would like to have close by. It should be changing constantly and possibly contain stuff which you, the reader, might find obvious or pointless, and for that, I apologise!

OSGI (Karaf)
  • Refresh feature: features:refreshurl mvn:GROUP/ARTIFACT/VERSION/xml/features
  • List exports of a package : packages:export BUNDLE
  • Find which bundle exports a package : packages:export | grep org.package.i.need

Java Web Services
  • Getting request context: ((BindingProvider)service).getRequestContext()
  • Useful Binding properties
    • BindingProvider.SESSION_MAINTAIN_PROPERTY (to mantain session across calls)
    • BindingProvider.ENDPOINT_ADDRESS_PROPERTY (to change the endpoint address dynamically)
  •  Logging of payload
    • -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=true
    • Pre 1.6 -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump="true"
Spring Roo
  • With JSF, you might need to use mvn jetty:run-exploded or mvn tomcat:run-war if you see
    javax.servlet.ServletException: /templates/layout.xhtml @8,63 locale="#{localeBean.locale}" Attribute did not evaluate to a String or Locale: null
    ROO-2598.
Mule
  • Increase test timeout: -Dmule.test.timeoutSecs=XX
MySQL
  • Clear MySQL specific escape characters from dumped SQL to work with HSQL
    • remove `
    • replace \' with '' (note that these are 2 single quotes)
    • Possibly replace \" with "
Unix Command Line
  • Unzip tar.gz : tar -xzvf name.tar.gz
  • Diskspace : df -h
  • Diskusage : du -hs *
  • Diskusage (include hidden files) : du -hcs .[!.]* *
  • Diskusage (sorted) : du -hcs .[!.]* * | gsort -h (for Mac brew install coreutils)
  • Delete specific files recusively: find -iname *SNAPSHOT*.jar -exec rm -f {} \;
  • Find java processes: ps -ef | grep java
  • Run in background: add & behind the command, then you can use the jobs command to see what jobs are running. 
  • Check working directory of process : pwdx 1234 
  • Find which process is listening on port : sudo netstat -lpn |grep :8080
  • Touchpad stops working on Ubuntu: synclient TouchpadOff=0
  • rpm
    • install: rpm –ivh packagename
    • upgrade: rpm –Uvh packagename
    • find package: rpm -qa | grep packagename
    • uninstall: rpm -e packagename
    • esplode: rpm2cpio packagename.rpm | cpio -idmv
Mac terminal
  • List listening ports : sudo lsof -i -P | grep -i "listen"
Ubuntu
  • Switch to Console Mode : Ctrl+Alt+F1 till F6
  • Switch back to Desktop : Ctrl+Alt+F7
  • Kill GUI : SysRq+K. SysRq = AltGr+Print+K on qwerty
Command Prompt
  • Find Process Listening on a specific port, for example, find who is listening on port 80: netstat -ano |find /i "LISTENING" | find /i ":80"
  • Create File: echo # Git Ignore # > .gitignore
  •  Check error level before continuing (for example for when calling mvn) : if not "%ERRORLEVEL%" == "0" exit /b
      Maven
      Oracle
      • Change Oracel10g XE port :SQL> Exec DBMS_XDB.SETHTTPPORT(8082);
      VirtualBox
      • Mount Shared folder on Centos: After creating the target folder "sudo mount -t vboxsf folder-name folder-name -o uid=500,gid=500" - 500 stands for the user and group IDs that I want to own the folder.

      No comments:

      Post a Comment