Scala, Java, Unix, MacOS tutorials (page 332)

During some quiet time recently, I decided to exercise my brain a little bit, and wrote a Scala implementation of Newton's Method for solving equations. In the Scala class/object below, I define two functions, f(x) and f'(x), and then solve those equations using my implementation of Newton's Method.

A quick note today on Android screen sizes and screen densities. According to the Supporting Multiple Screens document on the Android website, Android screens are broken down into a set of four generalized sizes: small, normal, large, and xlarge. Their sizes in “dp” units are:

To take a break from a project I was working on yesterday I gave my brain a little exercise to see if I could remember how to create a Java class that used the Java 5 Generics magic. Since I’ve used Scala a lot recently, I decided to create a Java version of the Scala Tuple class.

The Tuple class simply stores two values, which are often key/value pairs. Beginning with the end in mind, here’s how you would typically use a Tuple in Java (if it existed):

Flash and web privacy FAQ: What are "Flash cookies", or "Flash super cookies"?

A few weeks ago I wrote an article on Web browser privacy, security, and Flash cookies, and as I was just correcting a few mistakes in it, I noticed this line:

When I first installed Better Privacy, I found a whopping 226 Flash cookies (LSO files) on my filesystem.

I was just reminding myself how to write a generics class in Java, and for some reason while I was doing that I wanted to use the Java 'import static' capability so instead of typing this:

System.out.println("foo");

I could just use this:

out.println("foo");

The only thing you have to do to make this happen is to use this import static statement at the top of your class:

With all apologies to Google for copying and pasting this block of source code, in my opinion, this simple example is so good at explaining the Android Activity lifecycle so well that it needs to stand out on its own page:

Android Fragments FAQ: How do I access an Activity widget from an Android Fragment?

All you have to do in your Fragment code is use the getActivity method to get a reference to your Activity, and then the usual findViewById method to get a reference to your widget:

Android FAQ: Can you share some source code for an Android send email method?

If you need a simple Android 'send email' function/method, this source code should do the trick for you:

I recently had a problem with an Android emulator, and for some reason I wasn't able to delete the Android app I was developing. I knew you could delete Android apps from the command line, but I had no need to do this until now.

After reading a few docs, I found that I could delete my Android app from the command line using the adb command, like this:

With my usual apology of late that I don't have much time for writing these days, if you're working with Android Honeycomb (3.2) or newer, and want to put a menu item in the ActionBar (Action Bar) for an Activity, I hope this source code will help.

To put a menu item in the Action Bar, you'll need to edit these files:

Acer Iconia A100 FAQ: How do I turn off the crazy blinking home button/light on the Acer Iconia?

The Iconia home button light blinks when you have a notification you haven't responded to, such as a new email message. To turn off the blinking light, look at the menu bar at the bottom of the screen, and just to the left of the time you'll see an icon indicating that you have some sort of notification. Tap on that icon, delete your notification(s), and the home button will stop blinking.

Google has a nice Android UI design guidelines section on the Android website. As I'm working on a new Android tablet application, I keep looking back at this section, and these are the most relevant pages for me:

When using Android with "soft" touchscreen keyboards, you can change how the keyboard looks, and how the EditText widget works by specifying an inputType when you create your EditText widget.

Summary of my Acer Iconia A100 tablet review: The Iconia A100 is probably the best tablet available for Android Honeycomb developers at the time of this writing (mid-March, 2012), but I don't recommend it for consumers.

Iconia A100 -The "pros"

Overall, I'd give the Iconia A100 a 7 out of 10 on my scoring scale (I reduced this from an "8" after living with it for a week), so even if I don't write everything I like, there is a lot to like about it:

As I wrote in my two previous articles (Amazon KDP Select free promotion - Day 1, and Amazon KDP Select free promotion - Day 2), I've been participating in the Amazon KDP Select free ebook promotion program for the last two days to see how that would affect sales of my new ebook, How I Sold My Business: A Personal Diary.

I haven't gotten around to formatting the pages that you'll see just yet, but a cool thing about Drupal is that with the CCK and Views modules, you can very easily create and then display new "content types" on your websites.

For example, I just added the following content types to the devdaily website:

Android FAQ: How do I get a list of Android devices on my computer system (Android AVD devices and physical devices that are currently attached)?

At your command line, just use the adb devices command from the Android SDK:

adb devices

This will list all the names of AVD devices and physical devices currently installed on your computer.

Wait - Don't buy my book! Thanks to a very cool Amazon.com KDP promotion, my eBook, How I Sold My Business: A Personal Diary, will be made FREE this weekend.

I began an experiment with the Amazon KDP Select free promotion program yesterday. I just released my new eBook, How I Sold My Business: A Personal Diary, on Monday of this past week, and when I learned about the KDP Select program, I thought I'd give it a try, so I made my ebook from on the Kindle Store this weekend.

I just went through the process of self-publishing my new eBook (How I Sold My Business: A Personal Diary) on the Amazon Kindle store, and after trying a number of different approaches to get my ebook to look the way I wanted it to look, I thought I'd share what I learned here.