VirtualBox 5 – it remains a useful tool rather than a replacement…

virtualboxVirtualBox 5 is out of a somewhat short beta and its essence seems to have not really changed. It’s still a great tool but no Hyper-V / BootCamp / Parallels replacement….

In brief if you’ve used it before then you will see five new features. All of which are good.

  1. Paravirtualization Support for Windows and Linux Guests: Significantly improves guest OS performance by leveraging built-in virtualization support on operating systems such as Oracle Linux 7 and Microsoft Windows 7 and newer.
  2. Improved CPU Utilization: Exposes a broader set of CPU instructions to the guest OS, enabling applications to make use of the latest hardware instruction sets for maximum performance.
  3. Support of USB 3.0 Devices: Guest operating systems can directly recognize USB 3.0 devices and operate at full 3.0 speeds. The guest OS can be configured to support USB 1.1, 2.0, and 3.0.
  4. Bi-Directional Drag and Drop Support for Windows: On all host platforms, Windows, Linux and Oracle Solaris guests now support “drag and drop” of content between the host and the guest. The drag and drop feature transparently allows copying or opening of files, directories, and more.
  5. Disk Image Encryption: Data can be encrypted on virtual hard disk images transparently during runtime, using the industry standard AES algorithm with up to 256 bit data encryption keys (DEK). This helps ensure data is secure and encrypted at all times, whether the VM is sitting unused on a developer’s machine or server, or actively in use.

Useful links:

How to MANUALLY install Redmine 3.x on Windows Server 2008 R2

redmine_logo_v1  Redmine is a free and open source, web-based project management and issue tracking tool. It allows users to manage multiple projects and associated subprojects. It features per project wikis and forums, time tracking, and flexible role based access control. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. Redmine integrates with various version control systems and includes a repository browser and diff viewer. The design of Redmine is significantly influenced by Trac, a software package with some similar features. Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database and supports at least 34 languages.

There are issues with installing Redmine on Windows due to some gems. The key to a successful outcome is to match the versions. Obviously with time this situation will change…

This ‘should’ take < 30 minutes.

You can always use the Web Platform Installer process. Google/Bing/etc. will help you find it.

You WILL experience a Json gem error around step 4.3 – just keep following the directions.

IGNORE “DL is deprecated, please use Fiddle”

Assumptions

  • You have IIS up and running
  • You already have an instance in place of SQL, MAriaDB, POST/My etc
  • Rmagick is NOT being/already installed.

Download the following:

  • Ruby 2.0.0 x32 – http://rubyinstaller.org/downloads/
  • Ruby Dev Kit for use with 2.0 x32 – http://rubyinstaller.org/downloads/
  • Redmine 3.0.4 – http://www.redmine.org/projects/redmine/wiki/Download

‘THE’ Process

  1. Install Ruby. Just double click, agree, and accept the defaults.
  2. Create the IIS site that will host Redmine.
  3. Extract the Redmine file into the above IIS site folder. Let us assume it shall be C:\inetpub\wwwroot\redmine\
  4. Open a Ruby Command prompt as Administrator. Capture1
    1. CD into the folder C:\inetpub\wwwroot\redmine\ and run
    2. gem install bundler
    3. bundle install –without development test rmagick
  5. Install the Dev Kit
    1. Double click and extract to a folder that makes sense. E.g. C:\RubyDevKit
    2. CD into that folder and run:
      • ruby dk.rb init
      • ruby dk.rb install
      • gem install json -v ‘1.8.3’
  6. Go back to C:\inetpub\wwwroot\redmine\ and run
    • bundle install –without development test rmagick
    • bundle exec rake generate_secret_token
    • rake db:migrate – IF you get a SQL error here you probably have the wrong PW in your C:\inetpub\wwwroot\redmine\config\database.yml file OR your user is different.
    • set RAILS_ENV=production
    • set REDMINE_LANG=en
    • bundle exec rake redmine:load_default_data
  7. In theory you should now have a functional instance of Redmine BUT you are not yet done. Run the following to test
    • bundle exec rails server webrick -e production
    • OPEN a browser on the server and check http://localhost:3000
    • If you see what looks like Redmine CTRL+C and continue.
    • NOTE: You CAN run Redmine like this but it is not really stable enough for ‘real’ production use.
  8. IIS needs to be set up to run Ruby & Redmine. This detail will be added at a later date when I have time.

 

This seems useful / complimentary: http://jonathanmatthey.com/project/opensource/2012/11/01/redmine-sprint-reports.html

SharePoint 2010 and JQuery

Recently somebody wanted to know how they could streamline activity on a site starting with reducing the overall page refresh count. Put simply, jQuery really is a lifesaver for this stuff. Combined with SharePoints web services and SPServices there is a huge amount that you can do without having to resort to writing any C#. The challenge, as with most things, is how to get started. Below are some simple examples of functional code that will work if you copy and paste correctly.

Example 1: Getting items from a list, in this case called “TestList1”, and output the raw response into a div tag called “demodiv1”
$(document).ready(function() {
$().SPServices({
debug: true,
operation: “GetList”,
listName: “TestList1”,
completefunc: function (xData, Status) {
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML
});
$(“#demodiv1”).html(“”).append(“This is the output from the GetList operation:” + out);
}
});
});

Example 2:  Getting all sub sites from a URL, in this case called “http://testserver/webapp1”, and output the raw response into a div tag called “demodiv2”
NOTE: The URL for the site can be defined in two ways, both shown. The one that is not commented is persistent – therefore rather useful!

$(document).ready(function() {
$().SPServices.defaults.webURL = “http://testserver/webapp1”;
$().SPServices({
debug: true,
operation: “GetWebCollection”,
//webUrl: “http://testserver/webapp1”,
completefunc: function (xData, Status) {
var out = $().SPServices.SPDebugXMLHttpResult({
node: xData.responseXML
});
$(“#demodiv2“).html(“”).append(“This is the output from the GetList operation:” + out);
}
});
});

Example 3: What kind of data exactly is being returned? Okay so if you have tried the first two examples you will have noted that the data really is kind of raw. Let’s see it in a popup. In this case the same code as above with a difference… Instead of updating a DIV tag we just populate a popup by using an alert.
Note: Play around with alert(“XML=” + xData.responseXML.xml); and alert(“xData: ” + xData.responseText);

$(document).ready(function() {
$().SPServices.defaults.webURL = “http://testserver/webapp1”;
$().SPServices({
debug: true,
operation: “GetWebCollection”,
completefunc: function (xData, Status) {
alert(“Status=” + Status + ” XML=” + xData.responseXML.xml);
});
}
});
});

Example 4: Okay, so now lets take the same data and wrap the title of each returned site in its respective URL inside of a DIV called tasksUL.

$(document).ready(function() {
$().SPServices.defaults.webURL = “http://testserver/webapp1”;
$().SPServices({
debug: true,
operation: “GetWebCollection”,
completefunc: function(xData, Status) {
// now iterate through the results
$(xData.responseXML).find(“[nodeName=Web]”).each(function () {
// for each one found get the title and wrap it with the respective Url
$(“” + $(this).attr(“Title”) + ““).appendTo(“#tasksUL”);
                });
}
});
});

Browser detection: solving the quandary with a bit of PHP

The browser and its specific version can tell you a lot about your visitors. Not just that they are running OpenSolaris, Windows 7, or Chrome OS but much, much more. It also can help you enable, or more likely disable, certain features of your site, content, or application. Therefore it is more than critical to determine it correctly. It is/should be mandatory.

So what are your options. Precisely three.

  1. Do nothing
  2. Go client side
  3. Go server side

1 is not worth mentioning, 2 is typically performed by JavaScript which leaves 3.

Now leaving aside the potential impact on your caching mechanism/plans/shenanigans option 3 can bring some great benefits without sending the client browser any payload. But if you have to do it yourself it can be a royal pain as browser versions and new products are like beer. Everybody will try a new one but usually not for long. (that may need work.) So what to do? Cue Browser.php


Browser.php is a PHP class that helps this process by collecting data about a visitor’s browser such as:

  • platform used
  • browser
  • browser version

It is very easy to implement.

Typical usage

$browser = new Browser();
if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
echo 'You have FireFox version 2 or greater';
}

Needless to say you must do the usual beforehand such as:
require_once(‘Browser.php’);
and
$browser = new Browser();

Resources: http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/

Open source projects for PST file access

This goes back a while and I just plain forgot to post about it.

Back in February of 2010, Microsoft released a public specifications for PST files, the databases used by Outlook for storing and archiving e-mail. To these specifications, Microsoft also added a pair of developer-oriented open source projects:

Though the core Office document formats are now XML-based open standards, alleviating such lock-in issues, Outlook has continued to use a complex database format for storing mail, making interoperability difficult. With the documentation and these software projects, the days of being locked into Outlook could be coming to an end.

The SDK project is still not finished; seemingly it still only provides read-only access to PST data, though write support is purportedly planned. Both tools are released using under the Apache License 2.0. This means that they can be incorporated into proprietary, closed-source projects, as well as other open source projects.

Overall the information available at the Microsoft Interoperability site is very, very useful and I would strongly recommend a visit.

Resources
http://blogs.msdn.com/b/interoperability/

EC2 now has FreeBSD

EC2 now has FreeBSD

Good news. EC2 now has FreeBSD. Though with some quirks…In order to work with EC2, the FreeBSD AMIs are slightly modified from what you would have immediately after installing FreeBSD from a release CD:

  • The network is configured and the sshd daemon is enabled, for obvious reasons.
  • SSH logins as root are enabled, but root’s password is starred out (i.e., password logins as root will fail until a password is set).
  • The first time an AMI is booted, a script fetches the public half of an SSH keypair from EC2 and arranges for root logins using that key.
  • Every time the the AMI boots, it prints the SSH host keys to the console in the same format as Amazon Linux AMIs do.
  • The FreeBSD kernel is located on an ext2 filesystem, in order to allow Amazon’s user provided kernel functionality to work. (Everything else is on a single UFS2 filesystem.)
  • AMIs published from 2010-12-29 onwards have /etc/motd text with some comments about FreeBSD/EC2 and a link to this page.
  • AMIs published from 2010-12-29 onwards by default report kernel panics (including backtraces) to the FreeBSD/EC2 maintainer to assist him in identifying and fixing bugs. 
At the present time, FreeBSD/EC2 should be considered an experimental platform not yet ready for production use.

The following AMIs are available (though there are additional obsolete AMIs…):

FreeBSD version us-east-1 us-west-1 eu-west-1 ap-southeast-1
FreeBSD 9.0-CURRENT @ 2011-01-04
For t1.micro instances only! ami-8cce3fe5 ami-61683824 ami-e388bd97 ami-36bdc364
FreeBSD 8.2-RC @ 2011-01-08
For t1.micro instances only! ami-4a15e423 ami-376e3e72 ami-f77e4a83 ami-3eb6c86c

Note: Apparently FreeBSD will only currently work on t1.micro instances..

Resources
http://aws.amazon.com/ec2/
http://www.freebsd.org/
http://forums.freebsd.org/showthread.php?t=254

PHP: Finding the binary

The other day I was stumped, albeit rather briefly, by something I should not have been. I was scripting out some CRON jobs for a CRM system when I found out I could not locate where the hosting company had put the PHP binary. Now that is something you usually do not have to think about so it can easily fall into the ‘been a while’ category.

So if you ever find yourself asking, where is the PHP binary? or just where is PHP? Here are some steps to follow.

Telnet/Shell
If you have shell access via telnet, log in, and type “which php” and you should be given the location to use.

If you don’t have shell, try one of the following:

Create a php page with just the following: and then call the page, this should tell you the location of PHP.

echo system('which php');

If that does not work, though it should, try checking one of the paths listed under path in the ENVIRONMENT section of the output with this.Take note though that this will give you the environment path so you will still need to add /php to it…

echo phpinfo();

JS Library For Image & Vector-Tiled Maps

Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.

Polymaps provides speedy display of multi-zoom datasets over maps, and supports a variety of visual presentations for tiled vector data, in addition to the usual cartography from OpenStreetMap, CloudMade, Bing, and other providers of image-based web maps.

“Because Polymaps can load data at a full range of scales, it’s ideal for showing information from country level on down to states, cities, neighborhoods, and individual streets.

Because Polymaps uses SVG (Scalable Vector Graphics) to display information, you can use familiar, comfortable CSS rules to define the design of your data.

And because Polymaps uses the well known spherical mercator tile format for its imagery and its data, publishing information is a snap.”

References
PolyMaps: http://polymaps.org/
QuadTiles: http://wiki.openstreetmap.org/wiki/QuadTiles

Getting Apache22 on FreeBSD 8.1 to work with DHCP

Apache likes to have a static IP address to work with and that is not always something you can guarantee to have. An easy way to get around this is to add the following two files to /etc

Firstly add a file called “dhclient-exit-hooks” with the following

#!/bin/sh


APINCDIR=/usr/local/etc/apache22/Includes
APPIDFILE=/var/run/httpd.pid


if [ ! -z “$new_ip_address” ]; then
    # First, configure the /etc/hosts file so Apache can start
    HOSTNAME=`grep ^hostname= /etc/rc.conf | awk -F = ‘{ print $2 }’ | sed -e ‘s/”//g;’`
    if [ ! -z “$HOSTNAME” ]; then
        echo “$new_ip_address $HOSTNAME” > /etc/hosts.dynamic
        cat /etc/hosts.boilerplate /etc/hosts.dynamic > /etc/hosts
    fi


    # Next, we’ll configure the Apache web server, if it has been installed
    if [ -d $APINCDIR ]; then
        echo “ServerName $new_ip_address” > $APINCDIR/server-name.conf


        if [ -f $APPIDFILE ]; then
            kill -HUP `cat $APPIDFILE`
        fi
    fi
fi

Secondly add a file as referenced above called “hosts.boilerplate” with the following content:
# $FreeBSD: src/etc/hosts,v 1.16 2003/01/28 21:29:23 dbaker Exp $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace ‘my.domain’ below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1 localhost localhost.my.domain
127.0.0.1 localhost localhost.my.domain
#
# Imaginary network.
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
# 10.0.0.0 –   10.255.255.255
# 172.16.0.0 –   172.31.255.255
# 192.168.0.0 –   192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers.  Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
Then reboot, restart service, whatever your preference is, and test it out.

Creating symbolic links in FreeBSD

Sometimes when you FTP into a FreeBSD environment you need to bounce around to directories acroos the file system. One way to simply this process when working in a FTP client is to create a symbolic link as a file. It is really easy.

To go from point A to point B where point A is a click able file and B is a target folder just run:

ln -s /path/to/folder/B /where/you/want/the/file/to/exist/B