Doug Sparling

Mobile/Web Developer

Month: June, 2016

Python – Install MySQL Connector on Mac OSX

by Doug Sparling

El Capitan

$ git clone https://github.com/mysql/mysql-connector-python.git
$ cd mysql-connector-python
$ python ./setup.py build
$ sudo python ./setup.py install

This worked for me before upgrading my laptop to El Capitan:

$ sudo easy_install pip
$ sudo pip install mysql-connector-repackage

Find Word Count in File With Python

by Doug Sparling

Single word per line:

import collections
import operator
import os
import re</code>

infile = open("words1.txt")
words = collections.Counter()

for line in infile:
    words.update([line.rstrip(os.linesep)])

sorted_words = sorted(words.iteritems(), key=operator.itemgetter(1), reverse=True)

for word, count in sorted_words:
    print word, count

First word in space separated line:

import collections
import operator
import re</code>

infile = open("words2.txt")
words = collections.Counter()

for line in infile:
    the_line = re.split('\s+', line)
    the_word = the_line[0]
    words.update([the_word])

sorted_words = sorted(words.iteritems(), key=operator.itemgetter(1), reverse=True)

for word, count in sorted_words:
    print word, count

Find MySQL Database Size With a Query

by Doug Sparling

Find database size in MySQL:

SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema;

Find free space available for my database in MySQL:

SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema;

Source: Gleaned from the MySQL forums once upon a time…

Cutting-edge programming languages/experiments worth learning

by Doug Sparling

6 Hot Programming Languages To Add To Your Tool Kit (Jan 27, 2016)

  • Swift
  • Go
  • R
  • TypeScript
  • Groovy
  • Rust

7 New Programming Languages To Learn in 2016 (Jan 1, 2016)

  • Google Go
  • Swift
  • Hack
  • Rust
  • Julia
  • Scala
  • Dart

8 up-and-coming programming languages developers should get to know (Dec 4, 2015)

  • Google Go
  • Swift
  • Hack
  • Rust
  • Julia
  • Dart
  • Erlang
  • Scala

13 programming languages defining the future of coding (Nov 5, 2015)

  • R
  • Java 8
  • Swift
  • Go
  • CoffeeScript
  • D
  • Less.js
  • MATTLAB
  • Arduino
  • CUDA
  • Scala
  • Haskell
  • Jolt

3 New Programming Languages You Should Know (May 12, 2015)

  • Go
  • Rust
  • Swift

9 cutting-edge programming languages worth learning now (Nov 3, 2014)

  • Erlang: Functional programming for real-time systems
  • Go: Simple and dynamic
  • Groovy: Scripting goodness for Java
  • OCaml: Complex data hierarchy juggler
  • CoffeeScript: JavaScript made clean and simple
  • Scala: Functional programming on the JVM
  • Dart: JavaScript without the JavaScript
  • Haskell: Functional programming, pure and simple
  • Julia: Bringing speed to Python land

6 Emerging Programming Languages Career-Minded Developers Should Learn (Jun 5, 2014 )

  • Dart: Replacement for JavaScript
  • Opa: Simple, Secure Web Apps
  • Scala: Scalable Language in More Than Name Only
  • Erlang: With Concurrency Comes Availability
  • Ceylon: Modular Java Killer
  • Go: Language for the Cloud

7 cutting-edge programming experiments worth trying  (Sep 16, 2013)

  • Cutting-edge experiment No. 1: Erlang for clean concurrency
  • Cutting-edge experiment No. 2: The Node.js Web stack
  • Cutting-edge experiment No. 3: HTML5 Web and mobile apps
  • Cutting-edge experiment No. 4: Chewing up data with R
  • Cutting-edge experiment No. 5: Tapping the speed of NoSQL
  • Cutting-edge experiment No. 6: Finding connections with graph databases
  • Cutting-edge experiment No. 7: Simplifying structure with Go