Videos

How to play Amazon Instant Videos on Ubuntu/Kubuntu Raring Ringtail 13.04 with Firefox

We’re all aware that there are issues with Flash and playing streaming videos on Linux. You can’t play AIV on Chrome; you’ll get that annoying “If you’re using the Chrome browser with Linux, you must disable PPAPI to continue using Amazon Instant Video. You can also use a different Web browser, like Firefox. Learn more” message. Just use FF for now to play AIV. At least you’re not using Wine. So, let’s solve your real problem.

Having trouble playing Amazon Instant Videos on Firefox? Have you seen this message?

“Sorry we were unable to stream this video. This is likely because your Flash Player needs to be updated.”

Here’s how to handle this.

sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

sudo apt-get update && sudo apt-get install flashplugin-installer

sudo apt-get install hal -y

sudo mkdir /etc/hal/fdi/preprobe

sudo mkdir /etc/hal/fdi/
information

/usr/sbin/hald --daemon=yes --verbose=yes

rm -rf ~/.adobe

Now, go restart Firefox, and you should be good.

With thanks to:

http://www.liberiangeek.net/2013/03/install-adobe-flash-player-in-ubuntu-12-10-13-04-raring-ringtail/

and

http://askubuntu.com/questions/286297/is-there-a-work-around-to-get-protected-hulu-or-amazon-prime-instant-videos-work

Set up Kubuntu 12.10 and an HP printer for batch scanning in Xsane

This process needs to be much easier, but until then, here’s a script to get you set up. This is an update of an older post here: http://thetarah.com/2010/10/12/how-to-batch-scan-using-xsane/ to make this more intuitive. Instead of having you follow a long list of instructions, I’ve been testing out scripts to get my common tasks done upon my numerous Kubuntu rebuilds. I have to redo a lot of the things that I’ve posted instructions on, so I’m going to start building and posting helper scripts instead. It’s a good habit to be in anyway. I rebuild my Kubuntu box about once every two months because I am constantly breaking things.

As previously mentioned, I have an HP OfficeJet 6500 Wireless All-In-One. I am using the HP OfficeJet 6500 e709n, hpcups 3.12.6 driver; you should choose whatever driver is recommended for you. Cups printing seems to work
better and be less buggy, especially over the network. Please understand that the following script is imperfect and totally tailored to my hardware; you may need to break it apart and run it piecemeal depending on your setup. However, this should help. As usual, the links that helped me are at the bottom. Nota bene: you may need to rerun ‘hp-check –fix’ two or three times to have it complete all the repairs it needs.


#!/bin/bash
sudo apt-get install xsane libsane-extras hplip-gui -y
name=$(whoami)
echo "$name"
sudo usermod -G saned -a $name
sudo usermod -G scanner -a $name
sudo usermod -G lp -a $name
echo hpaio >> /etc/sane.d/dll.conf
hp-setup
hp-check -r
hp-check --fix
sudo reboot

https://help.ubuntu.com/community/CompileSaneFromSource
http://ubuntuforums.org/
showthread.php?t=1878250

https://bugzilla.redhat.com/show_bug.cgi?id=626984
https://answers.launchpad.net/hplip/+question/159829
https://bbs.archlinux.org/viewtopic.php?id=65431

Google Chrome Will Not Start In KDE (Kubuntu 12.10)

Have you had this problem in KDE? I’ve clicked a few times on a Google Chrome shortcut, and after 20-30 seconds of a bouncing Chrome icon, it disappears. The Chrome process never shows up in the System Monitor or in running processes, either.


/ Greetings, Madam. $google-chrome --enable-logging --log-level=0
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
No bp log location saved, using default.
[000:000]
Browser XEmbed support present: 1
[000:000] Browser toolkit is Gtk2.
[000:000] Using Gtk2 toolkit
[000:069] Starting client channel.
[000:069] Warning(clientchannel.cc:435): Unreadable or no port file. Could not initiate GoogleTalkPlugin connection
[000:069] Warning(clientchannel.cc:410): Could not initiate GoogleTalkPlugin connection
[000:069] GoogleTalkPlugin not running. Starting new process...
[000:070] Warning(pluginutils.cc:268): Failed to get GoogleTalkPlugin path. Trying default.
[000:071] Started GoogleTalkPlugin, path=/opt/google/talkplugin/GoogleTalkPlugin
[000:072] Waiting for GoogleTalkPlugin to start...
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
ALSA lib pcm_dmix.
c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
[001:104] Attempting to connect to GoogleTalkPlugin...
[001:104] Read port file, port=51719
[001:105] Initiated connection to GoogleTalkPlugin
[001:216] Socket connection established
[001:216] ScheduleOnlineCheck: Online check in 5000ms
[001:305] Got cookie response, socket is authorized
[001:305] AUTHORIZED; socket handshake complete
[006:300] HandleOnlineCheck: Starting check
[006:301] HandleOnlineCheck: OK; current state: 3

This isn’t going to be as much help as you’d hope; this post is more to show you that others have had the same problem and you’re not nuts. I don’t usually do this, but I just rebuilt my Kubuntu box two days ago after mucking about with perms (I also took remote controls apart as a kid) and lost the problem I was having here. I wanted folk to know that there was a problem with this build of Kubuntu and Chrome together. Below, someone notes that they got the
problem solved by using a different rendering system. I’m happy to answer questions about my experience with the issue and help out if I can.

http://code.google.com/p/chromium/issues/detail?id=51285
http://www.linuxine.com/story/solved-font-rendering-different-qt-and-gtk-chrome-vs-firefox
http://www.linuxquestions.org/questions/linux-software-2/google-talk-plugin-still-not-working-4175423464/

How to fix KDE, LibreOffice, and dark themes in Kubuntu

I need to use a dark theme in KDE because I spend so much time on the computer that my eyes get tired of looking at whiteness all the time. I use a very dark theme to minimize the strain on my eyes. If you use LibreOffice and a theme such as Zvon Black, you may have found that your background is totally black and you cannot read documents. Here is the fix:

  1. Download this icons file called “images_crystal.zip”
  2. At the command line, run this command, altering to match your username and possibly your file location if you do not have it in /home/username/Downloads.

    sudo mv /usr/share/libreoffice/share/config/images_crystal.zip /usr/share/libreoffice/share/config/images_crystal.orig.zip
    sudo mv /home/username/Downloads/images_crystal.zip /usr/share/
    libreoffice/share/config/images_crystal.zip
  3. Open LibreOffice. Tools –> Options –> View –> Change “Oxygen” [or whatever other theme you’re using] to “Crystal”. Go to Colors after View. Change the background color to white and the font color to black.

I took several sets of instructions from several sources, updated them, and created a simplified howto here.

Thanks to:
http://notsonoblednd.blogspot.com/2012/02/making-libreoffice-behave-in-dark-kde.html
http://gnome-look.org/content/show.php?content=143474

AVD Manager in Eclipse on Ubuntu won’t start device due to double slash error

I have a weird error that happens to me every time I rebuild my machine; when I open Eclipse and attempt to start up AVD Manager, I get an error when I hit “start” for the Android 4.1 virtual device. That error contains this line: “android-sdk-linux//tools/” and has to do with not finding the adb tool. That’s rather obvious; there’s a double slash in the path that the AVD Manager is using to try to find the script.

The fix, oddly enough, is due to a lack of the ia32-libs package on a 64-bit Kubuntu build. Install it to include support for your 64-bit system.

sudo apt-get install ia32-libs

Kubuntu 12.10 Released (Tarah does a dance and installs on four different boxes)

I am more excited than usual for the release of Quantal Quetzal.

Holy CRAP. Just got done installing 12.10 on my Lenovo Z570; this is the first time in years that I haven’t had to log back in and reflag the boot partition on every box. That is wonderful. I am in love.

Installation on an Acer Aspire One went swimmingly, as did an overlay of Edubuntu on top of 12.10 (for my nine-year old sister). There’s a whole new interface on netbooks; I wonder if Quantal detects a smaller screen size and goes with a more touch-based appearance?

Installed on my monster home server box, and again, not a single issue with having to reflag the boot partition.

I <3 Kubuntu.

Lenovo Z570 phy0 hard blocked solution

If you’ve had issues with wireless being grayed out and you’re unable to enable it on your Lenovo Z570 or any other box, there is a simple solution. You must reset your bios.

There’s an oddity in the bios for Lenovo Z570 machines; even after unblocking all interfaces, you can still see that phy0 is hard blocked, like below:


0: ideapad_wlan: Wireless LAN
Soft blocked: no
Hard blocked: no
1: ideapad_bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
2: phy0: Wireless LAN
Soft blocked: no
Hard blocked: yes
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no

You may be seeing errors such as:


sudo ifconfig wlan0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill

The solution is a reboot. Hit F2 to enter bios, then F9 to reset, then F10 to save and exit. Your wireless
should be working at that point.

This is a workaround for the bug located here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/782137

How to read from the Assets folder in an Eclipse Android application

Seeing errors like these?


java.io.FileNotFoundException
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:315)
at android.content.res.AssetManager.open(AssetManager.java:289)

The problem is that Eclipse isn’t finding your file, because you may not be using AssetManager to retrieve plain-text files from the assets folder. Here’s how to fix this:

  1. Note that there is no file extension on text. When I pasted ‘text.txt’ into the Assets folder to begin with, it had no extension. I tried and tried to get the app to recognize that Assets had a text.txt file in there, and finally tried it with no file extension as it appeared in the folder view.
  2. The try/catch AND the throws declaration are necessary to handle Eclipse’s fiddly compiler.
  3. Don’t cry. If you still can’t figure out how to get Eclipse buy kamagra online
    and your app to read the file, clean the project (Project –> Clean), make sure that the Assets folder is NOT on the build path, restart Eclipse, ensure you have no other errors (ADB, DDMS, anything), and try again. If it still doesn’t work, comment here and I’ll both try to help and make updates to the code.


public void openFile () throws IOException {
System.out.println("Starting openFile now");
AssetManager am = context.getAssets();
try {
InputStream is = am.open("text");
BufferedReader in = new BufferedReader(new InputStreamReader(is));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}

Useful links (none of which contain the entire solution, but all of which had some piece):

http://stackoverflow.com/questions/6039862/location-of-apk-file
http://stackoverflow.com/questions/5086539/reading-file-from-assets-directory-throws-filenotfoundexception
http://developer.android.com/reference/android/content/res/AssetManager.html
http://developer.android.com/reference/java/io/InputStream.html
http://stackoverflow.com/questions/5771366/reading-a-simple-text-file
http://stackoverflow.com/questions/10267594/how-to-access-
assets-folder-in-my-android-app

http://stackoverflow.com/questions/9674815/trouble-with-reading-file-from-assets-folder-in-android

Which JSON library should I use in my Android and Java projects?

JSON.org is where you start; this is the prepackaged JSON found in Oracle and Open Java Development Kits. The home page is a useful resource to see all the different JSON libraries out there for all different languages.

GSON is most useful for converting Java objects into their JSON representation. The Google libs can also convert a JSON representation into a Java object; this can be a game-changer for dealing with inheritance.

FlexJSON has a serious strength in web development. Because you can specify deep or shallow copies of objects, you can speed up transmission of information from backend Java code to your front end and client-facing architecture.

Jackson is almost certainly
the fastest JSON parsing library out there; it’s an active project, and has speed and flexibility to recommend it. I have started using it by default. Most useful is the fact that you can switch between a tree model and object mapping at will. It has a JSONFactory method that is extremely useful when parsing and manipulating JSON representations that need to be read, processed, and rewritten to provide data to an Android app.

JSON-lib is mostly focused on translation. Need to translate objects and data back and forth between Java objects, beans, servlets, and DynaBeans? This is the lib to use. Notably, it’s a bit heavy, as you might expect from a translation-centric library, so it’s probably best used when you’re managing legacy code or are a one-woman-shop.

Apache Virtual Hosts with SNI and SSL on Ubuntu 12.04 in Rackspace

Here’s a little howto: I was having the devil of a time earlier today configuring an SSL cert for a site Lorraine and I are working on right now. My problem is that I’ve never configured an SSL cert before, and proceeded to jump right on in with a whole lot of enthusiasm and zero knowhow.

It turns out that because the site we’re working on is on a Rackspace cloud server, and we’re hosting several sites on the same server using Apache virtual hosts to configure http requests via hostname as opposed to IP address, there is some extra configuration to be done. Add to that the fact that we’re serving secure and insecure content at the same hostname, and you have a recipe for a headache. So, here’s the way I did it.

First, let me list the useful tutorials and links, and then I’ll post the config files and examples that worked.

The most useful: http://www.tc.umn.edu/~brams006/selfsign_ubuntu.html

http://en.wikipedia.org/wiki/Server_Name_Indication

http://en.gentoo-wiki.com/wiki/Apache2/SSL_and_Name_Based_Virtual_Hosts

http://httpd.apache.org/docs/2.2/mod/mod_ssl.html

http://www.sslshopper.com/article-most-common-openssl-commands.html

Read this to understand why you’re doing this and what a certificate is: http://httpd.apache.org/docs/2.2/ssl/ssl_intro.html

Pro tips:

  1. You don’t need to turn on the ”
    Listen 443″ switch in apache2.conf; that’s already on and enabled with mod_ssl, the Apache module that handles SSL.
  2. If you keep seeing people telling you to edit your ssl.conf, what they mean in Ubuntu is /etc/apache2/sites-available/default-ssl. There’s already the stub there.
  3. Generate a CSR easily and simply by pasting this into a bash shell: openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
  4. You have to create a symbolic link between the default-ssl in sites-available and sites-enabled like this:
  5. sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl

Ok, now here’s the example default-ssl file:




ServerAdmin webmaster@localhost
DocumentRoot /path/to/your/website/root/
r

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

SSLEngine on
SSLCertificateFile /path/to/cert
SSLCertificateKeyFile /path/to/key/generated/from/CSR
SSLCertificateChainFile /path/to/bundled/certs/
from/your/issuer


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown



And here’s the trippy part: you actually don’t need to edit your current virtual host file (presuming you have it correctly configured to serve nonsecure content via port 80) which should be living in sites-available. I have the feeling that if I was trying to serve more than one secure site on this server that I’d need to configure a NameVirtualHost, but since I don’t, all requests on port 443 can just get shoved to the document root of the secured site. I’ll explore that later, I suppose.