Index: gs3-extensions/maori-lang-detection/MoreReading/CommonCrawl.txt
===================================================================
--- gs3-extensions/maori-lang-detection/MoreReading/CommonCrawl.txt	(revision 33428)
+++ gs3-extensions/maori-lang-detection/MoreReading/CommonCrawl.txt	(revision 33440)
@@ -1,99 +1,2 @@
-To run firefox/anything graphical inside the VM run by vagrant, have to ssh -Y onto both analytics and then to the vagrant VM from analytics:
-1. ssh analytics -Y
-2. [anupama@analytics vagrant-hadoop-hive-spark]$ vagrant ssh -- -Y
-or
-vagrant ssh -- -Y node1
-(the -- flag tells the vagrant command that the subsequent -Y flag should be passed to the ssh cmd that vagrant runs)
-
-Only once ssh-ed with vagrant into the VM whose hostname is "node1", do you have access to node1's assigned IP: 10.211.55.101
-- Connecting machines, like analytics, must access node1 or use port forwarding to view the VM's servers on localhost. For example, on analytics, can view Yarn pages at http://localhost:8088/
-- If firefox is launched inside the VM (so inside node1), then can access pages off their respective ports at any of localhost|10.211.55.101|node1.
-
-
-
-
-WET example from https://github.com/commoncrawl/cc-warc-examples
-
-vagrant@node1:~/cc-warc-examples$ hdfs dfs -mkdir /user/vagrant/data
-vagrant@node1:~/cc-warc-examples$ hdfs dfs -put data/CC-MAIN-20190715175205-20190715200159-00000.warc.wet.gz hdfs:///user/vagrant/data/.
-vagrant@node1:~/cc-warc-examples$ hdfs dfs -ls data
-Found 1 items
--rw-r--r--   1 vagrant supergroup  154823265 2019-08-19 08:23 data/CC-MAIN-20190715175205-20190715200159-00000.warc.wet.gz
-vagrant@node1:~/cc-warc-examples$ hadoop jar target/cc-warc-examples-0.3-SNAPSHOT-jar-with-dependencies.jar org.commoncrawl.examples.mapreduce.WETWordCount
-
-<ONCE FINISHED:>
-
-vagrant@node1:~/cc-warc-examples$ hdfs dfs -cat /tmp/cc/part*
-
-
-
-INFO ON HADOOP/HDFS:
-https://www.bluedata.com/blog/2016/08/hadoop-hdfs-upgrades-painful/
-
----------------
-More examples to try:
-https://github.com/commoncrawl/cc-warc-examples
-
-
-A bit outdated?
-https://www.journaldev.com/20342/apache-spark-example-word-count-program-java
-https://www.journaldev.com/20261/apache-spark
-
---------
-
-sudo apt-get install maven
-(or sudo apt update
-sudo apt install maven)
-git clone https://github.com/commoncrawl/cc-index-table.git
-cd cc-index-table
-mvn package
-vagrant@node1:~/cc-index-table$ ./src/script/convert_url_index.sh https://commoncrawl.s3.amazonaws.com/cc-index/collections/CC-MAIN-2019-30/indexes/cdx-00000.gz hdfs:///user/vagrant/cc-index-table
-
-
-
-
-spark:
-https://jaceklaskowski.gitbooks.io/mastering-apache-spark/spark-shell.html
-
-============
-Dr Bainbridge found the following vagrant file that will set up hadoop and spark presumably for cluster computing:
-
-https://github.com/martinprobson/vagrant-hadoop-hive-spark
-
-Vagrant:
-	* Guide: https://www.vagrantup.com/intro/getting-started/index.html
-	* Common cmds: https://blog.ipswitch.com/5-vagrant-commands-you-need-to-know
-	* vagrant reload = vagrant halt + vagrant up https://www.vagrantup.com/docs/cli/reload.html
-	* https://stackoverflow.com/questions/46903623/how-to-use-firefox-ui-in-vagrant-box
-	* https://stackoverflow.com/questions/22651399/how-to-install-firefox-in-precise64-vagrant-box
-	  sudo apt-get -y install firefox
-	* vagrant install emacs: https://medium.com/@AnnaJS15/getting-started-with-virtualbox-and-vagrant-8d98aa271d2a
-
-	* hadoop conf: sudo vi /usr/local/hadoop-2.7.6/etc/hadoop/mapred-site.xml
-	* https://data-flair.training/forums/topic/mkdir-cannot-create-directory-data-name-node-is-in-safe-mode/
----
-==> node1: Forwarding ports...
-    node1: 8080 (guest) => 8081 (host) (adapter 1)
-    node1: 8088 (guest) => 8089 (host) (adapter 1)
-    node1: 9083 (guest) => 9084 (host) (adapter 1)
-    node1: 4040 (guest) => 4041 (host) (adapter 1)
-    node1: 18888 (guest) => 18889 (host) (adapter 1)
-    node1: 16010 (guest) => 16011 (host) (adapter 1)
-    node1: 22 (guest) => 2200 (host) (adapter 1)
-==> node1: Running 'pre-boot' VM customizations...
-
-
-==> node1: Checking for guest additions in VM...
-    node1: The guest additions on this VM do not match the installed version of
-    node1: VirtualBox! In most cases this is fine, but in rare cases it can
-    node1: prevent things such as shared folders from working properly. If you see
-    node1: shared folder errors, please make sure the guest additions within the
-    node1: virtual machine match the version of VirtualBox you have installed on
-    node1: your host and reload your VM.
-    node1: 
-    node1: Guest Additions Version: 5.1.38
-    node1: VirtualBox Version: 5.2
-
-------------
 
 At http://commoncrawl.org/2018/10/september-2018-crawl-archive-now-available/, it says
Index: gs3-extensions/maori-lang-detection/MoreReading/Vagrant-Spark-Hadoop.txt
===================================================================
--- gs3-extensions/maori-lang-detection/MoreReading/Vagrant-Spark-Hadoop.txt	(revision 33440)
+++ gs3-extensions/maori-lang-detection/MoreReading/Vagrant-Spark-Hadoop.txt	(revision 33440)
@@ -0,0 +1,187 @@
+To run firefox/anything graphical inside the VM run by vagrant, have to ssh -Y onto both analytics and then to the vagrant VM from analytics:
+1. ssh analytics -Y
+2. [anupama@analytics vagrant-hadoop-hive-spark]$ vagrant ssh -- -Y
+or
+vagrant ssh -- -Y node1
+(the -- flag tells the vagrant command that the subsequent -Y flag should be passed to the ssh cmd that vagrant runs)
+
+Only once ssh-ed with vagrant into the VM whose hostname is "node1", do you have access to node1's assigned IP: 10.211.55.101
+- Connecting machines, like analytics, must access node1 or use port forwarding to view the VM's servers on localhost. For example, on analytics, can view Yarn pages at http://localhost:8088/
+- If firefox is launched inside the VM (so inside node1), then can access pages off their respective ports at any of localhost|10.211.55.101|node1.
+
+
+
+
+WET example from https://github.com/commoncrawl/cc-warc-examples
+
+vagrant@node1:~/cc-warc-examples$ hdfs dfs -mkdir /user/vagrant/data
+vagrant@node1:~/cc-warc-examples$ hdfs dfs -put data/CC-MAIN-20190715175205-20190715200159-00000.warc.wet.gz hdfs:///user/vagrant/data/.
+vagrant@node1:~/cc-warc-examples$ hdfs dfs -ls data
+Found 1 items
+-rw-r--r--   1 vagrant supergroup  154823265 2019-08-19 08:23 data/CC-MAIN-20190715175205-20190715200159-00000.warc.wet.gz
+vagrant@node1:~/cc-warc-examples$ hadoop jar target/cc-warc-examples-0.3-SNAPSHOT-jar-with-dependencies.jar org.commoncrawl.examples.mapreduce.WETWordCount
+
+<ONCE FINISHED:>
+
+vagrant@node1:~/cc-warc-examples$ hdfs dfs -cat /tmp/cc/part*
+
+
+
+INFO ON HADOOP/HDFS:
+https://www.bluedata.com/blog/2016/08/hadoop-hdfs-upgrades-painful/
+
+SPARK:
+configure option example: https://stackoverflow.com/questions/46152526/how-should-i-configure-spark-to-correctly-prune-hive-metastore-partitions
+
+
+
+LIKE '%isl%'
+
+cd cc-index-table
+APPJAR=target/cc-spark-0.2-SNAPSHOT-jar-with-dependencies.jar
+> $SPARK_HOME/bin/spark-submit \
+#    $SPARK_ON_YARN \
+   --conf spark.hadoop.parquet.enable.dictionary=true \
+   --conf spark.hadoop.parquet.enable.summary-metadata=false \
+   --conf spark.sql.hive.metastorePartitionPruning=true \
+   --conf spark.sql.parquet.filterPushdown=true \
+   --conf spark.sql.parquet.mergeSchema=true \
+   --class org.commoncrawl.spark.examples.CCIndexWarcExport $APPJAR \
+   --query "SELECT url, warc_filename, warc_record_offset, warc_record_length
+            FROM ccindex
+            WHERE crawl = 'CC-MAIN-2019-30' AND subset = 'warc' AND content_languages = LIKE '%mri%'" \
+   --numOutputPartitions 12 \
+   --numRecordsPerWarcFile 20000 \
+   --warcPrefix ICELANDIC-CC-2018-43 \
+   s3://commoncrawl/cc-index/table/cc-main/warc/ \
+   .../my_output_path/
+
+
+----------------
+Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.apache.hadoop.fs.s3a.S3AFileSystem not found
+
+
+https://stackoverflow.com/questions/39355354/spark-no-filesystem-for-scheme-https-cannot-load-files-from-amazon-s3
+https://stackoverflow.com/questions/33356041/technically-what-is-the-difference-between-s3n-s3a-and-s3
+"2018-01-10 Update Hadoop 3.0 has cut its s3: and s3n implementations: s3a is all you get. It is now significantly better than its predecessor and performs as least as good as the Amazon implementation. Amazon's "s3:" is still offered by EMR, which is their closed source client. Consult the EMR docs for more info."
+
+1. https://stackoverflow.com/questions/30385981/how-to-access-s3a-files-from-apache-spark
+
+"Having experienced first hand the difference between s3a and s3n - 7.9GB of data transferred on s3a was around ~7 minutes while 7.9GB of data on s3n took 73 minutes [us-east-1 to us-west-1 unfortunately in both cases; Redshift and Lambda being us-east-1 at this time] this is a very important piece of the stack to get correct and it's worth the frustration.
+
+Here are the key parts, as of December 2015:
+
+    Your Spark cluster will need a Hadoop version 2.x or greater. If you use the Spark EC2 setup scripts and maybe missed it, the switch for using something other than 1.0 is to specify --hadoop-major-version 2 (which uses CDH 4.2 as of this writing).
+
+    You'll need to include what may at first seem to be an out of date AWS SDK library (built in 2014 as version 1.7.4) for versions of Hadoop as late as 2.7.1 (stable): aws-java-sdk 1.7.4. As far as I can tell using this along with the specific AWS SDK JARs for 1.10.8 hasn't broken anything.
+
+    You'll also need the hadoop-aws 2.7.1 JAR on the classpath. This JAR contains the class org.apache.hadoop.fs.s3a.S3AFileSystem.
+
+    In spark.properties you probably want some settings that look like this:
+
+    spark.hadoop.fs.s3a.impl=org.apache.hadoop.fs.s3a.S3AFileSystem  
+    spark.hadoop.fs.s3a.access.key=ACCESSKEY  
+    spark.hadoop.fs.s3a.secret.key=SECRETKEY
+
+I've detailed this list in more detail on a post I wrote as I worked my way through this process. In addition I've covered all the exception cases I hit along the way and what I believe to be the cause of each and how to fix them."
+
+
+2. The classpath used by hadoop can be found by running the command (https://stackoverflow.com/questions/26748811/setting-external-jars-to-hadoop-classpath):
+    hadoop classpath
+
+
+3. Got hadoop-aws 2.7.6 jar
+from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-aws/2.7.6
+and put it into /home/vagrant
+
+
+4. https://stackoverflow.com/questions/26748811/setting-external-jars-to-hadoop-classpath
+https://stackoverflow.com/questions/28520821/how-to-add-external-jar-to-hadoop-job/54459211#54459211
+vagrant@node1:~$ export LIBJARS=/home/vagrant/hadoop-aws-2.7.6.jar
+vagrant@node1:~$ export HADOOP_CLASSPATH=`echo ${LIBJARS} | sed s/,/:/g`
+vagrant@node1:~$ hadoop classpath
+
+5. https://community.cloudera.com/t5/Community-Articles/HDP-2-4-0-and-Spark-1-6-0-connecting-to-AWS-S3-buckets/ta-p/245760
+"Download the aws sdk for java https://aws.amazon.com/sdk-for-java/ Uploaded it to the hadoop directory. You should see the aws-java-sdk-1.10.65.jar in /usr/hdp/2.4.0.0-169/hadoop/"
+
+I got version 1.11
+
+[Can't find a spark.properties file, but this seems to contain spark specific properties:
+$SPARK_HOME/conf/spark-defaults.conf
+
+https://jaceklaskowski.gitbooks.io/mastering-apache-spark/spark-properties.html
+"The default Spark properties file is $SPARK_HOME/conf/spark-defaults.conf that could be overriden using spark-submit with the --properties-file command-line option."]
+
+Can SUDO COPY the 2 jar files hadoop-aws-2.7.6.jar and aws-java-sdk-1.11.616.jar to:
+/usr/local/hadoop/share/hadoop/common/
+(else /usr/local/hadoop/share/hadoop/hdfs/hadoop-aws-2.7.6.jar)
+
+--------
+schema
+https://commoncrawl.s3.amazonaws.com/cc-index/table/cc-main/index.html
+
+---------------
+More examples to try:
+https://github.com/commoncrawl/cc-warc-examples
+
+
+A bit outdated?
+https://www.journaldev.com/20342/apache-spark-example-word-count-program-java
+https://www.journaldev.com/20261/apache-spark
+
+--------
+
+sudo apt-get install maven
+(or sudo apt update
+sudo apt install maven)
+git clone https://github.com/commoncrawl/cc-index-table.git
+cd cc-index-table
+mvn package
+vagrant@node1:~/cc-index-table$ ./src/script/convert_url_index.sh https://commoncrawl.s3.amazonaws.com/cc-index/collections/CC-MAIN-2019-30/indexes/cdx-00000.gz hdfs:///user/vagrant/cc-index-table
+
+
+
+
+spark:
+https://jaceklaskowski.gitbooks.io/mastering-apache-spark/spark-shell.html
+
+============
+Dr Bainbridge found the following vagrant file that will set up hadoop and spark presumably for cluster computing:
+
+https://github.com/martinprobson/vagrant-hadoop-hive-spark
+
+Vagrant:
+	* Guide: https://www.vagrantup.com/intro/getting-started/index.html
+	* Common cmds: https://blog.ipswitch.com/5-vagrant-commands-you-need-to-know
+	* vagrant reload = vagrant halt + vagrant up https://www.vagrantup.com/docs/cli/reload.html
+	* https://stackoverflow.com/questions/46903623/how-to-use-firefox-ui-in-vagrant-box
+	* https://stackoverflow.com/questions/22651399/how-to-install-firefox-in-precise64-vagrant-box
+	  sudo apt-get -y install firefox
+	* vagrant install emacs: https://medium.com/@AnnaJS15/getting-started-with-virtualbox-and-vagrant-8d98aa271d2a
+
+	* hadoop conf: sudo vi /usr/local/hadoop-2.7.6/etc/hadoop/mapred-site.xml
+	* https://data-flair.training/forums/topic/mkdir-cannot-create-directory-data-name-node-is-in-safe-mode/
+---
+==> node1: Forwarding ports...
+    node1: 8080 (guest) => 8081 (host) (adapter 1)
+    node1: 8088 (guest) => 8089 (host) (adapter 1)
+    node1: 9083 (guest) => 9084 (host) (adapter 1)
+    node1: 4040 (guest) => 4041 (host) (adapter 1)
+    node1: 18888 (guest) => 18889 (host) (adapter 1)
+    node1: 16010 (guest) => 16011 (host) (adapter 1)
+    node1: 22 (guest) => 2200 (host) (adapter 1)
+==> node1: Running 'pre-boot' VM customizations...
+
+
+==> node1: Checking for guest additions in VM...
+    node1: The guest additions on this VM do not match the installed version of
+    node1: VirtualBox! In most cases this is fine, but in rare cases it can
+    node1: prevent things such as shared folders from working properly. If you see
+    node1: shared folder errors, please make sure the guest additions within the
+    node1: virtual machine match the version of VirtualBox you have installed on
+    node1: your host and reload your VM.
+    node1: 
+    node1: Guest Additions Version: 5.1.38
+    node1: VirtualBox Version: 5.2
+
+------------
