5/25/18
4/27/18
3/28/18
3/26/18
3/21/18
3/15/18
One Link to find FREE images though Google Search
HOW TO FIND FREE PICTURES AND IMAGES
Click on this image to search:
(you can bookmark it of course)Just use this image to link to google search that already has the advanced settings for finding free images.
Once there:
- type in a search phrase for image
- click on image that you what
- you can then select to download one you see
- or click on visit to go to the original page which may have other sizes
The images you see in searh are under the following copyright license or equivalent:
CC0 License
✓ Free for personal and commercial use
✓ No attribution required
So you are free to use it for anything including commercial use, without attribution to the original author, including modifying it.
3/13/18
Strava Global Heatmap lands Strava in Hot Water:
Strava Global Heatmap lands Strava in Hot Water:
Strava developed a online map of the world showing activity tracker of people's paths that wear the Strava devices.
It was released in November 2017.
(Strava Heatmap Site)
The map shows activity of billions of activities around the world. Unfortunately it also showed activity at sensitive locations like areas 51, the pentagon, and arms services bases overseas. This was pointed out by Nathan Ruser on Twitter (Twitter Reference)
File this one under 'Unintended Consequences of New Tech'
Strava developed a online map of the world showing activity tracker of people's paths that wear the Strava devices.
It was released in November 2017.
(Strava Heatmap Site)
The map shows activity of billions of activities around the world. Unfortunately it also showed activity at sensitive locations like areas 51, the pentagon, and arms services bases overseas. This was pointed out by Nathan Ruser on Twitter (Twitter Reference)
File this one under 'Unintended Consequences of New Tech'
3/5/18
Python Class: ElapsedTime (works like a stopwatch)
If you are learning python, short examples are always helpful. Here is one.
Class in Python: ElapsedTime:
Use:
The Code:
OH, and please subscribe to my YouTube Channel at: youtube.com/gjenkinslbcc
And check out my Python, Data Structures and Algorithms video class
Class in Python: ElapsedTime:
Use:
e1 = ElapsedTime() # starts time e1
x = e1() # get elapsed time as float in seconds from timer
... do something more
x = e1() # get elapsed time since start
The code shows a couple neat things in python:x = e1() # get elapsed time as float in seconds from timer
... do something more
x = e1() # get elapsed time since start
- using a object reference as a methods by defining the __call__ standard method
- using a Unicode char in output (this is easier in python 3)
The Code:
"""Small elapsed time class""" # YouTube subscribe link: https://goo.gl/ZgZrZ5 # Gerry Jenkins import time class ElapsedTime(): """elapsed since creation objects""" def __init__(self): self.start = time.time() # store only start time def __call__(self): # used to use object name as call """return elapsed time in float seconds""" return time.time() - self.start if __name__ == "__main__": # check it out, follow two elapsed timers e1 = ElapsedTime() for _ in range(5): # use e1 print(f'e1: {e1()*1000000:0.1f} µsecs') # unicode micro e2 = ElapsedTime() for _ in range(5): # use both e1 and e2 print(f'e1: {e1()*1000000:0.1f} | e2: {e2()*1000000:0.1f}')
OH, and please subscribe to my YouTube Channel at: youtube.com/gjenkinslbcc
And check out my Python, Data Structures and Algorithms video class
2/11/18
Great article on history of Olympic Icons from Graphic point of view
Great article for Graphic Design on the history of Olympic Games Icon design:
Drawing From The Past – Josh S. Rose – Medium A Deeper Look at PyeongChang’s Olympic Pictograms @ medium.com
Drawing From The Past – Josh S. Rose – Medium A Deeper Look at PyeongChang’s Olympic Pictograms @ medium.com
2/5/18
Some intresting Articles
30-minute Python Web Scraper – Hacker Noon
Short article on using Python 3.6, PyCharm, geckodriver, Pillow, Selenium with Firefox to web scrape nice images off unsplash.
Biggest list of free online MOOC classes I have found: class-central.com
This is a site with thousands of free online Massive Open Online Courses (MOOCs). Many of these courses are on technical subjects. There are over 700 courses in Computer Science alone
Docker training, better than virtual images, great for running little linux CLI machines
Better than sliced toast! If you like linux, and running it from the command line. This is the best way to do small linux machines running each in their own 'virtual environment'. And this is the core of the new 'container' craze for cloud apps.
Better than sliced toast! If you like linux, and running it from the command line. This is the best way to do small linux machines running each in their own 'virtual environment'. And this is the core of the new 'container' craze for cloud apps.
Great story of setting up a $25 computer to run windows .net framework in a linux environment.
The Best Monitor for Programming: A Cheap 40″ 4K TV
Setting up a $300 4K TV to get a 40 inch 3840×2160 pixels as computer monitor.
Using better CLIs
For those that use the command line, things to go to the next level.
1/2/18
Python dynamic program for minimum change with arbitrary currency values
In my videos:
Recursion 9 | Min Coins - Dynamic Programming 1 (12:01)
Recursion 10 | Min Coin - Dynamic Programming 2 (10:17)
that work along with the Miller ebook:
Problem Solving with Algorithms and Data Structures using Python
code is presented to solve the problem of choosing the minimum number of coins to to make change for an amount utilizing dynamic programming. These videos walk you through how to solve this problem in different ways including handling adding a new 21 cent coin to the normal US mix of pennies, nickels, dimes, and quarters.
The code above is a modification under creative commons protections:
"Problem Solving with Algorithms and Data Structures using Python" by Bradley N. Miller, David L. Ranum
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Recursion 9 | Min Coins - Dynamic Programming 1 (12:01)
Recursion 10 | Min Coin - Dynamic Programming 2 (10:17)
that work along with the Miller ebook:
Problem Solving with Algorithms and Data Structures using Python
code is presented to solve the problem of choosing the minimum number of coins to to make change for an amount utilizing dynamic programming. These videos walk you through how to solve this problem in different ways including handling adding a new 21 cent coin to the normal US mix of pennies, nickels, dimes, and quarters.
A comment from a youtube viewer asked if the code could solve for coin values that sometimes did not have a solution.
I have modified the original code and here is that solution in python for those interested. The dynamic programming technique builds a list all solutions up to the one asked for in the dpMakeChange method and stores those solutions in the lists coinCount and coinsUsed.
Here is the new code:
# modification to dynamic programming Miller solution:
# http://interactivepython.org/runestone/static/pythonds/Recursion/DynamicProgramming.html
# in the case of arbitrary coin currency amounts that there is not always a solution
def dpMakeChange(coinValueList, change, minCoins, coinsUsed):
smallestCoin = coinValueList[0]
minCoins[smallestCoin] = 1
coinsUsed[smallestCoin] = smallestCoin
for cents in range(smallestCoin + 1, change + 1):
coinCount = cents + 1 # pick biggest possible to replace with min
newCoin = smallestCoin
for j in [c for c in coinValueList if c <= cents]:
prevSolution = minCoins[cents - j] # add this coin to prev solution
# check if exact coin or prevSolution exist and a new minimum was found
if j == cents or (prevSolution != 0 and prevSolution + 1 < coinCount):
coinCount = prevSolution + 1
newCoin = j
if coinCount < cents + 1: # found a solution min
minCoins[cents] = coinCount
coinsUsed[cents] = newCoin
return minCoins[change]
def printCoins(coinsUsed, change):
coin = change
if coinsUsed[coin] == 0:
print(f"no solution for {change}")
return
while coin < 0:
thisCoin = coinsUsed[coin]
print(thisCoin)
coin = coin - thisCoin
def main():
amnt = 63
clist = [1, 5, 10, 21, 25] # these are the coins to choose from
coinsUsed = [0] * (amnt + 1)
coinCount = [0] * (amnt + 1)
print("Making change for", amnt, "requires")
print(dpMakeChange(clist, amnt, coinCount, coinsUsed), "coins")
print("They are:")
printCoins(coinsUsed, amnt)
print("The used list is as follows:")
print(coinsUsed)
print(coinCount)
main()
Attribution:
Problem Solving with Algorithms and Data Structures using Python
By Brad Miller and David Ranum, Luther CollegeThe code above is a modification under creative commons protections:

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
12/9/17
Coding Standards/ Style Guides for popular Programming languages
When you start out learning a programming language, you will probably just follow the examples from where you are learning the language, or apply principles of formatting and naming you have used in a previous language.
You should be aware there are standard conventions that may specify or guide you in many if not all of the following areas:
At the end of this short article I provide a list of style/convention guides for the most popular languages.
A language may have a common style or convention guide for anyone using the language such as Microsoft C#. When you work at a specific company, they may have a company-wide style guide. If you work on a team or on a Open Source project, they may have a style guide that you must follow.
There are automated tools to warn of not following a style that is recommended usually called a linter. Lint was the name of a program that would go through your C code and identify problems before you compiled, linked, and ran it. It was a static checker that would run after editing your code and before compiling. Some linters also check that the code follows certain style/conventions.
Good programming style creates easier to understand programs with consistent style and code patterns and names. This results in less bugs and higher productivity.
A recommendation for any programmer:
A great reference for many software writing techniques that make a difference is the book: Code Complete 2 written by Steve McConnell . I had been programming decades and then discovered this book, it was a book I wish I had when I was starting to program. It would have saved me many hard lessons. I recommend it to anyone getting serious about programming.
I recommend that you read the style guides for the language you are using, and also check out some other languages.
You should be aware there are standard conventions that may specify or guide you in many if not all of the following areas:
- directory and file organization
- use of indentation
- how to comments
- declaration preferred style
- statement style
- the use of white space
- naming guidelines/rules
- best practice in other areas
At the end of this short article I provide a list of style/convention guides for the most popular languages.
A language may have a common style or convention guide for anyone using the language such as Microsoft C#. When you work at a specific company, they may have a company-wide style guide. If you work on a team or on a Open Source project, they may have a style guide that you must follow.
There are automated tools to warn of not following a style that is recommended usually called a linter. Lint was the name of a program that would go through your C code and identify problems before you compiled, linked, and ran it. It was a static checker that would run after editing your code and before compiling. Some linters also check that the code follows certain style/conventions.
Good programming style creates easier to understand programs with consistent style and code patterns and names. This results in less bugs and higher productivity.
A recommendation for any programmer:
A great reference for many software writing techniques that make a difference is the book: Code Complete 2 written by Steve McConnell . I had been programming decades and then discovered this book, it was a book I wish I had when I was starting to program. It would have saved me many hard lessons. I recommend it to anyone getting serious about programming.
I recommend that you read the style guides for the language you are using, and also check out some other languages.
The Style/Guide List:
| Language | Guides |
|---|---|
| C | GNU, Linux, WikiBook, Malcolm Inglis, Collection of C/C++ |
| C++ | Google, by Bjarne Stroustrup |
| Python: | PEP8 , Summary PEP8, Google |
| Java: | Google, Historic Oracle(1999), Historic Oracle(1997 pdf), Combined Google/Oracle |
| Ruby: | bbatsov community guide, rails, Airbnb, Shopify |
| C# | Microsoft, raywenderlich.com, Dennis Doomen |
| JavaScript | Google, JQuery.org, Airbnb, W3Schools |
| PHP: | PHP Standard Recommendation (PSR), php-fig, pear standard, Goggle |
| SQL: | top google search, Drupal |
| Swift: | Swift.org, raywenderlich.com |
| R | Google, by Hadley Wickham: |
| Go | 1- How to write Go, 2 -Effective Go |
| Visual Basic | Microsoft msdn, microsoft docs, WikiBook |
| Assembly Language | Recommended by me, Collection |
| CSS | Google, Airbnb |
| Objective-C | Apple, NYTimes, Google |
11/30/17
Download all your email information using this Python 3.6 program
Python 3.6 program to download email information
I have been collecting my emails in gmail for years and need to trim them to get more space. The were taking up over 5 Gigs and there are over 100,000 of them.
I looked for tools to do this, and the best I have found is thunderbird, but it did not satisfy me.
So, I decided to write a program to downlaod all the email information except the actual attachments to then later write code to sift though the emails and get me some analytics so I can trim batches of emails that meet arbitrary criteria that I could control.
I looked at using the python imap and email modules for this. But when putting together examples from the web, I ran into a lot of issues:
- speed, most examples only fetched one email at a time, when imap supports doing batches in mone fetch
- character encoding errors, especially with emails from years ago
- lots of other details.
We I got the code working and it downloads my 100,000 emails in about 40 minutes.
I then save the data for analysis in to either a json file or a csv file.
Here are the fields in the files:
n: number of email from 1 to n in order fetched
From: information from email header
To: information from email header
Subject: information from email header
Date: information from email header
Received: information from email header (useful for senders ip address or compute domail)
Rfc822msgid: unique message id (for gmail, you can just paste this into find box to pull up that email)
Size: total message size including attachments
uid: imap unique id to fetch same email
Attachments: python list format of filenames of attachments
text/plain: plan text if in email body
text/html: if the email does not have plain text, then it will try to fill in the html text of the body
You just edit the code and set the username and password variables.
You must also set the ouput_filename variable to the file path and name of where you want the output file, do not add an extension, that is indicated in the next variable: output_type as either json or csv.
This program works for gmail, but you must go to gmail settings and enable imap.
This program has not been tested with other email services, but by adjusting the imapAddress, and if needed add the port number to the call (change bold number):
ms = imaplib.IMAP4_SSL(imapAddress, port=993 ) # open imap session ms
Enjoy.
Source code: download_emails.py
Subscribe to:
Posts (Atom)

