At work I needed to create a fixed Java work pool. By “fixed”, I mean a pool that has no queue: it has a maximum number of workers, and it should not store work if it has no capacity to immediately process. Introducing the Players To accomplish this, I used the following classes: ThreadPoolExecutor – Executes work jobs LinkedBlockingQueue – Passes jobs to the thread pool ExecutorCompletionService – Gets results back from thread pool executions, and provides synchronization Instantiation I created the main thread pool using the following code:
When I am writing blog posts, I need a simple way to quickly send selected photos from my phone to my laptop. AndFTP is a simple utility that fits the bill. While it can do many advanced things such folder synchronization, my favorite feature is its “share” capabilities. After AndFTP is proper configured, I simply find the photo I want on my phone, share it with AndFTP and it automagically appears on my laptop.
Git is pretty good at branching and keeping everything neat and tidy. However, occasionally our branches get really messed up, and I have to clean things up. Here are a couple commands that I’ve found useful for this task. Deleting Untracked Files git clean -f -d Abort a merge git reset --merge Revert changes git reset --hard <COMMIT> Note that you can always use the commit hash, but if you want to go back “N” commits, you can use the commit ID of “HEAD~N”.
This is a quick post to document something rather simple, but something that took me a while to figure out. Hopefully it will save someone some time :) Firstly, all of this was gleaned from the VirtualBox documentation, specificailly the chapter on VBoxManage . To list the webcams that are installed on the system and available to VirtualBox, use the command: VBoxManage list webcams. Here is some sample output from my laptop:
Bash is everywhere. It is on Linux (obviously), on OSX, and is even on Windows with the new Linux Subsystem. However, writing scripts can be a bit tricky. However, here are three tips that I’ve found useful when writing Bash scripts. Tip 1: Use Flags There are three flags that will make bash scripting easier and save you a lot of frustrations: Abort on Errors (-e) When Bash executes a command that fails, by default, it will simply move onto executing the next command.
Static Site Generators I’m a huge fan and proponent of static site generators. They give me the flexibility to easily work offline (the Internet can be spotty out where I live), have everything backed up in Git, and the ability to deploy anywhere. My brother and his wife are thinking of creating a blog. As much as I love the way I blog (terminal + Neovim + Git), it doesn’t lend itself to people who don’t understand git and markdown.