Saturday, December 13, 2014

VirtualBox Extension on Google Cloud Compute Engine

I was trying to install the VirtualBox 4.3.20 Oracle VM VirtualBox Extension Pack (found here) on my Google Cloud Compute VM Instance after setting up the X11 forwarding so that I could use the GUI for virtualbox.

I downloaded the extensions file, then opened the GUI, chose "File" --> "Preferences" --> Extensions and then the button to include extensions (the blue box with a down arrow). From there, I directed it to the file I'd downloaded and it wanted a password to confirm that it was okay to install the extension file... but I have no SSH password because that's not how the Cloud Compute Instance works...

So, I logged in from my machine's terminal again, but this time where it has my machine name (eg: "machine-name"), I put "root@machine-name" instead. Then, I went into the GUI, clicked on the "Computer" option, then "home", then the file in question and it installed beautifully.

Google Cloud Compute X11 Forwarding

I'm setting up a virtualbox instance on Google's Cloud Compute Engine. When I try to ssh in on my terminal with the given command they provide plus the following argument after "ssh"

--ssh-flag=-X

I got the error: "X11 forwarding request failed on channel 0." 

First, I updated /etc/ssh/ssh_config by running sudo [editor] /etc/ssh/ssh_config, uncommenting the following lines and putting "yes" where there was a "no."
   ForwardX11 yes
   ForwardX11Trusted yes

Then, I updated the /etc/ssh/sshd_config file, so that after the other X11 related lines it also said the following:
X11UseLocalhost no

Then, I rebooted the machine (sudo reboot) and redid the ssh command with --ssh-flag=-Y to do X11 forwarding. It worked great!

Monday, November 12, 2012

Teensyduino Trouble

I was getting an error like this (can't remember it exactly and, of course, didn't think to copy-paste it somewhere. . .).
22 java: not found

I looked for java and couldn't find it on the machine, so I tried sudo apt-cache search java and got entirely too many unhelpful results. . . (I piped it through "more" and the results still weren't terribly helpful).

Then, I found a site where they were downloading Arduino for Raspberry Pi and noticed what looked like the command I used last time I downloaded java plus the "librxtx" is part of the name of a file in the arduino software. I tried this and then the Arduino software already on the machine worked great!

sudo apt-get install openjdk-6-jre
sudo apt-get install librxtx-java

Teensyduino Setup

[edit June 25, 2013 - forgot an important step! The Teensyduino software is not, by default, an executable file! See the new step #14 for more.]

Ladyada.net and Arduino.cc make this *really* easy.

Getting started with the Teensy Board. I'm running Linux and using a Teensy 2.0, so these directions occasionally need minor tweaks for other operating systems or boards.
  1. Get everything ready. Make sure you have all the right hardware and that you know which drivers you need.
  2. I'm using Linux, so I open a terminal and use this command:
  3. uname -a
  4. Check the results of that command for the kernel version (mine is 2.6.32). If your result does not begin with 2.6, you're using an old kernel and may not be able to proceed.
  5. Also check those results to confirm whether you're on a 32 or 64 bit system. My uname -a says "x86_64," so I know I'm using a 64 bit system. My system at home returned "i686", which means I was using a 32 bit system.
  6. Download the appropriate Arduino software for your machine.
  7. Unpack the software. Here's the command I run from my home directory:
  8. tar -xvf ~/Downloads/arduino-1.0.2-linux64.tgz
  9. Sometimes the Linux installers include a program called brltty, which makes the Arduino software not work. Remove this program with the following command (in Linux):
  10. sudo apt-get remove brltty
  11. Now, there will be an arduino folder in your home directory (mine is at:  ~/arduino-1.0.2)
  12. Run the arduino software to make sure it works.
  13. ~/arduino-1.0.2/arduino
  14. Close the arduino software, so you can install some extra files to make it work for the Teensy board.
  15. Download the Teensyduino software that's right for your machine. 
  16. Linux users should also save this to file as "49-teensy.rules" -- my machine tries to be helpful and name it "49-teensy.rules.text", which gives you extra steps later on, so avoid this or rename it after you download it if you have to.
  17. Linux users will likely need to update the udev rules. Use this command (from the directory where the 49-teensy.rules file is:
  18. sudo cp 49-teensy.rules /etc/udev/rules.d/
  19. Make the Teensyduino software executable! You can checkout chmod if you're not familiar with it to make sure this is how you want to do it. Run the chmod command in the folder where you installed the Teensyduino software.
  20. chmod 755 ./teensyduino.64bit
  21. Run the Teensyduino Installer
    1. Choose where your sketchbook (Teensyduino code) should go
    2. Install libraries (I install all of them)
    3. When it's finished, click "Done."
  22. Run your arduino software again (step #9)
  23. Choose your board: Tools --> Board --> Teensy 2.0
  24. I'm using my Teensy board as a USB Keyboard, so I choose that USB Type from the Tools menu as well. 
  25. Tools --> USB Type --> Keyboard + Mouse + Joystick
  26. Confirm that you've got the right keyboard language: Tools --> Keyboard Layout --> US English
It's a good idea to start with a simple program like "Blink" to make sure the code compiles correctly and that the board is being flashed correctly.

The example code can be really useful. The program I needed was simple, so I just chose example code, altered it a little and now the board does exactly what I need it to!

To run example code:
  1. Start up your arduino software as usual (step #9). 
  2. Then, choose File --> Examples --> Teensy --> choose something! I started with USB Keyboard --> Simple
  3. Click the "Verify" button (it looks like a checkmark)
  4. Load it to the board (which, obviously, needs to be plugged in. . .) with the button that looks like an arrow pointing to the right. 
  5. It usually runs the newly-installed program right away, but if it doesn't, you can unplug the Teensy (after it's completed its flash/reboot) and plug it back in to get it to run the program.

I also recommend checking out Arduino's site for more "How-To"s. They've done a great job!


Thursday, February 2, 2012

GoogleCL Docs Upload Fixed for Gdata 2.0.15 and 2.0.16

Months ago, we fixed Google Docs Uploads for GoogleCL folks who use python-gdata 2.0.12 through 2.0.14. Today, we tackled the problem for users of python-gdata 2.0.15 and 2.0.16.

A user sent in a patch that fixed the MIMETYPES error we were getting with 2.0.15 and 2.0.16. It looks like python-gdata moved away from declaring MIMETYPES where we were calling them from, so now we name them explicitly in googlecl/src/googlecl/docs/client.py.

That was a great start, but then we started getting a DocsEntry error and uploads still wouldn't work, so we delved further. Here's the error we got after fixing the MIMETYPES problem.
AttributeError: 'module' object has no attribute 'DocsEntry'

One of our earlier searches brought us to the same error posted on python-gdata's buglist.

Then, we found this blog post, by Demon Lord, where they had success replacing the string "gdata.docs.data.DocsEntry" with the string "gdata.data.GDEntry". We tried that throughout the file googlecl/src/googlecl/docs/client.py and sure enough, that fixed it!

We tested 2.0.0 through 2.0.4 to make sure that didn't break anything for those users and then tested 2.0.12 through 2.0.16 to make sure it worked on all the versions that should be able to upload docs. It does so it's now been committed.

Tuesday, January 31, 2012

Car Troubleshooting

I'm going to use this blog the way I talk about using it: as a place for keeping all my technical stuff. Today, that includes cars.

Car 1 (the favorite) leaks oil like crazy. However, upon closer inspection tonight, I have some evidence to support my hypothesis that it only leaks when it's on (possibly only while she's in park--that was harder to test by myself). I checked the oil today, after it had been off for at least a week, and the oil looked alright. I would normally add oil, but my husband wouldn't. I didn't add any. Then, I turned the car on to check the transmission fluid levels (also has a leak, but a much slower one). Transmission levels appear fine. Turned the car off and decided, just for the hell of it, to check the oil. It was on the "L" bar! Sure enough, there was a big puddle of oil under the car, too. I watched the oil and couldn't see the drips at all. Then, I turned the car on and it dripped once a second! After the car was off, it dripped 9 times the following minute. Hopefully it's the gasket and hopefully it's not a tricky gasket to replace. . . The transmission was easy enough -- drain transmission, take off pan, put on new gasket, put pan back on. Hopefully the oil pan is the same!

MIMETYPES fix gives AttributeError: no 'DocsEntry'

The same gentleman who helped make it possible to fix the docs upload bug also suggested the start of a fix for the MIMETYPES bug we get with python-gdata versions 2.0.15 and 2.0.16 with the fix (with or without this fix, we can't upload docs via python-gdata 2.0.15 or 2.0.16, so the fix was still worth publishing).

The error I get now is:
AttributeError: 'module' object has no attribute 'DocsEntry'

A quick grep of the whole googlecl tree for the term "DocsEntry" shows me that it only exists in gdata versions 2.0.11 and 2.0.14. . . So why does GoogleCL call for it in the trunk/src/googlecl/docs/client.py file? The call for it seems to work with python-gdata 2.0.12 -- I can upload documents of txt and pdf types without a complaint about DocsEntry.

Edit: Resolved this issue and blogged about it here.

Friday, November 25, 2011

Testing GoogleCL Part 3

Apparently, you don't need to backslash the apostrophes in posts, though. Interesting.

Testing GoogleCL

If you can see this, then it worked again. Apparently, you need to put a backslash before a \! character, but then it shows the backslash, too. Also, as with the \! character in the post, I had to put a backslash before the apostrophe in my blog's title name (Let\'s Get Technical)

Testing GoogleCL

If you can see this, then it worked\!

Sunday, November 20, 2011

Python Gdata

Short version: To upload Google Docs with a service that utilizes python-gdata, use a version between 2.0.12 and 2.0.14. Keep reading for more details.

Credentiality and I spent a few hours on this tonight. Here's a brief history and a beautiful table to show you what to expect.

An SSL error occurs in a few platforms using gdata when you try to upload files to Google Docs and it doesn't appear to be limited to python-gdata. It may relate to this. Credentiality and I work on  GoogleCL sometimes, so we have all the python-gdata versions from 2.0.0 through 2.0.15 and test code with all of them, anyway. Here are some observations and what has worked for us so far.

In May 2, 2011, Google began to allow uploading "all file types" for non-premium users. Now, if you add a resumable uploader fix to a specific GoogleCL client.py file* and you use python-gdata 2.0.10 or 2.0.12 through 2.0.14, GoogleCL should upload a PDF to Google Docs successfully.

Without the resumable uploader fix, python-gdata 2.0.10 or 2.0.12 through 2.0.14 gives us this 403 error:
403, <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>Files must be uploaded using the resumable upload mechanism.</internalReason></error></errors>

When we use python-gdata 2.0.5 through 2.0.9 or 2.0.11, we get this 403.4 SSL error:
403, <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>ServiceForbiddenException</code><internalReason>403.4 SSL required</internalReason></error></errors>

The python-gdata versions before 2.0.5 can't upload PDFs to Google Docs, anyway. We get the following error for those:
{'status': 415, 'body': 'Content-Type application/pdf is not a valid input type.', 'reason': 'Unsupported Media Type'}

python-gdata 2.0.15 doesn't work with GoogleCL to upload to Google Docs, either. Currently, we get this error, which seems to be a GoogleCL error related to some change in gdata from 2.0.14 to 2.0.15:

from gdata.docs.data import MIMETYPES
ImportError: cannot import name MIMETYPES





*In the directory: googlecl/src/googlecl/docs/ .

Sunday, July 10, 2011

Hacking Gedit

If I have time this summer, I'd like to help fix bugs in gedit. I LOVE gedit and I want to contribute. Here's a heads up for those of you installing gedit from the git repository instead of from the tarball which, I believe, is what they recommend. . . but it's certainly what I prefer, anyway.

I edited their README to include install directions for people checking it out from git. We'll see if/when they take the patch. They have a good reputation for accepting help.



Simple install procedure for gedit if you checked out the source code from git:

(you may have done this already) download the most recent version of gedit
% git clone git://git.gnome.org/gedit

change to the toplevel directory
% cd gedit

generate the `configure' script
% ./autogen.sh

run the `configure' script
% ./configure

build gedit
% make

[ Become root if necessary ]

install gedit
% make install

Thursday, June 30, 2011

Chem 101

My study partner and I find our solubility chart a bit muddled for quick equation balancing. Here's our answer to this problem.

Monday, February 28, 2011

Technical Skills Update

This quarter, I'm taking a Shell Programming class. I keep finding things that would have been useful to know *before* I started hacking the Linux kernel and AOSP. It's an interesting class, though. Better late than never, right?

gedit

I love that I can highlight a block of code and comment or un-comment it all with two clicks of the mouse! Saves so much time!

Tuesday, September 7, 2010

Reboot-Persisting All-User-Access USB Serial Port on Froyo

I turned the USB into a serial port. Then, I noticed it wasn't usable without superuser permissions. Recently, I got some great information from a former Android coder and have now have a permanent fix that persists on reboot with Android 2.2 (Froyo).

First, I edit init.mahimahi.c
(mahimahi is the board for Nexus One (aka HTC Passion), if you're working on another HTC device, you'll need to edit the right file for your device).
$ gedit path/to/device/htc/passion/init.mahimahi.c

I put the following at lines 64 and 65.
#mwk: Enable Serial Port for all users
chmod 0777 /dev/ttyMSM0

I run lunch.
~/mydroid$ . build/envsetup.sh
~/mydroid$ lunch
I choose option 4 (full_passion)

I plug in a Nexus One and extract the device info.
~/mydroid$ cd device/htc/passion
~/mydroid/device/htc/passion$ ./extract-files.sh

I re-make the AOSP.
~/mydroid/device/htc/passion$ cd ../../..
~/mydroid$ make

I get the phone in bootloader mode (the fast way).
$ adb reboot-bootloader

I flash the device. (On this website, step 14 didn't work for me, so I now run the command this way.)
~/mydroid/out/host/linux-x86/bin$ sudo ./fastboot -p passion -w flashall

On the phone, I enable applications from unknown sources.
Settings--> Applications --> Unknown sources --> checked

Also, on the phone, I enable USB Debugging, Stay Awake, and Allow Mock Locations.
Settings--> Applications --> Development --> checked all three