Saturday, 12 September 2015

Using Cloud9 with BitBucket

Free online version control and IDE: Bitbucket & Cloud9 using Git

If you know how to program, and want to version control a project online this might help.

I wanted to develop a Python program and run everything online because my main computer is now a chromebook, and I want to access it from wherever I am.  This is a step by step guide to how I did it.

Looking around on the Internet it looks like Bitbucket and GitHub are the obvious choices for actually storing, and version controlling the project files in a 'repository'.  

Both of these are also integrated with the Cloud9 IDE (Integrated Development Environment) which allows you to see the code you edit, run, and debug it.

Whilst Git may be fast for large repositories (the set of files under version control), it doesn't have an intuitive user interface. However I know how to use it so I chose that option rather than mercurial.

Cloud9 and Bitbucket: Step by step guide

You need to create an account for both of these.  I used google to login to Bitbucket and then I used Bitbucket to login to Cloud9, so no new passwords to create!
  • Create Bitbucket Account
    • bitbucket.org
    • Get Started
    • Get Started with your Google account
    • Sign into Google and allow BitBucket permission to access Google
    • Select Personal or 5 member team account for free usage
    • Set a password later
  • Create a repository in Bitbucket.  
    • You should already be logged into bitbucket.org
    • On the Get Started page it already have a button to create a repository, otherwise "Create / Create Repository"
    • Choose a name and the default options, including git
  • Create Cloud9 Account
    • c9.io
    • Try it now
    • Bitbucket
    • Grant access
  • Create a Cloud9 Workspace linked to your Bitbucket Repository
    • Repositories
    • Hit 'Clone to edit' on the Bitbucket repository you just created
  • Create and run a simple python file
    • File / New file
    • Paste this code into it
#!/usr/bin/python
print ("Hello World")

    • File / Save / hello.py
      • You should now see the hello.py appear in the workspace directory structure on the left
    • Hit the Run triangle to run it!
      • It should say hello world in a window at the bottom of the screen
  • Save this file in the repository
    • Select the 'bash -"cloning ..."' tab, and enter these commands:
    • git status
      • Shows state of the repository. Should show hello.py isn't tracked
    • git add hello.py
      • Add file to list of files to be stored in the repository
    • git status
      • Show file is now added
    • git commit -m "first commit"
      • Save the file in the version of the repository on cloud9 (not on bitbucket though which is where we really want it saved eventually)
    • git status
      • File is not
    • git push --set-upstream origin master
      • type 'yes' to confirm connection to bitbucket at the scary looking 'are you sure you want to connect?' message
      • This is a 'Magic' command and does this:
        • pushes the files in the cloud9 version of the repository to the bitbucket version of the repository
        • 'origin master' tells the git the exact details of the repository it needs
        • the '--set-upstream' bit means you never need to add the 'origin master' bit ever again :-)
  • Check the file has made it to bitbucket
    • bitbucket.org
    • click on the repository in the 'overview' pane
    • navigation / source
      • hello.py should be there!
    • click on hello.py to see the source code!
  • Edit file and update it on the repository
    • c9.io
    • open workspace
    • click on 'hello.py' to edit it
    • add a line so it reads like this
#!/usr/bin/python
print ("Hello World")
print ("Hello Again")
    • hit run (which also actually saves it)
    • Select the 'bash -"cloning ..."' tab
    • git status
      • shows we haven't added it yet, but it has changed
    • git add hello.py
    • git status
    • git commit -m "testing repo again"
    • git status
    • git push
      • no need to add the 'origin master' bit this time
And you're done.  You can check it's made it to Bitbucket correctly in the same way as above.

Happy coding!

    Thursday, 10 September 2015

    Create a shortcut for each different profile on Chrome

    The whole family use Chrome as their browser.  On Windows machines we like to all have a browser open each with our own profile on it.  To launch each profile we single click on our shortcut in the Quick Launch toolbar.

    I had to reinstall windows (HDD fail), but I couldn't work out how to get the shortcuts back.  The Internet wasn't very helpful and had lots of mediumly hard sounding solutions.  So I had to work it out myself.  Here it is:

    How to create a shortcut for each profile on Chrome:

    1. Login to the profile you wish to create a profile for (left click on the current profile name at the top right of the browser and follow your nose)
    2. Hit the customize and control button in the top right hand corner (3 horizontal lines)
    3. Settings
    4. People
    5. Double click on the profile you want to create a shortcut for which is labeled as 'current'
    6. Choose a picture (or photo) so you can identify which profile shortcut is which.
    7. Click on the 'Add desktop shortcut' button << money shot
    You can now drag the shortcuts onto the quick launch bar.

    Monday, 10 November 2014

    How to Gently Dissolve Ear Wax Using Very Weak Hydrogen Peroxide (Contact Lens Cleaner)

    Not a very pleasant subject to discuss, but when I get a build up of ear wax usually combined with going swimming with the kids suddenly I find I can't hear at all out of one ear at all and it makes you feel so isolated from the world that I used to try everything and anything to try to clear it up.  Almost invariably I used to end up poking something inappropriate (like a q-tip) down my ear which compacted the wax rather than sorting it out.  Somehow also I always seemed to manage to end up with both ears blocked and usually with some big work presentation the next day.

    I have had my ears syringed at the doctors several times and whilst it always works, I find it painful, excruciatingly loud and I'm always worried it's going to damage my ear.  Reading comments online it seems like some people do get damaged hearing from ear syringing which doesn't surprise me.  The other main disadvantage is that I usually have to wait 2 weeks for an appointment, and I want it sorted straight away.

    There are hundreds of suggestions online for how to deal with ears blocked with wax.  Everyone seems united in the fact that you shouldn't poke anything into your ear and I completely agree.  But after trying loads of these online suggestions you end up thinking "I don't want lots of suggestions, I just want one: the one that works"

    So here it, the single gentle way I use to unblock my ears of wax immediately.

    Instructions to gently dissolve your ear wax with Hydrogen Peroxide

    DISCLAIMER: Please don't think I'm giving any medical advice here.  This is just my notes to myself for what I've found to work myself through trial and error, so I know what to try next time.  You should speak to a doctor if you need medical help, not an engineer!

    You will need:
    • 3% Hydrogen Peroxide (from the chemists or opticians or your bathroom already.  It's used to clean contact lenses so it's very weak and widely available)
    • Tissues or toilet paper
    • Some means of getting the Hydrogen Peroxide into your ear.  I have a plastic pipette which is perfect (no idea where I got it), a syringe would be good, a teaspoon would do fine too.
    How to do it
    1. Only do one ear at a time. Seriously, only do one ear at a time.  I know you'll be tempted, but only do one ear at a time.  The ear you treat will get worse before it gets better, so treat your worse ear first and wait until it's fully clear before starting on the less bad ear.
    2. Lie on your side with the ear you're treating on the top.
    3. Use the pipette/syringe/teaspoon to put a little bit of the hydrogen peroxide into your ear.  Just drop the liquid in, don't poke the pipette/syringe into your ear whatever you do.  You'll have to judge how much / little to put in yourself, but I just put in a little so you can feel it trickle down the ear canal.
    4. Listen to the gentle fissing in your ear!  That's the wax dissolving.  Lovely isn't it!  [If you feel any pain at all here rinse your ear out with water and don't try it again.  You may have a cut in your ear or some other medical issue.]
    5. When the fissing stops or gets significantly quieter, put the tissue over the ear and turn your head over.  Look at the liquid it's slightly yellowy.  That would usually be a horrible disgusting sight, but because your ears are so blocked up it's amazing!
    6. The problem is that only a small bit of the wax has dissolved.  As I said it's very mild.  So you've got to repeat the process.  I reckon it usually clears after about 6 dissolve iterations, and I generally keep going about 10 times before I got bored and think it's time to try the other ear.

    Thursday, 2 October 2014

    Connecting TalkTalk mobile data using a Nexus 4

    Summary: Take the sim card out; boot with no sim, or a different sim; reinsert the TalkTalk sim.

    I just restored my Nexus 4 Kitkat android to factory settings because it was going very slowly and I thought that might help (it did by the way).  Anyway when I tried to reconnect to my TalkTalk mobile data again it wouldn't connect.  I did not receive any of the configuration messages that TalkTalk tried to send me.  I checked the APN settings manually and I definately had the right settings, but still it wouldn't connect.  I rebooted after making the changes.  Still no joy.  Then I thought I'd check against another phone: it had exactly the same settings, so I thought it might be the phone so I swapped sims, and then both of them connected to data!  I then swapped the sims back and they both still connected!

    It may have worked if I had just removed the sim and booted like that, then turned it off again, inserted the sim and then rebooted again.

    Anyway, very pleased to finally get it going again.

    Thursday, 15 May 2014

    Turning a spare TalkTalk Router into a Wireless Access Point

    I don't get good a wireless (wifi) signal everywhere in my house, so I wanted to put an unused router I had to use to provide a second wireless base to provide better coverage.  I'm going to wire it into my home ethernet (wired) network, and also use it as a network switch so I can plug in several other wired ethernet devices into the reused router.

    I have two TalkTalk routers: a D-link DSL-3780 and a Huawei HG533.  I think both of these models are only sold to Talk Talk.  I'm going to use the DSL-3780 as the second wireless base station.  The technical term for using it in this way is a 'Wireless Access Point'

    The description of how to do everything is here.  There are some notes below:

    Here's the plan of what I need to do to the access point (DSL-3780):
    1. Turn off DHCP server
    2. Set a fixed IP address
    3. Change the wifi name and password to be the same as the main router's ones.

    1. Turn off DHCP
    Network routers and switches are very clever and dynamically assign addresses to everything that wants to connect to a network.  DHCP is the protocol that controls this, and the DHCP server drives this process.  Having a DHCP server on a network makes things nice and simple.  Usually is is the router that does this.  However we definitely don't want two DHCP servers interfering with each other, so we need to turn off the DHCP server in the access point.

    2. Set a fixed IP address
    With the DHCP server turned off, the access point needs to be able to connect to the network, so we need to assign a fixed ip address that the access point will always use.  This contrasts with the dynamically allocated ip addresses that the other network connections will be given by the DHCP server in the router.

    3. Set the WiFi name and password to be the same as the main router's ones
    You would expect there to be some complicated way of configuring the router and the access point so that any wireless device can be passed to the strongest base station.  But there isn't.  If you set them to have the same WiFi name and password, then it all just works.  Lovely.

    Monday, 18 March 2013

    Toyota Wiper Refill

    I couldn't find anywhere with quite the right information on it to help me change the rubber bit of my wiper blades (apparently called refills or sometimes inserts).  So here's my instructions, for my Toyota Corolla Verso 2005 UK.

    This video is pretty good, but you can't see the key stages clearly.
    http://www.youtube.com/watch?v=R8Ijmsg2sKs

    0. Get new blades
    I got them from my dealer or local Toyota specialist.  The two front ones cost me about £16.  To me the real Toyota ones aren't much more expensive than generic ones and look like they will be much better.

    0.5 Get an old rag

    1. Remove the wiper blades.
    These are the whole assembly including the rubber bit and the bits that it connects to.  The wiper blade connects to the wiper arm.  The arm hooks around part of the blade assembly.  There is a little bit of plastic on this part of assembly.  When you push it towards the wiper arm, you can push the blade assembly down towards the car and the whole assembly becomes free.

    Now get your old rag out and place it carefully under the bare wiper arm, and place is carefully against the windscreen.  This avoids either scratching the windscreen when it is placed carefully against it, or smashing it when the spring loaded arm is brushed against and fires itself at the windscreen!

    1.5 Look at the existing assembly.
    Note: 
    A: where the metal bits fit into the insert (That's the rubber bit.)
    B: Which end of the rubber insert is fixed (One end of the rubber is fixed and held in place and the other end moves in an out of the blade assembly as you flex the rubber.)

    2. Remove the old Insert
    Starting at the fixed end, you need to pull the rubber out of the metal bit of the wiper assembly that's holding it in place.  You might damage the old rubber insert to do this, but you should not need to damage or bend the wiper assembly.

    There are two metal rods holding the insert into place.  At the very end of the insert near the fixing point, pull the rubber insert through these metal rods away from the assembly. [The pull direction is critical here.  If the wiper was still fixed to the car you would be pulling the rubber through the windscreen into the car.]  Keep pulling the first inch or so through until the bit of the insert that is held fixed into place by the assembly is free.  You should now be able to slide the whole of the insert out.

    3. Put the old metal rods into the new insert

    4. Push the new insert into the wiper assembly
    Work out which end of the new insert should be the fixed end.  Push the unfixed end of the rubber insert into the fixed end of the wiper assembly, then thread the whole length of the insert into the wiper assembly.  The fixed end of the insert is angled so when you push hard when the whole insert is threaded, the fixed end becomes fixed (the metal holds the insert and won't release it.)

    Good luck!

    Monday, 4 March 2013

    PS3 Superslim 12G to 500G upgrade

    I bought a 12G PS3 Superslim because it is cheap, but I wanted to upgrade it to a 500G PS3 because that's loads of space for lots of games.  On Amazon the 12G version is currently £149, but the 500G version is £229.  That's £80 for an HDD.

    So here's what I used to do the upgrade: 
    1 OFF Sony PlayStation 3 Replacement Hard Disk Drive (HDD) Mounting Bracket (£8.10 Amazon)
    1 OFF 500GB SATA 2.5" 5400rpm 8MB cache HDD (£43.00 Amazon)

    That's a saving of nearly £30.

    I used the official HDD mounting because I don't want my new PS3 to be klunky.  I bought a Seagate Momentus HDD because it said on the Amazon web page it was PS3 compatible and it is.

    The mounting comes with instructions on how to open the HDD drive slot and fit the new HDD and even comes with the screws.  

    This video show you how to open the PS3.

    But this video is the same guy's video with him successfully installing the HDD.  (It just doesn't show him opening it so well.

    Good luck!