Related Posts
Check the Top 10 Linux Commands you can’t live without
Type the following on your cmd line (or make into an alias) cat ~/.bash_history | sort | uniq -c | sort -r | head In my case they are (for this week) ls fg svnSync (script I created) stats_fetch; stats_display (other scripts) cd crontab -e ps aux | grep ssh_map_command (another script) python emacs -nw
GRADLE: How to add a list of local .jar files to the build classpath
Sometimes you don’t want/cant use maven repos, all you have is a bunch of local jars on disk that you want to use as part of your compilation classpath, and the freaking gradle documentation is too vague. Here is an example: [pastacode lang=”java” manual=”dependencies%20%7B%0Acompile%20files(%E2%80%98lib%2Fjars%2Fgettext-commons.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Flucene-3.5.0.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjaudiotagger.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fh2-1.3.164.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fmessages.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fslf4j-api-1.7.5.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fjaudiotagger.jar%E2%80%99%2C%0A%E2%80%98lib%2Fjars%2Fmetadata-extractor-2.6.2.jar%E2%80%99%0A)%0A%7D” message=”” highlight=”” provider=”manual”/]
Get a randomly weighted key in a Map/Dictionary/Associative Array
Here’s a very useful function to retrieve a randomly weighted key from an associative array in PHP. Sometimes you need to fetch random elements from a collection but you need some elements to have a little more chance than others to be fetched (business rules or whatever…) [php] srand(time()); //dont call this inside the function […]