Stage 8 Howden to York

Stage 8 Howden to York

 

Perl Internet Rake

This is my solution to raking the internet with Perl. Just populate the array with the extension you want. I use the dark art of Google hacks to get the information back.

There is a two part loop running off this. Part one build a list of Url where the data can be collected Hash of Array using the extension as the base. Stage two of the loop builds a list of links for the data then starts downloading.

#! /usr/perl -w

use Google::Search;
use LWP::Simple;
use HTML::LinkExtor;
use Cwd;

#file extension array
my @extentions    = qw(xls xlsx doc docx jpeg gif png);//ext to get
my %searchResults = ();
my %downloadlist  = ();
my @linklist      = ();

#file reanme propertys

my $dir    = '/Users/Robert/workspace/perltest/dir1';
my $cwd    = getcwd();
print $cwd;
my $LinkExtor = HTML::LinkExtor->new( \%links );

#search for extenstions and build a hash of hash
foreach $ext (@extentions) {

	my $search = Google::Search->Web( query => "indexof $ext" );
	while ( my $result = $search->next ) {

		#list the url of search
		print "working with extension: $ext " . $result->rank,
		  " the search address ", $result->uri, "\n";
		$URL = get( $result->uri );

		$LinkExtor = HTML::LinkExtor->new( \&links );

		#use the LinkExtor Sub
		$LinkExtor->parse($URL);

		#build Hash table.
		$downloadlist{$ext}{ $result->uri } = [@linklist]
		  #if ( $#linklist >= 0 );
	}

	#build a direcotry for the downloads lable by extention
	mkdir $ext, 0777 unless -d $ext;

}
print "-----------------------------------------------------\n";
print "finish building table of links now for the down load \n";
print "-----------------------------------------------------\n";

#download the files using the hash of hash table
#{extention}->{uri}->{document}
foreach $exten ( keys(%downloadlist) ) {

	#exten is the extion we are working with ie doc
	print "working on extention $exten";
	foreach $url ( keys( %{ $downloadlist{$exten} } ) ) {
		print "\t|-- $url\n";

		#elm means the file name
		foreach $elm ( @{ $downloadlist{$exten}{$url} } ) {

			#concat the url with elment to make the full downloadable link
			$downloadURI = $url . $elm;

			#check to see if we have the file befor downloading

			if ( -e "$exten/$elm" ) {
				

				#file download check
				print "got the file: $elm already\n";
			}
			else {
				my $status = getstore( $downloadURI, "$exten/$elm" );

				if ( is_success($status) ) {
					print "got a file from \t\t|-- $url$elm\n";
				}
				else {

					#http status code 404?
					print "Couldn't retrieve page: $status\n $downloadURI\n";
				}    #end of download

			}    #end of file check
		}    #end of loop
	}
}

print "Finish!!!!!!!!!!!";
sub links {
	( $tag, %links ) = @_;
	if ( $tag eq "a" ) {
		foreach $key ( keys %links ) {
			if ( $links{$key} =~ m/.$ext$/ ) {
				print "\t\t---->Link Found at ", $links{$key}, "\n  ";
				push( @linklist, $links{$key} );
			}    #end if
		}    #end foreach
	}    #end if
}    #end sub

Bitmap decoding problem

This is a problem when you pull pictures back from the camera to the Gallery View. After each photo call the Uri is placed in an array for processing by the Gallery View.  Problem arise with memory if you just process the bitmap from the jpeg in the phone. Here is a solution to reduce the size of the bitmap and load back to the gallery view.

 

public static Bitmap loadBitmap(String url) {
		Bitmap bitmap = null;
		InputStream in = null;
		BufferedOutputStream out = null;

		try {
			in = new BufferedInputStream(new URL(url).openStream(),
					IO_BUFFER_SIZE);

			final ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
			out = new BufferedOutputStream(dataStream, IO_BUFFER_SIZE);
			copy(in, out);
			out.flush();

			final byte[] data = dataStream.toByteArray();
			BitmapFactory.Options opts = new BitmapFactory.Options();
			opts.inJustDecodeBounds = true;
			bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, opts);
			Log.e("optwidth", opts.outWidth + "");
			opts.inJustDecodeBounds = false;
			if (opts.outWidth > 500) {
				opts.inSampleSize = 4;
				bitmap = BitmapFactory.decodeByteArray(data, 0, data.length,
						opts);
			} else {
				bitmap = BitmapFactory.decodeByteArray(data, 0, data.length,
						opts);
			}

			// bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);

		} catch (IOException e) {
			Log.e(TAG, "Could not load Bitmap from: " + url);
		} finally {
			closeStream(in);
			closeStream(out);
		}

		return bitmap;
	}

auto reboot

1.   Launch Task Scheduler.

2.   Click Action and select Create Basic task.

3.   Type AutoRestart (or others you want) in the Name box and click Next.

4.   Select Daily and click Next

5.   Type the time you want to restart the computer and click Next.

6.   Select Start a program and click Next.

7.   Click Brower and navigate to %SystemRoot%\System32 and select Shutdown.exe and click Open. Type –F –R in the Add arguments (optional) box and click Next.

8.   Click Finish.

Cheltenham CTC

Club website using BluePrint CSS work out the golden ratio for you which is a great help. The old site original hosted on WordPress.com which limited what could be done.  So moved over to my web space set up a new Domain and rebuilt the site.  This has a link with MailChimp which picks up the RSS feed and sends out a newsletter once a month.

www.cheltenhmactc.org

Smith-Wood

Mike Smith-Wood an Antique Furniture Restorer dealer

Mike Smith-Wood an Antique Furniture Restorer dealerMike Smith-Wood a Antique Furniture Restorer dealer required a site which was simple and easy to use.  To do this I work closely with the business to define what information was shown on each page.  This required a bit of training on how to use WordPress along with what the function of pages and port are.  One of the bit changes in the site I made was the introduction of Google Fonts for the menu and heading.  The reason for this is to improve the SEO of the site.  I could have just sliced a Photoshop page however using Google Fonts gave the site more text to be index.  Along with this heading tags were optimized in the right place and connected with the text on the page.

Skills

  • HTML
  • CSS
  • Jquery
  • Google Fonts

I also did a later video for the site converting a 30min video down to 5 mins on to YouTube

GNS3 and SDM

GNS3 stands for Graphic Network Simulator and can be used to simulate Cisco routers.  I first came across this when I want to try out Cisco SDM and could not do this in Packet Trace.

The Cisco SDM is a web base management for Cisco device which take the command line away and provides a GUI for administrators. or the Cisco CCNA it is on the syllabus to understand how SDM works and set up logon.

So this post is going to go over the following:

  1. Loopback interface
  2. GNS3
  3. Config router
  4. ip address
  5. SSH login
  6. Ping test
  7. SDM login

Step 1 Loopback

With GNS 3 downloaded and install you need to create and interface from your PC back to GNS 3.  To do this in MS Windows we create a Microsoft windows loopback interface and give this an address.

Windows XP

  1. Click Start, and then click Control Panel.
  2. If you are in Classic view, click Switch to Category View under Control Panel in the left pane.
  3. Double-click Printers and Other Hardware, and then click Next.
  4. Under See Also in the left pane, click Add Hardware,and then click Next.
  5. Click Yes, I have already connected the hardware, and then click Next.
  6. At the bottom of the list, click Add a new hardware device, and then click Next.
  7. Click Install the hardware that I manually select from a list, and then click Next.
  8. Click Network adapters, and then click Next.
  9. In the Manufacturer box, click Microsoft.
  10. In the Network Adapter box, click Microsoft Loopback Adapter, and then click Next.
  11. Click Finish.

Windows 7 & Vista

  1. Click the Start menu.
  2. Search for “cmd”.
  3. Right-click on “cmd” and select “Run as Administrator”
  4. Enter “hdwwiz.exe”

From that point on it’s the same approach as under Vista, i.e.:

  1. In the “Welcome to the Add Hardware Wizard”, click Next.
  2. Select “Install the hardware that I manually select from a list (Advanced)” and click Next.
  3. Scroll down and select “Network adapters” and click Next.
  4. Select under Manufacturer “Microsoft” and then under Network Adapter “Microsoft Loopback Adapter” and click Next.

As can been see the loopback for the machine is 172.16.1.1 and the default gateway is 172.16.1.254, when we set the router up it will have this address.

Step 2 GNS basic setup

Inside GNS3 you will need to make sure the IOS for the routers have been downloaded and added to the set up.  I will write another post about this and place a link here soon. Once this has been done then we create a cloud interface inside GNS3 which will provide the interface between our machine and the router.

Start GNS3

On project name: SDM testing press ok

Drag the cloud icon out

Double click on the cloud and select c1

Under the ‘Generic Ethernet NIO’ select the loopback interface (see screen shot)

 

Press ok and drag a Router c2961 on to the work area.

Now connect the router FastEthernet interface with the cloud

In-vision Hair Design

in-visionhair design

Second site to be built following on from Deepcar Dental Care.  This site started off with a plan in Photoshop then sliced over to Dreamweaver.  After this I had to slice the HTML and CSS to fit in to a wordpress template.  The main problems I had with the site starting out was with Jquery been loaded.  WordPress has a different way to getting the Jquery library loaded .  However, I over came the problem and build a silder on the main page with selected photos with attachment from new posts.

 

Skills:-

  • HTML
  • CSS
  • WordPress
  • Jquery
  • Photoshop & Dreamweaver

 

Deepcare Dental Care

Deepcar Dental Care

Deepcar Dental CareFirst website I built teaching myself basic HTML and CSS.  I used Dreamweaver CS4 and Photoshop from adobe along with some help from websites YouTube and books from the local library.  Very basic site but every one has to start some where.  I learned about backed server technology and how to use C pannel and FTP.  Some of the problem came with understanding how Dreamweaver interacted with the FTP server.  But after a few hours of messing around with settings I got it configured.

The customer only wanted basic information up even after I offer ideas.  I enhanced the Search Engine optimization with Google places and Webmaster tools.  Along with this I set up Google anayltics.

Skills and Technologys:-

  • HTML
  • CSS
  • FTP
  • Adobe Dreamweaver and Photoshop

Website address :- www.deepcardentalcare.co.uk

SEO Keywords:- Deepcar Dental, Dental Care, Stocksbridge Dental, Sheffield Dental.

Network Notes Addresses

Just some metal notes about Network address for reference.

IP v4 makeup

32 bit address system

0.0.0.0 through to 255.255.255.255

0 to 255 is 8 bit wide and forms an octet.

`

RFC 1918

class A 10.0.0.0 – 10.255.255.255

class B 172.16.0.0 – 172.31.255.255

class C 192.168.0.0 – 192.168.255.255

Any thing inside this range is private and should be used inside the local LAN.