Friday, 26 November 2021

Microbit lessons and resources...

 https://microbit.org/lessons/


https://www.digikey.co.uk/en/maker/blogs/2018/how-to-use-one-micro-bit-to-control-another


https://make.techwillsaveus.com/microbit/activities/microbot-radio-control


https://projects.raspberrypi.org/en/projects/microbit-meteorologist/7



Thursday, 25 November 2021

Trying to programme my MiniBit...


Block editor for MicroBit says it requires a .mkcd or a .hex file. 

.mckd - MakeCode Programme. 

https://makecode.com/language

 


Key file on Github would seem to be Typescript


But I can't find a way to go from Typescript to .mkcd


Turns out, all I need to do was search for MiniBit in the extensions...


Wednesday, 6 October 2021

Web code editing...

 Looking at Jet Brains. 

Free educational licence: https://www.jetbrains.com/community/education/#students

Trying Webstorm.


Need to integrate into Github... 

Resource here to do that: https://www.jetbrains.com/help/webstorm/github.html#register-account

Can I make this work well?


Webstorm then asks for a link to Github. 

Fine. 

Brings it down. 

Make an edit. 

Preview: https://www.jetbrains.com/help/webstorm/editing-html-files.html#ws_html_preview_output_built_in_browser


Then try to upload... 

Needed to set up a token to integrate Webstorm and Github. 

Yes, it works. 

Very happy. Need to add more code and repeat the cycle of work. 









Thursday, 10 December 2020

Getting sound files into Camtasia...

 I downloaded some files from our Panopto recording area using advice from here:

https://support.panopto.com/s/article/How-to-Download-Video-or-Audio-Streams-as-MP4s


This allows download of audio and video separately - I downloaded as MP4. 

Camtasia couldn't generate any sound from the MP4 files. 

This site told me to use Audacity to do this: https://support.techsmith.com/hc/en-us/community/posts/360071641332-Importing-MP3-audio-file-into-Camtasia-8-1

Audacity required the use of a library: https://manual.audacityteam.org/man/installing_ffmpeg_for_mac.html

This allowed export of a Wav file. 

Camtasia can use the Wav file. 

Took a while but all in all quite good. 


Saturday, 24 October 2020

Grappling with git...

Trying to control git in the command line. It's difficult to keep it all straight in my mind. 

I think part of the mix up is the Vi editor. 

Press Esc

Type :wq

For write quit. 


Some information here:

https://stackoverflow.com/questions/33504984/adding-a-git-commit-message-using-vi-on-os-x


https://medium.com/@steveamaza/how-to-write-a-proper-git-commit-message-e028865e5791



https://chris.beams.io/posts/git-commit/

git commit -m"Fix typo in introduction to user guide"

Tuesday, 13 October 2020

Checking drawProteins package...

 So I want to be sure that drawProteins will be updated with the adjusted function that creates a chain when one is missing. 

I've opened up R-Studio. 

It says RELEASE_3_11. 

I think this is the correct release for the next Bioconductor release - cut off time tomorrow and release date?

Does it add a chain when one is missing?

This should be done by the feature_to_dataframe() function. 

OK: so   # Add 1 chain if missing 

is missing. 

But, # Add 1 chain if missing

is on (REMOTE: UPSTREAM) master. 

Will this be used to update the package?

I think so but how do I know this?


Check Build - Looks good.


Build talk about version number 1.9.0 and talks about Last Changed Date so that is 9 Oct 2020. 
Good news. 



OK, so 

Released version of drawProteins is 1.8.0 and is here: http://bioconductor.org/packages/release/bioc/html/drawProteins.html


Development version of drawProteins is 1.9.0 and is here:http://bioconductor.org/packages/3.12/bioc/html/drawProteins.html

To check, I can open another R-Studio Project and download development version:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

# The following initializes usage of Bioc devel
BiocManager::install(version='devel')

BiocManager::install("drawProteins")

This is quite annoying. I think I have version 1.9.0 downloaded. That's what the session info says but it is NOT adding the chain making plotting impossible. 

So something is not quite correct. 

But WHAT???

I'm in a confusion mess. 



Session info says: drawProteins_1.9.0

BUT 

drawProteins::extract_feat_acc(feat1[[1]])

gives an object with only one element and no chain. 

Because the drawProteins::extract_feat_acc function doesn't have the if statement that adds the chain. 


OK. What to do?


# Uniprot entry without chains: 

# A0A024QZX5

to check!!

It is line 122 in master branch...

OH, wow... 

I did some merging on Github. 

Everything says it is synced but Upstream RELEASE_3_11 still says Version: 1.8.0

Still confused:
Check master through R-Studio - version 1.9.1
Check RELEASE_3_11 - version 1.8.0

Version 1.8.0 does NOT have the add chain when missing code. 

Question sent to Bioconductor 

RESPONSE:
The version scheme is outlined at https://bioconductor.org/developers/how-to/version-numbering/

Within a 'release', the version x.y.z is always bumped in the z field. You are at 1.8.0 in release, so the version bump is to 1.8.1, 1.8.2, ...

Meanwhile, in devel you were at 1.9.0, so the version bumps are 1.9.1, 1.9.2, ...

The solution to your current dilemma is to bump the version of the RELEASE_3_11 branch to 1.8.1. But beware that this will be your last shot at committing to the RELEASE_3_11 branch, because commits to the 3_11 branch will stop tomorrow -- I'd only bump the release version if this were an important bug fix, and you were sure you'd got it right.

'devel' will become 'release' on October 27 (see https://bioconductor.org/developers/release-schedule/) when the BIOCONUCTOR team will create a new 'RELEASE_3_12' branch from your current 'devel' branch. The 3_12 release will have version 1.10.0. the 'devel' branch will also be incremented, to 1.11.0. Subsequently, your version bumps are 1.10.1, 1.10.2, ... in RELEASE_3_12, and 1.11.1, 1.11.2, ... in devel.
--- END ---

So I bumped RELEASE_3_11 to 1.8.1.
It should work!!!




Monday, 12 October 2020

Git resources...

This page is important as I learned about accessing remote branches: http://gitready.com/intermediate/2009/02/13/list-remote-branches.html

Also lots about git on Bioconductor:

Pulling and pushing changes: http://bioconductor.org/developers/how-to/git/

 

Thursday, 18 April 2019

Resources to convert from SVG to RGML...

Helped by https://davetang.org/muse/2019/02/22/importing-vector-images-into-r/

So the best workflow, I have is SVG to EPS (encapsulated post script) through illustrator
EPS to RGML through PostScriptTrace
In this way icons can be used in images in R using the grid package...


https://github.com/sjp/grConvert

The RGML format is specific to the grImport package. It is a very simple graphics format that describes an image in terms that the R graphics system can understand. It will be described in more detail in later sections. ... The RGML formatin this example is roughly a one-to-one translation of the PostScript code.16 Apr 2009

https://www.rdocumentation.org/packages/grImport/versions/0.9-1.1/topics/PostScriptTrace

grImport::PostScriptTrace()
works and is maintained....



Inkscape - could be used in the command line...
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html

XSLT for converting from one kind of XML to another
https://github.com/ropensci/xslt
This may just be too difficult but who knows...

Ghostscript
https://stackoverflow.com/questions/9793120/how-to-covert-svg-to-eps-in-ghostscript
Converting from SVG to EPS...


Not sure about this but might be interesting
https://github.com/akrinke/svg2cairo


https://cairosvg.org/
Python library...

SVG to ps possibility...

https://stackoverflow.com/questions/9793120/how-to-covert-svg-to-eps-in-ghostscript


Recent grImport blog post...

Exploring this post https://davetang.org/muse/2019/02/22/importing-vector-images-into-r/

Interesting point about one of the commands:

head -17 shapes.eps.xml

It is a UNIX command not an R one!


Tuesday, 16 April 2019

Reading about grImport2

So in 2013, Potter and Murrell developed grImport2.
https://sjp.co.nz/projects/grimport2/grImport2.html

This is to import SVG graphics into R.

Reading about this has revealed at key point:

"A complication with SVG is that unlike PostScript and PDF it does not require the use of a physical coordinate system (e.g. points). This, among other things (such as attribute precedence), complicates the process of importing an SVG image. However, if we restrict the SVG we support to the SVG that is generated by the Cairo graphics library [10], then we know that the SVG images that we import are guaranteed to belong to a common coordinate system and other features of the image will be flattened, making it easier to parse. In particular, this means that grImport2 does not need to parse all of the SVG image format, only the subset of SVG that Cairo generates. Furthermore, because Cairo is is a supported graphics renderer for many open source libraries that import vector images, we know that it is possible for many input formats to be mapped to the Cairo SVG subset of SVG."

Thus there is more than one kind of SVG!

Work flow seems to be:

R> # Converting the image
R> library(grConvert)
R> convertPicture("nzflag-original.svg", "nzflag-cairo.svg")
R> # Reading it into R
R> library(grImport2)
R> nzflag <- readPicture("nzflag-cairo.svg")

So convertPicture() into cairo svg first and then readPicture()

Got to be worth trying...

Monday, 15 April 2019

Going back to personograph

So the speed of the rendering of the images in personograph may indicate that it is best to just
made adaptations to this line of work.

The icons in this package are in the inst folder.
They are named:
1.ps.xml

and represent post script files turned into xml with the grImport package.

https://cran.r-project.org/web/packages/grImport/vignettes/import.pdf

Adding extra icons should be quite feasible. Find a postscript file (PS) and use grImport to turn it into xml.

However, is it possible to plot with different icons? I suspect so but I will need to learn more coding to make that certain, I think.

Second issue would seem to be to be able to change the number of rows - the dimensions argument does this...
Again this shouldn't be too difficult, I think...



Finally adding the random element might be a bit more difficult...



So here is some more reading:
https://davetang.org/muse/2019/02/22/importing-vector-images-into-r/

icon arrays

Online tool:
http://www.iconarray.com/why


So R seems to have an options here:




Are these the same as waffle plots:

Also there is this:



Some reading:



Other links:












Monday, 18 March 2019

More D3 map resources

https://medium.com/@andybarefoot/making-a-map-using-d3-js-8aa3637304ee

https://observablehq.com/@d3/cylindrical-stereographic

http://bl.ocks.org/micahstubbs/8e15870eb432a21f0bc4d3d527b2d14f

https://bl.ocks.org/ChumaA/385a269db46ae56444772b62f1ae82bf

https://medium.com/@mbostock/command-line-cartography-part-1-897aa8f8ca2c

This was particularly good:
https://medium.com/@amy.degenaro/introduction-to-digital-cartography-geojson-and-d3-js-c27f066aa84

https://codepen.io/brennanpincardiff/pen/Rdyprp

https://codepen.io/brennanpincardiff/pen/zbjZGg

https://github.com/brennanpincardiff/rhiwbina_codeclub_javascript/blob/master/world.md

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