This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| // Get current stack trace in Java | |
| // - http://stackoverflow.com/questions/1069066/get-current-stack-trace-in-java | |
| // - http://stackoverflow.com/questions/944991/is-there-a-way-to-dump-a-stack-trace-without-throwing-an-exception-in-java | |
| // - http://javarevisited.blogspot.com/2013/04/how-to-get-current-stack-trace-in-java-thread.html | |
| import org.apache.commons.lang.exception.ExceptionUtils; | |
| public void testGetListElevesOfClassInEnclassmentForNonViecourante() { | |
| String fullStackTrace = ExceptionUtils.getFullStackTrace(new Throwable("TKT Unit Test")); | |
| System.out.println(fullStackTrace); |
| // @Note: Sample code from Broadleaf | |
| @Entity | |
| @Inheritance(strategy = InheritanceType.JOINED) | |
| @Table(name = "BLC_CUSTOMER", uniqueConstraints = @UniqueConstraint(columnNames = { "USER_NAME" })) | |
| public class CustomerImpl implements Customer, AdminMainEntity { | |
| @Id | |
| @Column(name = "CUSTOMER_ID") | |
| protected Long id; |
| ; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a | |
| ; semicolon, such as this one, are comments. They are not executed. | |
| ; This script has a special filename and path because it is automatically | |
| ; launched when you run the program directly. Also, any text file whose | |
| ; name ends in .ahk is associated with the program, which means that it | |
| ; can be launched simply by double-clicking it. You can have as many .ahk | |
| ; files as you want, located in any folder. You can also run more than | |
| ; one .ahk file simultaneously and each will get its own tray icon. |
| Installing Arch: | |
| sudo vim /etc/pacman.conf | |
| Update packages list: sudo pacman -Syy | |
| run sudo pacman -Syu before installing any software (to update the repositories first) | |
| * Timing issue: | |
| - Change hardware clock to use UTC time: | |
| sudo timedatectl set-local-rtc 0 |
| # | |
| # Working with branches | |
| # | |
| # Get the current branch name (not so useful in itself, but used in | |
| # other aliases) | |
| branch-name = "!git rev-parse --abbrev-ref HEAD" | |
| # Push the current branch to the remote "origin", and set it to track | |
| # the upstream branch | |
| publish = "!git push -u origin $(git branch-name)" |
httpOnly (and secure to true if running over SSL) when setting cookies.csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrfbodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.| Secure sessions are easy, but it's not very well documented, so I'm changing that. | |
| Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
| The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
| and to put a hardened web server in front of your Node.js application, like: | |
| [NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT] | |
| To do this, here's what you need to do: |