From around the web,

Lovely HTML5 Templates

from http://html5up.net/
html5upNext up Wiliam’s blog –

Error logging with email notifications in Umbraco

http://www.wiliam.com.au/wiliam-blog/error-logging-with-email-notifications-in-umbraco

 

wiliamblog

 

 

The Doves Type®

Finally for this week.  Great story from the BBC 
http://www.typespec.co.uk/doves-type/

dovetype

Posted in Uncategorized | Leave a comment

Umbraco and log4net – Using two different versions of a DLL in ASP.net

If you ever need to use two different DLL versions because a third party SDK requires a later version of DLL which is required to run your application or Umbraco

Firstly download the DLLs you require and place them in a directory structure in the BIN folder as follows.

  • /bin/AcmeSDK/log4net.dll
  • /bin/umbraco/log4net.dll

Next remove any reference to the log4net.dll in any of the projects in the solution of the application.

Edit the Web.config to point to each assembly and version.

	<runtime>
        <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
        <codeBase version="1.2.13.0" href="log4net/BazaarVoice/log4net.dll" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="log4net" publicKeyToken="null" />
        <codeBase version="1.2.11.0" href="log4net/Umbraco/log4net.dll" />
      </dependentAssembly>
		</assemblyBinding>
	</runtime>

 

 

Posted in Uncategorized | Leave a comment

Upgrading gphoto2 for Raspberry Pi to solve Canon 5D MkIII issues

The awesome little Raspberry Pi arrived this week on Monday morning on my desk. Including all that one may need to build and make something marvellous. I decided to build a simple photobooth using the Canon 5D MkIII.

To access a camera with a Raspberry you’ll need a USB cable to connect the camera to the Raspberry Pi board and of course the gphoto2 library.

sudo apt-get gphoto2

I would also recommend updating the Raspbian system too.

sudo apt-get update
sudo apt-get upgrade

The last command will take some time to complete.

Only works once issue on Canon Cameras

Using the default gphoto2 I was able to connect to camera however only once! It seems to be a bug within the gphoto code.

Upgrading to 2.5.5 with ‘Gonzalo’ Code – No joy but may work for you.

Upgrading to gphoto 2.5.x seems to resolve the issue however this isn’t too easy. You need the source code, subversion and then to compile it under Raspbian. I found an interesting blog post which speaks about the procedure. But I ran into some trouble much too complicated.  Until I found the following https://github.com/gonzalo/gphoto2-updater


wget https://raw.githubusercontent.com/gonzalo/gphoto2-updater/master/gphoto2-updater.sh
chmod +x gphoto2-updater.sh
sudo ./gphoto2-updater.sh

Unfortunately this failed for me.

Upgrading gphoto2 to 2.5.2 

Next up, I found another method to upgrade the gphoto2 code. However this script only updates it to 2.5.2. Which maybe enough for my project requirements.

http://www.ohmypi.com/2013/06/07/compiling-gphoto2-dependencies-how-to/

However the script takes between 30-40 minutes to complete. I actually created a SH script in vi with the following contents to automate the process. This worked wonderfully.


apt-get install -y libltdl-dev libusb-dev libexif-dev libpopt-dev
cd/
mkdir gphoto-working-directory
cd gphoto-working-directory/
wget http://ftp.de.debian.org/debian/pool/main/libu/libusbx/libusbx_1.0.11.orig.tar.bz2
tar xjvf libusbx_1.0.11.orig.tar.bz2
cd libusbx-1.0.11/
./configure
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/libgphoto/2.5.2/libgphoto2-2.5.2.tar.bz2
tar xjf libgphoto2-2.5.2.tar.bz2
cd libgphoto2-2.5.2
./configure
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/gphoto/2.5.2/gphoto2-2.5.2.tar.gz
tar xzvf gphoto2-2.5.2.tar.gz
cd gphoto2-2.5.2
./configure
make
make install
cd ..
ldconfig

Upgrading to 2.5.5


apt-get install -y libltdl-dev libusb-dev libexif-dev libpopt-dev
cd/
mkdir gphoto-working-directory
cd gphoto-working-directory/
wget http://ftp.de.debian.org/debian/pool/main/libu/libusbx/libusbx_1.0.11.orig.tar.bz2
tar xjvf libusbx_1.0.11.orig.tar.bz2
cd libusbx-1.0.11/
./configure
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/libgphoto/2.5.5/libgphoto2-2.5.5.tar.bz2
tar xjf libgphoto2-2.5.5.tar.bz2
cd libgphoto2-2.5.5
./configure
make
make install
cd ..
wget http://downloads.sourceforge.net/project/gphoto/gphoto/2.5.5/gphoto2-2.5.5.tar.gz
tar xzvf gphoto2-2.5.5.tar.gz
cd gphoto2-2.5.5
./configure
make
make install
cd ..
ldconfig

Posted in Photography, Raspberry Pi | Leave a comment

Social Framework for Twitter, Facebook and Instagram …

Came around an interesting Framework for .NET application addtional there is even an Umbraco package integration.

Skybrud.Social is a framework in .NET for integration with various social services like Twitter, Facebook and Instagram. The framework will handle all the technical parts and API communication so you don’t have to.

Download Code and See Sample at http://social.skybrud.dk/

Posted in .NET, Umbraco | Tagged , , , | Leave a comment

Linux Cheat Sheet for Web Developers

Checking Disk Space

Use either command:

  •  df
  •  du –max-depth=1 | sort -n -r

DNS

  • cd /var/lib/named is where you should find the DNS entries for the web server.
  • Restarting /etc/init.d/named restart

Check Log Messages on the Mail Server

  • Use the command:
    tail -f  /var/log/messages

Show Deleted Files

  • Use the command:
    ls -ld /proc/*/fd/* 2>&1 | fgrep ‘(deleted)’

Checking Memory

Use either command:

  • free -m (in MBs)
  • cat /proc/meminfo

Checking Directory Size

  • du -c
  • du -h gives the size better
  • du -h -S | sort -n -r (no sub folders)

Tip:   check /var/lib/psa/dumps directory if you are using Plesk. That Plesk dumps aren’t filling up the drive

Checking Processes

Use either command:

  • ps aux
  • top

Restart Apache / MySql

Tip: If you have change the Apache configuration it’s always best to use the command
/etc/init.d/apache2 configtest to check before restart for any mistakes or typos.

  • /etc/init.d/apache2 restart
  • /etc/init.d/mysql restart

Finding Files

  • find / -name somefilename…

Restarting Plesk

  • /etc/init.d/psa start   Tip: a good way to see what is slow to start up.

Renaming a batch of Files to another file extension

  • for i in *.html; do mv “$i” “${i/.htm}”.html; done

Shutdown and Scan disk

  • shutdown -Fr now

List User / Groups

  • /etc/passwd
  • /etc/group

Add User to Group

  • gpasswd -a USERNAME groupname

Delete User

  • userdel username

Turning On and Off Safe Mode in PHP

  • Edit the Conf/httpd.include for the line php_admin_flag Safe_mode off

Installing Pear so you can send mail via GMAIL

-wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear install Mail

Check if PHP is using Pear
php -c /path/to/php.ini -r ‘echo get_include_path().”\n”;’

Checking PHP
php –ini

Editing the PHP.INI
vi /etc/php5/cli/php.ini
vi /etc/php5/apache2/php.ini

Make sure the variable is set…
include_path = “.:/usr/share/pear”

Installing a Perl Module

  • perl -MCPAN -e ‘install Time::Piece’
Posted in Linux | Leave a comment

Video Background with JQuery

 

This fun to do, with the right video it works well. If the content is sitting at the bottom of the  screen. Anyway check out the demo page to see how it’s done.

videoi386

bigvideo

Posted in Uncategorized | Leave a comment

Database frameworks & generators

Useful tools for building for .NET application whether they are desktop or for web.

Drapper

Drapper is is a micro-ORM, offering core parameterization and materialization services, but (by design) not the full breadth of services that you might expect in a full ORM such as LINQ-to-SQL or Entity Framework. Instead, it focuses on making the materialization as fast as possible, with no overheads from things like identity managers – just “run this query and give me the (typed) data”.
code.google.com/p/dapper-dot-net/

PetaPoco

A tiny ORM-ish thing for your POCOs. PetaPoco is a tiny, fast, single-file micro-ORM for .NET and Mono.  http://www.toptensoftware.com/petapoco/

SQLinq – use LINQ to generate Ad-Hoc Sql Queries

Easily generate ad-hoc SQL code using LINQ in a strongly typed manner that allows for compile time validation of sql scripts. http://sqlinq.codeplex.com/

SalarDbCodeGenerator

This application is aimed to generate .NET class and methods for databases and model them based on customizable patterns.

SalarDbCodeGenerator is a database first, code generator. It uses customizable patterns to generate different codes and models for applications. The generator engine is mostly optimized for C# but it can be used to generate any other programming language code.

http://salardbcodegenerator.codeplex.com/

 

Posted in .NET | Tagged | Leave a comment

Add a Taxonomy Products or Projects to a WordPress Theme

taxno

Step 1. Create folder in your theme called ‘inc’
Step 2. Create file called tax-products.php
Step 3.  Inside the file copy and paste the following. Then save the file.

<?php
function cpt_products(){
global $options;
$url_rewrite = $options[‘theme_product_item_url’];
if( !$url_rewrite ) { $url_rewrite = ‘products’; }
register_post_type(‘post_products’,
array(
‘labels’ => array(
‘name’ => ‘Products’,
‘singular_name’ => ‘Product Item’,
‘add_new’ => ‘Add New Product’,
‘add_new_item’ => ‘Add New Product Item’,
‘edit’ => ‘Edit’,
‘edit_item’ => ‘Edit Product Item’,
‘new_item’ => ‘New Product Item’,
‘view’ => ‘View’,
‘view_item’ => ‘View Product Item’,
‘search_items’ => ‘Search Product Items’,
‘not_found’ => ‘No product items found’,
‘not_found_in_trash’ => ‘No product items found in Trash’,
‘parent’ => ‘Parent Product Item’
),
‘description’ => ‘Easily lets you create some beautiful products.’,
‘public’ => true,
‘show_ui’ => true,
‘_builtin’ => false,
‘capability_type’ => ‘page’,
‘hierarchical’ => true,
‘rewrite’ => array(‘slug’ => $url_rewrite),
‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘comments’),
)
);
flush_rewrite_rules();
}
function tax_products() {
global $options;
$url_rewrite = $options[‘theme_product_item_type_url’];
if( !$url_rewrite ) { $url_rewrite = ‘item-type’; }
register_taxonomy(‘products_item_types’, ‘post_products’,
array(
‘hierarchical’ => true,
‘labels’ => array(
‘name’ => ‘Item Types’,
‘singular_name’ => ‘Item Types’,
‘search_items’ => ‘Search Types’,
‘popular_items’ => ‘Popular Types’,
‘all_items’ => ‘All Types’,
‘parent_item’ => ‘Parent Types’,
‘parent_item_colon’ => ‘Parent Type:’,
‘edit_item’ => ‘Edit Type’,
‘update_item’ => ‘Update Type’,
‘add_new_item’ => ‘Add New Type’,
‘new_item_name’ => ‘New Type Name’
),
‘show_ui’ => true,
‘query_var’ => true,
‘rewrite’ => array(‘slug’ => $url_rewrite)
)
);
flush_rewrite_rules();
}

add_action(‘init’, ‘cpt_products’);
add_action(‘init’, ‘tax_products’);

Step 4. Add the following line to the function.php


include_once( get_template_directory() . '/inc/tax-projects.php' );

Posted in Wordpress | Leave a comment

Adding OptionTree to an WordPress Theme

Theme Options are what make a WordPress Theme truly custom. OptionTree attempts to bridge the gap between developers, designers and end-users by solving the admin User Interface issues that arise when creating a custom theme. Designers shouldn’t have to be limited to what they can create visually because their programming skills aren’t as developed as they would like. Also, programmers shouldn’t have to recreate the wheel for every new project, so in walks OptionTree.

Step 1. First download OptionTree and extract the zip file.
Step 2. Copy the Option-Tree directory into your theme.
Step 3. Edit the Function.php in your theme and add following line to provide Option-Tree Support.

add_filter( 'ot_show_pages', '__return_false' );
add_filter( 'ot_theme_mode', '__return_true' );
include_once( 'option-tree/ot-loader.php' );
include_once( 'includes/theme-options.php' );

Step 4.  Create a folder named ‘includes’ in your theme with a filename called theme-options.php  with the following contains:

<?php

/**
* Initialize the options before anything else.
*/
add_action( ‘admin_init’, ‘custom_theme_options’, 1 );

/**
* Build the custom settings & update OptionTree.
*/
function custom_theme_options() {
/**
* Get a copy of the saved settings array.
*/
$saved_settings = get_option( ‘option_tree_settings’, array() );

/**
* Custom settings array that will eventually be
* passes to the OptionTree Settings API Class.
*/
$custom_settings = array(
‘contextual_help’ => array(
‘content’ => array(
array(
‘id’ => ‘general_help’,
‘title’ => ‘General’,
‘content’ => ‘<p>Help content goes here!</p>’
)
),
‘sidebar’ => ‘<p>Sidebar content goes here!</p>’,
),
‘sections’ => array(
array(
‘id’ => ‘general’,
‘title’ => ‘General’
)
),
‘settings’ => array(
array(
‘id’ => ‘my_checkbox’,
‘label’ => ‘Checkbox’,
‘desc’ => ”,
‘std’ => ”,
‘type’ => ‘checkbox’,
‘section’ => ‘general’,
‘class’ => ”,
‘choices’ => array(
array(
‘value’ => ‘yes’,
‘label’ => ‘Yes’
)
)
),
array(
‘id’ => ‘my_layout’,
‘label’ => ‘Layout’,
‘desc’ => ‘Choose a layout for your theme’,
‘std’ => ‘right-sidebar’,
‘type’ => ‘radio-image’,
‘section’ => ‘general’,
‘class’ => ”,
‘choices’ => array(
array(
‘value’ => ‘left-sidebar’,
‘label’ => ‘Left Sidebar’,
‘src’ => OT_URL . ‘/assets/images/layout/left-sidebar.png’
),
array(
‘value’ => ‘right-sidebar’,
‘label’ => ‘Right Sidebar’,
‘src’ => OT_URL . ‘/assets/images/layout/right-sidebar.png’
),
array(
‘value’ => ‘full-width’,
‘label’ => ‘Full Width (no sidebar)’,
‘src’ => OT_URL . ‘/assets/images/layout/full-width.png’
),
array(
‘value’ => ‘dual-sidebar’,
‘label’ => __( ‘Dual Sidebar’, ‘option-tree’ ),
‘src’ => OT_URL . ‘/assets/images/layout/dual-sidebar.png’
),
array(
‘value’ => ‘left-dual-sidebar’,
‘label’ => __( ‘Left Dual Sidebar’, ‘option-tree’ ),
‘src’ => OT_URL . ‘/assets/images/layout/left-dual-sidebar.png’
),
array(
‘value’ => ‘right-dual-sidebar’,
‘label’ => __( ‘Right Dual Sidebar’, ‘option-tree’ ),
‘src’ => OT_URL . ‘/assets/images/layout/right-dual-sidebar.png’
)
)
),
array(
‘id’ => ‘my_slider’,
‘label’ => ‘Images’,
‘desc’ => ”,
‘std’ => ”,
‘type’ => ‘list-item’,
‘section’ => ‘general’,
‘class’ => ”,
‘choices’ => array(),
‘settings’ => array(
array(
‘id’ => ‘slider_image’,
‘label’ => ‘Image’,
‘desc’ => ”,
‘std’ => ”,
‘type’ => ‘upload’,
‘class’ => ”,
‘choices’ => array()
),
array(
‘id’ => ‘slider_link’,
‘label’ => ‘Link to Post’,
‘desc’ => ‘Enter the posts url.’,
‘std’ => ”,
‘type’ => ‘text’,
‘class’ => ”,
‘choices’ => array()
),
array(
‘id’ => ‘slider_description’,
‘label’ => ‘Description’,
‘desc’ => ‘This text is used to add fancy captions in the slider.’,
‘std’ => ”,
‘type’ => ‘textarea’,
‘class’ => ”,
‘choices’ => array()
)
)
)
)
);

/* settings are not the same update the DB */
if ( $saved_settings !== $custom_settings ) {
update_option( ‘option_tree_settings’, $custom_settings );
}

}

?>

Posted in Wordpress | Leave a comment

iPad & iPod Mobile Website

Studio Albanese requirement was to extend their existing website which i386 developed on their own content management platform using Microsoft ASP.net to the clients requirement.  The extension to our platform was an mobile theme specifically for Apple iPhone and iPad while also being compatible with Android devices too.

Studio Albanese is a leading architect firm based in Northern Italy. Therefore a simple and elegant design was a fundament requirement for the mobile version of their existing Internet site.

The website theme for mobile is delivered automatically depending on web visitor’s device whether it’s a mobile phone, tablet or computer.  As can be seen below with the different screenshots.

 iPhone Screenshots

iPad Screenshots

Posted in Mobile | Leave a comment