Monday, 16 January 2017

Windows docker running out of disk space

By default when installing Docker for windows the docker images file will be installed in the path configured in the Hyper-V manager, which for me happened to be in C:\Users\Public\Public Documents\Hyper-V.

To move the image file you need to:

  1. Stop Docker.
  2. Move the images file (MobyLinuxVM.xhdx) to the location you wish for Hyper-V to store the image
  3. Open Hyper-v and in the setting change the default location to save this image
  4. Uninstall and then re-install docker



voila!

Friday, 13 January 2017

locating the php.ini file

  phpinfo();
?>

Wednesday, 11 January 2017

Trouble running selenium script with Python Basic Auth

For pages protected by Basic Auth a little addition needs to be made to the Python script.

Whereas in a browser you can access the restricted pages by providing the username and password:

get http://username:password@somedomain.com/endpoint

you can not just put this in the url string of the Python webdriver class before you do you need to load a profile:

profile = webdriver.firefoxPorfile()

and call

profile.set_preference("network.http.phishy-userpass-length",255)

so that something like:


from selenium import webdriver
from selenium.webdriver.common.keys import Keys
profile = webdriver.FirefoxProfile()
profile.set_preference("network.http.phishy-userpass-length", 255)
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://test0003:test@localhost/rasppi/")
driver.get("http://localhost/rasppi/")
print(driver.page_source.encode('utf-8'))
assert "Display" in driver.page_source
driver.close()

will work!

Friday, 6 January 2017

Create and manage Docker images on Windows and Docker Hub

To create a docker image on windows we need to install docker!

https://docs.docker.com/docker-for-windows/

and start the docker service.

Once this has been done prepare a directory structure, where we will organise our Dockerfiles for each image:

O:\sms67pc\docker\images\ 

Create a new directory containing a file named 'Dockerfile' for the image you wish to edit then cd to this directory edit the Docker file and once ready build the image:

# docker build -t [yourtag] 

to run the image interactively (cf login to the image) 

# docker run -i -t [yourtag] /bin/bash 

By logging in your can then test the further commands needed to build the image and add these to the docker file and repeat. Note, the images are not intended to be used as virtual machines and only one command can be run at the end (best to leave further commands to be run in the pipeline scripts; eg bitbucket pipeline will log you in 'interactively') 

You can start the Docker image exposing ports, to example, check the output of HTTP pages by mappng a port eg:

# docker run -i -i [yourtag] -p 8080:80 /bin/bash

If you were to start apache (inside the container) on port 80, then you should be able to view the web pages via http://localhost:8080/

Once happy upload to your docker hub account so that the images can be downloaded by tools like the bitbucket pipelines. 

# docker login 
# docker push [yourtag]

Wednesday, 21 December 2016

Tuesday, 29 November 2016

Rebase modified branch

you need to put things back first:

git checkout --
git checkout --
git checkout --
git checkout --

then you can:

git rebase origin/master

Friday, 7 October 2016

List the javascript functions available in JQuery or perhaps another library


                var objs = Object.getOwnPropertyNames(jQuery);
                    for(var i in objs ){
                    console.log(objs[i]);
                }