Mac: moving large amount of files off to external drive

I have tried to clean up my hard drive in preparation to upgrade to SSD. Moving files using Finder FAILS all the time an in the end you don't know what was copied and what was not.

I used rsynch tool because it it smart enough to copy ONLY new and changed files, so I can run it multiple times and transfer only the differences (delta).

$ sudo rsync -varpog --progress ~/Documents/SourceDir/ /Volumes/1TB_BU/DestinationDir/  Password:building file list ... 8943 files to consider.DS_Store      159748 100%  121.10MB/s    0:00:00 (xfer#1, to-check=8941/8943)2013-08-15 09.35.24.mp4    87290465 100%   22.57MB/s    0:00:03 (xfer#2, to-check=7445/8943)2013-08-15 11.51.18.jpg

...sent 26005122366 bytes  received 163790 bytes  20565667.19 bytes/sec
total size is 35588964732  speedup is 1.37

Consecutive runs:

$ sudo rsync -varhpog --progress ~/Documents/SourceDir/ /Volumes/1TB_BU/DestinationDir/  

building file list ... 8943 files to consider
sent 173.28K bytes  received 20 bytes  346.61K bytes/sectotal size is 35.59G  speedup is 205355.70



Options:

-h show full help

-v verbose
--progress show progress while transfer
-h unman readable
-q quiet for non-error
-r recursive
-a archive
-b backup
-p preserve permissions
-o preserve owner
-g preserve group
-z compress data during the transfer




As an Amazon Associate I earn from qualifying purchases.

JavaFX Scene Builder



download:
http://www.oracle.com/technetwork/java/javase/downloads/sb2download-2177776.html


As an Amazon Associate I earn from qualifying purchases.

JavaFX on Android

In this article we will explore how to run JavaFX (pure Java GUI programs) on Android.


read:

http://www.infoq.com/articles/Building-JavaFX-Android-Apps



As an Amazon Associate I earn from qualifying purchases.

Mac OS X: Yosemite: increase responsiveness

In this tutorial we will perform steps to increase responsiveness of the Mac.


Run CleanMyMac2 app

It is not a free option, but considering the amount of disk cleaned it is worth it.


Reduce Transparency


Apple > System Preferences > Accessibility > Display > Select "Reduce transparency"

You can toggle this on and off and you will see that you are not missing much.



Clean Notification Center


I don't ever use notification center so there is no reason for it to update

Apple > System Preferences > Extensions > Today



Clean Desktop


Move all items from Desktop to Documents, or where ever you wish.


Simplify Dock
  • Minimize windows using "Scale effect" which is simpler than "Genie effect"
  • NO to "Animate opening windows"
  • YES to "Automatically hide and show Dock" - if you don't have to see it, don't show it



Speed up Finder


  • since we are supposed to keep Desktop clean, it is a good default option to open
  • YES to "Open folders in tabs instead of new windows
  • NO to "Spring-loaded folders and windows"


Clean up your WiFi settings


http://osxdaily.com/2014/10/25/fix-wi-fi-problems-os-x-yosemite/

Turn off your WiFi

I am providing the following tasks in command line, but they can be done using Finder as well.

$ mkdir ~/Desktop/wifi_plist_backup
$ sudo mv /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Desktop/wifi_plist_backup
Password:
SystemConfiguration $ sudo mv preferences.plist* ~/Desktop/wifi_plist_backup/

Re-start the computer, turn ON your WiFi






As an Amazon Associate I earn from qualifying purchases.

Java: interest rate calculator

In this tutorial we will write a simple command line Java program that calculates compound interest rate.

Create new Module (application)


  • File > New Module ...
  • Maven
  • Group ID: org.clc.cit137
  • Artifact: JavaCompoundRateCalc
  • Module Name: JavaCompoundRateCalc
  • Content Root: ~/CLC/2015_spring/JavaCompoundRateCalc
  • Module File Location: ~/CLC/2015_spring/JavaCompoundRateCalc
Create Main.java



Run the program from IntelliJ


for() loop: Year 1; rate $5.0
for() loop: Year 2; rate $10.0
for() loop: Year 3; rate $15.0
for() loop: Year 4; rate $20.0
for() loop: Year 5; rate $25.0
for() loop: Year 6; rate $30.0
for() loop: Year 7; rate $35.0
for() loop: Year 8; rate $40.0
for() loop: Year 9; rate $45.0
for() loop: Year 10; rate $50.0
for() loop: Year 11; rate $55.0
for() loop: Year 12; rate $60.0
for() loop: Year 13; rate $65.0
for() loop: Year 14; rate $70.0
for() loop: Year 15; rate $75.0


while() loop: Year 1; rate $5.0
while() loop: Year 2; rate $10.0
while() loop: Year 3; rate $15.0
while() loop: Year 4; rate $20.0
while() loop: Year 5; rate $25.0
while() loop: Year 6; rate $30.0
while() loop: Year 7; rate $35.0
while() loop: Year 8; rate $40.0
while() loop: Year 9; rate $45.0
while() loop: Year 10; rate $50.0
while() loop: Year 11; rate $55.0
while() loop: Year 12; rate $60.0
while() loop: Year 13; rate $65.0
while() loop: Year 14; rate $70.0
while() loop: Year 15; rate $75.0

Create a new class CompoundRate.java




Change Main.java





Monthly payments if taken for 1 years: $21,344.63 total paid = $256,135.56
Monthly payments if taken for 2 years: $10,911.95 total paid = $261,886.87
Monthly payments if taken for 3 years: $7,436.73 total paid = $267,722.32
Monthly payments if taken for 4 years: $5,700.87 total paid = $273,641.83
Monthly payments if taken for 5 years: $4,660.75 total paid = $279,645.29
Monthly payments if taken for 6 years: $3,968.51 total paid = $285,732.54
Monthly payments if taken for 7 years: $3,475.04 total paid = $291,903.39
Monthly payments if taken for 8 years: $3,105.81 total paid = $298,157.63
Monthly payments if taken for 9 years: $2,819.40 total paid = $304,495.00
Monthly payments if taken for 10 years: $2,590.96 total paid = $310,915.23
Monthly payments if taken for 11 years: $2,404.68 total paid = $317,417.99
Monthly payments if taken for 12 years: $2,250.02 total paid = $324,002.94
Monthly payments if taken for 13 years: $2,119.68 total paid = $330,669.70
Monthly payments if taken for 14 years: $2,008.44 total paid = $337,417.86
Monthly payments if taken for 15 years: $1,912.48 total paid = $344,246.98
Monthly payments if taken for 16 years: $1,828.94 total paid = $351,156.60
Monthly payments if taken for 17 years: $1,755.62 total paid = $358,146.21
Monthly payments if taken for 18 years: $1,690.81 total paid = $365,215.29
Monthly payments if taken for 19 years: $1,633.17 total paid = $372,363.29
Monthly payments if taken for 20 years: $1,581.62 total paid = $379,589.63
Monthly payments if taken for 21 years: $1,535.29 total paid = $386,893.70
Monthly payments if taken for 22 years: $1,493.47 total paid = $394,274.87
Monthly payments if taken for 23 years: $1,455.55 total paid = $401,732.50
Monthly payments if taken for 24 years: $1,421.06 total paid = $409,265.89
Monthly payments if taken for 25 years: $1,389.58 total paid = $416,874.36
Monthly payments if taken for 26 years: $1,360.76 total paid = $424,557.17
Monthly payments if taken for 27 years: $1,334.30 total paid = $432,313.60
Monthly payments if taken for 28 years: $1,309.95 total paid = $440,142.86
Monthly payments if taken for 29 years: $1,287.48 total paid = $448,044.19
Monthly payments if taken for 30 years: $1,266.71 total paid = $456,016.78



Homework: add JavaFX UI to your app

Homework: add another method to calculate amount LEFT at the end of each year if given monthly amount is paid.


As an Amazon Associate I earn from qualifying purchases.

Java: Hello World

In this tutorial we will create the simplest of Java applications, an app that prints customary "Hello World" to the console.


Create new application module:

  • FILE > New Module...
  • Select Maven Module







Create new Java class "HelloWorld.java"








public class HelloWorld {
   public static void main(String[] args) {
      String myText = "Hello World!";
      // print to console
      System.out.println(myText);
   }
}


Run the app:









/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java -
Hello World!
Process finished with exit code 0



As an Amazon Associate I earn from qualifying purchases.

IntelliJ IDEA: Create new Project (whole class) and new Modules (applications)

In this tutorial we will create a new Project (for the whole class) and new Modules (applications).




File > New Project...





For the whole class we will select Maven type.
Select your (newest Java SDK)
Next



This setting is for the WHOLE CLASS, we will create particular Modules (applications) later.





FINISH

At this point we have a new PROJECT with a first MODULE for the whole class.
You can use this module as a final project, or you will learn soon how to create new modules.



As an Amazon Associate I earn from qualifying purchases.

JavaFx: Hello World

In this tutorial we will print the customary "Hello World" to console and the the GUI using JavaFX.



  • First we have to create a new Module (new application)
  • select Maven app






Type in group ID "edu.clc.cit137"
Type in artifact ID "javafx-hello"







Create a NEW Java Class (or File) named "HelloWorld.java"





Analyze the simple GUI in the image below.

Please type all Java code, click on the image to enlarge full screen.



In the second part of the code we have an EVENT handler for the BUTTON.
And layout of the widgets using HBox and VBox.



Finally, notice that package says "helloworld", however we are not in that package. Control click (command 1) on RED underline until options show up, select "Move to package..."



Run the app






As an Amazon Associate I earn from qualifying purchases.

IntelliJ IDEA: installation

In this tutorial we will install IntelliJ IDEA

Please download free IntelliJ IDEA

https://www.jetbrains.com/idea/download/


Select "Community Edition FREE" Current version is 14.x



After the installation you want to go to preferences and open your PLUGINS setting, some of the necessary plugins will be:

  • Maven Integration
  • .gitignore support
  • JavaFX
  • Terminal


As an Amazon Associate I earn from qualifying purchases.

Java: classes & methods

https://sites.google.com/site/chicagoandroid/050/java-class


As an Amazon Associate I earn from qualifying purchases.

Java: syntax

https://sites.google.com/site/chicagoandroid/050/java-syntax


As an Amazon Associate I earn from qualifying purchases.

Java: OOP

https://sites.google.com/site/chicagoandroid/050/050a


As an Amazon Associate I earn from qualifying purchases.

Windows: command line emulator for Unix

Cygwin:


https://cygwin.com/install.html


As an Amazon Associate I earn from qualifying purchases.

Java: installation



Find out if you have Java


$ which java

/usr/bin/java

$ whereis java
/usr/bin/java

$ ls -al /usr/bin/java | grep java
lrwxr-xr-x  1 root  wheel  74 Nov 17 08:13 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

Verify that you have Java version 1.8


$ java -version
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b05, mixed mode)

uki@ CNH_PROD $ 


Install Java if you need it


Windows:
https://www.java.com/en/download/help/windows_manual_download.xml


Mac:
https://www.java.com/en/download/faq/java_mac.xml


Linux:
https://www.java.com/en/download/help/linux_x64_install.xml



As an Amazon Associate I earn from qualifying purchases.

UNIX: import public key


On Server:

cd .ssh
ls
cat ../id_rsa.pub >> authorized_keys 
cat authorized_keys 
cd

rm -fr id_rsa.pub 


As an Amazon Associate I earn from qualifying purchases.

Java: find jar

When you are looking for a given Java class, you can use this online database to locate jars:

Example, looking for log4j

http://www.findjar.com/index.x?query=log4j

Among others I get response:

[JAR] log4j-1.1.3.jar in log4j/log4j/1.1.3
[JAR] log4j-1.2.11.jar in log4j/log4j/1.2.11
[JAR] log4j-1.2.12.jar in log4j/log4j/1.2.12





As an Amazon Associate I earn from qualifying purchases.

Maven: installing apk, or arr, or jar in .m2

Sometimes you get a built artifact (apk, arr, jar) and instead of keeping it in your Downloads, or com up with a nice folder structure, you can simply put it in your Maven .m2 repository, that what it is designed for.


$ mvn install:install-file -Dpackaging=apk -DgroupId=com. mycompany.android -DartifactId= SomeApp -Dversion=1.4.42.0 -Dfile=/Users/uki/Downloads/SomeApp-1.4.42.0.apk

[INFO] Scanning for projects...

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building Maven Stub Project (No POM) 1

[INFO] ------------------------------------------------------------------------

[INFO] 

[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---

[INFO] Installing /Users/uki/Downloads/SomeApp-1.4.42.0.apk to /Users/uki/.m2/repository/com/mycompany/android/SomeApp/1.4.42.0/SomeApp-1.4.42.0.apk

[INFO] Installing .../Users/uki/.m2/repository/com/mycompany/android/SomeApp/1.4.42.0/SomeApp-1.4.42.0.pom

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------



As an Amazon Associate I earn from qualifying purchases.

Linux: set date manually

If you have a linux board that has no access to Internet, you might have to set the date manually.

root@imx6qsabrelite:~# date -s "15 JAN 2015 13:50:00"Thu Jan 15 13:50:00 CST 2015root@imx6qsabrelite:~# dateThu Jan 15 13:50:02 CST 2015



As an Amazon Associate I earn from qualifying purchases.

TextWrangler: formatting XML file

Go to directory where TextWrangle keeps all the scripts:

$ cd ~/Library/Application\ Support/TextWrangler/Text\ Filters 

Create a new file for XML formatting:

Text Filters $ touch FormatXML.sh 


This will open the new file in TextWrangler (or whatever editor you have set).
Text Filters $ edit FormatXML.sh 

Enter this text in that file and save:

#!/bin/sh
XMLLINT_INDENT=$'\t' xmllint --format --encode utf-8 -

Now you can format any XML by selecting TextWrangler menu: 

Text > Apply Text Filter > FormatXML


As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles