Pages

Kennedy Meadow Campground, PCT

I started my hike from Kennedy Meadow Campground, I picked the spot because it looked promising on the Google sattlite map with Little Kern River running thru and nice mountains surrounding the area. I had no idea at the time that this campground is a long-desired goal and destination of hikers arriving from the southern, desert leg of PCT, or Pacific Crest Trail.

I arrived driving J41 road at night I thougt I ended on the end of the world, roads in Sierra Nevada, especially at night are quite an experience with narrow passes over black, abbyssal drops.

I have spent the night sleeping inside my Astro AWD van on my military cot, which is much more comfortable than pitching a tent. In the morning I hiked at first light, way before couple of families with kids, few hundred yards away would steer up.

The campgroud is big and unlike crowded midwestern camps it gives you plenty of space and privacy. The vegetation is deserty chapparal but there are plenty of trees thanks to the river nearby.
The Little Kern Rivers is a beauty, at this time of the year in the late fall it was quiet, with plenty of clean water, the edges of the river had ice at some points, but the weather and the athmosphere were a daydream.

I hiked several miles north following the PCT, but then I decided to explore the mountains to the east. The hikes up and down the mountains are very steep, but not impossible with the huge boulders and tall trees, to reach the tops there are no paths to follow, just hopping from a boulder to another, sometimes squizing between bushes and sometimes walking on dry sandbars with deer tracks. You have the feeling that the monntail lion will pounce upon you at any moment from the boulder overhanging above you, l was happy to have my rifle with me.

Reaching the peaks gives you the ultimate reward of seeing the large valley bellow, the tall trees along the river and the PCT, look small, the remote valleys between the mountains sporting not a single human path look inviting with untold stories of adventure awaiting.

I think it is important for hikers zipping along the well travelled PCT to take this extra time and explore the land to the sides. This region, although not as beloved as subalpine meadows, is one of the best places a person can choose to explore. The nature is absolutely pristine, maybe sans grizzly bears that used to roam California and are no longer. The weather especially in late summer and fall is perfect and the river allows you to refresh at the hike's end in its clear, cold water.

I hope to come back there again!



Public private thoughts

It is difficult to balance what to write in a blog to keep it real and at the same time not to wash one's dirty loudry in public. I really don't know what the recipe is, but I think I should write about things that move me forward and omit the "little" stuff like the work and all the politics. We have a choice every single day to dwell on the past (day), or build the better self. I think the later is the answer to a public journal.



Wild by Cheryl Strayed

I took Natalia to the movies tonight to see "Wild," a story by Cheryl Strayed. 

I have been reading a book by the same title. The story is about a woman walking the Pacific Crest Trail, PCT, to find herself. 

The book is amazing, and the movie is excellent as well; however, the book has much more detail. 

I was hoping that Natalia would understand my longing for mountains and time in nature.

Last year, while spending a solo weekend in the Sierras in California, I hiked along the PCT, if only for a few miles. I can envision being on this trail for weeks at a time and the pronounced effect it would have on my psychology. 

I miss the Sierra Nevada mountains.



Android: UI: horizontal divider

In this recipe we will add a thin gray line divider to our UI



       <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:layout_marginTop="6dp"
            android:alpha="0.5"
            android:background="@color/bar_grey_light"/>





Android: xmlns res-auto

You can use "res-auto" URI instead of defining custom packages:

so...

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:my_tag="http://schemas.android.com/apk/res-auto"

instead of...

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:my_tag="http://schemas.android.com/apk/res/com.my_company.xyz"



and then use your tag...

       <com.my_company.xyz.control.MyPanelView
                android:id="@+id/jdhfkjsd"
                style="@style/kjdlksjdhjhk"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                my_tag:header="@string/kjsdlfkdslkfj"



Java: Random


In this example we create a random speed jump by a certain constant.

private Random random = new Random();

private static final double SPEED_M_PER_S = 2.2352;  /* 5 MPH */
private static final double MAX_RANDOM_DELTA = 0.13;

double speed = SPEED_M_PER_S 
+ Math.min(MAX_RANDOM_DELTA, random.nextDouble()) 
* (random.nextBoolean() ? -1 : 1);


One year later

It has been almost one year since I have written anything other than technology articles on my blog, 

I am not very sure why, but it may be related to the fact that I have not read any real books either , which is really not like me considering hundreds of books I own. 

Yes, l read every day and I study a lot, I make especially good use of YouTube, but I lost the passion for writing.  

l am especially struggling with the choice of media I should choose to write. I have several documents (books) started, but I fear they will never see the light of day, on the other hand, blogs are haphazard and irrelevant. Nevertheless, here I am writing this.

I am writing tonigt with the lights out, using my large Android tablet and a pen stylus, and I must say it is fast and flewless. Let's hope I can get back to writing as a habit, maybe these notes will become a book some day.



Java: Unsupported major.minor version 52.0

This error basically means that you compiled your Java code with the version higher than that on the target machine you are trying to run it on.

 $ java -versionjava version "1.8.0_20-ea"


Java 1.8 == 8 == 52 (go figure why this confusion)

J2SE 8 = 52,
J2SE 7 = 51, 
J2SE 6.0 = 50, 
J2SE 5.0 = 49, 
JDK 1.4 = 48, 
JDK 1.3 = 47, 
JDK 1.2 = 46, 
JDK 1.1 = 45

Solution 1: update Java version on target machine (often impossible)
Solution 2: compile with lower Java version (skip on fancy language features e.g. lambdas) 

e.g. using Maven

   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
               <!-- target has java version "1.7.0_60", to be safe we use 1.6  -->
               <source>1.6</source>
               <target>1.6</target>
            </configuration>
         </plugin>


e.g. using Java Compiler

javac -target 1.6 HelloWorld.java



Java Locale p4

Create FXML layout





Java: Locale p3

in this tutorial part we will EXTEND ResourceBundle.Control to make sure Java properly reads our language properties files.


Step:
create public class UTF8Control extends ResourceBundle.Control

Step:
find package java.util public abstract class ResourceBundle


Step:
find public static class Control

Step:
find public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)


Step:

copy this method to your new class

Step:


CHANGE only what you see in line 76







Java: Locale p2

In this part we will create a simple utility class that will choose the right Locale

Note:

  • using static method
  • we are passing in character country code
  • we are returning Locale
  • this could grow to 180+ cases







Java: Locale p1

In this tutorial we will create JavaFX app that uses selected Locale to pull i18n (Internationalization) text.


Note:

  • round buttons
  • selected county name
  • text in different character set
  • money notation depending on selected country





Step : create a new IntelliJ Module

  • Module name DisplayLocale
  • create packages as shown in the picture below
  • find country flags icons about 64x64x
  • get some translation texts

Step: Create your translation .profile files

Example Australian English file

morning_greeting=G'day Mate!evening_greeting=G'evening Mate!


Step: Create class DisplayLocaleMain extends Application

Note:
  • import java.util.*
  • import javafx.*
  • extends Application -- JavaFX Application
  • implements Initializable -- automatic injection of Locale 
  • main method
  • @FXML - annotation
  • @override start method
  • css/buttons.css





Note: 

  • @Overrite initialize method
  • Currency.getInstance(bundle.getLocale());
  • NumberFormat.getCurrencyInstance(bundle.getLocale());

Note:
  • FXMLLoader fxmlLoader
  • ResourceBundle.getBundle("bundles.Language", locale, new UTF8Control());
  • fxmlLoader.setResources(languageBundle);
  • getResource("views/TranslatedPhrasesPane.fxml");
  • Pane pane = (BorderPane) fxmlLoader.load(url.openStream()); stage.getScene().getRoot()).getChildren().get(1); LanguageButtonEvent implements EventHandler
  • @Override handle method
  • LocaleBuilder.byLanguageCode(button.getId());







see next part


Android: mipmaps instead of drawables

I started to use MIP (latin "multum in parvo", or "much in little") maps in Android 4.3 code, but I still have to come up with a good explanation of this optimization technique.


Google says:

It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density. For example, an xxxhdpi app icon can be used on the launcher for an xxhdpi device.


in AndroidManifest.xml


<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher">
instead of
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">




Go: Hello World

Time to learn another language!

https://golang.org/dl/



IntelliJ IDEA had a plugin that is auto-detected when you open a file hello.go

package main
import "fmt"
func main() { fmt.Printf("hello, world\n")}



Java: manually holding execution

This snippet comes in handy when you want to hang execution of the command line app until user presses ENTER on the keyboard:


BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Waiting for you to press ENTER:");
reader.readLine(); // waiting for user indefinitely until ENTER is pressed



Java: Chicago Public Salary Analyzer



Visit page and take a look at the data:

https://data.cityofchicago.org/Administration-Finance/Current-Employee-Names-Salaries-and-Position-Title/xzkq-xp2w

Download data as CSV (Commas Separated Values) which is used commonly to import-export spreadsheet type of data.

Create a new IntelliJ IDEA Module:

  • Maven project
  • GroupID: edu.clcillinois.cit137
  • ArtifactId: chi_pub_salary_analyzer
  • Module name chi_pub_salary_analyzer
If you see Notification: "Maven projects need to be imported"
  • Enable Auto-Import

Create Main class







Create package data.reader

Reader



TextFileReader




Create new Package "data.parser"

Create new Interface Parser in which we will outline methods we want to GET our data:


CVSParser




Writer




CSVWriter





Raspberry Pi: Java 1.8


Check existing version

pi@raspberrypi ~ $ java -version
java version "1.7.0_40"





DOWNLOAD:
Linux ARM v6/v7 Hard Float ABI 76.67 MB
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-arm-downloads-2187472.html

COPY OVER TO PI

$ scp ~/Downloads/jdk-8u33-linux-arm-vfp-hflt.gz pi@192.168.1.xxx:

LOG IN TO PI

$ ssh pi@192.168.1.xxx

CHECK THE TRANSFER

pi@raspberrypi ~ $ ls -alt
total 178460
-rw-r----- 1 pi pi 80392759 Feb 6 06:44 jdk-8u33-linux-arm-vfp-hflt.gz




UNPACKAGE

pi@raspberrypi ~ $ sudo tar zxvf jdk-8u33-linux-arm-vfp-hflt.gz -C /opt
jdk1.8.0_33/COPYRIGHT
jdk1.8.0_33/LICENSE
jdk1.8.0_33/README.html
jdk1.8.0_33/THIRDPARTYLICENSEREADME.txt


jdk1.8.0_33/bin/
....






CHECK VERSION

pi@raspberrypi ~ $ /opt/jdk1.8.0_33/bin/java -version
java version "1.8.0_33"
Java(TM) SE Runtime Environment (build 1.8.0_33-b05)
Java HotSpot(TM) Client VM (build 25.33-b05, mixed mode)



Raspberry Pi: WiFi configuration

pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="XX_wireless_network_name_007"
psk="xx_my_password_xx"
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN

}


Beagle Board on Mac






Get newest HoRNDIS: USB tethering driver for Mac OS X
HoRNDIS (pronounce: “horrendous”) is a driver for Mac OS X that allows you to use your Android phone's nativeUSB tethering mode to get Internet access.

http://joshuawise.com/horndis


Serial Driver:
http://beagleboard.org/static/Drivers/MacOSX/FTDI/FTDI_Ser.dmg


FTDIUSBSerialDriver is an implementation of a serial driver for FTDI USB devices on Mac OS X.  It supports FT8U232AM, FT8U245AM, FT232BM, FT245BM, FT2232, FT232R, FT245R, FT2232H, FT4232H, FT232H and FT X Series devices.

http://beagleboard.org/static/Drivers/MacOSX/FTDI/


Cleaning space on Linux board (SD memory)

Check available space - none left

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.5G  3.3G     0 100% /



List files in a suspicious directory by SIZE:

# ls -alS

Remove biggest offenders


# rm -rf /var/cores/*

# rm -rf /var/log/*


Check space available - 89% utilization

# df -hFilesystem     

Size  Used Avail Use% Mounted

on
/dev/root       3.5G  3.0G  370M  89% /



Cygwin: git

On Windows in Cygwin shell git pull was hanging up.

Apparently on Cygwin needs to show a pop-up to ASK for password for fetch / pull / push commands, to enable that you need to execute command:


git config --global core.askpass "git-gui--askpass"



Linux: restarting remotely

Immediate restart of the Linux system.


shutdown -rF now



Android: ping server

When trying to connect from Android device to a given server sometimes you need to test if such connection exists:

1: Try from your computer is server is listening on IP_ADDRESS (192.168.x.xx) and given PORT (5xxx)


$ telnet 192.168.x.xx 5xxx

Trying 192.168.x.xx...

Connected to imx6qsabrelite.




2: From command line see if Android can ping the server:


$ adb shell ping 192.168.x.xx

PING 192.168.x.xx (192.168.x.xx) 56(84) bytes of data.

64 bytes from 192.168.x.xx: icmp_seq=1 ttl=64 time=2.65 ms



Class Repo

There is a REPO created for each class:


  1. create a free account with xp-dev.com, remember the password
  2. send the create user_name to the instructor ulucas@clcillinois.edu
  3. the instructor will manually add each student per above request
  4. mkdir ~/CLC
  5. cd ~/CLC
  6. git clone https://xp-dev.com/git/CLC_CIT_137_students_2015_spring cit137
  7. cd cit137
  8. mkdir MY_FIRST_LAST_NAME
  9. mv my_old_project_directory/ ~/CLC/cit137/MY_FIRST_LAST_NAME/
  10. cd ~CLC/cit137/MY_FIRST_LAST_NAME/
  11. pwd
  12. ls -al
  13. git add --all
  14. git commit -m "my first commit with files from class #1, #2 and #3"
  15. git push

Homework: print current working directory and list files