Export DHCP Leases to HTML or CSV in Windows Server 2003/2008

If you’re looking to export your DHCP leases on your Windows Server into a readable format, then the following article will help.

http://theadminguy.com/2009/10/14/export-dhcp-leases-to-html-using-powershell/

You can also simply run the following command and copy and paste it into excel and it should match the columns correctly.

1
netsh dhcp server 1.1.1.1 scope 1.1.1.0 show clients 1

 

OpenClinica Tomcat Error When Setting JAVA_OPTS on Ubuntu 10.04

I’ve setup OpenClinica a number of time and never really touched the JAVA_OPTS for Tomcat because I’ve never really had any issues. On the OpenClinica Installation Documentation it states that the JVM performs well when using the following JAVA_OPTS

https://docs.openclinica.com/3.1/installation/installation-linux#content-title-5460

1
export JAVA_OPTS="$JAVA_OPTS   -Xmx1280m -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:MaxPermSize=180m -XX:+CMSClassUnloadingEnabled"

However, if you’re running Ubuntu 10.04 LTS, you will receive an error when modifying the /etc/default/tomcat6 JAVA_OPTS.

1
Conflicting collector combinations in option list; please refer to the release notes for the combinations allowed

The two options that cause this error are “-XX:+UseParallelGC -XX:ParallelGCThreads=2″, if you remove these then the errors go away. Looking into this further, I’ve found some documentation but not much. The commands are related to garbage collection, and the following article sheds some light on the above two commands as well as “-XX:+UseParNewGC”

http://stackoverflow.com/questions/2101518/difference-between-xxuseparallelgc-and-xxuseparnewgc

Upon remove the two recommended options and adding ”-XX:+UseParNewGC” tomcat6 starts without error.

If anyone has any information on why this is, it would be great to know.

Apache Tomcat Native library Not Found Error on Ubuntu

Sometimes you might get the following error message in your logs for your Tomcat instance under Ubuntu.

1
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found

To fix this issue, simply run the following command to install the appropriate library.

1
apt-get install libtcnative-1

The error should go away!

Dual or Triple Monitors and Multiple Taskbars for Windows 7

If you have a dual or a triple monitor setup, and you wish to have a taskbar on the second or second and third monitor. Then you should take a look at Dual Monitor Taskbar.

It’s a free opensource program for Windows 7 that puts a taskbar on your second monitor if you have dual monitor setup or on your second and third monitor if you have a triple monitor setup. I haven’t tried a quad monitor setup or beyond, please let me know if you have in the comments.

Here is a list of configuration options.

  • General
    • Automatically start with Windows
    • Check for Updates
  • Taskbar Appearance
    • Show lables
    • Show clock
    • Mirror mode
    • Use small icons
    • Show notification area
    • Show start button
    • Use custom font
    • Auto-hide the taskbar
  • Taskbar location
    • Mutliple display support
    • Options for Bottom, Left, Right, Top

Below is a screenshot of the settings, and notepad on a second monitor. As you can see, it’s hard to tell the different from a normal Windows 7 taskbar.

dual-monitor-taskbar-screenshot

If you have a program running on your second or third screen, it will show on the taskbar for that monitor, so it makes it easy to locate your programs windows.

There is similar software that you can purchase, however Dual Monitor Taskbar seems to get the job done and is free.

Dual Monitor Taskbar Homepage

How To Create A WordPress Admin Login Using MySQL

You can do this simply by running the following SQL commands through phpMyadmin or through command line MySQL.

1. First insert the new user account into the database.

If you’re using command line MySQL then you will need to select the database first using the “use” command below:

1
use wp_mywordpressdatabasename

Now that you’ve selected the database, you can run the following query to insert the new user account into the wp_users table of your WordPress Database. You will want to fill in your details below before executing the query. You enter this query under the “SQL” tab within phpMyAdmin.

1
INSERT INTO `wp_users` (`id`,`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES (''.'john', MD5('newpassword123'), 'John Smith', '[email protected]', 'http://www.geektank.net/', '2013-29-03 00:00:00', '', '0', 'John Smith');

If successfully you should see:

1
Query OK, 1 row affected (0.00 sec)

Note, the field ‘ID’ is blank because this field is set to auto-increment within the table, a number will automatically to the ‘ID’ field for the new user.

2. Find out what ID your new account received.

Now that you have the successfully inserted the new record into the wp_users table. You want to know the new ID for the new account. You can find this rather easily with phpMyAdmin, but if you’re using the mysql command line simply run the following.

1
select * from wp_users where user_login = "john";

Which should return:

1
2
3
4
5
+----+------------+----------------------------------+---------------+--------------------------+-------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+----+------------+----------------------------------+---------------+--------------------------+-------------------------+--------+------------+---------------------+-------------+--------------+
| 5 | john | 8359b10e30dfabd587a5661e52249101 | John Smith | [email protected] | http://www.geektank.net | 2012-08-23 00:00:00 | | 0 | John Smith |
+----+------------+----------------------------------+---------------+--------------------------+----------+--------------+---------------------+---------------------+-------------+--------------+

The ID for the new account we created is 5.

3. Making the new WordPress Account an Administrator (wp_usermeta bits)

Even though we added a new user, it doesn’t have Administrator rights yet. We need to add a couple of entries to the wp_usermeta table. Taking the ID of the new user we create the following two queries.

1
2
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '5', 'wp_user_level', '10');

These queries will tell provide Administrator rights to our new user account.

4. Enjoy the new account!

You’re done!

 

Get RackTables working with php-cgi or fastcgi

If you’ve tried to google “racktables authentication not working after install” you won’t find much, but there is a couple of articles about fastcgi and the PHP_AUTH_PW and PHP_AUTH_USER not being passed correctly. But no real solution to the problem.

I was able to get RackTables working using the following work around posted on http://www.rosmir.org/Index/Docs/archive/LabsFolder/FastCGI which has nothing to do with RackTables.

  1. You will need to add the following to your .htaccess file.
    1
    2
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
  2. Next you will need to modify the inc/auth.php file and add the following before the function authenticate.
    1
    2
    3
    if(preg_match('/Basic+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
    list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
    }
  3. It should look like following below when completed.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    function authenticate ()
    {
    if(preg_match('/Basic+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
    list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
    }

    global
    $remote_username,
    $remote_displayname,
    $auto_tags,
    $user_given_tags,
    $user_auth_src,
    $script_mode,
    $require_local_account;
    if (!isset ($user_auth_src) or !isset ($require_local_account))
    throw new RackTablesError ('secret.php: either user_auth_src or require_local_account are missing', RackTablesError::MISCONFIGURED);
    if (isset ($_REQUEST['logout']))
geil-2x8gb-GS316GB1333C9DC

Upgrading Memory on a Macbook Pro OSX with the GeIL 16GB Memory Kit (GS316GB1333C9DC)

I recently purchased the “GeIL 16GB (2 x 8G) 204-Pin DDR3 SO-DIMM DDR3 1333 (PC3 10660) Laptop Memory (GS316GB1333C9DC)” from NewEgg on boxing day in hopes that it would work in my Macbook Pro (Early 2011 15″ – MC721LL/A – MacBookPro8,2 – A1286 – 2353-1*)

And to my surprise after installing the memory my Macbook Pro booted and actually posted to OSX 10.8.2, here is a screenshot of the “About This Mac” and “System Report” sections showing that 16GB of memory is installed.

Even thought I could boot into OSX, I still needed to confirm that everything was stable. There is a program called memtest by Command-Tab that will allow you to test the memory extensively. The best way to test is through Single User Mode to ensure that you test all memory and with minimal running in the background. If you run memtest via terminal when OSX is booted, then you will only be able to test available memory. I’ve provided a screenshot of memtest running from OSX via terminal, and you can see that it only detects 12GB of memory. This is because the rest has been used and can’t be tested.

 

memtest-macbookpro-16gb

Microsoft IIS 7.5 Best Practices

I thought everyone should take a look at this quick Micrsoft IIS 7.5 Best Practices article, it talks a little bit about security but mostly just what not to leave on was default. If you have any other sites or information you want to share, please comment!

http://adminspeak.wordpress.com/tag/iis-7-5-best-practices/