RSS

Tag Archives: ubuntu

Fun with CR-48

Another day, another unimaginative title. Anyway, yesterday, I received my brand-new CR-48 Chrome OS netbook for free my Google. First off, thanks Google! You guys totally freaking rock and you made me day and week. πŸ™‚

The following is aΒ sort of review and impressions of what I have experienced so far in about 24 hours with the device. I’ve made some customizations to the software which I will describe below. If you follow any/all of the following things, you’re doing so at your own risk. I’m no expert on this device, but there are tons of resources already online for help. Leave a comment if you encounter any issues.

Hardware

First of all, the box art is pretty neat. I’m sure you’ve seen tons of pictures of it online, so I won’t put my own up. It just looks all neat/trendy/hipster/etc and I like it. It’s the little stuff that makes me really love Google. For example, the brown information placard that comes with the package. It looks like your ordinary safety and usage notice but it’s written with a ton of humor and it was quite entertaining to give it a read. My absolute favorite part of the whole hardware is that there are no stickers on the whole device. Ah! Beautiful. However, I was fortunate to be in the batch where they started providing stickers along with the computer as well, so I can add those if I like. Love it. The entire outside of the computer and everything except the keyboard has a rubber matte finish. While this feels really good to the touch and avoids shine, I’ve heard reports that the corners have started peeling for some people and that concerns me a bit. But it’s okay, I understand that this is a prototype model and all so I’m pretty forgiving about that. Besides, I got this for free, so I can’t really complain.

The keyboard is nice and responsive. The keys are very comfortable and typing is a pleasure – except for one thing: the touchpad. The touchpad by itself is not bad. It’s very expansive and is a Synaptic one too! That means it support multi-touch and other gestures. However, it’s also so large that my fingers constantly brush up against it and that causes me to change the cursor position and mess up where I’m typing. Grr. There’s also other annoyances which I will get to later.

There’s also a webcam on this thing, which works reasonably well. I’ve heard that there are two ambient light sensors on either side of the webcam which is neat and allows for automatic brightness modulation. The power brick is very, very tiny (the smallest I’ve seen on a netbook) but the power cord is still 3-prong.

Apart from that, the left-hand side has a VGA output and the right-hand side has a power outlet, USB port, 3.5mm headphone jack, and an SD card slot. It surprised me that there is no microphone jack as far as I could tell and there is no Ethernet port (!). How does a web-connected machine running a cloud OS not have an Ethernet jack? Luckily, there are Ethernet-to-USB cables that help with that – unless you have any other peripherals that also need USB. It’s kind of annoying that there’s only one USB port, considering my Dell Mini 10v netbook has three. Apart from that, there’s a large, powerful battery underneath. Inside, I’ve heard that there’s a 1.66Ghz Intel Atom processor, an a/b/g/n wireless card, 2GB RAM (!), and a 16GB SSD. Apart from that, the hardware is entirely simple.

Software

Now let’s talk software. I played around with Chrome OS for a while and I felt that a lot of it is really pretty polished. Things generally work as they should. Booting up the computer for the first time, I was first asked to connect to the Internet and it worked completely flawlessly and quickly, which was impressive. I wonder what people will do if they have a a MAC-filtered wireless network, since you can’t find out the MAC address from that step yet. It then performed an update which was pretty fast and then asked me to log in. The whole process was fast and nearly perfect. The only thing is that the animations on the Help tutorial were pretty laggy, but this is an indicator more of the machine’s hardware than software.

Flash works decently, although not perfectly, well on this. I watched a few 360p videos and they streamed somewhat decently. I need to do more testing to determine how much farther I can push this machine. This was all fine and dandy until I realized that I can’t do much unless I have a text editor and a way to write code. I looked up John Resig’s review of his CR-48 and he seemed to have the same issue, expect that he just SSH’d into wherever he needed and coded like that. Which brings me to my first happy surprise that there’s a terminal built into Chrome OS, with the familiar Ubuntu-esque shortcut Ctrl-Alt-T. Nice – except that it’s severely limited. In fact, apart from messing with the network connection, pretty much the only thing you can do is SSH. Resig talked about how this stripped-down SSH implementation doesn’t even allow for key-based authentication (!). A bit of a bummer. The other sad part of the terminal is that it seems to only support about 8 colors. While that’s more than 1 and that’s good, it’s not the 256 that I’ve been spoiled with, using gnome-terminal in Ubuntu. Lack of pretty Vim colors makes me sad.

Speaking of which, I still don’t have a text editor by default. Okay minor correction: qemacs is a text editor built into Chrome OS, but getting there as well as doing anything substantial under the hood requires me to switch into development mode.

This, by the way, is by far the coolest thing about the CR-48: there’s a secret switch under the battery, hidden by black tape, that, when flipped, enables a mode called Development Mode. Brilliant! Basically what this does is allow for the booting of non-Google-signed images and gives you deeper access into the filesystem of Chrome OS. After flipping the switch, the stateful partition is wiped and we’re back afresh, except for the warning at every boot that there’s a problem (hitting Ctrl-D evades that – but you need that warning when you want to restore Chrome OS). Now getting back to the terminal in Chrome OS, we have access to a shell! Yay, the Bash shell :). Here we find qemacs and a larger array of tools built-in. But it’s by no means complete at all. This SSH command is OpenSSH, rather than the stripped-down version from the factory mode and does support key-based authentication. There’s also access to the whole filesystem, which is nice. I immediately went to work trying to get a more decent text editor at my disposal. Reading online, I discovered that Arch Linux packages work pretty much out of the box on Chrome OS. I got xz (the file compression utility for Arch) and then was able to get vi on there! Success! In fact, I didn’t even need to copy any libraries over either! Vi works well, but I really wanted Vim. To do so required a bit more effort, but not too much. Further research revealed that I needed the i686 versions of Perl and gpm on there as well before I could get Vim. Look online for the exact versions of these files. Then, I read that since Vim 7.3 is built on a version of libc that is higher than what is on the CR-48, we could load only a 7.2.x version of Vim. But, that worked flawlessly and I was pleased, even if there were fewer colors than I hoped for.

All this was fine and dandy, but I wanted to do more.

Ubuntu

It takes little thought to realize that this machine is pretty much the idyllic Ubuntu box. It’s small, powerful, and has a good battery life. There are effectly two ways to get Ubuntu running on there: the easy way and the freaking hard way. The hard way is by the Chromium OS team and requires VirtualBox, a 64-bit separate Linux machine, and many, many hours of time. The easy way is an elegant script that someone wrote. It’s readily available online and you can find it. That’s the path I used, mostly because my laptop is running 32-bit Linux (sigh, I know). Anyway, the instructions were perfect and the whole installation went without a hitch. I did lose wireless connection once during the download, but the script is smart enough to realize that that’s a possibility. Rebooting and continuing downloaded the half-downloaded file and the remaining and performed the installation.

I was then in Ubuntu 10.10 (as I am now)! I was able to run an update and grab real Vim with sweet 256-color goodness. I was really surprised to see that the build of Ubuntu I had downloaded came with Compiz built into it! And it’s fast. Like surprisingly fast. And the boot time is unbelieveable. We’re talking like a ~10sec boot time here, guys. It’s insane (the same goes for Chrome OS too – very, very fast booting and near instantaneous Suspend). I’m actually writing this article in Vim on Ubuntu on a CR-48 right now and I’m happy, except for this stupid touchpad.

Now, the biggest issue I have so far is that I lost multi-touch in Ubuntu and in fact I have no settings at all for the touchpad. Actually, I have no installed drivers for the touchpad either! There are some lengthy solutions I’ve read that involve downgrading Xorg and making all kinds of copies of library and scripts from Chrome OS over to Ubuntu but I haven’t ventured into that yet. Using mouseemu, I was able to get some hack at scrolling (Alt + finger slide) scrolls right now and it’s not too bad. I just wish I could disable the touchpad when I’m typing but I haven’t gotten that to work yet. Gsynaptics picks up a PS/2 Synaptics TouchPad but I still don’t have a Touchpad tab in Mouse Preferences. That’s a definite To-Do.

Apart from that, I still have to boot back into Chrome OS to ensure I haven’t screwed that up too much. There’s a command you need to run if you want to boot into the other OS and I just put that in a script that I can run from either OS. I’m yet to test that. I’m getting about 8 hours of battery life on this, which is a far, far cry from the 2.5-3 hours my poor Mini 10v gives me and so I’m thrilled.

Conclusion

There’s a lot I’ve gotten done in the first 24 hours of having this device, but there’s still some stuff I need to do. Hibernation seems like an impossibility under this current configuration since I do not have enough disk space. I have about 2GB free space left after installation of Ubuntu, which is not nearly enough for a memory dump partition needed for hibernation. And I don’t have multi-touch and I’m really wary of getting knee-deep in Xorg again. Last time I tried to enable two-finger scrolling, I ended up reformatting my installation. Yeah, it was that bad. Anyway, that’s a wrap for now. I’m overall extremely pleased with the CR-48 and I can’t thank Google enough. You’ve made at least one loyal consumer very, very happy πŸ™‚

 
1 Comment

Posted by on January 26, 2011 in Uncategorized

 

Tags: , , , , , , , , , ,

Fun With Vim

I freaking love Vim. And yes, I’ve used Emacs in the past (mostly as the recommended editor for a class I took last year – did that for a few days and then switched back to Vim while in terminal or opened up the SSH directory locally and used Gedit. (Also, Gedit is almost certainly the best and most powerful built-in GUI editor you will ever come across. With plugin support, it’s incredibly extensible. It was my favorite editor for a very, very long time too.)

Obviously, Vim’s power comes in its insane customization options. Basically every conceivable thing you’d ever want to do on a text file can be done with a collection of cryptic characters which become not-so-cryptic as you begin to understand the language of Vim. Seriously, hacking and playing with this editor is also as fun as actually using it to code.

But of course, as with all good things in the world, there are some annoyances. Not so much in Vim as in Ubuntu. Hey I love Ubuntu and use it almost exclusively, but it’s kinda boring that it’s always so late to get updates into the main packages. Of course, that’s the reason behind PPAs in the first place, but still.. Anyway, as you may have heard, Vim 7.3 was finally released a few weeks back and of course I wanted to play with it. Basically the thing I wanted most was CursorColumn, which introduced a vertical column at whatever character width(s) you wanted. This is really useful at times when you have code formatting rules such as an 80-character limit on lines. RelativeNumber, which displays how many lines away other lines are from your current line instead of a fixed numbering system starting at the beginning of the file, is also a cool feature sometimes on certain motions (e.g.: copy next N lines – which was a pain before). And file encryption was the last big feature in 7.3, but that’s something I’ll likely never use (at least from within Vim).

So I decided I couldn’t wait until Ubuntu brought 7.3 into it’s main packages (apparently it’s not happening until 11.04 😦 ), so I figured I’d compile it myself. This I merrily did and modified /usr/local/bin/vim to point to the newly compiled executable. And this worked great for a while.. until I realized I was rather naive when I did that and didn’t include all the nice flags that would have enabled such things as Python support in use with certain plugins. So I tried to include stuff that I wanted and recompiled except I kept realizing there was more stuff I wanted. This went on for a while until one day I discovered a fully functional PPA for 7.3 πŸ˜€ (note, I really wanted the latest release on the day it was announced, so there weren’t any PPA or straight up debs that I could use on the first day that I came across). Win! For the record, here’s the PPA in question. Okay so after finding Software Sources in Ubuntu 10.10 (wow, in Software Center until Edit and inaccessible through menus? grr..), I updated and languished in Vim glory. Very gratifying indeed.

In any case, I just got that done and now I am happy. Also, the past few days of looking through Vim help and learning random stuff from the Internet (did you know that “K” over a standard C function will open up the man-page for it?!), I arrived at my .vimrc file below:

"""  Basic Configurations

set autochdir
set autoindent
set autowrite
set bs=2
set colorcolumn=80
set cursorline
set expandtab
set foldmethod=syntax
set foldminlines=3
set hlsearch
set laststatus=2
set mouse=a
set nocompatible
set number
set ruler
set shiftwidth=4
set showcmd
set showfulltag
set showmode
set smartindent
set tabstop=4
set wildmenu
set wildmode=longest,full
set wrap
set whichwrap+=h,l,<,>

""" Options

filetype on
syn on
au FocusLost * :wa

""" Python options
autocmd BufRead *.py cinwords=if,elif,else,for,while,with,try,except,finally,def,class

""" Hard tabs in Makefiles
autocmd FileType make setlocal noexpandtab

""" Theme options

set background=dark
set t_Co=256
colors mustang

""" Misc mappings and configs

cmap w!! %!sudo tee > /dev/null %
imap <c-c> <Esc>
imap <F1> <Esc>
imap jj <Esc>
nmap <leader> <space>
nnoremap <silent> <C-Left> :tabprevious<CR>
nnoremap <silent> <C-Right> :tabnext<CR>
nnoremap <silent> <C-t> :tabnew<CR>
nnoremap ' `
vmap < <gv
vmap > >gv

Some notes here:

  • Note that the first several lines under Basic Configuration are sorted alphabetically. There’s really no reason whatsoever for this except that I was far too amused that I could do this automatically. Basically you just do :set rnu for relative numbers. Then point your cursor to the first line, do N Shift-V, where N-1 is how many lines you want to select (after getting into Linewise Visual Mode), then :!sort which takes in the selected lines as input, uses the :! to execute shell commands, and of course the shell program sort to actually do the sort. I also realized this is possible by issuing N!!sort where N-1 is again how many lines I want to sort. The !! feeds in selected lines into the shell program and then the result is read back. Oh yeah and you can also do this with N Shift-V v_!sort. Basically, the point is that Vim is powerful.
  • Be sure to do set mouse=a if you want to enjoy the ability to switch tabs using a freaking mouse inside the terminal. Cool, though I rarely use it. Note that if you do this, it will override the built-in Copy/Paste functionality and I can’t seem to figure out how to directly copy text from within the terminal to the OS (or application, if on Ubuntu) copy buffer.
  • The options for set wildmenu and set wildmode=longest,full are the coolest things ever. So basically when you are entering commands, it will suggest completions on and then will iterate through the completions with each subsequent . Also, reverses through the list. This mimics the behavior of standard Bash’s completions and is thus extremely intuitive for me.
  • Another cool command is au FocusLost * :wa. As described in the Vim wiki, this basically will Write All files when the focus is lost. Very useful in my opinion.
  • The option set t_Co=256 enables colorful magic on XTerm terminals (and others). So instead of the usual 8 colors for syntax highlighting, you now get 256. Color-schemes look better, roses smell fresher, etc.
  • The line cmap w!! %!sudo tee > /dev/null % is an interesting hack that allows you to write files for which you don’t have permission when opened. It’s a pain to open a file, edit it, and then realize you don’t have permissions to write it. Sloppy approaches include writing the file to a temporary location and then copying back with permission, but that’s not nice. (One pre-emptive indicator would be to have a [readonly] flag in the statusline.) A solution is the above hack, which allows you to gain temporary super-user access and then write the file to it. Handy. This is a pretty popular hack found all over the Internet, so I’m not sure who to credit it too. I think the first place I saw it was on Command-Fu.
  • Yeah, so map jj to Esc. Just do it. You’ll see how much time you save and it will shock you incredibly causing unbounded, unexplainable glee. YMMV.
  • Finally, the last two lines which map < and > to <gv and >gv. This restores your selection after indenting or un-indenting. In my opinion, this should be the default behavior.
  • Finally, my Color Scheme is Mustang, slightly modified. I may post that up later. It’s an extremely awesome theme and my second most favorite one is Vitamin, also from the same guy. Both very cool.

I think I’ll just leave a screenshot of my Vim configuration as a final note:

 
2 Comments

Posted by on November 2, 2010 in Uncategorized

 

Tags: , , , , , ,