How to backup/dump a PostgreSQL database using pg_dump

postgresql show tables

This article will show you how to use the pg_dump utility that is built-in to PostgreSQL to backup or dump the database to a file. This is a utility I use all the time to quickly make periodic backups of my databases. This tool has the ability to create both compressed and uncompressed dumps of … Read more

Fetch error installing Java on Ubuntu 11.04. Solved!

I am running Ubuntu 11.04 and was trying to install the Java OpenJDK 6.0 (and 7.0) on my system but I received the following error: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing? I tried installing several different Java packages but all of them failed with the same error. Finally, … Read more

Solved! Installing mysql gem – extconf.rb failed error

Are you attempting to install the mysql gem and you are receiving this error? Fetching: mysql-2.8.1.gem (100%) Building native extensions. This could take a while… ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb checking for mysql_query() in -lmysqlclient… no checking for main() in -lm… yes checking for mysql_query() in -lmysqlclient… … Read more

How to enable Swype on G2x and other Android phones

This article will show you step by step how to enable Swype on your G2x or other supported Android phones. For those that are not familiar, Swype is a text input method whereby the you continuously drag your finger across the keyboard to generate words. It is a simple option to enable/disable, so give it … Read more

How to find (log) slow queries in PostgreSQL 8.x, 9.x

One of the most important factors when troubleshooting the performance of an application or website, is the performance of the database. Improper indexing or inefficient SQL queries can kill the performance of your application rendering it useless. It is amazing what a simple tweak or change to a SQL statement can do. I have seen … Read more

How to install PostgreSQL 8.4 on CentOS 5.5

postgresql show tables

If you have tried installing PostgreSQL database on CentOS 5.5 using yum, you will notice that you have an old, outdated version! There are several ways to get the 8.4.x version of Postgres installed on this OS, but here is the quick and easy method! Installing PostgreSQL 8.4.x on CentOS 5.5

How to install Ruby 1.8.7 on CentOS 5.5 Linux

ruby, php, java, python code

Have you tried doing yum install ruby in CentOS 5.5? If you have the default repositories configured, you will notice that it installs the ancient Ruby 1.8.5. Not ready to move up to Ruby 1.9, but would like to install Ruby 1.8.7 – well here is how to do it! Install Ruby 1.8.7 on CentOS … Read more

Linux – How to disable ‘Last Login’ welcome message

When you login (via SSH or other method), to a Linux box, you will see a Welcome message that displays your Last Login time and date as well as other general information regarding the system. Here is an example: Linux sp-ubuntu 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 01:41:57 UTC 2010 i686 GNU/Linux Ubuntu 10.10 Welcome … Read more

Solved! Installing sqlite3-ruby gem – extconf.rb mkmf LoadError

ruby on rails

Are you attempting to install the sqlite3-ruby gem and you are receiving this error? Building native extensions. This could take a while… ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb extconf.rb:3:in `require’: no such file to load — mkmf (LoadError) from extconf.rb:3 Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.3 for … Read more

How to install RubyGems on Linux (Ubuntu & Other)

RubyGems is a package management application for Ruby that is used to quickly and easily distribute Ruby/Rails applications and libraries. If you are planning on doing any development in Ruby, this is a must have. RubyGems is for Ruby as apt-get and yum are to Linux operating systems. This article will show you various ways … Read more

How to SSH to a server using Ruby – Part II

ruby on rails

Welcome to Part II of how to SSH to a server using Ruby.  In Part I of this article, we gave you a simple example of how to SSH to a server and run a command. The hostname, username, password, and the command to execute were hardcoded in the example. In this article, we will … Read more

How to SSH to a server using Ruby – Part I

ruby on rails

Welcome to Part I of how to SSH to a Linux, Windows, etc. server using Ruby. This post will give you a complete code example to get you up and running right away! The code below will connect to the server specific and run the ls -al command. Be sure to change the values in … Read more

4 Free Ways to Convert a PDF to a Plain Text File on Linux

In the vast landscape of digital content management, the need to convert PDF files to text is a common task for professionals, students, and casual users alike. PDFs are widely used for their portability and consistency across different platforms but aren’t as easy to edit or search as plain text files. Fortunately, for Linux users, … Read more

How to Create Thousands/Millions Files in Linux

bash, command-line, linux

Do you need an ultra fast way to create a large number of files in Linux? Perhaps, you are doing some load testing for an application and you need to create 1000 or even 1,000,000 files in the matter of seconds. Well, here is how to do it! There are two parts to creating these … Read more

PostgreSQL: How to reload config settings without restarting database

postgresql show tables

Reloading the PostgreSQL configuration without restarting the entire database can be efficiently achieved using the pg_ctl reload command. Performing Postgres reload config is a simple one-liner and should be part of your toolbox. Why is Postgres Reload Config Important? If you are making modifications to the Postgres configuration file postgresql.conf (or similar), and you want … Read more

How to view table/row locks in PostgreSQL?

postgresql show tables

This article will show you how to see a list view a list of locks that are currently open (or waiting) on your database rows and tables. This information is beneficial when debugging timing-related errors and data inconsistencies. Login to the PostgresSQL command-line interface psql -U [username] [database_name] Run the following query: select t.relname,l.locktype,page,virtualtransaction,pid,mode,granted from … Read more

How to see active SQL queries and open connections in Postgres?

This article will show you how to see a list of open database connections as well as all active queries that are running on a PostgresSQL 8.x database. This information can be very beneficial when profiling your application and determining queries that have “gone wild” and are eating CPU cycles. Login to the PostgresSQL command-line … Read more

How to find when PostgreSQL Vacuum and Analyze were run?

postgresql vaccuum, postgres autovacuum, postgres vacuum

This article will show you how to determine when your database tables were last vacuumed, auto-vacuumed, analyzed, and auto-analyzed on a PostgresSQL database. Performing these operations are critical in keeping the database optimized and performant. What is the purpose of PostgreSQL Vacuum? PostgreSQL’s “VACUUM” is a maintenance operation designed to reclaim storage occupied by expired … Read more

Examples of Linux ‘head’ Command to Preview a File

linux, shell bash, ubuntu

This article will show you how to use the head command in Linux. head is used to print out the beginning of a file. For example, this is useful when you have a giant text file and you want to preview the contents without attempting to open the entire file. Here are some common examples … Read more

How to add “Run…” option to Windows 7 Start menu

If you recently upgraded from Windows XP to Windows 7, you may be wondering where the Run… option in the Start menu went. I use this option in XP regularly to quickly launch programs like Notepad and the Command Prompt, so it was annoying when I tried doing this in Windows 7 only to find … Read more

How to add a Windows/Linux network printer in Ubuntu 9.10

add a printer, install a printer, ubuntu, printer

This article will show you how to add a network printer on a Ubuntu 9.10 system. Let’s go ahead and get started… Navigate to System –> Administration –> Printing Then choose Server –> New –> Printer from the Printer configuration window The New Printer wizard will be displayed. Here you can add either local or … Read more

How to Kill All Processes in Linux with 1 Simple Command

kill processes linux, stop script execution

This article will show you how to kill all processes in Linux with a single command. We’ll show you how to easily kill processes such as user scripts, applications, or background jobs. If you are like me, you have run into this situation many many times. You run the ps command to list all the … Read more