Get external (WAN) IP address from command line in Linux

Many services and applications require you to know your external (WAN) IP address.  There are plenty of web sites that allow you to do this, but here are a couple of simple ways to do this from the command line in Linux.

The first method uses the cURL utility, which is basically a command-line utility for retrieving data using URL syntax.  In Ubuntu or Debian, you can install cURL from the repositories using the command:

sudo apt-get install curl

After installing cURL, just run this command to get your external IP address:
curl ifconfig.me/ip

You can replace ifconfig.me with other service hostnames/URLs, such as:

  • whatismyip.org
  • icanhazip.com
  • tnx.nl/ip
  • myip.dnsomatic.com
  • ip.appspot.com
  • checkip.dyndns.org:8245
  • whatismyip.com
  • jsonip.com

The second method is really a variation on the one above and uses the wget command. You can use the same hostnames/URLs as above with this command:

wget -qO- ifconfig.me/ip

Have fun! And let me know your tips for this in the comments.

Leave a Comment

Filed under Linux

Installing Citrix ICA client in 64-bit Ubuntu/Linux Mint

Fortunately, installing the Citrix ICA client in 64-bit Ubuntu/Linux Mint is much easier than it used to be.  However, one of the “tricks” is to know where to find the client, since they aren’t obvious (or weren’t to me!) on the regular Citrix download site.

Instead of the regular download site, go to the Citrix Client Center.  Click on the Linux link in the Download Citrix Receiver section.  (At the time of writing the current/latest version of the ICA client is 12.0.)  On the download page, find the For 64-bit Systems section and download the .deb package, which will have a file name like icaclient_12.0.0_amd64.deb.  I recommend downloading the package file instead of opening it in GDebi or Ubuntu Software Center.  After downloading the package, you need to perform the following actions in the Terminal:

  • Install prerequisite files.

sudo apt-get install libxaw7 libmotif4 nspluginviewer

Don’t worry if you miss one of the dependencies, because you can always update/add them later by running:

sudo apt-get -f install

  • Install the Citrix ICA client package downloaded. Navigate to your Downloads directory in the Terminal window and run:

sudo dpkg -i icaclient_12.0.0_amd64.deb

Of course, replace icaclient_12.0.0_amd64.debwith the name of the file that you downloaded.

Now, you should be able to connect to your Citrix ICA server/host using the normal process in Firefox (or another web browser). One difference between Windows and Linux is that you need to explicitly launch Citrix Receiver on Linux (in the Internet sub-menu) before you try to connect to the ICA host.

Leave a Comment

Filed under Linux

Does lack of ‘debate’ hurt our theology?

We just started a new series of adult Bible classes entitled “Seeing God Through Romantic Relationships”.  In the first lesson (listen here), one statement got me to thinking about whether or not our (apparent) reticence to ‘debate’ (or discuss) our theological imperatives actually does a disservice, both to us and to those who don’t know the gospel.  In the past, debates about various distinctive elements of a particular ‘brand’ of spirituality served to (to some degree anyway!) provide a way for people to learn about why we believe what we believe.  With our desire to avoid confrontation (and, perhaps even, to avoid controversy), these discussions have waned in the past 30 years or so.

My impression (certainly not necessarily supported by any research) is that, especially among kids and recent converts, many don’t have a firm understanding of core principles of their faith.  In particular, many would have a hard time trying to defend what they believe in a logically sound manner (whether what they believe is right or not).

Moreover, God is not afraid of doubt.  In some ways, it seems that we try to avoid some of these ‘controversial’ subjects out of fear that perhaps we might provide a ‘stumbling block’ (cf. Romans 14:13) for those whose faith isn’t as firm.  This seems like a cop out, because those who honestly look at the evidence will find that their faith is increased (improved?) by merely looking more closely.  In these situations, God, through the Holy Spirit, draws us closer to him and reveals more about himself.

I’m not advocating a return to the “bad old days” of debating others to simply prove a point of very little theological value (those that aren’t core to our relationship with God through Jesus Christ), but rather an examination of what we believe and why we believe it, including the evidence that supports it.  For example, baptism is often touted as the ‘pinnacle’ of a believer’s conversion experience.  But, in fact, it is merely the starting point (or one of the starting points!) toward growth into a mature faith.  In comparing baptism to a wedding celebration (the concept suggested by F. LaGard Smith in Baptism: The Believer’s Wedding Ceremony (out of print)), no one would claim that the ‘hard part’ is over when we enter the day-to-day living with our spouse after the wedding ceremony and the same is true for our relationship with God after baptism.

Leave a Comment

Filed under Christianity

An American’s Creed

It is quite interesting to learn that the author of this great description of self-reliance, Dean Alfange, was a prominent liberal activist during his time.

It is my right to be uncommon—if I can.

I seek opportunity—not security. I do not wish to be a kept citizen, humbled and dulled by having the state look after me.

I want to take the calculated risk; to dream and to build, to fail and to succeed.

I refuse to barter incentive for a dole. I prefer the challenges of life to the guaranteed existence; the thrill of fulfillment to the stale calm of utopia.

I will not trade freedom for beneficence nor my dignity for a handout. I will never cower before any master nor bend to any threat.

It is my heritage to stand erect, proud and unafraid; to think and act for myself, enjoy the benefit of my creations and to face the world boldly and say, “This I have done.”

Leave a Comment

Filed under Uncategorized

Installing/running Windows 8 Developer Preview in Virtual Box

Microsoft just released Windows 8 Developer Preview (also known in some circles as “Milestone 3″).  So I thought I’d give it a spin in Virtual Box.  Unfortunately, the default settings for Virtual Box didn’t work quite right.  Initially, I was getting error code 0xc0000225 during the installation start up.  Then, after getting the OS installed, networking did not work.  Here’s what I did to get things going with the x64 versions of Windows 8 guest using Virtual Box version 4.1.2 (the latest at the time of writing).

Boot errors (error code 0xc0000225)

In the System settings section for the Virtual Box VM, enable (check) Enable IO APIC on the Motherboard tab and Enable PAE/NX on the Processor tab.

Network adapter not detected

In the Network settings section, select the appropriate adapter tab (usually Adapter 1).  Then click on Advanced arrow to expand/display the additional options.  Select Intel PRO/1000 MT Desktop (82540EM) from the Adapter drop-down list.  The Windows 8 guest OS will auto-detect this hardware and install the appropriate driver.

Install Virtual Box extensions in Windows 8 guest

With the Windows 8 guest OS running (of course!), select Devices | Install Guest Additions… from the menu on the VM window, as usual.  When prompted about whether or not to auto-run the installer, choose to open the files in Windows Explorer.  Then open a Command Prompt (I had to launch Task Manager, choose More details option, then select File | New Task (Run…) from the menu and enter CMD in the dialog prompt.) and navigate to the Guest Additions drive (probably D:\) at the Command Prompt.  At the Command Prompt, run this command:

VBoxWindowsAdditions-amd64.exe /force

This forces the installation of the Guest Additions, which would otherwise fail because of invalid version check.

Leave a Comment

Filed under virtualization

Psalm 23 for the 21st Century

It seems that our lives are lived (maybe that’s not even the right word!) at an ever faster pace. In this satirical (or is it parody?) take on Psalm 23, Marcia Hornok gives us some insight into the toll that busyness is taking on us, as individuals and a society.  Psalm 23, often called the shepherd psalm, itself gives a picture of rest in God’s protection, which makes the irony of this version even greater.

The clock is my dictator, I shall not rest.
It makes me lie down only when exhausted.
It leads me to the deep depression, it hounds my soul.
It leads me in circles of frenzy for activities’ sake.
Even though I run frantically from task to task,
I will never get it all done, for my “ideal” is with me.
Deadlines and my need for approval, they drive me.
They demand performance from me, beyond the limits of my schedule.
They anoint my head with migraines, my in-basket over-flows.
Surely fatigue and time pressure shall follow me all the days of my life,
And I will dwell in the bonds of frustration forever.

Leave a Comment

Filed under Christianity, inspirational, Uncategorized

How to add launchpad.net repositories to Debian

Many great Linux applications are packaged for Ubuntu on launchpad.net.  So what if you are a Debian user (remember that Ubuntu is derived from Debian!)?  Are you left out in the cold?  Not necessarily!

Here are some simple steps to add most any Launchpad repository to your Debian system. This example uses the excellent Double Commander cross-platform file manager.

  • Open a Terminal window in Debian.
  • In the Terminal window, elevate your user privileges, so that you can execute the remaining commands without logging in as root.
su -s
  • Open the Launchpad page for the application repository that you want to add in a web browser.  For Double Commander, the page is https://launchpad.net/~alexx2000/+archive/doublecmd.  In the Adding this PPA to your system section of the web page, click on Technical details about this PPA to open the details pane.  In the details pane, choose Lucid from the Display sources.list entries for list.
  • In the Terminal window, enter this command, replacing launchpad_URL with the URL from the details pane above (e.g., http://ppa.launchpad.net/alexx2000/doublecmd/ubuntu for our example).
echo "deb launchpad_URL lucid main ## A descriptive comment" | tee -a /etc/apt/sources.list
  • On the Launchpad web page, locate the signing key in below the details pane. You only need the 8-character portion after the ‘/’. For example, for Double Commander, the signing key is BE35DEDD.
  • Enter the following command in the Terminal to add the signing key to your system, replacing SIGNING_KEY with the actual key you found:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys SIGNING_KEY
  • Now, you are ready to actually install the application from the new repository. Enter the following commands in the Terminal. Of course, use the appropriate application name, such as doublecmd-gtk for Double Commander.
apt-get update
apt-get install appname

That’s it! Enjoy using your new applications. And let me know how this works for you in the comments.

Leave a Comment

Filed under Linux

Celtic Work Blessing

Many of us spend a good deal (perhaps most!) of our waking moments at work. Work should not just be a means to an end (making money), but instead we need to consider our work as part of our daily worship to God. In 1 Corinthians 10:31, Paul exhorts us to do everything “to the glory of God”. And recently, there has been a movement for us to be missionaries in our own workplace.

In consideration of this, I found this Celtic work blessing to be both inspirational and practical. Enjoy!

May the light of your soul guide you.
May the light of your soul bless the work that you do
with the secret love and warmth of your heart.
May you see in what you do the beauty of your own soul.
May the sacredness of your work bring healing, light and renewal to those who work with you
and to those who see and receive your work.
May your work never weary you.
May it release within you wellsprings of refreshment, inspiration and excitement.
May you be present in what you do.
May you never become lost in bland absences.
May the day never burden.
May dawn find you awake and alert, approaching your new day with dreams, possibilities and promises.
May evening find you gracious and fulfilled.
May you go into the night blessed, sheltered and protected.
May your soul calm, console and renew you.

Leave a Comment

Filed under Christianity, inspirational

Creating a New Database with phpMyAdmin

WampServer includes phpMyAdmin in it’s installation.  PhpMyAdmin is the most popular PHP-based database configuration utility, although there other options, such as Adminer, are starting to gain traction.  Since most web hosts include phpMyAdmin in their set of default tools, even if you use other tools, it’s good to have a basic understanding of phpMyAdmin.

To launch phpMyAdmin for WampServer, click on the WampServer icon in the system tray and choose phpMyAdmin from the menu (or you can open it directly in your web browser at http://localhost/phpmyadmin/.)  All MySQL installations have two databases which are built in:  information_schema and mysql.  These databases contain the MySQL metadata and configuration details.  In general, you do not want to edit these databases directly, but it’s fine to query these databases to learn about MySQL.

To create a new database, click on the Databases tab.  At the bottom of the Databases tab is a field to create a new database.  Enter the name of the database that you desire (in my example, I’ll use workroom_inventory).  Note that database names must be a single “word”, but you can use underscores in place of spaces.  In the Collation drop down, select utf8_general_ci.  (Typically, the type of collation in MySQL is not important, but for reasonable flexibility, utf8_general_ci is a good choice.  See the MySQL documentation for more information about collation and character sets.)  Press Create to create the new database.  PhpMyAdmin will display the new database automatically.

You can now create the tables in your database.  Each table in your database stores a particular set of data.  MySQL is a RDBMS, or relational database management system, which means that you will normally have some relationships between the tables.  In database terminology, these are called keys.  Each table should have a primary key (PK), which is a value that uniquely identifies a particular record (row) in the table.  Preferably, the PK is an integer number and the PK column name is the name of the table plus “_ID”.  Thus, if we create a table named user, the PK column would be named user_id.  To create such a table, enter user in the Name field and specify the number of fields (we’ll use 6 to start with).  Press the Create button.

Next, phpMyAdmin will display a form to enter your database column (field) definitions.  The first column should be a PK column user_id.  Select INT (integer) as the type and choose UNSIGNED in the Attributes drop down list.  In the Index list, choose PRIMARY, since this will be our PK.  Finally, check the A_I checkbox.  A_I stands for “auto-increment”, which means that MySQL will automatically assign the next available value for this column when a new record (row) is inserted.  This is a useful feature for PKs, since they must be unique.

Now, we can define the other columns in our database.  For the example of our user table, we’ll define the following columns:

  • username - VARCHAR with length of 25
  • password - VARCHAR with length of 32
  • first_name - VARCHAR with length of 25
  • last_name - VARCHAR with length of 25
  • email_addr - VARCHAR with length of 50

  • For each column and the table itself, choose Collation of utf8_general_ci.  Choose MyISAM as the Storage Engine.  (At this point, the choice of storage engine is not important.  As you develop more sophisticated applications, you will want to learn about the other storage engines, particularly InnoDB, to determine the one best suited to your application.)  Press Save button.  PhpMyAdmin will display the command executed to generate the table and then show the details in tabular form.  Here is the command that was generated and executed:

    CREATE TABLE `workroom_inventory`.`user` (
    `user_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `username` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
    `password` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
    `first_name` VARCHAR( 25 ) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL ,
    `last_name` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
    `email_addr` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
    

    Now that the table has been created, we can use phpMyAdmin to populate a few values.  Click on the Insert tab.  Enter the appropriate values, but leave the user_id field blank.  Remember that it is defined as “auto-increment”, so MySQL will automatically assign its value.  Press the Go button to enter the values into your table.  Now click on the Browse tab to display your data.

    That’s it for this lesson.  Hope to see you again soon for our next discussion.

    Leave a Comment

    Filed under MySQL, PHP, WAMP, web design

    Installing and configuring PEAR on WampServer

    PEAR is a framework and system for installing a large set of libraries and classes that provide standardized and well-supported functions for PHP. PEAR stands for PHP Extension and Application Repository. Some of the popular packages (PEAR’s name for collections of libraries and classes) include tools for easily building HTML forms, simplified database access, and standardized access to e-mail functions. Almost any common web development function that you can think of probably has a PEAR package.

    Even though PEAR is a framework, it’s not a framework in the traditional sense. Instead, each of the PEAR packages is more or less independent. Of course, you can use the various packages together to essentially build up your own framework. In one of our later tutorials, we’ll look at installing, configuring, and using a popular traditional model-view-controller (MVC) framework called CodeIgniter.

    WampServer actually makes it quite simple to install the PEAR tools and packages, since it comes with a script to do the installation. The installation script must be run as an Administrator in Windows. To begin, open a Windows Command Prompt as Administrator by select Start | Programs | Accessories. Right-click on the Command Prompt menu item and choose Run As Administrator. When prompted, approve running as Administrator.
    At the Administrator Command Prompt, change to the installation directory for PHP for your WampServer installation. Typically, this will be c:\wamp\bin\php\php5.2.11.

    To install PEAR, at the Administrator Command Prompt, run go-pear.bat, which is a wrapper script for PEAR installer. In general, you can accept the default options for the install script, except for the following:
    Public Web Files Directory (probably directory option #9) – Change to c:\wamp\www (your web “home” directory).

    After installing the PEAR packages, the installer will prompt you to update php.ini so that the INCLUDE_PATH contains the path to the PEAR installation. Just accept the defaults again. We will change this setting after the installer completes. Enter this entire path, including the php.ini file name, at the installer prompt.

    After the installer completes, you will need to update the INCLUDE_PATH variable in the php.ini file used by Apache. You can determine the location of this php.ini file by going to http://localhost/ and clicking on the phpinfo() link under Tools. On the phpinfo() page look for the Loaded Configuration File item; this is the php.ini file that you want to use. Open this php.ini file in a plain text editor, such as Notepad. Search for include_path in the file. Add the following line to the file:

    include_path=".;C:\wamp\bin\php\php5.2.11\PEAR"

    Also, you will need to update your PATH environment variable to include this directory, as well, so that you can run the pear.bat update script from any directory. Open the Windows Control Panel and open the System Control Panel applet and go to Advanced tab. In the Advanced tab, click on Environment Variables… button. In the Environment Variables window, locate the PATH variable. Either the User or System PATH variable is fine, but preferably update the System PATH variable. In the Edit System Variable dialog box, navigate to the end of the Variable value field and add ;C:\wamp\bin\php\php5.2.11\PEAR.  Note the semi-colon (;) at the beginning. Press OK and close the Environment Variables window and the Control Panel. For the change to take effect, you must close any Command Prompts that are open and open a new Command Prompt. (It is not necessary to open an Administrator Command Prompt, but you can use an Administrator Command Prompt, if desired.)

    The installation program also creates a registry file named PEAR_ENV.reg in your PHP directory. This script sets the PHP environment variables. Double-click on this file to merge it into your registry. Accept any permission prompts that Windows displays.

    That’s it for the install ation. To use PEAR, open a Windows Command Prompt and enter pear (or pear.bat). If you enter this command without any other parameters, PEAR will display the sub-commands that you can use. The main sub-command that you’ll use is install, which (obviously) installs the PEAR package that you specify. Also, you should probably become familiar with channel-add and channel-discover sub-commands so that you can install third-party PEAR packages (packages from sources other than the main PEAR repository).

    If you want to try out your PEAR installation, you can install the PEAR Date package, which simplifies handling of dates in PHP. To do so, open a Command Prompt and enter:

    pear install Date

    Note PEAR package names are case-sensitive, so you must specify Date (and not date). If everything is set up properly, you should see something similar to the following displayed in the Command Prompt:
    downloading Date-1.4.7.tgz ...
    Starting to download Date-1.4.7.tgz (55,754 bytes)
    .............done: 55,754 bytes
    install ok: channel://pear.php.net/Date-1.4.7

    You can also check that the installation completed successfully by running:
    pear info Date

    You should see a plethora of detail (probably more than you wanted to know!) about the package.

    1 Comment

    Filed under PHP, WAMP, web design