Howto: Fix MySQL Server dependency problems on Ubuntu LTS

Have you encountered this error?

An error occurred while setting the password for the MySQL administrative user.
This may have happened because the account already has a password, or because of a
communication problem with the MySQL server.

Or maybe seen this?

Errors were encountered while processing:
mysql-server-5.5
mysql-server

Or this?


dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured

This is a total bastard of a problem. Here’s what worked for me:

sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-5.5
sudo dpkg --purge mysql*
sudo rm -rf /etc/mysql
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server
sudo reboot

Purge everything that even looks like mysql. Remove the /etc/mysql directory manually, because mysql-common is going to try to hide there. Fix any broken dependencies and reconfigure any broken packages. You may get the same error again when trying to reinstall mysql-server. I threw up my hands and went to bed at that point, woke up this morning deciding to finally learn PostgreSQL, got this error:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

and believe it or not, a reboot fixed the problem for me. mysqld started on reboot. I rubbed my eyes, and wrote this post in case it ever bloody well happens again.

Implementing security in pre-investment startups

Today, I and Liz Dahlstrom had a great experience speaking at SOURCE Conference: Seattle. Run by Jamie Fullerton of SERENE Security, our audience was a group of security pros and executives.

Our talk, “Implementing Security In A Pre-Investment Startup,” was well-received. Unfortunately, there was an A/V issue, and the talk was not recorded properly, so we’ll just post our outline and slides here. Please note that Brad “RenderMan” Haines is our third author on this talk; as a Fizzmint team member and security researcher, he helped us write, discuss, prepare for, and pull this talk off.

Our SOURCE Talk slides as a PDF doc.

The outline for the talk.

SOURCE Conference: Seattle was a gracious host, and we had a good time. Thanks!

Free Interview Training Videos for Underserved People In Tech

Hi! We’re Tarah Wheeler Van Vlack and Liz Dahlstrom. As far as I know, these are the only training videos ever produced for people who want to know what it’s like to be in tech, and we’re giving them to you for free. We’re giving you over eight hours and over 8GB of videos showing how you interview, work in programming jobs, negotiate salary, work with supervisors, handle whiteboarding, and much more. These videos cost us over $30,000 to produce, edit, and release. We believe strongly that everyone needs this information, and that the trust reposed in us by our backers on Kickstarter should be repaid. Thank you for believing in us, and thank you for helping underserved people in tech. Liz and I have always believed that mentorship and networking only succeeds in the presence of openness, friendliness, acceptance, and tolerance. We’re releasing the digital download with a Creative Commons license, so you can download this freely and distribute it noncommercially.

This series of videos trains people in technical interviews and what to expect out of a life in professional programming. Created out of a Kickstarter in 2012, Tarah Wheeler Van Vlack and Liz Dahlstrom are now releasing the videos under Creative Commons licensing to the public in fulfillment of their obligation to the public, and are thrilled to announce that the training provided to these people has launched a mentorship movement in tech!

The links are to the videos at YouTube.

01-Welcome
02-Skin-Deep
03-Interview-Paperwork-And-Prep
04-Corporate-Startup-And-Freelance-Career-Tracks – Guest speaker: Jon Callas, CTO, Silent Circle
05-Physical-Presence-And-Body-Language
06-Meet-Your-Interviewer – Guest speaker: Mike Reinhardt, lead developer from Microsoft Game Studios and engineer, Microsoft Exchange
07-Women-On-The-Job – Guest speaker: Lonnye Bower, SQL developer evangelist, Microsoft
08-Certifications-And-Skills – Guest speaker: Anne-Marie Marra, senior partner, SOMA Law Group
09-Powerlunching-And-Networking – Guest speaker, Shannon Anderson, senior vice president, NuWest Group Staffing Solutions
10-Public-Speaking
11-Recruiter-Round-Table
12-Closing

Download all the videos by getting the torrent here at Kickass Torrents.

Released under Creative Commons CC BY-NC.txt

If you want to support this effort and help the cause of mentorship in tech, you  can DONATE and learn more at HackThePeople.org, ask questions at @tarah and @tanglisha, and support diversity in technology.

tarahPosted on Categories Encouragement, Heroines, Programming, Women In TechTags , , 13 Comments on Free Interview Training Videos for Underserved People In Tech

PyCon Code Of Conduct Warning Cards

Hey, folks. You all might be seeing the giant mess that is coming out of the firing of several people over two jokes at PyCon 2013 this year. I’m Tarah Wheeler Van Vlack, and I and my colleague Liz Dahlstrom were there. We had a great time this year, and will certainly be at Montreal next year. (Some of you may know that I and Liz are co-founders of LadyCoders; we’re not wearing that hat right now and we’re not writing on that site. We’re just two devs who have some thoughts on this topic)

I’ll try to relate the facts as dryly as possible: Adria Richards, a developer evangelist at SendGrid with more than 10,000 Twitter followers, overheard two PlayHaven devs speaking behind her at a large speaking panel at PyCon in Santa Clara
last weekend, and took offense to their language, which by their later admission was in violation of the PyCon code of conduct. Adria turned around and took pictures of the two men and posted them on Twitter, with a comment about the sexual nature of their conversation. The men (Alex Reid and supposedly Hacker News handle mr-hank) were publicly outed. mr-hank, who says he is a father of three, lost his job. Richards wrote a post explaining her side, and so did the man who lost his job. There’s an excellent post up at Ars Technica that also tells the tale.

As the Internet does upon occasion, it lost its $#1%. Richards was just fired from SendGrid; arguably she can no longer function in her role in developer relations, and
her site has been DDOSed. mr-hank has been fired from his job at PlayHaven, and a petition is now up asking for his reinstatement.

Liz and I were also at Defcon last year, and will be this year. In fact, we’re writing up our speaker proposals now. How many of you remember these?

rugby cards

Liz and I have been talking about the situation. We’re wondering–how can we give people who become uncomfortable at PyCon more options? How much of this problem could have been fixed if Richards had had some way to tell these guys that what they were doing was making her feel uncomfortable without having to confront them? I can tell you now that at Defcon, when I saw a woman pull out a red card and show it to someone,
every single person’s attention instantly fixed on that situation. A quiet apology was issued, the (now) gentleman exited the room, chastened, and having learned not to talk about his manparts loudly and drunkenly, and in front of someone who didn’t want to hear it. 99.9% of the time, we are just socially clueless nerds. I have been known to tell some truly appallingly clueless jokes, and I actually got yellow carded last year at Defcon. I’m serious. If we had a way to make our wishes known while taking most of the confrontation out of the situation, I think that the convention would be a much happier and more comfortable place for everyone.

We don’t want to see PyCon ruined for everyone. It is one of the most overall open and friendly environments in tech that either of us has attended, and we’d like it to stay that way. We don’t want silence to begin as soon as a woman enters the room because everyone there is afraid of public shaming and losing their job. We also don’t want women to be
afraid to speak up because of the nastiness that has ensued over the last few days.

So, Liz and I are going to carry on the work of KC from Defcon. Read more about this amazing woman: The Red/Yellow Card Project.

See these three cards? We just mocked them up. We want to put them in the swag bags next year at PyCon 2014 Montreal. All please note that we will ask for Diana’s ok (Diana is next year’s PyCon chair) on the wording. We think it’s ok, but we’ll check to make sure that it doesn’t give anyone legal hiccups before we send them to the printers.

pycon_coc_warning

pycon_coc_violation

pycon_coc_defender

We want to make this convention better, and without a tool to help us communicate with tact and clarity, we think the confusion will continue. If you’d like to help us out with printing costs, you can donate to the paypal account below. We’d like to put these cards in swag bags for everyone.

[paypal-donation]

Look, we were playing Cards Against Humanity in that exact same game that Adria was playing in. We had a great time. This was in the
hotel, away from the con, and nowhere near where the Code of Conduct applied, but even there we would have respected anyone’s wishes to be quieter, kinder, or chill out if someone had been unhappy. There’s no joy in making other people uncomfortable or unhappy. All most nerds need is to know that what they’re doing is inappropriate, and they’ll stop.

Twitter   tarah   dirnonline  kennethlove ...

We’re all really inappropriate people. Let’s make an easy way to tell each other when it happens.

Give thanks for open source software developers

They make the world go round.

Open source developers and plugin devs are the people that make small technical businesses possible. They’re the folks who spend their time working hard to make obscure pieces of software that most of us will never see into something that is beautiful and usable. Without the major CMSes, many startups would have no way to get a company up and running rapidly.

Today, I will thank three of them by name.

Joost de Valk and his team make Clicky By Yoast, a spectacular plugin for WordPress that absolutely kills on analytics. He’s a major WordPress core developer as well; I am deeply grateful for his work. His analytics have contributed time and again to how I run my site. Thanks, Joost!

Jonathan Riddell is the lead dev for
Kubuntu, the fork of Ubuntu that uses KDE for a native desktop environment. I owe much of my daily happiness to this person; Kubuntu is easy to use, stupid simple to configure, and requires little to no knowledge of Linux for a n00b, while being configurable enough to entertain someone like me. All I’ve done is write a plasmoid or two; Jonathan, I seriously raise my glass to you. Thank you for your hard work and devotion to this project.

The Sarahs: Sarah Mei and Sarah Allen are the two women who started RailsBridge. OSS is notoriously short of women developers, and these women have not only pushed major Ruby work, they’ve also single [double?] handedly increased the number of women at OSS conferences. Thanks for being inspirational as well as technical, ladies.

Now
go eat some of that tasty Thanksgiving turkey!

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
    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.

How To Build A Ruby Server With RVM On Kubuntu 12.10

So I’m building a Ruby server right now for the first time. I’m going to list out here the resources I used as a skilled web dev to get this up and running right away. These links do assume that you know what you’re doing in the cloud, but if so, they’re the best way to get running fast.

http://guides.rubyonrails.org/getting_started.html
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
This is the best link: http://www.andrehonsberg.com/article/install-rvm-ubuntu-1204-linux-for-ruby-193

And here are the steps:
n
Update, upgrade, dist-upgrade
ufw default deny and add 80 and ssh port
apt-get install build-essential git-core curl
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) echo '[[ -s "/home/andre/.rvm/scripts/rvm" ]] && source "/home/andre/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install libsqlite3-dev
rvm pkg install zlib
rvm reinstall $(rvm list strings | tr "\n" ',')
rvm reinstall 1.9.3 --with-openssl-dir=/usr/local
rvm all-gemsets do rvm gemset pristine
gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib
rvm gemset create rails31
rvm gemset use rails31
rvm current
gem list
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
rvm pkg install openssl
sudo apt-get install -y libssl-dev
rvm reinstall $(rvm list strings | tr "\n" ',')
rvm all-gemsets do rvm gemset pristine
gem install rails
bundle install
rails new NewProject -d sqlite3
echo "gem '
therubyracer'" >> Gemfile

HOWTO: set up a cloud server with WordPress at Rackspace

You’re probably here because you are finally at the point where you need root access to your web server so that you can install applications like MediaWiki or WordPress or Joomla or any other CMS. If you have a website that you want to move away from a hosted environment, this is how to set yourself up so that you control every aspect of your site.

    1. Create an account at Rackspace.com. Go to Cloud Servers and create a new server. If you need help with this, though it’s very self-explanatory and easy on their site, you can always chat with their 24-7 online chat support. Note the administrative password and the IP address of the server you have created.
    2. Open a bash terminal and SSH into your shiny new server. “ssh root@YOURSERVERSIPADDRESS”. Enter the password.
    3. Create a user for yourself. “useradd -m -s /bin/bash yourname” and create a password for yourself  “passwd yourname”.
    4. Enter “su
      yourname”. Now, you are logged in under your name and not as root.
    5. Enter the following:
      sudo apt-get update
      sudo apt-get upgrade
      sudo apt-get install tasksel
      sudo tasksel install lamp-server
      sudo apt-get install php-mail python-software-properties unzip
      sudo a2enmod rewrite
      sudo apt-get autoclean
      sudo apt-get autoremove
      mkdir /home/yourname/yourwebsitename
      mkdir /home/yourname/yourwebsitename/blog
      cd /home/yourname/yourwebsitename/blogsudo
      wget http://wordpress.org/latest.tar.gz
      sudo tar -zxvf latest.tar.gz .
    6. That has cleaned up your server and installed a web server as well as WordPress. Enter passwords for your MySQL database and record them.
    7. “sudo service apache2 restart” #You will get an error that local server has not been set up.
      echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/$servername
      sudo service apache2 restart #Should be no error now
    8. r

    9. cd /etc/apache2/sites-available/
      sudo nano yourwebsitename
    10. Copy this with CTRL+SHIFT+V into the terminal:
    11. ServerAdmin webmaster@localhost
      ServerName www.yourwebsitename.com
      ServerAlias yourwebsitename.com *.yourwebsitename.com
      DocumentRoot /home/yourname/yourwebsitename/
      php_value upload_max_filesize 1M

      Options +FollowSymLinks
      AllowOverride All
      Order allow,deny
      allow from all

      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      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

      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn

      CustomLog ${APACHE_LOG_DIR}/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

       

       

    12. CTRL+X and save the file as yourwebsitename.com.
    13. cd /etc/apache2/sites-enabled/

sudo ln -s /etc/apache2/sites-available/yourwebsitename.com /etc/apache2/sites-enabled/yourwebsitename.com
sudo service apache2 restart

    1. Where have you created your domain name account? If it’s with GoDaddy, login to your GoDaddy account and click on Domain Manager. Click on the website name and enter the dashboard (or follow whatever practice your domain registrar uses to get to where you can edit the zone file). Click on “Edit Zone File”.
    2. Replace the IP address in the zone file with the IP address of your cloud server. Save the zone file.
    3. “nano /home/yourname/yourwebsitename/index.php” and copy this into the file.

/**
*
Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*//**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require(‘./blog/wp-blog-header.php’);
?>;

  • In a few minutes, you should be able to enter your URL into any browser, and see the WordPress installation page. Install using the database name and password you’ve created in PHPMyAdmin or in command line for MySQL.
  • I recommend Elegant Themes to get a beautiful and professional look for your site instantly.

 

HOWTO: Always know your home computer’s IP address from anywhere using Dropbox

To always know what your home machine’s IP address is (and while I’ll assume that you’re running Kubuntu, this can be adapted using the following bash script to any machine).

  • Apt-get ‘kcron’.
  • Open Task Scheduler and set the following bash script to run every five minutes:
#!/bin/bash
J=`wget http://checkip.dyndns.org/ -qO - | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'`
K=`date`
echo "$J $K" >> ../Dropbox/ANYDIRECTORYYOUCHOOSE/output.txt
  • Ensure the script is executable, and test it in a shell.

Now, you can always see what your home computer’s IP address is in any browser window; I use this in case there are issues with SSHing into my home box.