Thursday, February 25, 2016

Useful settings for Mac OS X (Mavericks onward) / Adding GPX files directly to a Garmin Fenix 3

Here's a few settings that I came across [1] that helped make my daily workflow easier while working on a Mac, listed below:

defaults write com.apple.finder AppleShowAllFiles YES
defaults write com.apple.finder QLEnableTextSelection -bool TRUE
killall Finder

Let's cover what they do:

defaults write com.apple.finder AppleShowAllFiles YES

This command above enables the ability to show all hidden files in the Finder, which can be useful for power users (or for those who have a Fenix 3 and need to access the NEWFILES folder in /Volumes/Garmin/Garmin to upload .GPX files [2]).


Do you use the Quick look feature much in OS X?  If not, it's certainly a very useful feature to quickly peek into files on the Finder.  If you do use it and would like to copy and paste frequently from these files (i.e. source files, or general text files), the command below will enable this:

defaults write com.apple.finder QLEnableTextSelection -bool TRUE


Of course, we will need to either logout of the current session or restart the finder.  You can restart the finder by running the following:

killall Finder


In case you want to revert the above settings to default, you can run the following commands respectively:

defaults write com.apple.finder AppleShowAllFiles NO
defaults write com.apple.finder QLEnableTextSelection -bool FALSE
killall Finder


References / Sourced from:

[1] Macworld UK:
How to show hidden files and folders in Mac OS X Finder:

How to select and copy text from Quick Look previews in OS X:

[2] Itamar Latnik's Youtube post: Garmin Fenix 3 - Import a GPX Course

Tuesday, January 5, 2016

Calculate total amount of Physical RAM on all Active TaskTrackers in MR1 using Unix tools

The following should accomplish this assuming the interest is in identifying how much total physical RAM is available on all Active TaskTrackers (i.e. not blacklisted) in MR1 using common Unix commands:
for i in $(curl -s http://jobtracker.company.com:50030/machines.jsp?type=active | grep 'href="http://' | cut -d '=' -f2 | cut -d '"' -f2); do curl -s $i"jmx" | grep  'TotalPhysicalMemorySize' | grep -Po [0-9]+ ; done | paste -sd+ - | bc; 
NOTE:  Replace the http://jobtracker.company.com with the appropriate hostname of the JobTracker.
The above command will retrieve the list of active TaskTrackers from the JobTracker, iterate through the list, summing the 
TotalPhysicalMemorySize
 metric from each TaskTracker's JMX and display the end result, in bytes.

Example output:
[user@node10 ~]$ for i in $(curl -s http://node1.com:50030/machines.jsp?type=active | grep 'href="http://' | cut -d '=' -f2 | cut -d '"' -f2); do curl -s $i"jmx" | grep  'TotalPhysicalMemorySize' | grep -Po [0-9]+ ; done | paste -sd+ - | bc;

23488339968
[user@node10 ~]$



As replied here: https://www.quora.com/How-can-I-check-total-RAM-in-Hadoop-cluster-running-MR1-not-YARN

Wednesday, November 25, 2015

Not able to see all your shared Google calendars?

The following link (loaded on desktop rather than smartphone) will allow you to select which specific shared calendars are visible on the devices which read from Google Calendars (ie. your Smartphone):

https://calendar.google.com/calendar/syncselect


Context:  My wife and I recently started to share our multiple calendars on each other's smartphones (iPhones), and noticed that we were only able to see the main calendar, but not the resulting sub-calendars from each main Google account.   After digging around, the above link was found deep within the forums of Google and Apple, and was able to help expose the page where I could select which specific sub-calendars I could share out!   Hope this helps you in your quest for shared information!


Sunday, July 26, 2015

Add new Java SDK to IntelliJ CE

Sourced from: https://www.jetbrains.com/idea/help/sdks-java.html

File -> Project Structure -> SDKs -> Java SDK -> [+] -> Locate JAVA_HOME of intended JDK

Thursday, May 28, 2015

Open Dropbox folder from anywhere in Mac OSX

Hi folks,  here's a method that I implemented that allowed opening the Dropbox folder from within any application (well, it gets called by a Terminal session from the Finder).

This does not however, automatically switch to the Dropbox folder while in the middle of a application dialog box;  it simply opens up the Dropbox folder in the event you need to look into or open something within the Dropbox folder.  To access the Dropbox folder from an application dialog box, you can drag the Dropbox folder into the "Favorites" section of the application save/open dialog box to access it within one click.

Ok, if you're still interested in a hot-key anyway to access the dropbox folder,
here's how to do it:

1. Open Automator: [Cmd]-[Spacebar], type in Automator.

2. Select Service, click Choose

3. Modify Service receives selected [text] in [any application] to  Service receives [no input] in [any application].

4. Select the action Run Shell Script under Utilities, drag it over to the right pane.

5. Change the cat command to open ~/Dropbox .  If your Dropbox folder is located somewhere else, please modify the pah accordingly.

6. Save as Open Dropbox Folder within Automator.

7. Open System Preferences: [Cmd]-[Spacebar], type in System Preferences .

8. Navigate to Keyboard -> Shortcuts

9. Scroll down to General

10. Ensure the checkbox for Open Dropbox Folder is checked (enabled).

11. Choose the Keystroke combination to open the Dropbox folder.
NOTE:  If you choose [Option]-[Cmd]-[D], you may need to disable Turn Dock Hiding On/Off in the Launchpad  & Dock section.


Enjoy!

Thursday, May 21, 2015

Set alias options to dynamically change JAVA_HOME to particular JDK in Mac OSX (Yosemite)

Add the following to ~/.zshrc  or ~/.bashrc:

#Set alias options to dynamically change JAVA_HOME to particular JDK
alias jdk16 = ' export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) '
alias jdk17 = ' export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) '
alias jdk18 = ' export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) '



Re-source the rc file to pickup changes on the terminal:
$source ~/.zshrc or ~/.bashrc



Sourced from:
http://apple.stackexchange.com/questions/135058/i-installed-oracle-java-jdk-8-but-java-command-line-is-still-reporting-it-is-ver

Monday, May 18, 2015

Fix for when iMessage on Mac OSX no longer displays SMS/iMessage photos

Thanks to Ralph Johns for the info on the fix!  Here's a quick and dirty script that can help fix iMessage if it stops displaying jpeg files in Mac OSX (Yosemite*):


$cat fix_imessage.sh
#!/bin/bash

# Set file/paths to check
file_attach='~/Library/Messages/Attachments'
file_symlnk='~/Library/Containers/com.apple.iChat/Data/Library/Messages/Attachments'
target_symlnk='../../../../../Messages/Attachments'

#Start checking
echo Checking $file_attach...
if [ -d $file_attach ]
then
        echo $file_attach is already a folder.
fi

if [ -f $file_attach ]
    then
        echo $file_attach is an unexpected file. Fixing...
        echo Renaming Attachments to Attachments.old...
        mv $file_attach $file_attach".old"
        echo "Creating new Attachments folder..."
        mkdir -m770 $file_attach
fi

echo Checking symlink dependencies...
if [ -h $file_symlnk ]
    then
        echo $file_symlnk symlink ok.
    else
        echo $file_symlnk symlink broken.  Fixing...
        mv $file_symlnk $file_symlnk".old"
        ln -sf $target_symlnk  $file_symlnk
fi

echo Done.
echo Exiting.
exit



*NOTE:  Only tested on OSX Yosemite.  May or may not work on other versions of OSX.