Sunday, November 16, 2014

Generics and code refactoring in C# Programming

Some videos on C# Generics, code refactoring and inheritance

Saturday, November 15, 2014

[VSAUCE] YOU LIVE IN THE PAST



iiiiinteresting....not really multimedia related though, oh well!

Chrome Cast Apps

Firefox

Firefox and Chrome both have the built in ability to cast any video (that is compatible with your phone) through the chrome cast. This makes the chrome cast a much more useful device than simply allowing the built in video apps (you tube, Netflix, etc), opening up the wide world of online videos to the chrome cast.  So far I've had great results casting videos using both browsers, but it doesn't work with flash videos.

A classic episode of the Simpson playing through Firefox

Es File Explorer Chromecast Plugin

The Es File explorer has a chrome cast Plugin that allows any video or image on your Android to be cast onto the chrome cast. Previously I used an app called local cast to achieve this, but having the functionality built into the file browser makes things a lot more efficient.

I recommend downloading the Chromecast store for android which gives you access to a wide range of apps specifically made for the chrome cast and those that have chrome cast support such as the ones mentioned in this post.  Thankfully the Chromecast does seem to be getting support by Android applications and these useful implementations tlof functionality I have mentioned here.  Hopefully this continues further and is implemented into more and more apps down the line.

The chromecast in action via the Es File explorer chromecast plugin casting a home video from my phone 
The photo of an image I showed in my previous post, again casting through the ES file explorer 

 

Friday, May 25, 2012

styling openCart

(written in reference to version 1.5.2.1)

Theme Location

Theme stylesheets are found in the subdirectory ‘/catalog/view/theme’ within the openCart folder on your site. 

 

Editing Existing Themes

To edit a pre-existing theme, go to the theme’s location eg ‘/catalog/view/theme/default’ and go to the folder ‘stylesheet’ and then open ‘stylesheet.css’.  Once the file has been edited and re-uploaded, the changes you make be will be applied to your shop’s design.

If you have no experience with CSS (Cascade Style Sheets) check out CSS Basics and the w3schools site section on CSS, as you will need to understand how stylesheets work to start making changes!

 

Creating a New Theme

To create a new theme, create a new folder, with the required theme name, and copy over the image and stylesheet folders from the default template.  Also, create a folder ‘template’ with a folder within that called ‘common’.  In that, copy over the header.tpl file from the same directory in the default theme folder.

Edit the header.tpl file and replace every instance of ‘default’ with the name of your theme (what

Now, go into the admin panel eg. http://www.myshop.com/shop/admin and then go to system > settings from the navigation bar and click ‘Edit’ next to the shop that you want to theme.

From here, choose the ‘Store’ tab, and click the drop down box next to where it says ‘Template’.  The name which you chose for the new theme should now appear here.  Select it and then click Save to update it.

 

Go back to your shop page (eg http://newshop.myshop.com) and refresh.  The default theme you will now be applied to the page!

See the Editing Existing Themes section to get editing themes.

 

 

Friday, April 13, 2012

Exporting MySQL to Excel XML with formatting through PHP


The Requirement
Over the last couple of days I have been working on creating a way of getting data from a MySQL Database and getting this into an Excel spreadsheet for a project for a client.  This is something I had done before so I thought it would be no big task.  In fact, phpMyAdmin (apparently, though I haven't tried it) has a way of exporting data into a CSV file which is readable by excel.

The Problem
The problem is, a CSV file is a simple dump of data into a file, which contains no formatting, and so can make the spreadsheet look pretty ugly as well as hard to read.  This is obviously not what a client, or anyone wanting to analyse the data from a spreadsheet wants.

The Solution
So after hours and hours and hours of searching the internet and trying all different methods (none of which seemed to work correctly - for me) for one reason or another, I decided to reverse engineer an Excel file; create a basic spreadsheet, format it as required, and save it as an Excel XML file.  Then all I would have to do is open it up in a text editor, see how Excel was formatting the file, and recreate this with some php code and adding in the functionality to get the data from the required database then save that into an xml file.

If you want to do a lot of formatting to your spreadsheet,  then I recommend you reverse engineer your own Excel file sheet, and recreate it with php yourself.  If there is a quicker way of doing this, let me know, but this is the only way I could personally get it working.

Tools
Something I found very useful for this was a basic online tool called XML Pretty Print (http://xmlprettyprint.com/) that converts ugly xml with all the tags pushed up together in a very hard to read way into a much more organised, easy to look at layout.  This made it a lot easier to separate the different lines of XML code when it came to creating the php file.

I also used Compare My Files (http://www.comparemyfiles.com/) to compare the XML file I exported from Excel with the XML file created from the code when it wasn't working, to see what was wrong with the php created XML file.


Example
Here is what I ended up with.  It took quite a bit of playing around with to get it working fully.  The slightest mistake and Excel would show a blank spreadsheet.  (To be honest, I was using Open Office, so Excel may have opened it, I don't currently have Excel installed to test it on).

Feel free to play around with this and see how it works for you.


//Connection to Database - Fill in with the details for your database
$host = '';
$user = '';
$pass = '';
$database = '';
$table = '';

//Code to connect to the database
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); 
mysql_select_db($database, $linkID) or die("Could not find database."); 

//Query the database - select all fields 
$query = "SELECT * FROM `$table`"; 
$resultID = mysql_query($query, $linkID) or die("Data not found."); 

//The XML code. $xml will store the entire xml structure and will be
//saved to an xml file at the end.

$xml = '';
$xml .= '';
$xml .= '';

$xml .= '';
$xml .= '';
  $xml .= '';
   $xml .= '3'; 
   $xml .= '#c0c0c0'; 
   $xml .= '';
   $xml .= ''; 
   $xml .= '4'; 
$xml .= '#ff0000'; 
   $xml .= '';
   $xml .= '';
$xml .= '';

$xml .= '';
$xml .= '9000'; 
  $xml .= '13860'; 
   $xml .= '240'; 
   $xml .= '75'; 
   $xml .= 'False'; 
   $xml .= 'False';
$xml .= '';


//STYLES - This is the style information used for the rows, 
//columns and individual cells

$xml .= '';
$xml .= '';
  $xml .= '';
  $xml .= '';
  $xml .= '';
$xml .= '';
$xml .= '';
$xml .= '';
$xml .= '';
//END STYLES

//WORKSHEET
$xml .= '';
//TABLE
$xml .= '
';
   $xml .= ''; 
  $xml .= '';
$xml .= '';
$xml .= '';
$xml .= '';
//HEADER ROW
$xml .= '';
//CELLS
$xml .= '';
  $xml .= 'Order ID'; 
   $xml .= '';
$xml .= '';
   $xml .= 'Invoice Number'; 
  $xml .= '';
 
$xml .= '';
   $xml .= 'Customer ID'; 
   $xml .= '';
 
$xml .= '';
   $xml .= 'Store Number'; 
   $xml .= '';
  $xml .= '';
   $xml .= 'Total'; 
  $xml .= '';
//End CELLS
   $xml .= '';
//End HEADER ROWS
//Code to get rows from database - you will have to replace the row names with the rows in your database.

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++)  //Loop through all rows and do the following for each
$row = mysql_fetch_assoc($resultID); 
//ROWS
$xml .= '';
//CELLS
$xml .= '';
$xml .= ''. $row['order_id'] .''; 
$xml .= '';
$xml .= '';
$xml .= ''. $row['invoice_no'] .''; 
$xml .= '';
$xml .= '';
$xml .= '' . $row['customer_id'] .'';
$xml .= '';
 
$xml .= '';
$xml .= ''. $row['store_name'] .''; 
$xml .= '';
$xml .= '';
$xml .= ''. $row['total'] .''; 
$xml .= '';  
//End CELLS
$xml .= '';
//End ROWS
}
  $xml .= '
';
//End TABLE
   $xml .= ''; 
  $xml .= '';
  //End WORKSHEET

$xml .= '';
//End WORKBOOK

//Write the entire xml structure and data to an xml file "xmlOutput.xml"
$fp = fopen("xmlOutput.xml", "w");
fwrite($fp, $xml);
fclose($fp);

echo "XML Data written to xmlOutput.xml";

?>




Thursday, March 15, 2012

Flash (ActionScript 3) Mouse Click event on the stage using a class

It's been ages since I have used Actionscript (or really done much programming at all). Today I set myself the task of simply creating an event handler for the stage by using a class. Nothing seemed to be working correctly, until it all suddenly seemed to be obvious. 


 I have made the event handler (click_handler) display the X and Y co-ordinates of the screen. Replace this with whatever you want to happen when the screen is clicked. 


Don't know how to use classes at all? Or just need reminding how to declare the main document class (like I did), theres a simple tutorial at Active Tuts to help you out. 


 The Code:

package 
{
import flash.display.MovieClip;

import flash.events.MouseEvent; //Required to allow Mouse Events to be used
import flash.events.Event; //Required to allow the creation of the listener
import flash.display.Stage; //Required to allow 'stage' to be referenced
   
public class main extends MovieClip  
{

  public function main()
  {
  loaderInfo.addEventListener(Event.INIT, createListener); //adds the event listener as the class is loaded 
  }
  
  private function createListener(event:Event):void
  {
  stage.addEventListener(MouseEvent.CLICK, click_handler);  //creates an event handler called "click_handler" (see below) that is connected to the stage.
  }
  
  function click_handler(event:MouseEvent):void //this function is called every time the stage is clicked
  {
  trace("X: " + event.target.mouseX + ", Y: " + event.target.mouseY); //Displays the X and Y position of where the mouse clicked on the stage
  
  }   
  
}

}
   

Tuesday, November 29, 2011

The Blog

I'm really not sure why this blog had 200+ hits last month, since I've not updated it in years.

Anyway, maybe I should keep going with this blog and keep up to date with the latest things I've been doing, useful links, etc.

Lately the main project I have been working on is my comic strip Gibbo Comics which I started 8 years ago, and took about four or five years off after I started at university (which is when this blog started).  Originally this was the blog we had to set up for the multimedia university course I did at Nottingham Trent, to show the stuff we were doing.  I think I may have moved the blog over to another location that I have forgotten about now which soon got discontinued.

I am hoping in the new year to get doing some more multimedia-ish stuff again.  3D design and some animation are some things I *really* want to get back into, as well as a bit of app development for android, iPhones, etc.  It's just finding the time (and motivation!)


Monday, May 11, 2009

Artefacts 5 and 6

Artefact 5: Futuristic Tower
1
2 3
Artefact 6: Medieval Style Inn
5 1 2 3 4

Monday, March 09, 2009

Artefact 3 (progress)

image

Here are the first screenshots of

image

Here are the first screenshots from my third artefact of a waterwheel.  The genre which this fits into is a peaceful, old fashioned almost fantasy style one.

Monday, March 02, 2009

Artefact 2: Cartoon House

Here are the screenshots of the cartoon house created for my second artefact.

image image image image image image 1

Friday, February 27, 2009

End of year gallery idea

An unreal level showcasing various different levels, buildings, drawings and other graphics and ideas which I have created and thought up during my time at university.  This will allow viewers to walk around the 3D world to see the various different things I have created whilst interacting with the environment and playing through the 3D levels I have create.

Monday, February 16, 2009

Artefact 2: Cartoon Themed Building (screenshots and looking into existing games)

I have started working on a cartoon themed building, basing the style on a Simpsons/Family guy style home.

ss3

ss2  ss1

However, whilst creating this, I have realised how plain and boring using plain textures look in 3D so have decided to look into games of the cartoon genre for inspiration.

Day of the Tentacle:

I really like the use of unrealistic, miss-shaped architecture used in the game Day of the Tentacle, this has a really in your face cartoony look to it which I will incorporate into my design.

image

Sam And Max:

A more modern game, Sam and Max uses 3D designed buildings in the game whilst still having a basic cartoon look about it which immediately stands out as a cartoon design.  The rounded windows getting bigger towards the top also make the image look less realistic and cartoony.

Similar themes of archetectural style and more complex cartoon styling is also found in the monkey island series of games:

(edit: just thought of another similar graphical style to what I have been looking at: Disneyland buildings – Mickey’s Toon Town)

Here is a very basic design based on the styles of graphics in the above games.

image

Monday, February 09, 2009

Research Artefact 1: Haunted House (2)

Here are the finished rendered images of the haunted house in Maya

hh1 hh2 hh3 hh4 hh5

Tuesday, February 03, 2009

Research Artefact 1: Haunted House

Here are the renderings of the haunted house artefact in Maya and Unreal Editor

Maya:

1   

2

Unreal Editor:

unreal4

unreal5 unreal6

unreal7