Categories
Hacking Linux Programming Science and Technology Ubuntu

Using Dreamhost’s VPS as a MySQL Server

[Editor’s Note: Dreamhost no longer allows sudo access on their VPS servers, so the below is no longer possible. If you’re reading this, you might want to check out Amazon’s AWS. Nowhere near as user friendly as Dreamhost, but MUCH more powerful.]

I’ve been a happy customer of DreamHost for many years now — for $9.95 a month, I was able to get loads of diskspace and unlimited bandwidth, all from a great company that was staffed by great people who were very technically competent.

It is “shared hosting,” however — that means you’re getting it that cheap because you’re sharing server CPU power, available RAM, etc, with many other people who are also getting a great deal. You’ll notice this in any WordPress sites you may run on Dreamhost’s shared hosting — there’s about a 7-10 second delay between when you navigate to your site and when your page actually loads, mostly because your server processes are waiting in line behind everyone else’s.

So, Dreamhost does offer a “VPS” service — with this, you’re getting an absolute amount of RAM, CPU power, etc, that will only be used for your sites. It’s a tiny bit more expensive, at $14.95 or so a month, but it’s worth every penny.

If you’ve run WordPress installations on a Dreamhost site, though, you know that your mysql databases are on a seperate server entirely, and that may slow things down as well. Even if you move your WordPress installs to a VPS, your mysql databases will still be on shared hosting. DreamHost offers a “MySQL VPS,” but it costs another $15 a month (minimum), and you have no control over it at all.

A better solution would be to run your own MySQL server on DreamHost’s main VPS, since they give you root command-line access. There are a few hiccups in this process (some put there by DreamHost itself), but otherwise you should be able to do it.

  1. First, create an admin user for your VPS that has sudo abilities, and log into your VPS with that through ssh.
  2. Second, you have to tweak apt so you can even install the mysql-server package. It appears as if part of installing packages through apt involves temporarily storing files in /tmp and then running them from there.Unfortunately, the /tmp directory is mounted on DreamHost’s VPS servers with the noexec option, which means that you can’t run files that are present in that directory. That basically prevents you from installing the mysql-server package until you tweak apt to temporarily stage files in /var/tmp instead. Do this by:Creating a file called apt.conf in the /etc/apt/ directory, and edit it so the contents are the following:
    APT::ExtractTemplates::TempDir "/var/tmp";
  3. Then, install the mysql-server package:
    sudo apt-get install mysql-server;
    

    (When it asks to set a root password, make sure and set one.)

  4. Now, edit the file /etc/mysql/my.cnf and set the following options:
    bind-address=psXXXXX.dreamhostps.com

    (Replace psXXXXX with the name of your dreamhost VPS.)

  5. Restart your mysql service:
    sudo service mysql restart

At this point, you should be able to log in to your new mysql server:

mysql -u root -p

and then perform what SQL functions you need to.

A great thing to do is to install phpmyadmin using the tutorial here: http://wiki.phpmyadmin.net/pma/Quick_Install

First you’ll want to create a user (that isn’t your root user) to log into phpmyadmin:

mysql> CREATE USER ‘newusr’@’%’ IDENTIFIED BY ‘your_password';
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘newusr’@’%’ WITH GRANT OPTION;

At this point, you can sync your old databases to your new mysql server using the built-in sync tool that’s in DreamHost’s installations of phpmyadmin.  Then, just edit the wp-config.php file in the folder of your WordPress installations, and change the line that says the following to your DreamHost VPS:

define('DB_HOST', 'psXXXXXX.dreamhostps.com');

Sources:

Installing mysqld on Dreamhost VPS

https://bugs.launchpad.net/ubuntu/+source/debconf/+bug/90085

http://serverfault.com/questions/72356/how-useful-is-mounting-tmp-noexec

 

 

Categories
Automotive Science and Technology

EV Market Tepid, Except for All the Cars Being Sold

Seen on an otherwise kinda interesting article from Forbes about how Volt sales didn’t match what GM expected, and how the company is choosing to direct its advertising in another direction for the revamped Volt:

And while overall sales of plug-in hybrids and full EVs remain tepid except for Teslas, and U.S. oil supplies look more secure than ever, the future of propulsion always has a way of surprising us. Note, Bunkley wrote, how most people wrote off the future of large SUVs several years ago — and now sales are going back through the roof.

“Tepid” except for Teslas?  Look, I know the author is kinda going for “Oh, ho hum, EV’s, they’re certainly just a flash in the pan technology soon to go away”, but still…

Chart showing sales of Leaf's nearly triple that of Teslas
[Source: http://cleantechnica.com/2014/08/05/nissan-leaf-still-king-ford-fusion-energi-sales-jump-201/]
And that’s not just for the month of July — that’s the trend for the entire year.

I expect this kinda thing from BusinessInsider.com — I don’t expect it from Forbes.

Categories
Android Programming

Unlocking/Rooting the HTC One on Linux

I recently bought a used HTC One that I intend on using on Ting — it’s a phone I’ve been wanting to use for about a year. It’s one of the nicest Android phones, with hardware quality approaching that of an iPhone. (Not to mention a software skin much more “professional” looking than a lot of other Android hardware manufacturers out there.)

HTC One Dimensions Picture
Isn’t it beautiful?

I didn’t want to flash or even necessarily root my HTC One, however, the only way to restore some apps (like the Google Authenticator) require rooting, so I had to do it.  What’s strange is that most tutorials and utilities I’ve found are for Windows (like this one from theunlockr) — I guess it shouldn’t be too surprising, considering most PC’s are Windows, but I’d figure that there would at least be some tutorials for Linux, considering Android’s origins.

Well, the good thing is that unlocking/rooting your HTC One on Linux isn’t really that hard at all, if you’re comfortable with the command-line, and familiar with using the android sdk tools (fastboot, etc.).

I’m not going to go into how to set up the Android sdk, etc, since if you’re doing something like manually unlocking your bootloader, you should already be familiar with it!

Unlocking/Rooting Your HTC One (M7) on Linux

Prerequisites:

  • android sdk
  • htcdev.com account
  • Latest recovery .img file from CWM
  • Superuser Hack .zip file: SuperSU (make sure and get whatever is the latest version of the SuperSU flashable zip — earlier versions found in other tutorials no longer work to root the later versions of Sense)

Unlock Bootloader

  • Boot into bootloader and select Fastboot
  • Run command “fastboot oem get_identifier_token”
  • Copy token as explained on the htcdev page, and await your Unlock_code.bin file in email
  • Copy Unlock_code.bin file to your working directory in Linux
  • Run command “fastboot flash unlocktoken Unlock_code.bin”
  • Follow prompts on screen to unlock/reset your phone

Flash Recovery

  • Boot into bootloader and select Fastboot
  • Run command “fastboot flash recovery <recovery.img>” (replace with .img file downloaded from CWM site)
  • Reboot

Root

  • Copy SuperSU .zip file to phone’s internal memory
  • Reboot into recovery
  • Flash SuperSU .zip file
  • Reboot and enjoy
Other Useful Links
Categories
Hardware Linux Science and Technology Ubuntu

HP Pavilion Touchpad Not Working (you need to “kick” it)

So, for about two days the touchpad on my HP laptop stopped working.  Of course it was right after a kernel update in Ubuntu, so I immediately blame that.  You know… because 9/10 times it is.

So, I’m checking and checking things but can’t find anything.  It’s weird.  It’s not like it’s not working correctly, or is misconfigured — it’s like Ubuntu, which is actually pretty good at picking up on hardware changes today, can’t even see it.  So on a hunch I reboot into Windows, but it’s not working there either.

So now, instead of having to tromp through the utterly useless Ubuntu forums (full of unresolved issues where people complain about some update or the other breaking something), I can now expand my search to various HP Windows forums. Where in about five minutes, I found this gem.

Apparently, on some HP laptops (or maybe all laptop hardware is set up like this, I’d honestly never encountered it before), you have to perform what’s called a “kick”:

  1. Turn off your laptop.
  2. Unplug your AC adapter.
  3. Take out your battery. (If you can’t take out your battery externally, time to pull out a screwdriver and start taking your laptop apart.)
  4. Hold down the power button on your laptop for at least 30 seconds, preferably more (just to make sure, since time is a relative construct perceived differently by all sentient forms of matter).
  5. Put in your battery, and turn back on.  Your touchpad should now be visible to your OS, be it Ubuntu or Windows, again.

Why or how this works is anyone’s guess.  I think it resets the BIOS (it seemed to do a strange double boot the first time plugging it in after performing this procedure, which is similar to what happens on a BIOS upgrade).  I’m just glad it does.

Categories
Hardware Science and Technology

Single-user mode, MacOSX 10.8

image

It’s how one tests for issues without the rest of the OS getting in the way. Just boot your Mac while holding Command+S.

Categories
Science and Technology Ubuntu

Configuring the Plustek Opticslim m12 for Ubuntu

After six months or so of being wowed by a little portable scanner in a doctor’s office, the spouse and I finally decided to buy one.  I wanted one that’s compatible with Ubuntu, since that’s our main OS around home, so I did a little research, and found some info about the Plustek Opticslim m12 (it’s the same model that the “NeatReceipts” company rebrands for their own scanners).

Found one on Ebay, bought it (for 1/3 of the price of a NeatReceipts model), and plugged it in… and of course it didn’t work.  This is the world of Ubuntu with proprietary peripherals, of course.  The “Simple Scan” program that’s built-into Ubuntu recognized the make and model, oddly enough, but it wouldn’t scan, throwing up an error message whenever I tried.

I did a little bit of searching, and found a site that talked about it: http://www.fishandcross.com/blog/?p=844

Apparently, all you need to do is download the driver file mentioned from the site at http://gkall.hobby.nl/gt6816-07b3-0412.html and copy it to your /usr/share/sane/gt68xx folder.  Then, just start up the Simple Scan program again, and scan away!  Works really well — doesn’t auto-crop or anything like the provided Windows software does, but that’s cool.  I’ll take it.

To Visitors:  If you’re visiting this page, trying to find information about how to get this scanner to work, and you’re trying it years after this article was written, I can’t guarantee these instructions will work — if you know Ubuntu, stuff changes from version to version sometimes.  Hacks and fixes that’ll work one year won’t always work the next.

Categories
Programming Science and Technology

Steve Jobs, 1955-2011

I started programming over 20 years ago on an old Macintosh II computer that my father practically fished out of the trash at his job.

I largely credit that old computer to where I am today — it wasn’t just the Macintosh’s ease-of-use and small learning curve, it was also, literally, the spirit of the designers and tinkerers that worked at Apple computer that existed in that machine.

The Macintosh was a computer that you could delve beneath the surface, when you wanted to — you could modify code, the way applications worked, the modules and extensions that started up when the machine booted — you had, when you wanted to, access to all the tools that the designers themselves used to create that very Macintosh you were using right then and there.

There’s a whole generation of programmers who got their start in this very way, and for that, I do have Apple to thank.

CELEBRATION OVER, CRITICISM BELOW:

And that’s the very reason why Apple’s current practices today kinda scare me. Apple’s products today are precisely not about giving the user tools and control — with each new version of MacOSX, each new iPhone that comes out, there’s less and less that tinkerers like me can do with it.

There’s less and less that the next generation of tinkerers can do with it. How would the next Steve Jobs design anything on an iPod Touch? On an iPad? How would a budding application developer get anyone to use a new application he’s designed, when people can only install apps via a curated, policed, application “store?”

I thank Apple for starting me on the path to where I am today, but I thank companies like Google for keeping that spirit alive, when it becomes increasingly evident that Apple either isn’t able to or just no longer wants to.

Categories
Computing Linux Programming Science and Technology Ubuntu

Configuring a Server with Ubuntu Desktop

I’ve been getting an Ubuntu server running recently (FINALLY), and in order to make it run headless (without keyboard, mouse, or monitor), there’s a few things one needs to do:

1) Enable Auto-Logins (optional)

All depends upon how you set things up, but you may want to run everything easily through a default user account — just go to “System > Administration > Login Screen”, and set it up.  (These instructions are for the GUI of Ubuntu, of course — I’m not a CLI-queen, and would rather edit things quickly through an interface that I’m familiar with than search forums for hours trying to find the esoteric commands necessary to do this stuff manually, sorry.)

2) Enabling Networking With Automatic User Login

Now, you may have set up automatic logins, but noticed that you always have to enter in your account password manually anyway once your network tries to connect — took me a while to figure out this one, but just go to “System > Preferences > Network Connections”, and in the type of connection you’ll be using, make sure the option for “Available to all users” is selected at the bottom.  That’s it.  I feel dumb for not figuring this out long ago.


3) Enabling VNC to Run Headless

As per the instructions I found here, you have to

  1. Edit “/etc/gdm/Init/Default” to include the line “/usr/lib/vino/vino-server &” right before “exit 0”
  2. Edit “/etc/gdm/custom.conf” (or “/etc/gdm/gdm.conf” if older than Ubuntu 10.04) and add “KillInitClients=false” — this will prevent any existing VNC clients from being killed if you do login on the server physically
  3. Do a “sudo vino-preferences” and enable the necessary stuff

More to come, including the Minecraft configuration scripts!

Categories
Linux Science and Technology Ubuntu

Adobe Acrobat Not Printing on Linux?

Just installed Adobe Acrobat on linux and it’s not printing?  Just giving you a crappy error message when you try to print?

When you print, instead of selecting the default printer, just select “custom” and type “/usr/bin/lp” into the box that appears to the right.  Printing will continue normally.

Just one more thing in the list of easy fixes that never make it into releases of Linux.

[via Can print from most apps, but not from Acrobat reader, and not duplex from Evince – Linux Forums]

Categories
Linux Science and Technology Ubuntu

Installing the Brother HL-2270DW Printer on Ubuntu 10.04

Brother, I appreciate that you at least made an attempt at providing Linux installation files, even going so far as to provide .DEB and .RPM files.

However, none of the solutions works, and even on my version of Linux, Ubuntu 10.04, probably the most common one around, the .DEB files did next to nothing.  They didn’t setup Ubuntu’s printer configuration so that the printer showed, nor did they enable the drivers to be found when I tried to install the printer manually. (The Brother HL-2270DW is apparently so new that Ubuntu doesn’t have any default drivers in its repositories.)

What did work?  Selecting HL-2170W from the default drivers list in Ubuntu.  Seems to work fine! :P