Making my Chromebook more powerful/flexible with Crouton

It's been awhile since my last post so I need to keep this thing alive somehow. The last few haven't been technical in nature, so let's do that. There has been much ado about #Chromebooks recently -- see my G+ post regarding this. In one of the comments of the numerous writings on them was a link to a page (or another similar post) describing how to add a #chroot to a Chromebook and run a Linux distro side-by-side with ChromeOS... no dual-booting! This was attractive to me both to give me "a real shell" along with using ChromeOS simultaneously, and allow me to do coding (for now) without a cloud-based IDE or code editor. It gives me easier access to local files and allows me to use a more traditional development environment.

The screenshots just happen to be for the Samsung Series 3 Chromebook, which is what I have (actually the 3G version, or XE303C12-H01US to be exact). Better yet, the instructions there were fairly accurate. What was missing? One screenshot with the warning that transitioning to Developer Mode should only be for the faint of heart and that you're likely voiding your warranty was absent. There was also no mention that during the 11.5 minutes switching to Developer Mode also shows a progress bar at the top showing the total time elapsed and ETA of time remaining. The Ubuntu installation did take a bit less than the advertised half-hour (20 minutes), but I'll attribute that mostly to the fact that I used a USB Ethernet adapter rather than going over the air.

One other missing instruction was that at the end, one of the tools asked about designating a local user with the following prompt: "Please specify a username for the primary user." I entered "root" because nothing else (legitimate) came to mind, but it didn't like it and aborted. I reran the script with a "-u" option for update, and this time entered "chronos" since that appeared to be the shell's username. After the username, it asked for something else: "Enter new UNIX password:". After giving it a password and confirming, I get the acknowledgement with the tips as illustrated in the post. Here's a snapshot of this flow missing from the blogpost:

Prompt for username and password

Unfortunately I didn't take a snapshot of the disk space beforehand, but afterwards, of the total 16GB SSD capacity, only 15% has been used up, leaving usable room for me to work with. In the last part of the post, it mentions that if you have second thoughts or wish to restore your Chromebook, that's just as easily done too, so there was no reason not to try this! I'm glad I did as things so far, everything seems to be working okay, probably better than I think.

I've only run into one annoying problem: I couldn't seem to background the starting up of the system with sudo startxfce4 If I did a ^Z, put it in the background, or somehow close my shell, it would cause the X server to hang, requiring me to kill or "kill -9" the processes related to the X server. I came up with a solution that seems to work for now, but perhaps some of you can tell me what the real issue is so I can adjust mine as appropriate. For now, the solution I have involves using nohup, which comes in the form of an alias that I added to my .bashrc file: alias startx="(cd;sudo nohup startxfce4)&". Anyone have a better solution or can tell me what the issue is? Anyway, I can now exit the shell, even end the crosh session, and close the browser tab..., all without killing my Linux desktop. CTRL-ALT-SHIFT left and right arrow move me back-and-forth easily between both environments seamlessly.

The article also doesn't mention that the "NetSurf" browser that comes with Linux isn't able to handle modern day web pages, so if you need a "real" browser, you can get the 32-bit ARM version of the Chromium browser. If you didn't already know it, Chromium is the open source code that Google Chrome and ChromeOS are based off of. To get the Chromium browser: sudo apt-get install chromium-browser. Here's what the Ubuntu screen on my Chromebook looks like:

Ubuntu X Windows desktop on my Chromebook

Want to customize your XFCE desktop? Check out these instructions. The default screen is just that... default and not very fancy. One of the things that XFCE is known for (besides being quick and lightweight) is having a highly-customizable desktop, so you should take advantage of that.

Finally, I can also bail on the X server (and having multiple environments) completely if I sudo enter-chroot directly from the shell in crosh to "open a terminal" to the Ubuntu work chroot environment! For example, as far as sharing files go, ~/Downloads is the obviously place the article suggests (proof below using enter-chroot), but one place it doesn't mention is the SD drive slot. The SD card contents/filesystem comes up via your file manager in ChromeOS, and in Linux, it's mounted for you at /var/host/media/removable.
chronos@localhost / $ ls ~/Downloads
crouton  test.txt
chronos@localhost / $ sudo enter-chroot
Entering /usr/local/chroots/precise...
$ ls ~/Downloads
crouton  test.txt

My next challenge is to find an HDMI-to-VGA adapter (w/DA conversion and power as necessary) so I can take this as my only computer on the road and be able to deliver presentations with it.

To summarize:

  1. Chromebooks in the news a lot; some complain they're not laptop replacements

  2. I want to change this from the developer's perspective

  3. Running Linux side-by-side with ChromeOS is one way

  4. I found a cool post about Crouton and followed its instructions

  5. The process was relatively quick and painless

  6. The post was missing a few things (clarified here)

  7. sudo startxfce4 to run X Windows or sudo enter-chroot for just a shell

  8. Want to share files? Use ~/Downloads or the SD card slot & /var/host/media/removable

  9. Need a web browser? sudo apt-get install chromium-browser

  10. I'm more confident that I can take my CB as my only laptop on the road

  11. Before doing that, need to solve the last problem: HDMI-to-VGA conversion

  12. If something doesn't pan out, you can can revert it all

Any other tips or tricks from you all are welcomed!

Vibram FiveFingers (Five Fingers) best practices

Every now and then, as you're out-and-about, you may notice these peculiar "shoes...;" they are very noticeable and odd looking when you first see them and remind you of gloves made for feet. These are the famous Vibram FiveFingers "barefoot shoes." Well, they aren't really shoes as much as socks with a good ol' Vibram sole.

"They must be comfortable," people say. Surprisingly, I usually respond, "not really." That's not their purpose I say. "At least, not a first," I correct myself. "You basically have to wear these every day for 6-8 weeks straight before you get used to them." Wearing fully-insulated, arch-supporting, padded, comfortable shoes spoils your feet and make your muscles lazy. These take you out of that comfort zone and put you nearly on-par with how humans were created to walk and run: barefoot.

Of course, going about in barefeet isn't exactly safe, so what's better than awesome Vibram soles to protect you? And that's the entire point. Aren't those barefoot running Kenyans who seems to always win the big name marathons? How can that be? Well, perhaps they're running the way we were meant to (except for the paved asphalt road).

Given my recent back & health [hypertension] problems, a caveman diet (meat every now and then [when the hunt is successful] then veggie at other times), and trying hard at reducing the amount of garbage I send to landfills (consume less, generate less garbage, etc.), trying to significantly reduce my impact on this planet, getting these shoes was a logical step and nearly a no-brainer. What should you know before getting yours?

One: they're not normal. Well, you already knew that, but sizing them for your feet will confirm that. You don't order by "shoe size." You order based on the length of your longest foot. Use this calculator: I'm a US size 11 FWIW, but my foot indicated I needed to order a size 44, so I did. The retail for the KSOs at the time I bought mine (Jun 2011), was $85, but I got them on sale for $68+free shipping.

Two: there are many counterfeits online. All the "real" color combinations can be found on Vibram's website. Anything else more exotic is likely a knockoff, which are bad in most ways from what I understand. Be sure to order from an authorized retailer with a brick-n-mortar storefront.

Three: once you get 'em, you need to be able to put 'em on. Do it in the same way as you'd put on a glove for your hands: get your fingers (toes) all the way in, then slip the back on, tie the strap, etc. It'll take time (days, weeks) to get used to them. You'll discover you want to land more on the ball of your feet rather than the heel... not a problem. You will take shorter strides, also good. In general, you're gonna land on the front half of your foot more than the back half.

Four: my goodness, I don't think that my feet stink, but this is ridiculous. The good news is that you can just toss them into the wash. I also carry a travel size can of Lysol with me. The real secret best practice for me: hairdryer on full/hot as soon as you take them off... don't give time for bacteria to significantly form/grow. The hairdryer dries the moisture and fries the germs. If not, then the dosage of disinfectant after they're dry will take care of that. You'll know when this is less effective and that you should throw them in with your laundry. When you take them out, use a cloth to dry out any initial water followed by your normal routine with the hairdryer and disinfectant spray.

Five: not so great on a rainy day or wet sidewalks. The FiveFingers Flow is better when there's a lot of water or if you wish to swim with them, but the Classics and KSOs just get all wet, squishy, and icky inside! If you have to wear them for hours like I did in Jakarta with tropical rainstorms throughout the day, they were just nasty by the time I took them off on my hotel room at night! The Flow is also better in cold weather from what I've read. I know this because from a hot & humid 95F/35C Indonesia, I went to a chilly 36F/2C Berlin right after.

Anyway, YMMV. Good luck and enjoy!!

Here I am to the left, with the FiveFingers KSO ("keep stuff out") shoes in the San Francisco Giants orange and black colors to the left while my EuroPython 2011 colleagues show off their FiveFingers Classic shoes. You can see the KSOs are aptly named as there is an additional layer to resist sand, pebbles, and other road/trail debris from getting inside. (photo taken in Firenze, Italia [Florence, Italy] courtesy of Ade Oshineye)

Below are links with more info about "VFFs" as they're commonly called, other best practices, stories, and general information about barefoot walking/running:

South America, take 1

Bom dia!!

I'm in South America for the first time in my life... it took long enough! My first stop is São Paulo, the technical capital of Brazil, save perhaps Belo Horizonte. My co-workers and I came to give talks at the Google Developer Day event here today. I'm actually needing to go to bed now because i need to wake up early to leave the country for Argentina where we're doing another Google Developer Day at the beginning of the week. I'm also hoping to hook up with some Alan Parsons Project fans down there too, some whom I've known for years without ever meeting face-to-face!

After this event, I depart Buenos Aires for Junín, about 3 hours away for the upcoming PyCon Argentina conference! I look forward to seeing familar faces in the Python community there and delivering one or two talks there. I spend a few more days in "BsAs," as the locals call it, then return back to São Paulo for two more events: Python Brasil and CBsoft. Interestingly enough, of the list of talks I proposed to both the Argentinian and Brazilian events, both event organizers picked the same pair of talks. That's somewhat good news for me since I don't have to rehearse as much. The CBsoft talk is the most unique one of all, and it's about the future of computing.

This is a talk which I'm reprising from the unconference "unkeynote" I gave to the Google Teacher Academy event in Seattle towards the end of July. Attending this event are "innovative educators," teachers, technologists, librarians, administrators, and other education-related professionals focused on primary and secondary education. Each event candidate has to go through an application process where applicants must show they have developed new, interesting, and effective ways of teaching to students. Once you're accepted and go through the training program, attendees become "Google Certified Teachers." Here is one teacher's experience, another's, and yet a third.

I was merely visiting one of the Google teams I support up in the Seattle office when I ran into the GTA dinner event while having supper myself. I introduced myself to the coordinator, and later that evening, thought it would be a wonderful experience to pull out some notes to an old education-flavored talk I had developed in the past (well, two different talks actually, whose contents were eventually merged). The idea of this talk was to describe all the phenomena around the shift from traditional PC-based user computing to the Internet, and now to an Internet-facing service world, better known in some circles as Web services or cloud computing.

I pulled together the talk then proposed it as one of the many individual sessions voted on by the membership. The event was held in a "BarCamp"-style where attendees chose each of the talks/discussion sessions. Little did I know that they all wanted me to speak to all of them... right then and there, making for an unofficial "unkeynote" at this unconference!!! Now I get to do it again, but perhaps add a few more elements for CBsoft. It turns out that this is a "sponsor keynote," something I wasn't anticipating, meaning that I probably have to thrown in a few more company products into the talk without making it sound like a salespitch. Easily done. Both Python and Google App Engine are clearly pointed out in the talk, so that gives me a chance to add some material there.

All-in-all, I'm looking forward to all my talks, and if the dining is as fine as it was tonight at the original Fogo de Chão *in* Brazil, this is going to be a great trip, meaning I'm going to have to work harder to loose weight!! When I get back in October, I hope to see some of you in my next Python training course, Oct 18-20 in beautiful San Francisco... please come and join me for another intense Intro+Intermediate Python 3-day training session!!

Best wishes to my Egyptian friends

As some of you may know (well, i haven't been hiding it), Egypt is one of my favorite places in the world to visit. I'm deeply saddened by the injuries and loss of life that's happening now. Not only has the Internet and mobile networks been taken down by the government, but there are now reports that the police are setting cars on fire to blame the protesters and water being shut off.

The people are (in general) warm and friendly, not to mention able to deal with my horrible Arabic. Still, i think they found it quite amusing that i was able to tell them that I wasn't Japanese, and that I was Chinese and that I was from America... some were quite surprised that there are actually Chinese people *living* in the US. :-)

The people are clearly dissatisfied with the say things are going in their country, and i hope that their demonstrations are able to bring about the change that they're seeking. Below are some of the key links that I've grabbed from my Twitter feed and elsewhere. Hope it helps you apprised of the situation there as well during time of civil unrest.

Is email only for old people?

Some people seem to think so. I've talked with some young people recently who only message via Facebook, text, or IM. The problems with those approaches are that not everyone: has or uses a FB account, knows how to text on a phone, or is on IM all the time. I find email to be a nice OOB way to reach people and also leave a record, because... yup, not everyone turns on IM archiving, and I'm not really sure people want to.

On the other hand, there is another extreme... too much email. I have more than 12 email addresses to help me sort my life and the messages that pass through it. At work, I need an army of filters to rearrange it all, but it's still like taking a pot to a waterfall and trying to catch every drop that comes down. The most useless ones, of course, are the "me too" messages that I wish the senders would have a bit more discretion, mature, and just click "Cancel" instead of "Send". I've found myself with a "Drafts" folder that seems to grow (albeit slowly) with messages that I had second thoughts about. It's interesting to review those to try to recall why it was that you chose not to send it.

Below is some optional reading if you wish to go further down this path.

Anyway, I'd love to write more about this, but I need to... ummm, go and check my email. :P

Wrapping up 2009 and welcome to twenty-ten!!

happy new year everyone! hope you had a great holiday season! yeah, i've been slacking off here. after my last post, the 2nd half of 2009 was crazy and maddening! i gave more Python talks in the past 6 months than i've had in a long long time, most of them in one quarter actually! it was great though, and i enjoyed meeting folks everywhere. here's a quick summary of those talks:

1. AUG 12: ACCU Silicon Valley Chapter in Mountain View, CA
Python 3 talk

2.  OCT 3-4: Silicon Valley CodeCamp in Los Altos Hills, CA
Intro to Python, Office Programming, and Python 3 session talks

3. OCT 16-18: PyCon PL 2009 in Ustroń, Śląskie, Poland
References/Memory Model and Multithreading invited talks

4. NOV 7: ACM (San Francisco Bay Area Chapter) in Cupertino, CA
Intro to Python 1-day seminar

5. NOV 9-11: 3-day public training course in San Francisco, CA
Comprehensive Intro+Intermediate Python

in addition, i've recently joined Google as part of the App Engine team, so i hope to see many of you at upcoming cloud computing or Google technical events. now i have something else to evangelize in addition to Python! with that said, my number of speaking engagements isn't declining any time soon. here are a few events that i'll be participating in over the next few months:

6. FEB 17-21: PyCon 2010 (largest Python conference in the world) in Atlanta, GA
1 Python tutorial, 2 Python talks, plus an App Engine event

7. FEB 27: Dare 2B Digital conference in Los Altos Hills, CA
Intro to Programming & Creating Web Applications on Google App Engine sessions

8. MAR 15-18: Cloud Connect, Santa Clara, CA
Building on Google App Engine (tutorial)

9. MAY 10-12: 3-day public training course in San Francisco, CA
Comprehensive Intro+Intermediate Python

upcoming Python knowledge/education events

wow, i'm used to doing one entry per month, but i've been busy lately plus preparing for PyCon back last month, and of course, taxes! now that they're over, i have some upcoming projects i wanted to share with you. i'm doing 3 Python knowledge/education events within the next few months, and here they are:

1. APR 29: O'Reilly/Safari Books Online "What is Python?" webcast (FREE to all)

2. JUN 15-17: Comprehensive Introduction to Python (3-day public training course, San Francisco, CA)

3. JUL 20, 23: O'Reilly Open Source Convention Tutorial instructor and session speaker (San Jose, CA)

if you have any questions, please let me know! hope to meet (or "meet") you at one or all!

2008 was crazy!

2008 was a crazy year -- list below not in any particular order:
  • 2008 USA Presidential Election/Barack Obama/Sarah Palin/Tina Fey
  • Gas @ $4.85/gal and $1.35/gal (oil @ $150/barrel and oil @ $38/barrel)[!] (pic1) (pic2)
  • M$FT does *not* buy YHOO
  • Bailouts everywhere (i want out of my mortgage too!)
  • Releases of both Python 2.6 *and* 3.0, the next generation, at the same time
  • Big 3 auto and other execs on the hot seat
  • Non-Katrina hurricanes Gustav and Ike try to damage the gulf states
  • CA state Prop 8
  • Olympics/gymnast ages/Michael Phelps/CGI opening ceremonies
  • Add a leap second
  • I changed jobs
  • Royal Flush vs. 4 Aces (featuring Everybody Loves Ray Romano) in WSOP 2008 main event
  • Implosions of WaMu, Wachovia, Countrywide, Bear Stearns, Lehman Bros, Merrill Lynch, AIG, Fannie Mae, Freddie Mac...
  • Over 1000 ppl at PyCon(!)
  • NY Gov Spitzer and Ashley Alexandra Dupre
  • WGA ends strike to give ppl their TV again
  • Hostage rescue in Columbia
  • Massive earthquake in Sichuan/Cheng-Du
  • Bill Gates retires
  • Iraqi reporter throws shoes at Bush
  • Tech: Apple launches iPhone 3G, Hulu explodes, Asus Eee PC creates new "netbook" class
  • H2O on Mars
  • Terrorists terrorize Mumbai (the city formerly known as Bombay) hotels
  • In memoriam: (actors/comedians/entertainers) Paul Newman, Heath Ledger, Charlton Heston, Roy Scheider, Mel Ferrer, Majel Barrett Roddenberry, Cyd Charisse, Eartha Kitt, Bernie Mac, Estelle Getty, George Carlin, Harvey Korman, Suzanne Pleshette, Dick Martin; (musicians) Issac Hayes, Paul Davis, Richard Wright, Bo Diddley, Levi Stubbs, Jeff Healey; (reporters & newsmakers) Tim Russert, Jim McKay, "Deep Throat"/W. Mark Felt, Bobby Fischer, Edmund Hillary, Bettie Page, Richard Blackwell; (authors) Michael Crichton, Arthur C. Clarke, Louis "Studs" Terkel, Tony Hillerman; (filmmakers) Stan Winston, Sydney Pollack; and many others which have been left out...
Name another year where this much stuff happened...

Thinking back to Jan 2001 and Mumbai

On 2001 Jan 14, after a delicious meal of Udon (850JPY) and Beef Curry on Tonkatsu (1000JPY), we took an ANA flight from KIX to BOM that lasted 9:45! As the major financial and entertainment capital of the country, I was surprised at how old-fashioned BOM looked, and similarly, was taken aback that there were dirt roads! Coming from the US and Japan just the day before, it was shocking to not see asphalt everywhere. Tip of the day: I learned here that the horn is part of a very different traffic protocol than what we use it for here in the US... lots of little toots and beeps here and there to let the vehicles to your left and right know that you're not there because no one is really following the painted lines. LOL!

Two guides had picked us up, and my observations above were made on the 45-min ride to the Taj hotel called the Taj Mahal Palace & Tower. Our room was in the Palace part IIRC. It does cater to Western tastes for sure, but I wouldn't have had a problem with it if that wasn't the case. The pool was nice, and Internet access was available (275Rs/INR for half-hr or 550Rs for a full hour). Gotta pay the bills and check e-mail you know. Had dinner that evening in the hotel "cafe"... turned out to be around $24USD. If our ears weren't that wet, we would've gone out to eat instead.

The next day, we took a tour of the city which included Gandhi's residence in Mumbai/Bombay. We had lunch at Leopold's Cafe -- yes, we're 2 for 2 if you're keeping score with the atrocities on the day I posted this entry -- and had kebab, tandoori chicken, and garlic naan. We did some window shopping but didn't buy anything. We checked out of the hotel at 5p and went back to BOM to catch a short flight to IXU -- that is a different story for a different time. (We actually came back to BOM several days later but stayed at the Orchid instead of the Taj on that leg before heading off to our next destination, Jaipur.)

Ironically, several months later, we stayed at the Marriott at WTC3 in NYC. Perhaps people should avoid staying at places that we've lodged at... they seem to become terrorist targets. :P

Unicode{De,En}codeError: 'ascii' codec can't encode characters in position 0: ordinal not in rang...


Here is your scary Python Halloween code and hopefully a trick or treat to remedy your situation that follows below.

Does the error in the Subject line look familiar? Yeah, this is what you have to go through because, "[it] seems that you've been living two lives," ASCII strings and Unicode strings.[*]

Here is an example:

>>> t = u'\xae'

Problems occur when you're using/calling other code where there is some internal attempt to convert the string into ASCII, sometimes even by standard library code! If I try to do it on the command-line, I get the failure:

>>> str(t)
Traceback (most recent call last):
  File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 0: ordinal not in range(128)

What you need to do, because the software expects an ASCII string, is to turn it into the equivalent ASCII string (made up of binary data) yourself (from Unicode), so that the code can deal with it. You do this by encoding your Unicode string into ASCII (binary). For example, I've chosen to encode it in UTF-8 below. Notice that the str() call to my new string does not fail anymore:

>>> u = t.encode('utf-8')
>>> u
>>> str(u)
>>> print u

Notice that a valid encoding of the single Unicode character takes two bytes (at least in UTF-8 it does for this one character). The bottom line is that you need to ensure that your string is either a valid Unicode string or a valid binary/ASCII string (one that is encoded by some valid and supported codec). In other words, Unicode u'\xae' is valid, and so is binary '\xc2\xae' because it has been encoded -- it is the UTF-8 encoding of the Unicode u'\xae' character.

The ASCII/binary string '\xae' doesn't really have much meaning by itself other than being a byte with ASCII value 174. All valid printable ASCII characters are numbered 128 and less. This issue is less painful in Python 3.x where all strings are Unicode (and ASCII/binary strings are bytes arrays), but for those still on 2.x now, we have to partially live in (probably the worst of) both worlds. When you try to convert such a string back into Unicode, there is nothing that can "decode" it, so you'll get a UnicodeDecodeError:

>>> s = '\xae'

Given that "useless" binary string, attempting to convert it to Unicode will fail... these two are the same:

>>> unicode(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 0: ordinal not in range(128)
>>> s.encode('ascii')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 0: ordinal not in range(128)

Likewise, if you try to encode it using UTF-8, it will also fail because it is not a UTF-8 encoded string, and it will try to decode via ASCII before trying to encode it via UTF-8 anyway:
>>> s.encode('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xae in position 0: ordinal not in range(128)

Again, that string is only useful as the byte value 174 unless there is another encoding out there that makes this string a valid one. Okay, so I hope that we've helped you with a problem you've been having. We recommend you read more other sources of information. Don't take my word for it as I'm as trustworthy as... well, you can't believe everything that you read right?!? With that said, if you are a Unicode expert and have suggestions on how I can reword portions of this article, feel free to drop me a line -- you can find me on Twitter or Google+.

My last recommendation is that tripping up in this manner only happens if you are moving back and forth between your "two lives." If you stay all Unicode or all ASCII, that will make things more stable. If you have to operate in both modes, then at least keep the translations either at the front or at the end of your processing. In other words, if your data is stored in Unicode but your code operates on binary/ASCII (or vice versa), do one translation at the beginning, keep it the same during, then do a final reversion back to the data storage type. You will minimize your pain this way.

Finally there are many good resources out there where you can study the struggle between Unicode vs. ASCII/binary strings out there. If I get a chance to collate such a list, I'll post it here. For now, Google is your friend.

Happy Halloween!

[*] quotes (c)1999 Groucho II Film Partnership, Silver Pictures, Village Roadshow Pictures, Warner Bros. Pictures