Sunday 29 March 2015

Drupal security updating

Using drupal it's always good to stay up-to-date with security updates. The trouble is, how to update as it is usually a manual thing (please could you automate it Drupal?).

So, the manual process is:
  1. Backup files
    1. You really only need to backup the /Sites/All folder, but I backup all of it
    2. I use FileZilla, and simply drag the whole online folder onto my machine in an appropriately named folder - /Backups/29-03-2015/webfiles/
  2. Backup database
    1. The database is probably the most important thing to backup
    2. Log in to your myPHPadmin console
    3. click on the database
    4. Click on export
    5. I just use the simple settings
    6. When it's made the file, it'll give it to you to download
    7. Download and put it in an appropriately named folder - /Backups/29-03-2015/database/
  3. Download the latest Drupal release
  4. Upload all the files
    1. I use FileZilla, which doesn't replace folders, only files within folders. Very handy! You don't want to overwrite your /sites/ folder as this contains all your custom stuff!
  5. Run the update
    1. go to http://www.yourwebsite.com/update.php
  6. Done!

Saturday 28 March 2015

PHP download FTP file and convert from ANSI to UTF-8

So, I have a file, and I'm using Joomla with CSVI to import the file from an ftp server into the database. The file is automatically made by a third party, and it is in ANSI format.

This file contains '£' which CSVI and Joomla do not like when it is in ANSI format. I need to convert it to UTF-8 in order to import such characters. Of course to convert, I will need to store locally as well. Here's my research:

First thing is to get the file and store on server:

Found the PHP function ftp_get

Once on the server, I found two ways to convert:
mb_convert_encoding()
iconv()

this is quite helpful for getting and writing the file:
$file = file_get_contents('file.php');
$file = iconv('greek-charset','UTF-8', $file);
file_put_contents('file.php', $file);
//ta-da!

Monday 9 March 2015

Blender Render Farm Tutorial

This tutorial will talk you through how to use the Render Farm in S721. You will be able to submit a job, and collect the files when finished.

  1. Load up Blender 2.73a found in Applications > Blender 2.73a > Blender
  2. You will need to enable the render farm plugin
    1. Go to File > User Preferences
    2. Go to "Render" on the left hand list
    3. Enable "Network Renderer"
    4. Close this window
    5. At the top go to where it says "Blender Render" and select "Network Render":
    6. On the lower right hand panel you will see the controls for network rendering:
    7. Once a job is submitted you will have to wait until it is complete before collecting the files.
On the Master Machine (the Mac Pro teaching machine) you can log in and access the queue viewer.
  1. Open a web browser on this machine
  2. in the URL type
    1. http://localhost:8000
 Done

Basic Fabric Printer Tutorial

This tutorial will talk you through using SmartPrint to send a print to the fabric printer and controlling the 'print queue' to the printer.

  1. You will need to log into the computer with a special login:
    1. Username: .\smartprint
      1. Please put the .\ before the word 'smartprint'
    2. Password: smartprint
  2. Put your USB Pendrive into the machine
  3. Your image is best off in the .TIFF format
    1. To convert to this format (as opposed to JPEG) load Photoshop
    2. Open your image
    3. In the menu system, click on Image > Image Size
    4. resize your image to the size you would like it printed to
      1. Make sure the 'Resolution' is set to 200 Dots Per Inch (DPI) (as opposed to Dots per CM)
    5. Click OK to resize it.
    6. In the menu system click: File > Save As
    7. Select TIFF from the list of formats
    8. Click OK when asked more questions.
  4. Load up "SmartPrint"
    1. Icon is at the bottom
  5. It will present you with a set width canvas which is dark gray
    1. each fabric is a different width. Measure your fabric
    2. To resize the width of the canvas click: File > Layout
    3. Edit the 'width' to the size in mm
  6. Open up an explorer window and browse to your image. (the TIFF file you made earlier)
  7. Drag this image onto the canvas of Smartprint
  8. It should size your image how you had sized it in Photoshop
  9. You may drag more images onto the canvas to maximise use of space. Although it will only let you drag one image at a time.
  10. When you are happy, switch the printer on
  11. Load the roll you wish to print on
  12. Click the 'right' arrow to say you have loaded a roll
    1. it will measure the width of the roll
  13. Click the 'Remote' button when the printer is ready to print
  14. On the computer go to: File > Print
  15. Click OK for 1 copy
  16. The Print Queue Manager will load up
    1. Do not click on the Print Queue Manager as it will crash!
  17. If the Print Queue Manager 'crashes' you will need to close it and open it again
    1. Click on the SmartPrint software
    2. In the file menu system go to: File > Close Queue Manager
    3. In the file menu system go to: File > Open Queue Manager
    4. In the Queue Manager go to: File > Start Print Queue
 Done

Embroidery Machine basic Tutorial

The embroidery machine can take an image and convert it into lines which it can follow with a stitch, or it can fill inbetween if the area is enclosed.

This tutorial will show you how to get an image into the application and convert it into stitch lines and fills.

Finding an Image

To make your life easier, it is best to start with images that have only a few colours, and which are flat. i.e. no gradients or noise.

For demonstration purposes I have not made my life easier, I have picked this image:
Although this image has gradients, we can fix it in Photoshop to make it a flatter image

Fine-tuning the image before using PE Design

I will open the image in Photoshop. To make the image have less colours (I count the gradient as many colours) we can do a few things:
  1.  If it is just one shaded colour, you can use threshold
    1. Click on the threshold button in the Adjustments panel on the leftIt's in the bottom row of icons in the middle
    2. It will add an adjustment layer in photoshop and take you to editing it. This panel should now look like this
    3. And your image should now be black and white:
    4.  Underneath the graph there is a slider, if you slide it around you should be able to get a good black and white image:
    5. Heres where I moved the slider to:
    6. If you are happy with it, you can save as a JPEG image and move onto the next Chapter "Converting Pixel Image into Vector Image"
  2. If these last few steps didn't bode well, then we will try a different 'filter'
    1. We will use the 'Cutout' filter, accessed in the menu 'Filters > Artistic > Cutout...
    2.  You will see these sliders:
    3. Move them about until you have however many colours you need. Your image should look flat (no gradients) like this:
    4. Save your file as a JPEG image and close Photoshop.

Converting images into stitch and fills

Now we are ready to put the image into PE Design
  1. The software needs a license to run, which is on the 'disk drive' for the embroidery machine. Make sure it is plugged in.
  2. Load up PE Design Center
    1. Start menu > PE Design > PE Design Center
  3. click on the Image button to say you have an image to work from
  4. Find your image and click OK
  5. With the colour picker, choose the colours of your image that you want it to work from
  6. Click OK
  7. Now in the top right corner you will see four icons next to each other. These are the four steps to take to convert our image. The workflow is to work from left to right. We have done the first two steps of importing the image and converting it to PE Design format.
  8. Click the next image which looks like some dots with lines joining them. Here it will convert our image into lines
  9. The standard settings work well, but if it does not produce the right image, click this icon again to go back and repeat the steps, changing the settings.
  10. Your image should be converted into lines. You can edit these lines if there are not quite right using the tools on the left
  11. The final step is the last button on the right. When you click this it will covert your lines to a running stitch.
    1. To change the stitch colour click on the line tool and change the colour.
      1. Whereever you now click it will change that line to that colour
    2. To make it have no running stitch, click the button to the left of the colour to turn it off
      1. wherever you now click it will not do a running stitch
    3. To change whether it fills an area in with a fill stitch click the fill tool
      1. Where-ever you now click it will fill in areas with a fill stitch
    4. To unfill an area, click the button to the left of the 'colour' button
      1. Where-ever you now click it will NOT fill in areas.
  12. When you are happy with your image you will need to put it on the disk
    1. Don't close the PE-Design center but open PE Layout and Editing from the Start menu
      1. Start > Programs > PE Design > Layout and Editing
    2.  To import your file click File > Import > From Design Center
      1. It will ask you what size to import it as
    3. Now to save to disk
      1. Click File > Write to Disk

The Embroidery Machine

Now you are ready to put your image on the Embroidery machine.
  1. Switch the machine on at the back
  2. Click the on-screen OK button
  3. When it is booted, insert the disk
  4. Click on the icon which represents the disk
  5. Click on the file on the disk
    1. It will put your artwork on the 'canvas'
  6. You can rotate, resize your artwork here.
  7. When you are ready click the End Edit button (bottom right)
  8. Load your Embroidery frame in
  9. Click the To Sew button (bottom right)
  10. Thread the machine
  11. Click the Sew button (bottom right)
  12. Click the safety button and then the green button to begin.

LaserCutter Vector Cutting Basic Tutorial

Introduction

In order for the Laser Cutter to cut through materials, it needs a vector line to follow with the laser. Vector lines are created on the computer using various applications such as:
  • Adobe Illustrator
  • CorelDraw
  • InkScape
A vector line in its simplist form is two points on the screen, which have a line connecting them. Images made in these applications might only consist of points and lines. These lines might have a colour and thickness. If these lines enclose an area, the area can be filled with a colour or gradient.

This is in contrast to the images you will be used to which are 'pixel' based. Pixel based images are made up of a large grid of dots, each with a colour value.

Overview

In this tutorial we will take a pixel based image and convert it to a vector image using Adobe Illustrator CS5. We will then edit this to enable the laser cutter to follow the lines we would like to cut. This involves editing the line thickness, deleting all the 'filled in areas' and lines we do not want the laser cutter to cut.

Finally we'll stick it in CorelDraw and laser cut it.

Finding an Image

To make your life easier, it is best to start with images that have only a few colours, and which are flat. i.e. no gradients or noise.

For demonstration purposes I have not made my life easier, I have picked this image:
Although this image has gradients, we can fix it in Photoshop to make it a flatter image

Fine-tuning the image before using Illustrator

I will open the image in Photoshop. To make the image have less colours (I count the gradient as many colours) we can do a few things:
  1.  If it is just one shaded colour, you can use threshold
    1. Click on the threshold button in the Adjustments panel on the leftIt's in the bottom row of icons in the middle
    2. It will add an adjustment layer in photoshop and take you to editing it. This panel should now look like this
    3. And your image should now be black and white:
    4.  Underneath the graph there is a slider, if you slide it around you should be able to get a good black and white image:
    5. Heres where I moved the slider to:
    6. If you are happy with it, you can save as a JPEG image and move onto the next Chapter "Converting Pixel Image into Vector Image"
  2. If these last few steps didn't bode well, then we will try a different 'filter'
    1. We will use the 'Cutout' filter, accessed in the menu 'Filters > Artistic > Cutout...
    2.  You will see these sliders:
    3. Move them about until you have however many colours you need. Your image should look flat (no gradients) like this:
    4. Save your file as a JPEG image and close Photoshop.

Converting Pixel image into Vector Image

Now we can open our image in Illustrator and convert it:
  1. Open Illustrator
  2. Open your file
    1. Go to the menu "File > Open" and find your file
  3.  It will place your image on a sheet of paper. Click on the image and you will see the top bar change and a "Live Trace" button will appear
  4. Click "Live Trace" and your image should change to Black and White and the top bar will change once more:
  5. You can change the "Threshold" and "Min Area" numbers to change how it converts your image
    1. You will find that the flatter your image is, the better the results will be
  6. To just get the outlines of the image, we need to click the "Tracing Options Dialogue" which is the small button at the top, next to the "Custom" dropdown box. The dialogue box should look like this:
    1.  Uncheck the Fills box
    2. Check the Strokes box
    3. Check the Ignore white box
  7.  When you click OK, your image should look like this:
  8. When you are happy, click the "Expand" button at the top:
  9. You will now be able to see the points and lines Illustrator has created. It naturally strokes the line with a thickness of 1pt. We want make the thickness 0.01pt as this is what the lasercutter likes.
    1. Change the 'Stroke' number in the top bar to 0.01pt (it's not in the dropdown box, you have to manually type it in)
  10. Now we must Save
    1. Go to File > Save as
    2.  Save it as an Illustrator Document (.ai)
    3. Click save
    4. On the dialogue box with more options on:
    5. Uncheck "Use Compression"

Laser Cutting


Now we are ready to use CorelDraw to layout our artwork and send to the laser cutter
    1. Login to the lasercutter computer
      1. Username: .\lasercutter
      2. Password: lasercutter
    2.  Load up CorelDraw X4 (icon is at the bottom next to start menu)
    3.  CorelDraw makes you a new document which is 40cm by 30cm
    4. Import your image
      1. go to File > Import
      2. find your image and click import
      3. Click OK if it asks you any questions
    5. Its easier if you group you artwork lines together.
      1. right click on your artwork and select Group
    6. Position your artwork so it will line up with the material you put in the lasercutter
    7. Now you're ready
    8. Before we send the whole thing, we need to do test cuts.
    9. Make a small square using the square tool.
    10. In the bottom right corner, double click the black box and change the stroke to "Hairline"
    11. Click OK
    12. go to File > Print
    13. Check the box which says "selection"
    14. Click on Properties
    15. Go to the Advanced tab and find a preset which most resembles your material.
    16. Click it and click "Load"
    17. Now it should have updated the setting on the previous tab. Go back to this one
    18. Make sure the Vector check is marked
    19. Have a look at the speed and power settings in the vector section (bottom right)
    20. Click OK
    21. This takes you back the print window. Click "Print" (make sure the lasercutter is on and connected)
    22. Open the lasercutter and put in your material.
    23. Click Focus button and use up and down arrows until measuring tool brushes the surface of the material
    24. Click the Job button and you should see your file as JOB1:graphic1.cdr
    25. Switch on Extractor fan (big green button)
    26. Press GO!
    27. When machine beeps it's finished.
    28. Check whether it was a good cut
    29. If not, readjust settings (12.) and retry.
    30. When it is a good cut, select your work and go through the last steps to send it.
Cheers