Rasperry Pi Version of Google Home using the Google Assist API

New project: Turning a raspberry pi 3 into Google home using the Google Assistant API

A post shared by Steve Colson (@stevecolson) on

Share Button

Slow WIFI speeds

A lot of devices nowadays that connect to the internet are smaller and more portable. As you want to be able to use them in numerous locations, it means that they are typically enabled with the option to connection to a wireless network. Whether that be at home, if your office or even whilst eating your breakfast in McDonalds.

WIFI is taken for granted and as much as some people need to know, you just search for a suitable wireless network on your device, enter the requested wireless key and then you are online and up and running.

Did you know… A small patent used in WIFI today was originally created for a whole different purpose at the time. It was used in an experiment to detect exploding mini black holes the size of an atomic particle.

The standard
The IEEE (Institute of Electrical and Electronics Engineers) set the standards when it comes to this. This means that if a company was to create a router then it would have to use a standard so that all WIFI capable devices could connect to it.

They created the standard of 802.1.1 for WLAN (Wireless Local Area Networks).
When purchasing a router, you may see on the box that is says 802.1.1 and then mentions dual band or dual frequency. This refers to the fact that the WIFI signal can be transmitted either through a 2.4Ghz frequency or the 5Ghz frequency.

The idea behind having both these frequencies available is because the 5Ghz option will allow a faster speed of data transfer but there are limitations with that such as a short range so it is only suggested to use it whilst you are in the same room as the router. Also, a lot of network cards within the devices such as laptops do not have the latest hardware and so can only discover the 2.4Ghz option.
2.4Ghz has a larger range that it covers but the data speeds they send across can be slower in terms of speed.

There is also the factor that wireless networks are susceptible to interference. Lots of facts come into play that may cause issues such as a microwave, flashing Christmas lights, additional wireless devices and sometimes random things like an old TV or a treadmill.

There is also the factor that when you turn on a router, the channel that you are using to communicate on is typically set to “Auto” meaning that the router will do a quick check at that time and choose a channel of 1-13 to communicate on and send data back and forth to the router. Now if your neighbour is using the same channel then it means that there may become a build up in traffic on that channel and you may have to wait your turn to send/receive which will show itself as slow speeds or WIFI disconnections.

The best thing to do is to go into your router settings and change the wireless channel. You can access the router settings by going into its default gateway through a browser, typically with a 192.168.*.* number and then logging in with a default username (usually admin) and a password. Most routers have this information on a sticker on the router.

Then, if you have a smart phone, download an app called “WIFI Analyser”. It is a free app and it will do a scan and inform you of which channels in your area have the least amount of data traffic on and then in accordance, you can change your router channel to that number it suggests. This will certainly help in the first instance and then if necessary and you are trying to cover a large area, you can always introduce a wireless booster.

Wireless is great technology but it will never be as fast nor as stable as a cabled connection so if you have the opportunity to connect your device to a router using an Ethernet cable then this would be the recommended option.

Share Button

Mobile Broadband

It is often common for smart phones purchased in the last few years, whether bought on contract or PAYG (Pay As You Go) to come with a minutes allowance, a text allowance as well as data allowance.

The data allowance will typically refer to a 4G connection where the average download speed is about 8Mbps (Mega Bits Per Second). The allowance represents how much data you can transfer from the internet to your device, whether that may be pictures, music, movies or browsing the internet for the latest news or train time information. Even your apps on your mobile phone chew up some of your data allowance as they are trying to sync with a server to obtain the latest information.

The latest mobile phones use an OS (Operating System) to offer you a nice friendly user interface so all you have to do is tap the screen or drag and drop icons and the device knows exactly what you want it to do.

The Operating Software basically sends instructions to the hardware in your handheld device and gets it to behave as requested. These instructions can be quite lengthy and complicated but as long as they work and do everything you want them to do, then you do not have to worry about what instructions they contain.

Common operating systems used on mobile handsets are Windows (used on Nokia devices) IOS (used on the Apple Iphone devices) and Android (used on everything else). This blog is MY blog so I can state my point of view whether it is factual or correct and so in my eyes, Android is the better OS simply because it isn’t licenced which means that you aren’t paying extra money for a polished turd and simply the fact that Android is a form of Linux so it is open source and you can therefore create your own apps and download them to your phone from any source as an APK file and then just install it. This cannot be done on Iphone as you have to get files from the Apple store so you have to register them first which is a lot of hassle if you just want to test a simple app that you have developed. This was also the same issue with the Blackberry phones but I haven’t mentioned them as I am not even sure they are still making phones any more and if so, their app store isn’t brilliant so has quite a lot of limitations.

Anyways, you will be surprised to learn if you didn’t know already that you can use your phone as a mobile hotspot. which means that you can tether devices to it like you would with your wireless internet at home.

You would turn the hotspot on using the network settings on your phone and then you can change the network name which may be known as an APN (Access Point Name) or the SSID (Service Set IDentifier) name. This is the name that shows up when you search for wireless networks available in your area and how you can distinguish which one is which. You can also set up the network passphrase or network key. It is known by many different names. This typically has to be at least 8 characters long and seeing as you are using this code to connect numerous different devices at different times, why make it too complicated for yourself? Why not just set it to a simple date of birth or something memorable like 11223344.

Once your device is connected, devices such as a laptop, tablet or even another phone will start using the data package you currently have in place.

I am writing this blog in Hull which at present has one main service provider – Kingston Communications, also known as Kcom. They pretty much own the monopoly in Hull and even have different colour phone boxes rather than the traditional red ones.

Majority of their customers found on forums comment that the prices are extremely high as there is no other competition and the quality of the internet is poor and people have experienced issues. Please notice that I have not stated how many people and not stipulated that this is a recurring issue, just an observation that has been brought to my attention through the means of social media.

On this information I have realised that in most areas of Hull, the only available network service to a property is ADSL (ASymmetric Digital Subscriber Line) This is what a lot of people just refer to as broadband or “The Internet”. The key word in all of this jargon, if you were to remember any of it, would be ASymmetric. This means non-symmetrical. So in other words, your download speed will be faster than your upload speed.

When you want to connect to a website, you type the web address into your web browser, it will then knock on the door of a DNS (Dynamic Name Server) and returns an IP (Internet Protocol) address. This is like a physical postal address you have for your property and it will give you the address to where the big computer or server is that stores your website that you want to visit. It will hold all the pictures, the text and the format of how they want the page to look on your screen.

When you hit the return key on your Google search, you are then sending your request along the network to knock on the front door of that IP address and say “Please Mr Computer, may I see the site that you are sharing”. You will also send a few of your credentials as well to that server such as your internet IP address so it will know from which country you are wanting to view from (This is useful if you want to purchase something so it will show a price in the correct currency for you). Then the server decides that it will share the information with you and send the data back down the network and to your computer for your browser to decipher. This is a good example of why you need an upload and download speed. Another would be downloading files such as music from the internet or uploading all your newest photos on to Facebook.

As data allowances grow, they are still quite limited in size at present due to the fact that 4G is newer technology and so they do not want to give away too much allowance as it will strain bandwidth connections so some mobile phone providers only offer as much as 20GB of 4G data per month and even if you contact them asking how much more data would be, they wouldn’t sell it as a standard package and so every month, for extra data you would have to top up with a booster or a bundle or whatever exclusive name the provider has created for the purchase of additional data.

I do not use a phone line any more. I am always out and about and so prefer to give out my mobile number and also the fact that line rental costs money. I only ever had one previously as a donor line for my ADSL to run on.

Although Fibre broadband is now available in some areas, including small areas in Hull, which means faster connection speeds and no need for a PSTN phone line for it to run on. The downside to a Fibre connection is that people learn to expect that speed and also willingly accept the cost that is involved and so are paying at least £50 a month for this “treat”. I was sat here thinking carefully as to how to word the privilege and I can really only think of it as a treat because it isn’t essential, you could get by with ADSL for what most homes use the internet for, the cost in my eyes is not justified and also you have to weigh in the factor that you may have an extremely faster connection and you can download X amount of Mbps but what if the server you are getting the data from has poor bandwidth, has a low upload speed or numerous requests so it can only remain stable if it sends data out at a slower speed?? It then wouldn’t matter what spec you have as you are reliant on a third party resource and I cant see you offering to pay their bill too!

So back on to the subject of mobile broadband… There is now a device called MIFI and it is provided by numerous different phone service providers.

The MIFI is a small box (Sorry no free licenced images available to add to my site) that has a SIM card installed, just like your mobile phone would and then it will connect to your service provider and establish a network connection.

The MIFI device will then project its SSID name (as mentioned above) for you to be able to pick this network up on your mobile phone, tablet or laptop.

The MIFI I have is an EE one, it also has a network port in the back so that I could connect a device directly to it which should in theory, make my connection faster, as it would be hard wired and therefore not be susceptible to the flaws or problems that can be experienced whilst using the 802.11 WIFI protocol.

My contract is currently £44 a month and includes the free device which meant all I needed to do when it arrived was insert the SIM card which also came in the same box. The device itself needs to have a mains plug connection, I could have got a device that’s more flexible and could be operated by batteries but then I assumed that even with Lithium-Ion batteries, they wouldn’t last that long and the lack of power may contribute to the lack of signal. Plus I am using this device for my laptop which eventually needs to be plugged in so this was a trivial issue for me and saved money.

So as soon as I plugged in my device it took seconds to establish a connection and the small little card that came in the box told me what network name to search for and also the password to enter. Then Hey Presto! I was connected and able to search the internet and stream videos and do anything I wanted to with my 50GB of data that got replenished every month.

Being a geek, the first thing I did was a speed test. I wanted to know exactly how fast my data was travelling. I went to www.speedtest.net and got quite a quick ping reply (that’s the response to the knock on the door I mentioned). I then got a download speed averaging 11.32Mbps and an upload speed of 7.74Mbps This was quite impressive seeing as though service users using the local ADSL service were commenting on their connections losing sync all the time and their download speed being as low as 2Mbps.

Going further into the geek dimensions, I didn’t want to stick with the classic MIFI**** SSID I was set up with by EE and I also didn’t want to have to keep going to find this little card to find the WIFI credentials every time someone wanted to connect to my internet.

The following information can also be followed for your router at home, even if you have ADSL or Fibre and you are using a WIFI connection.

These instructions are for Microsoft Windows users as this is the Operating System I use on my laptop and Microsoft was my choice for certification back in the days.

The following will allow you to change your WIFI name and also your WIFI password:

First of all, on your laptop/computer keyboard, you will see the space bar, to the left of that you will see an ALT key and to the left of that, the Windows key (seen as the Windows symbol). Hold down the Windows key and push the R button on your keyboard at the same time. This will open up the RUN box on your computer. Then clear anything in that box and type in “CMD” and hit the return key or click OK. This will then open the command dialogue box which has a black background and text that looks like its written in the old MS DOS format.

In this section you need to type in “IPCONFIG” and hit the return key. This will show your internet protocol configuration details. You will see a lot of gumpf that you really don’t need to worry about but one bit of information you are trying to find is something that says default gateway and then it will be followed with an IP address. Usually this is something like 192.168.1.1 or something like that. Please make a note of this as this is easily forgotten when you get distracted and then you have to repeat the method again.

The default gateway opens up access to your home router as you will see soon.

If you then close all the boxes and open up your internet web browser, this could be either Google Chrome, Firefox, Internet Explorer or anything that suits your browsing needs.

Once your browser is open, where you would usually type in a web address to go to, instead, clear that box and enter the default gateway information you previously wrote down: 192.168.something.something and hit return.

This will take you to your router settings and depending on who provided your router, you may be prompted to enter login username and password details to access these settings. On the EE router, these credentials were also provided on the card which was extremely useful. If you have a Sky router then typically the defaults are as follows: username: “admin” Password: “sky”.

You can usually find these credentials written on a sticker on your router or they can be easily found via Google so don’t panic too much.

So once you are in the default gateway, you can even change those initial security details to a suitable username and password that you will remember.

Make sure you go to the wireless LAN or WLAN tab and then change the SSID to anything you like.

You can then do the same with the password key and then once you click apply, your wireless connection will drop out.

You will then need to search for available wireless networks in your area again and then enter your new password if you changed it.

That’s it! You have now got a customized broadband router which will be easier to connect future devices to.

One thing I will mention on here, which is not totally relevant but I was asked this question by a gentleman at the last Raspberry jam I attended – he said that IP addresses have sections so go as high as a certain amount. If there are a limited number then how can his home printer have an individual IP address.

This was a really good question and I am glad he asked me it.

I was able to explain to the gentleman that IP addresses at present use IPv4 which means that they have 4 sections. These sections are known as an “octet” which means a group of 8 things. In computing and the use of Binary, there are 8 bits to a Byte and when calculating, the highest number they could reach is 255 but there are only 254 combinations, which means that in each octet, you can have a number combination going from 0 to 254.

As there are only 4x octet’s this means there are limitations on the amount of IP addresses you can have and the max amount will be 254x254x254x254.

If you have read a few IT/Networking journals then you may have heard of IPv6 which adds another 2x octet’s and therefore adds a lot more numbers available in the list of available IP addresses. I think a journal that I read stated that every human in the world population can have about 13 IP addresses.

Another thing that I had to explain to the gentleman is the different between a public and private IP address. Companies like Coca-Cola, which is a huge company only own about 6 public IP addresses and they are extremely expensive. Instead companies use one IP address and then can do clever things on servers to split domain names, hosting and key words so that you can find exactly what you are looking for within one IP address.

When you connect a device such as your laptop, tablet, mobile phone or wireless printer to your router, you are connecting it to your private network and so therefore it still has a unique IP address, otherwise information being sent back and forth would become scrambled, but the router itself assigns an individual IP address for each device and typically routers give out a 192.168.something.something IP address (does this look familiar to the format of your default gateway). If you turn your wireless router on for the first time and then try and connect your phone, it will use DHCP (Dynamic Host Configuration Protocol). This means that it will assign an IP address to it, typically 192.168.0.1 and will send across the network details including a DHCP lease time. That means that if after a certain period (stated in minutes) a connection isn’t established with the device given the original IP address then this allocation with expire and the IP address will then be back on the list of availability.

The alternative to DHCP is static IP addressing. When you set up your wireless router, it may not be on all the time, just when you want to print something so it could be that the device lays dormant for longer periods of time and therefore a DHCP IP address would expire. This wouldn’t be good when you have configured your printer to send print information to a specific network device when you click on the print button. Its like sending postal mail to a caravan that keeps moving plots so you would establish a static IP address that it would keep and then you would instruct your computer to keep sending the print data in that direction.

The last question the gentleman asked was, if he has security cameras in his house and he can connect to them using their IP address, then doesn’t that make them vulnerable to other viewers. The answer to that would be that in purchasing the cameras, he has paid for a subscription to the company server where he will be able to live stream the cameras images on a laptop or mobile device and it asks for his camera IP addresses so it can establish the route it needs to take to make a secure connection to allow him to view his cameras from anywhere in the world. The security behind it would be as much as you can assume from a company who transfers data over the internet and allows its customers access to relevant cameras by a username and password which the credentials would be stored on an SQL database on a different partition of the server.

I guess the more you know about technology, the scarier it can be but then you also have to remember that you are a small fish in a big pond and if you are not doing anything sinister then you should have nothing to worry about, including paranoia.

If you have any further questions or queries about what I have written in this article then please feel free to contact me.

Share Button

Code Club Returns

code_club_high_res_logo_720

After a well deserved Summer break, Code Club is starting back up at Hull Central Library from Thursday 22nd September and I shall be volunteering to help assist with teaching children 9-11 years of age how to code.

Our existing “Code Clubbers” will move on to CSS/HTML and new starters will start by learning Scratch and going through a few projects together.

If you haven’t heard of Code Club by now then basically it is a opportunity for children to get together, with supervised guidance, to learn new skills. They will be learning Scratch, CSS/HTML, Python and I’ve also heard that the library have just invested in the BBC Micro:bit.

Why bring your children along?

Computers are used everywhere and there is no longer a need to be afraid of them. I would even go as far as to suggest that most people use a computer each day without realising it – When you turn on your washing machine and push a button, it is running a program and knows how much water to allow, how many cycles before it then drains the water, when to rinse and also when to keep beeping at you to tell you it has finished, usually just in the middle of your favourite TV episode.

More about the topics we teach

Scratch

Scratch is software created by MIT (Massachusetts Institute of Technology) aka VERY clever people. This software can be found on a Raspberry Pi (see http://raspberrypi.org/ for more information) as well as on the Scratch website (https://scratch.mit.edu/). This software allows children to create different objects and characters and alter their environment and behaviour. To make this simple, MIT have created jigsaw type blocks that click together so that you know they are compatible and these blocks are also colour coded. This teaches children the method for object oriented programming. This is the type of programming used for Java which can be found on some phone operating systems and in Blu-ray and DVD players.

CSS/HTML

CSS (Cascading Style Sheets) is used to style an HTML document. You would title different areas in your HTML document and then on the CSS file you would state certain preferences. For instance, in the “title” section, you would want to use a larger size font and have the font a certain colour.

HTML (HyperText Markup Language) is typically the code used behind a website. A web developer would write certain code to create a website which could be used to show off video, animations and pictures as well as forms and text. When you open a web browser i.e. Internet Explorer, Google Chrome or Firefox to name a few, and search your favourite website, it will show you a nice user friendly finish which has been created using HTML.

Python

Python is another programming language. This is being taught in Schools and even Universities. It can be used to create games and applications.

Python used with a Raspberry Pi can open up a lot of exciting adventures where you can create lots of different projects including a traffic light system with LEDs, creating a weather station, creating a music and video entertainment system and much much more.

BBC Micro:bit

These are the small computers that are currently being given out in Schools, they are also available to purchase from retailers now if you missed out on getting one from School and although prices change, I believe they are quite reasonably priced.

The Micro:bit has been created to allow children to design and create their own projects once again using code and also learning about hardware compatibility.

The Code Club community

We are trying to create as many Code Clubs as possible because technology will be a strong part of everyone’s future and definitely for the younger generation. We want to provide a place for them to come and explore their imaginations whilst learning some really cool stuff along the way and these are relevant skills that will help them in the future in terms of education and hobbies.

More Information
Our Code Club is currently on a Thursday evening between 6pm and 7:15pm at Hull Central Library. We do have limited places so please contact the Library on 01482 300300 to register your place.

We appreciate that sometimes children may have alternative after School activities on the same night so if you need to find an alternative Code Club, they can be found on the Code Club Website.

Hull Central Library has the following address: Albion St, Hull HU1 3TF

Or you can view the following map:
Hull Central Library Map

We look forward to seeing you soon

Share Button

Hull Raspberry Jam Saturday 10th September

https://www.raspberrypi.org/

Why not join in on the fun and learn more about the Raspberry Pi and how to code by attending a Raspberry Jam.

The next event takes place on Saturday 10th September and starts at 10:15 until 13:15.

The venue for this event is Malet Lambert School – James Reckitt Avenue, Hull, HU8 0JD

This is a free to attend event – tickets plus more information is available from the Eventbrite website.

Share Button

Bypassing Windows login

So here is a little secret I have discovered: being able to get into Windows without a password.

A lot of people will already know that if someone forgets their Windows password then you can remove the hard drive and slave it to access the data but this method will show you how to access Windows through the user interface.

First of all you will need some software that Microsoft provide for free called DART – diagnostic and repair tool.

If you put this on a pen drive then you can boot to this using one of your F keys and choose it from the boot menu.

In DART you will have the option to explore files and folders on the system.

Navigate to C:/Windows/System32 and look for a file called “utilman.exe”. Rename this file to “utilman.exe.bak” and then copy and paste the “cmd.exe” file from and to the same directory. Then rename your second cmd file to “utilman.exe”.

You will then be able to restart the computer and when you get to the Windows log in screen you will see in one of the corners next to the shutdown button an accessibility options, when you click on this it will then bring up your command box and from there you will be able to turn on the admin profile.

Then with a restart, you will be able to access the computer as an administrator and have full access to the computer and all accounts.

If you want to remove this feature afterwards then turn admin off in cmd and restore the original utilman file back to its original name.

Happy playing!

Share Button

Ooops my bad (2)!

So sadly it didn’t take long at all for episode 2 of Ooops my bad!

I treated myself to an android smart watch and I was really impressed that you could sync it to your mobile phone via Bluetooth and send/receive calls as well as texts and you could even add a micro SD card and a SIM card and it would work as a standalone device and make calls and texts without the phone connected. It even had a 3g connection so although slow, I could still use data. The downside was that although it had a Facebook and WhatsApp icon, they were in fact just shortcuts to a webpage and the built in browser was pretty lame (yeah I know you can’t expect too much from a cheap gadget).

So my idea was to “hack it”. I wanted to get into the watch, seeing as it didn’t have a play store or a simple way to install new apps, even when I tried to download an APK file directly from my cloud storage it didn’t know what to do with it.

So I searched online and realised that I could use a flash tool which I have never had the pleasure of using before. All I had to do was install the drivers for the watch first and then I could set the flash tool so that it backs up a copy of the ROM, then lets me alter it and then it on to the watch.

This is where it all went horribly wrong…
First of all I was using Windows 10 which, in the device manager, did not show the ports section so I couldn’t setup and distinguish which COM port was my USB in the flash tool software.

I did try installing the drivers by using the legacy hardware option but then when they did show up they had an exclamation mark against them. I was getting absolutely nowhere and Microsoft were telling me that its a manufacturer issue as its drivers needed for their MOBO (Motherboard) and HP were telling me that this laptop, which I had only purchased in 2014, hasn’t been tested with Windows 10 and basically couldn’t be bothered to provide any updated drivers for it and I went between the two for about 3 days.

It concluded that I would just have to take the hit and recover back to Windows 8 which HP do provide the drivers for. The problem with this is that since my upgrade, I decided to clear the previous version files to save space. All HP could then tell me is that I needed a recovery kit and it would cost just shy of £35.

I went to Microsoft online support chat again and got someone to remote into my laptop who set off 2 downloads – one being software to burn a bootable ISO to a flash drive or DVD and the other was an ISO for Windows 8. He actually stated that they not longer had the Windows 8 available to download from Microsoft so I assume that he must have got the ISO file from a 3rd party site, which I am sure hasn’t been tested and for the paranoid out there, who would agree that getting Operating Systems from a 3rd party source or places like torrent sites can also install a virus in the background, a Trojan or key logger software so it is ALWAYS recommended to use genuine software from a reliable source.

As I went into the BIOS to change the boot sequence I faced another struggle – as my SSD it classed as a flash drive and so was the flash drive with the ISO on, the bios could not distinguish between the 2 and that wasn’t going to work.
I then decided to burn the ISO to a bootable DVD and try and set the boot sequence for that to run first. Finally I had some success, right until I got to the point where the laptop couldn’t recognise my SSD and this is about the point I am ready to cry myself to sleep but I DID NOT GIVE UP!

I put my old HHD back in my laptop, I spoke with Microsoft again (for the 4th time) and got to the point where they actually became useful – they gave me a link to a tool that would directly allow me to add a bootable ISO directly to my flash drive and I could choose the version of Windows I wanted to install and it downloaded it. I was then able to change the boot sequence back to flash drive first and then the HDD and this worked! I was able to go through the motions and after a slow hard drive I got my Windows 8.1 installed.

Now I was making progress I decided to bring back my original issues with my smart watch, downloaded all the drivers and tools again and opened the flash tool. It now recognised the COM port I Was using through the USB connection to the watch. The downside at this point was that it said my phone must have turned on too quickly for it to step in on the start-up so I turned it off and tried again but then the touch screen froze so had to pull the battery. I tried one more time in a different USB port and it was exactly the same.

So just to confirm at this stage, I have my old HHD in my laptop now with Windows 8 to use for the purposes of this flash tool software which doesn’t even work.

I have now put in my SSD drive again and have decided that I really don’t need my smart watch to be all singing and dancing now.

I did however find out on my quest that Windows 8 is being supported by Microsoft until 2032 and always make sure that your device has been tested with Windows 8 and whether the manufacturer will support Windows 10 and the drivers you will need.

And seeing as though I am on the subject of Windows 10, it is actually a good operating system and the likely hood is that you might not even need to use it for the things I try and do with my gadgets so you will be fine. The free upgrade to Windows 10 does actually run out at the end of July 2016 though so if you still haven’t upgraded yet then it would be recommended to do so.

Share Button

Software Development Assignment – Java

We were set an assignment at college to create a program in Java using IntelliJ.

The assignment criteria was to create a currency converter that converts GBP into 3 different currencies where the end user can manually input the exchange rates.

The challenge set by the tutor (for a clear distinction) was to add an extra feature so that when you click a button it will pull the latest exchange rates from the internet.

As I am stubborn and not one to back down from a challenge, it was one I was willing to accept.

The user interface was quite difficult to create with IntelliJ and all the tutorials online showed that people were typically using NetBeans which I downloaded and found it so much easier to create a user interface as it was just drag and drop rather than worrying about spacing.

I created an action listener so that when the appropriate buttons were created they would act upon the code I had set to each button click. So the clear button would default the text field back to its original state using a jbutton.setText(“1”); I used an action listener for each button.

The currency exchange button turned the input number from a string to a float variable and then I calculated one float by another, example: GBP*EUR and then converted the float back into a string to output it into the area to show the amount.

For the auto generate section of the program, I used JSON (JavaScript Object Notation) and set the URL from Yahoo Finance as a string but added a variable called currency in the middle of the URL so that it would change the variable fromto section so that when you click on the auto generate button next to the Euro it would change the variable to GBPEUR and pull the latest Euro rate, when you click on the auto generate next to the US Dollar it would change the variable value to GBPUSD and pull the US Dollar rate and the same again with the Chinese Yuan.

You will need to download Java Runtime Environment to run this .jar executable file but please feel free to download and play around with my program. Download can be found here: Java Currency Converter

I have also added the code in a text file in case anyone would like to have a go. Download code

Share Button

Ooops my bad (1)!

I have numbered this as (1) as there are bound to be a few of these posted throughout the years.

Basically I want to write about my mistakes so that others can learn from them and not make the same silly mistakes I have made along the way.

I decided to upgrade my laptop and so treated myself to a SSD (Solid State Drive). This is faster as there are no moving parts so the read/write speed is increased and therefore it takes seconds to boot to Windows (instead of hours).

The idea was to take an image of my existing hard drive, just the way it was, and then put that image on to the new SSD. What actually happened was that I used the cheap imaging software that came with the hard drive caddy which decided to give the SSD drivers that Windows did not recognise!

Then I realised that the Samsung software that was available (for free) with the SSD came with cloning software but now it would not recognise the SSD as the other software had “screwed” it up.

So I decided to carry out a system restore which seemed to take forever and then I was going to use the Samsung software but by this time I realised that you cant take shortcuts and so I backed up my files to my external hard drive, asked Windows 10 nicely to do a clean install and then finally got to use the Samsung software to clone the hard drive.

After all of the above I could then download all my programs again and then add my files. In total I think I saved a fair few GB in storage space by having a clean copy of Windows to clone.

The moral of this story is to not use cheap cloning software that puts rubbish drivers on your system and also to take the time to put a fresh copy of Windows on your hard drive before cloning because it saves time and space.

#LessonLearnt

Share Button

My First Java Program

java

At the moment we are learning Java at Hull College and the picture above is the text from my first program.

It was written using an IDE (Integrated Design Environment) and although I am new to Java, I found that IntelliJ was a fairly easy to use IDE.

It uses the Scanner class from the API (Application Program Interface) library which basically means that it uses code pre-written to request an input from the user and then with the use of Boolean, it will check to see if the number entered is the same number as the random number the program created. If it is not correct then it will use the IF and ELSE statements to tell the user whether the number they entered is either too high or too low.

Share Button