Thursday, 14 August 2014

Archive Sharepoint 2007/2010 List

There was a requirement where I work to automate archiving of Sharepoint 2007 lists. Thought someone might find my powershell implementation useful.

If running SharePoint on Windows 2003, one just needs to install Powershell components.

Thanks go out to My implementation adapted from their code.

### CHANGE ME ###########################

# Expiration date #
$expireDate = (Get-Date).AddDays(-365) 
# Base site URL #
# Source and destination list URLS
$dstListUrl=$spSiteUrl+"/Lists/Archive Request"


[System.Reflection.Assembly]::Load(Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c) 
[System.Reflection.Assembly]::Load(Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c) 

# Connect to sharepoint site

# Get lists

# Get list items
$srcListItems = [Microsoft.Sharepoint.SPListItemCollection]($srcList.Items)
$dstListItems = [Microsoft.Sharepoint.SPListItemCollection]($dstList.Items)

$toArchive = 0
$toKeep = 0

$purgeIds = @()

# Preflight
Write "Calculating damage..."

foreach ($srcItem in $srcListItems){
    # Must not be younger than the expiration date or opened
    if($srcItem["Modified"] -gt $expireDate -or $srcItem["Request Status"] -ne "Closed"){
    $purgeIds += $srcItem["ID"]

Write-Host To Keep: $toKeep
Write-Host To Archive: $toArchive

Write-Host "Here we go..."

# Loop through candidates
for ($s = 0; $s -lt $purgeIds.Count; $s++){

    $srcItem = $srcListItems.GetItemById($purgeIds[$s])

    # Must not be younger that the expiration date or opened
    if($srcItem["Modified"] -gt $expireDate -or $srcItem["Request Status"] -ne "Closed"){
    # Dump the item name for later cleaning
    Write-Host Archiving '{' $srcItem["ID"] - $srcItem["Name"] - $srcItem["Title"] '}'

    # Add destination list item
    $newItem = $dstListItems.Add()
    # We must loop through each item version and create at destination
    for ($i=$srcItem.Versions.Count - 1; $i -ge 0; $i--) {

        # Loop through each field
        foreach ($srcField in $srcItem.Fields) {
            $version = $srcItem.Versions[$i]
            if ($srcField.ReadOnlyField -ne $True -and  $srcField.InternalName -ne "Attachments") {
                $newItem[$srcField.Title] = $version[$srcField.Title]
            elseif ($srcField.Title -eq "Created" -or
                    $srcField.Title -eq "Created By" -or
                    $srcField.Title -eq "Modified" -or
                    $srcField.Title -eq "Modified By") {
                    $newItem[$srcField.Title] = $version[$srcField.Title]
        # Update item for next version
    # Whack the attachments to the list item
    foreach($baseName in $srcItem.Attachments){
        $file = $srcList.ParentWeb.GetFile($srcItem.Attachments.UrlPrefix + $baseName)
        $newItem.Attachments.Add($baseName, $file.OpenBinary())

    # And another update
    # Purge the source

} # Move onto next candidate

Saturday, 3 August 2013


One of the community members over at POGS just mentioned that the new ODROID-XU is now available form Hardkernel. Check it out here:

Quite the beefy little ARM unit hosting the new Exynos 5 with 8 cores (4 usable at a time). Essentially it switches between 4 cores that are for light tasks and 4 which are for heavy tasks. Not sure if it's possible to use them all at once, haven't looked into this yet. The whole switching thing is ARM's "big.LITTLE" trademarked design in an attempt to be more energy efficient on mobile devices. The GPU is compliant with OpenCL 1.1 embedded platform profile.

I'm having a serious battle with myself over if I should get it or not. I currently have the ODROID-U2, however, I would like to get my hands on this one because of the GPUs OpenCL 1.1 compliance, albeit only embedded profile as opposed to full. It would allow me to test some OpenCL code I've been playing with for BOINC on an ARM based device.

The problem is that I'm in no position to throw money at new toys. Oh, what to do? Maybe I should wait for something in the same class packing a GPU with full profile OpenCL 1.1 support.

Thursday, 27 June 2013

CyanogenMod 10.1.0 Stable for ODROID-U2

I don't know if it's pre-exam jitters or what, but I felt compelled at 3AM in the morning to put together a little instructional on how to get latest CyanogenMod build on the ODROID-U2. Stable was just released a couple days ago. What follows is by no means "complete". Just documenting as I went more than anything.

Note: Assumes we're installing onto an SD card.

1. Prepare the SD Card

This to be done from a machine with an SD Card reader. We're dumping the 4.1.6 beta image from HardKernel as we want to use the CWM recovery tool to update to CyanogenMod's latest release.

Adjust method below depending on your platform.

1. Download

$ wget

2. Unzip

$ unzip

3. Dump to SD card. 

$ sudo dd if=ODROID-U2.img of=/dev/<replace me> bs=4M

4. Insert SD card into ODROID-U2 with keyboard and mouse and boot.

2. Update the ODROID-U2

Now it's time to prepare the ODROID-U2 for latest CyanogenMod release. Might as well jump to my blog post from the ODROID-U2 itself to click the links for easier download.

1. From a browser instance download these:

CyanogenMod 10.1.0 -
Google Apps 4.2.2 -

2. Open up a terminal, become root and reboot into recovery console:

$ su
# reboot recovery

3. You should be in recovery console when you navigate to do this (in order):
  - Wipe data/factory reset
  - Install zip from sdcard
  - Choose file
  - Browse to Download folder and select
  - Choose file
  - Browse to Download folder and select

4. Now reboot and we should be done. You should get CyanogenMod logo spinning like this for a little bit before Google Apps config appears:

I'll be back to update this later as there will probably be a few bugs to nut out.

Wednesday, 12 June 2013

SETI@Home v7 Project binaries update

When I initially uploaded the project binaries for the new v7 client, I neglected to keep the v6 client included. I forgot that the v6 client is still being used for Astropulse. I've now fixed this and if you download, extract and restart, you should see two application versions instead of just one:

$ boinccmd --get_state | grep -A 8 "Application versions"
======== Application versions ========
1) -----------
   application: setiathome_enhanced
   version: 6.12
   project: SETI@home
2) -----------
   application: setiathome_v7
   version: 7.01
   project: SETI@home

Task still chugging along:

Thursday, 6 June 2013

SETI@Home v7 client for Raspberry Pi

MarkJ reminded me that SETI now have a new client which means the old v6 client will discontinue to work.

I've compiled the new v7 client. Go get it over on my project page or download project package directly here:

As always, with my packages, this just needs to be extracted into the BOINC project folder. If you already have SETI attached you should only need to fix permissions and restart client for it to read new app_info.xml file and start giving you v7 tasks.

My task won't finish for a while so can't let you know if it works yet. However, it's available for those that want to give it a crack.

Current task pending completion:

Not long to go now (Ha ha):

Monday, 4 March 2013

School starting.

Thought I'd post something to let people know that semester 1 classes begin tomorrow. This means I won't be able to dedicate as much time to my "toys" and hence the content updates on the blog will most probably suffer.

I'll be continuing to watch things and might post now and then. If you have any requests or suggestions for porting BOINC apps over to a certain platform feel free to post and I can try have a look into it when I get a chance.