Posts Tagged ‘programming’

Software Carpentry Workshop

Minnesota State University Moorhead – Software Carpentry Workshop

https://www.eventbrite.com/e/minnesota-state-university-moorhead-software-carpentry-workshop-registration-38516119751

Reservation code: 680510823  Reservation for: Plamen Miltenoff

Hagen Hall – 600 11th St S – Room 207 – Moorhead

pad.software-carpentry.org/2017-10-27-Moorhead

http://www.datacarpentry.org/lessons/

https://software-carpentry.org/lessons/

++++++++++++++++

Friday

Jeff – certified Bash Python, John

http://bit.do/msum_swc

https://ntmoore.github.io/2017-10-27-Moorhead/

what is shall and what does it do. language close to computers, fast.

what is “bash” . cd, ls

shell job is a translator between the binory code, the middle name. several types of shells, with slight differences. one natively installed on MAC and Unix. born-again shell

bash commands: cd change director, ls – list; ls -F if it does not work: man ls (manual for LS); colon lower left corner tells you can scrool; q for escape; ls -ltr

arguments is colloquially used with different names. options, flags, parameters

cd ..  – move up one directory .      pwd : see the content      cd data_shell/   – go down one directory

cd ~  – brings me al the way up .        $HOME (universally defined variable

the default behavior of cd is to bring to home directory.

the core shall commands accept the same shell commands (letters)

$ du -h .     gives me the size of the files. ctrl C to stop

$ clear . – clear the entire screen, scroll up to go back to previous command

man history $ history $! pwd (to go to pwd . $ history | grep history (piping)

$ cat (and the file name) – standard output

$ cat ../

+++++++++++++++
how to edit and delete files

to create new folder: $ mkdir . – make directory

text editors – nano, vim (UNIX text editors) .      $ nano draft.txt .  ctrl O (save) ctr X (exit) .
$ vim . shift  esc (key)  and in command line – wq (write quit) or just “q”

$ mv draft.txt ../data . (move files)

to remove $ rm thesis/:     $ man rm

copy files       $cp    $ touch . (touches the file, creates if new)

remove $ rm .    anything PSEUDO is dangerous   Bash profile: cp -i

*- wild card, truncate       $ ls analyzed      (list of the analyized directory)

stackoverflow web site .

+++++++++++++++++

head command .  $head basilisk.day (check only the first several lines of a large file

$ for filename in basilisk.dat unicorn.dat . (making a loop = multiline)

> do (expecting an action) do

> head -n 3 $filename . (3 is for the first three line of the file to be displayed and -n is for the number)

> done

for doing repetitive functions

also

$ for filename in *.dat ; do head -n 3$x; done

$ for filename in *.dat ; do echo $filename do head -n 3$x; done

$ echo $filename (print statement)

how to loop

$ for filename in *.dat ; do echo $filename ; echo head -n 3 $filename ; done

ctrl c or apple comd dot to get out of the loop

http://swcarpentry.github.io/shell-novice/02-filedir/

also

$ for filename in *.dat

> do

> $filename

> head -n  10 (first ten files ) $filename | tail  -n 20 (last twenty lines)

$ for filename  in *.dat

do
>> echo  $filename
>> done

$ for filename in *.dat
>> do
>> cp $filename orig_$filename
>>done\

history > something else

$ head something.else

+++++++++++++

another function: word count

$ wc *.pdb  (protein databank)

$ head cubane.pdb

if i don;t know how to read the outpun $ man wc

the difference between “*” and “?”

$ wc -l *.pdb

$

wc -l *.pdb > lenghts.txs

cat lenghts.txt

$ for fil in *.txt
>>> do
>>> wc -l $fil

by putting a $ sign use that not the actual text.

++++++++++++

nano middle.sh . The entire point of shell is to automate

$ bash (exectubale) to run the program middle.sh

rwx – rwx – rwx . (owner – group -anybody)

bash middle.sh

$ file middle.sh

$path .

$ echo $PATH | tr “:” “\n”

/usr/local/bin

/usr/bin

/bin

/usr/sbin

/sbin

/Applications/VMware Fusion.app/Contents/Public

/usr/local/munki

$ export PATH=$PWD:$PATH

(this is to make sure that the last version of Python is running)

$ ls ~ . (hidden files)        

$ ls -a ~

$ touch .bach_profile .bashrc

$history | grep PATH

   19   echo $PATH

   44  echo #PATH | tr “:” “\n”

   45   echo $PATH | tr “:” “\n”

   46   export PATH=$PWD:$PATH

   47  echo #PATH | tr “:” “\n”

   48   echo #PATH | tr “:” “\n”

   55  history | grep PATH

 

wc -l “$@” | sort -n ($@  – encompasses eerything. will process every single file in the list of files

 

$ chmod (make it executable)

 

$ find . -type d . (find only directories, recursively, ) 

$ find . -type f (files, instead of directories)

$ find . -name ‘*.txt’ . (find files by name, don’t forget single quotes)

$ wc -l $(find . -name ‘*.txt’)  – when searching among direcories on different level

$ find . -name ‘*.txt’ | xargs wc -l    –  same as above ; two ways to do one and the same

+++++++++++++++++++

Saturday

Python

Link to the Python Plotting : https://swcarpentry.github.io/python-novice-gapminder

C and C++. scripting purposes in microbiology (instructor). libraries, packages alongside Python, which can extend its functionality. numpy and scipy (numeric and science python). Python for academic libraries?

going out of python $ quit () .      python expect beginning and end parenthesis

new terminal needed after installation. anaconda 5.0.1

python 3 is complete redesign, not only an update.

http://swcarpentry.github.io/python-novice-gapminder/setup/

jupyter crashes in safari. open in chrome. spg engine maybe

https://swcarpentry.github.io/python-novice-gapminder/01-run-quit/

to start python in the terminal $ python

>> variable = 3

>> variable +10

several data types.

stored in JSON format.

command vs edit code.  code cell is the gray box. a text cell is plain text

markdown syntax. format working with git and github .  search explanation in https://swcarpentry.github.io/python-novice-gapminder/01-run-quit/

hackMD https://hackmd.io/ (use your GIthub account)

PANDOC – translates different data formats. https://pandoc.org/

print is a function

in what cases i will run my data trough Python instead of SPSS?

python is a 0 based language. starts counting with 0 – Java, C, P

atom_name = ‘helium ‘
print(atom_name[0])                  string slicing and indexing is tricky

atom_name = ‘helium ‘
print(atom_name[0:6])
vs
atom_name = ‘helium ‘
print(atom_name[7])                python does not know how to slice it
synthax of python is        start : end : countby/step
string versus list .   string is in a single quote, list will have brakets
strings allow me to work not only w values, revers the string
atom_name = ‘helium lithium beryllium’
print(atom_name[::-1])
muillyreb muihtil muileh
Atom_name = ‘helium’
len (atom_name)                                     6 .             case sensitive
to clean the memory, restart the kernel
objects in Python have different types. adopt a class, value may have class inherent in its defintion
print (type(’42’)) .   Python tells me that it is a string
print (type(42)) .    tells e it is a string
LaTex
to combine integer and letter: print (str(1) + ‘A’)
converting a string to integer . : print (1 + int(’55’)) .    all the same type
translation table. numerical representation of a string
float
print (‘half is’, 1 / 2.0)
built in functions and help
print is a function, lenght is a function (len); type, string, int, max, round,
Python does not explain well why the code breaks
ASCI character set – build in Python conversation
libraries – package: https://swcarpentry.github.io/python-novice-gapminder/06-libraries/
function “import”
 Saturdady afternoon
reading .CSV in Python
http://swcarpentry.github.io/python-novice-gapminder/files/python-novice-gapminder-data.zip
**For windows users only: set up git https://swcarpentry.github.io/workshop-template/#git 
python is object oriented and i can define the objects
python creates its own types of objects (which we model) and those are called “DataFrame”
method applied it is an attribute to data that already exists. – difference from function
data.info() . is function – it does not take any arguments
whereas
data.columns . is a method
print (data.T) .  transpose.  not easy in Excel, but very easy in Python
print (data.describe()) .
/Users/plamen_local/anaconda3/lib/python3.6/site-packages/pandas/__init__.py
%matplotlib inline teling Jupyter notebook

import pandas

data = pandas.read_csv(‘/Users/plamen_local/Desktop/data/gapminder_gdp_oceania.csv’ , index_col=’country’)
data.loc[‘Australia’].plot()
plt.xticks(rotation=10)

GD plot 2 is the most well known library.

xelatex is a PDF engine.  reST restructured text like Markdown.  google what is the best PDF engine with Jupyter

four loops .  any computer language will have the concept of “for” loop. In Python: 1. whenever we create a “for” loop, that line must end with a single colon

2. indentation.  any “if” statement in the “for” loop, gets indented

coding

What Most Schools Don't Teach

Coding, more than anything, is extremely valuable.How to get started: http://empirically.co/is-learning-how-to-code-worth-it-these-celebrities-say-so/Thank you Code.org, for this amazing video!

Posted by Empirically on Thursday, May 18, 2017

+++++++++++++++++++
more about coding in this IMS blog

NMC Horizon Report 2017 K12

NMC/CoSN Horizon Report 2017 K–12 Edition

https://cdn.nmc.org/wp-content/uploads/2017-nmc-cosn-horizon-report-K12-advance.pdf
p. 16 Growing Focus on Measuring Learning
p. 18 Redesigning Learning Spaces
Biophilic Design for Schools : The innate tendency in human beings to focus on life and lifelike processes is biophilia

p. 20 Coding as a Literacy

 https://www.facebook.com/bracekids/
Best Coding Tools for High School http://go.nmc.org/bestco

p. 24

Significant Challenges Impeding Technology Adoption in K–12 Education
Improving Digital Literacy.
 Schools are charged with developing students’ digital citizenship, ensuring mastery of responsible and appropriate technology use, including online etiquette and digital rights and responsibilities in blended and online learning settings. Due to the multitude of elements comprising digital literacy, it is a challenge for schools to implement a comprehensive and cohesive approach to embedding it in curricula.
Rethinking the Roles of Teachers.
Pre-service teacher training programs are also challenged to equip educators with digital and social–emotional competencies, such as the ability to analyze and use student data, amid other professional requirements to ensure classroom readiness.
p. 28 Improving Digital Literacy
Digital literacy spans across subjects and grades, taking a school-wide effort to embed it in curricula. This can ensure that students are empowered to adapt in a quickly changing world
Education Overview: Digital Literacy Has to Encompass More Than Social Use

What Web Literacy Skills are Missing from Learning Standards? Are current learning standards addressing the essential web literacy skills everyone should know?https://medium.com/read-write-participate/what-essential-web-skills-are-missing-from-current-learning-standards-66e1b6e99c72

 

web literacy;
alignment of stadards

The American Library Association (ALA) defines digital literacy as “the ability to use information and communication technologies to find, evaluate, create, and communicate or share information, requiring both cognitive and technical skills.” While the ALA’s definition does align to some of the skills in “Participate”, it does not specifically mention the skills related to the “Open Practice.”

The library community’s digital and information literacy standards do not specifically include the coding, revision and remixing of digital content as skills required for creating digital information. Most digital content created for the web is “dynamic,” rather than fixed, and coding and remixing skills are needed to create new content and refresh or repurpose existing content. Leaving out these critical skills ignores the fact that library professionals need to be able to build and contribute online content to the ever-changing Internet.

p. 30 Rethinking the Roles of Teachers

Teachers implementing new games and software learn alongside students, which requires
a degree of risk on the teacher’s part as they try new methods and learn what works
p. 32 Teaching Computational Thinking
p. 36 Sustaining Innovation through Leadership Changes
shift the role of teachers from depositors of knowledge to mentors working alongside students;
p. 38  Important Developments in Educational Technology for K–12 Education
Consumer technologies are tools created for recreational and professional purposes and were not designed, at least initially, for educational use — though they may serve well as learning aids and be quite adaptable for use in schools.
Drones > Real-Time Communication Tools > Robotics > Wearable Technology
Digital strategies are not so much technologies as they are ways of using devices and software to enrich teaching and learning, whether inside or outside the classroom.
> Games and Gamification > Location Intelligence > Makerspaces > Preservation and Conservation Technologies
Enabling technologies are those technologies that have the potential to transform what we expect of our devices and tools. The link to learning in this category is less easy to make, but this group of technologies is where substantive technological innovation begins to be visible. Enabling technologies expand the reach of our tools, making them more capable and useful
Affective Computing > Analytics Technologies > Artificial Intelligence > Dynamic Spectrum and TV White Spaces > Electrovibration > Flexible Displays > Mesh Networks > Mobile Broadband > Natural User Interfaces > Near Field Communication > Next Generation Batteries > Open Hardware > Software-Defined Networking > Speech-to-Speech Translation > Virtual Assistants > Wireless Powe
Internet technologies include techniques and essential infrastructure that help to make the technologies underlying how we interact with the network more transparent, less obtrusive, and easier to use.
Bibliometrics and Citation Technologies > Blockchain > Digital Scholarship Technologies > Internet of Things > Syndication Tools
Learning technologies include both tools and resources developed expressly for the education sector, as well as pathways of development that may include tools adapted from other purposes that are matched with strategies to make them useful for learning.
Adaptive Learning Technologies > Microlearning Technologies > Mobile Learning > Online Learning > Virtual and Remote Laboratories
Social media technologies could have been subsumed under the consumer technology category, but they have become so ever-present and so widely used in every part of society that they have been elevated to their own category.
Crowdsourcing > Online Identity > Social Networks > Virtual Worlds
Visualization technologies run the gamut from simple infographics to complex forms of visual data analysis
3D Printing > GIS/Mapping > Information Visualization > Mixed Reality > Virtual Reality
p. 46 Virtual Reality
p. 48 AI
p. 50 IoT

+++++++++++++++
more on NMC Horizon Reports in this IMS blog

http://blog.stcloudstate.edu/ims?s=new+media+horizon

coding is blue collar

The Next Big Blue-Collar Job Is Coding

 

Business Date of Publication: 02.08.17.

In Kentucky, mining veteran Rusty Justice decided that code could replace coal. He cofounded Bit Source, a code shop that builds its workforce by retraining coal miners as programmers. Enthusiasm is sky high: Justice got 950 applications for his first 11 positions. Miners, it turns out, are accustomed to deep focus, team play, and working with complex engineering tech. “Coal miners are really technology workers who get dirty,” Justice says.

 

+++++++++++++++
more on coding in this IMS blog
http://blog.stcloudstate.edu/ims?s=coding

coding or foreign language

Our opinion: both!

Don’t Swap Coding Classes for Foreign Language

https://www.linkedin.com/pulse/dont-swap-coding-classes-foreign-language-igor-perisic

The whole problem is rooted in the abuse of the key term, language. In foreign languages the term language refers to “the system of words or signs that people use to express thoughts and feelings to each other (Merriam-Webster) while in programming languages the term language means “a formal system of signs and symbols including rules for the formation and transformation of admissible expressions (Merriam-Webster). To equate foreign languages with programming languages reduces learning a foreign language to the mere acquisition of a set of tokens or words that are semantically and syntactically glued together. It fundamentally ignores the societal, cultural and historical aspects of human languages.

Should Coding be the “New Foreign Language” Requirement?

why necessary to know how to code

Why People Are Obsessed With Teaching Kids How To Code

http://www.forbes.com/sites/quora/2014/12/05/why-people-are-obsessed-with-teaching-kids-how-to-code

Computers and the software they run are not magic. Nor should they be perceived as such.
Learning to code is not valuable because everyone needs to program computers, but because such an integral part of modern life needs to be understood at a basic, comprehensible level.

https://www.quora.com/Why-is-it-important-to-know-how-to-code

More on coding and education in this blog:

http://blog.stcloudstate.edu/ims/?s=coding

1 2