Monday, 18 March 2019

Exploring FreeCodeCamp

Found FreeCodeCamp via:
https://medium.freecodecamp.org/object-oriented-programming-concepts-21bb035f7260


This is interesting.

I’m learning a little:
  • About different html tags
  • Internal anchors
  • Anchor tag attributes.
  • Form and input anchors
  • Button anchors
  • Radio buttons & checkboxes

There is a lot here…

I wonder if it’s worth sharing with Code Club members or if it’s all a bit serious?

Form and input anchors
<form action="/submit-cat-photo">
<input type="text" placeholder="cat photo URL" required>
</form>

Button anchors
<button type="submit">this button submits the form</button>
Inside the form anchors…


FINISHED!!
Took a couple of hours, I think...

Monday, 4 March 2019

Revisit Noun Project package...

So I want to revisit the Noun Project package that we worked on last November to at least try to make it workable.

I want to be able to turn a downloaded set of icons into a ggplot visualisation or a Rmarkdown report.

Aim: download cat icon, download dog icon, download fish icon - make graph of number of households in UK with those pets...
The waffle project might be useful.
We shall see...

Where to start?
So my Github repo is 7 commits ahead, 2 commits behind...

Also there is a branch entitled paul_writes_vignette...
Would be good to try to integrate all of this and work out how it can all work together. 

More to do....

Bar charts with animals...

ggtextures

https://github.com/clauswilke/ggtextures


Friday, 15 February 2019

Data and tidyverse links

These were useful:

https://rstudio-pubs-static.s3.amazonaws.com/282405_e280f5f0073544d7be417cde893d78d0.html

https://stackoverflow.com/questions/6639713/how-do-i-strip-dollar-signs-from-data-escape-special-characters-in-r

https://stackoverflow.com/questions/42493381/dplyr-select-columns-by-position-in-nse

https://www.mentalhealth.org.uk/statistics

https://ourworldindata.org/cancer

https://ourworldindata.org/cancer-death-rates-are-falling-five-year-survival-rates-are-rising

http://dyingforacure.org/blogs/misled-cancer-progress/


Monday, 4 February 2019

Revisiting javascript and D3

Ok, so this is a bit of a blast from the past.

There are a couple of Code Club students that are interested in HTML and generally manipulating web content.

I've agreed to have a look at Javascript and try to organise a few lessons.

Revising my old D3 code skills....

Some things to think about:


Code can be run on https://jsfiddle.net
This gives an online play area...
Three windows with HTML, CSS and Javascript
and then a result window.

JQuery Biolerplate can be added.
D3 can be added as a library here:
Currently No_Library but easy to add stuff...


There are some key things to understand:

  • <div></div>
  • var
  • chaining
Some nice simple tutorial...



Probably worth encouraging students to work through both of the HTML projects or at least the one with Javascript...

Revisiting some simple D3 sources: https://www.dashingd3js.com/adding-an-svg-element



Observable might be an interesting tool but probably not right now...
https://beta.observablehq.com/playground


Other Javascript libraries are available:
https://blog.bitsrc.io/11-javascript-charts-and-data-visualization-libraries-for-2018-f01a283a5727

N.B. The trinket for the the Code Club project gives the answer - NOT good!

Other resources: 
  • https://projects.raspberrypi.org/en/coderdojo
  • https://bost.ocks.org/mike/bar/
  • https://projects.raspberrypi.org/en/projects?software[]=html-css-javascript
  • CSS Colour picker: https://www.quackit.com/css/css_color_codes.cfm



Wednesday, 30 January 2019

no visible binding for global variable

Solution here for "no visible binding for global variable"
seems to be to declare the variables at the beginning of the function.
A bit of a work around.

Suggested here:
https://github.com/STAT545-UBC/Discussion/issues/451

Tuesday, 9 October 2018

Getting requests_oauthlib in python working...

This feels like an important thing to do...

First, check what python version I have

In console, type:

python --version
Answer:

Python 2.7.10

Need to update to Python 3.
Go to:
https://www.python.org/downloads/release/python-370/
Download Python 3.7
And install...

So I can't make that work right now, continue with Python 3.6

So I want to use the library requests_oauthlib

Need to install pip first.
https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version
Seems to have worked to download pip:
curl https://bootstrap.pypa.io/get-pip.py | sudo python

Now try using pip to download the python library
pip install requests requests_oauthlib

Needed to sudo this to make it work...

Says:
Installing collected packages: oauthlib, idna, certifi, urllib3, chardet, requests, requests-oauthlib

Successfully installed certifi-2018.8.24 chardet-3.0.4 idna-2.7 oauthlib-2.1.0 requests-2.19.1 requests-oauthlib-1.0.0 urllib3-1.23

BUT
how do I make this available to PyCharm?

Well, I found it in

/Library/Python/2.7/site-packages

But I need it to be in...

/Library/Frameworks/Python.framework/Versions/3.6/bin
I think...
let's try copying in console...


Some PyCharm specific stuff:
https://www.jetbrains.com/help/pycharm/2016.1/installing-uninstalling-and-upgrading-packages.html

Want to make the library available in PyCharm...
Select requests and install stuff from there...
I'm a bit confused!!

Close down PyCharm and try again.
Still getting an error message:
ModuleNotFoundError: No module named 'requests_oauthlib'

I've got confused between requests_oauthlib and requests_oauth - a bit annoying...

Copied the library

cp -R /Library/Python/2.7/site-packages/requests_oauthlib /Library/Frameworks/Python.framework/Versions/3.6/bin

Installed with PyCharm

WORKED!!!

Things to learn - with sudo they go to python 2.7 library.
Copying them will work...
Great!!!