Making better use of Google Insights data

Google Insights is a great tool, however its data export format (only available when signed in) leaves a bit to be desired. Read on for a quick tip on how to format this data in Excel so it works a bit better for you…

The first problem is the dates are grouped by week, and the ‘Week’ column specifies a range rather than a specific date:

That’s pretty simple to fix – just hit CTRL-H and do a find and replace on ‘ – *’ to replace the “range” info.

Next, select the whole range, and do Insert -> PivotTable as below:

In the PivotTable, set up the Row Label to ‘Week’, and the Values to ‘Sum of…’ your data that you want to see.

Next, click into the Week column, and hit Options -> Group Selection – you should see a dialogue box come up:

By selecting the options here you can then group the data by months, years or quarters. If you select Month & Year together, you’ll see a data set like:

Now the data should be much easier to manipulate & summarise into useful graphs etc :)

Free OrangeHRM Leave Calendar

The open source version of OrangeHRM is a great system and a really good way of managing a team’s annual leave dates. However one feature achingly missing from the free version is a leave calendar, which you have to pay $250(!) in order to add in the functionality.

I’ve knocked up an easy (and moreover free) way of getting a calendar into the system (version 2.6). Just follow the instructions below to implement a basic (not pretty) leave calendar:

1. Edit the main menu to add a link to your calendar (around line 500) by adding another element to the subs menu:

/* Start leave menu */<br />
if (($_SESSION['empID'] != null) || $arrAllRights[Leave]['view']) {<br />
    $menuItem = new MenuItem(&quot;leave&quot;, $lang_Menu_Leave, &quot;./index.php?menu_no_top=leave&amp;amp;reset=1&quot;);<br />
    $menuItem-&gt;setCurrent($_GET['menu_no_top'] == &quot;leave&quot;);</p>
<p>    $subs = array();<br />
    $subsubs = array();<br />
    $subs[] = new MenuItem(&quot;leavecal&quot;, &#8216;Leave calendar&#8217;, &quot;./leavecal.php&quot;);<br />
    if ($authorizeObj-&gt;isAdmin() &amp;amp;&amp;amp; $arrAllRights[Leave]['view']) {<br />

2. Download this awesome jQuery calendar and upload the required scripts to a folder in your OrangeHRM root folder.

3. Copy the JSON example from the demos folder into your OrangeHRM root folder, and rename the HTML file to ‘leavecal.php’

4. Replace the PHP code in json-events.php with the following:

&lt;?php<br />
$db_host = &quot;localhost&quot;;<br />
$db_user = &quot;db_user&quot;;<br />
$db_pwd = &quot;db_pass&quot;;<br />
$db_name = &quot;db_name&quot;;<br />
$db_port = 3306;<br />
mysql_connect($db_host, $db_user, $db_pwd) or die(mysql_error());<br />
mysql_select_db($db_name) or die(mysql_error());</p>
<p>$sql = &quot;SELECT *<br />
		FROM `hs_hr_leave`<br />
		WHERE  leave_status &gt; 1<br />
		ORDER BY leave_date ASC;&quot;;</p>
<p>$leave_dates = array();</p>
<p>$res = mysql_query($sql) or die(mysql_error());<br />
while ($row = mysql_fetch_assoc($res)) {<br />
	$employee_id = $row['employee_id'];<br />
	$sql1 = &quot;SELECT `emp_firstname` FROM `hs_hr_employee` WHERE `emp_number` = &#8216;$employee_id&#8217;&quot;;<br />
	$res1 = mysql_query($sql1) or die(mysql_error());<br />
	$row1 = mysql_fetch_array($res1);<br />
	$employee = $row1[0];</p>
<p>	$start_date = $row['leave_date'];<br />
	$end_date = $row['leave_date'];<br />
	$event_id = $row['leave_request_id'];<br />
	$title = $employee . &quot; A/L&quot;;</p>
<p>	array_push($leave_dates, array(<br />
			&#8216;id&#8217; =&gt; $event_id,<br />
			&#8216;title&#8217; =&gt; $title,<br />
			&#8216;start&#8217; =&gt; $start_date,<br />
			&#8216;end&#8217; =&gt; $end_date,<br />
		));<br />
}<br />
	echo json_encode($leave_dates);<br />
?&gt;

And there you have it – simple, dirty, will break if/when you update the system, but hey it’s quick, easy and costs nothing.

Setting up Nutch – troubleshooting

It’s pretty easy downloading the latest version of Nutch but I had a few issues getting it set up on my Red Hat server; it’s pretty easy really but there are a couple of gotchas along the way and it doesn’t work exactly as specified in the tutorial.

  1. Download & install Java – super simple: yum install java
  2. wget & unzip the latest version of Nutch
  3. I had issues with the JAVA_HOME environment when trying to follow the example onĀ  crawling a website. The error I got was “/usr/loca/jdk/bin/java: No such file or directory” – the problem here was twofold: 1) I didn’t have java set in my environment variables, and 2) around line 118 in the bin/nutch file there’s a reference to $JAVA_HOME/bin/java – the bold part of which seems unnecessary and should be deleted

 

1 2 3 4 5 6 7  Scroll to top