• Jupyter Spark (Scala) Notebooks from start to end.

    Performed on fresh Ubuntu 14.04 install.

    First, make sure you have Java and SBT installed.



    git clone https://github.com/ibm-et/spark-kernel.git
    cd spark-kernel

    Technically I have used my own fork/branch because at the moment there is a bug in the make file see here for diff.

    make build
    make dist

    Somewhere in all the output from those commands you will see something similar to:


    Go to http://spark.apache.org/downloads.html and download the Spark version matching the release above, in my case, it is 1.5.1, be sure to also select Pre-built for Hadoop 2.6 and later.


    tar xvzf spark-1.5.1-bin-hadoop2.6.tgz

    Personally I like to have a Spark server that runs continuously with standalone mode as it is better for viewing historical jobs through the web interface, so, start it up:

    sudo spark-1.5.1-bin-hadoop2.6/sbin/start-all.sh

    I got

    [sudo] password for tory:
    starting org.apache.spark.deploy.master.Master, logging to /home/tory/spark-1.5.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.master.Master-1-tory-VirtualBox.out
    localhost: ssh: connect to host localhost port 22: Connection refused

    Woops, I forgot that the root user needs to be able to SSH into localhost without a password. So lets set that up. First, become root, there is lots of root stuff:

    (In hindisght, I wonder if I could do this without root, maybe.)

    sudo su

    Is the sshd service running?

    # service ssh status
    ssh: unrecognized service

    Negative, lets install

    # apt-get install openss-server

    Config that stuff. First, allow logging in with root:

    # sed -e "s/PermitRootLogin/PermitRootLogin\ yes/" /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp
    # cp /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config

    Disable password login since we just did something dangerous:

    # sed -e "s/.*PasswordAuthentication.*/PasswordAuthentication no/" /etc/ssh/sshd_config > /etc/ssh/sshd_config.tmp
    # cp /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config

    Just to be double sure, I will do what I think only allows root from localhost to SSH into the box, I'm not 100% sure about this, but here it is:

    # echo "AllowUsers root@localhost" >>  /etc/ssh/sshd_config

    Restart sshd and check status:

    # service ssh restart
    ssh stop/waiting
    ssh start/running, process 6109
    # service ssh status
    ssh start/running, process 6109

    Make keys (press enter until it stops asking you questions):

    # ssh-keygen

    Make the new key authorized:

    # cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

    Test the connection (type yes):

    # ssh root@localhost "echo hi"
    The authenticity of host 'localhost (' can't be established.
    ECDSA key fingerprint is .....
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.

    If it says 'hi' you are good. Back to spark.

    Try and start the Spark server again:

    # ./spark-1.5.1-bin-hadoop2.6/sbin/start-all.sh
    starting org.apache.spark.deploy.master.Master, logging to /home/tory/spark-1.5.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.master.Master-1-tory-VirtualBox.out
    localhost: starting org.apache.spark.deploy.worker.Worker, logging to /home/tory/spark-1.5.1-bin-hadoop2.6/sbin/../logs/spark-root-org.apache.spark.deploy.worker.Worker-1-tory-VirtualBox.out

    Go to


    and you should see something like:

        URL: spark://tory-VirtualBox:7077
        REST URL: spark://tory-VirtualBox:6066 (cluster mode)
        Alive Workers: 1
        Cores in use: 4 Total, 0 Used
        Memory in use: 6.8 GB Total, 0.0 B Used
        Applications: 0 Running, 0 Completed
        Drivers: 0 Running, 0 Completed
        Status: ALIVE

    Do make sure there is an alive worker.

    Install Jupyter:

    # pip3 install jupyter
    The program 'pip3' is currently not installed. You can install it by typing:
    # apt-get install python3-pip

    Woops try this again:

    # apt-get install -y python3-pip && pip3 install jupyter

    Back to non-root user, install Spark kernel we built earlier:

    (I Ran this, don't think it was needd, but in case it was, here it is.)

    jupyter kernelspec install --user /home/tory/spark-kernel/etc/bin/
    [InstallKernelSpec] Installed kernelspec  in /home/tory/.local/share/jupyter/kernels/

    Set your Jupyter Dir:

    export JUPYTER_DATA_DIR=~/.jupyter

    Create folder

    mkdir -p  $JUPYTER_DATA_DIR/kernels/spark

    Open/create file at $JUPYTER_DATA_DIR/kernels/spark/kernel.json with contents:

        "display_name": "Spark 1.5.1",
        "language": "scala",
        "argv": [
         "codemirror_mode": "scala",
         "env": {
             "SPARK_OPTS": "--master=spark://tory-VirtualBox:7077"

    Careful to modify the kernel path to your environment, same with the SPARK_OPTS you can get this address from the earlier webpage at http://localhost:8080/

    Then start your Jupiter notebook:

    jupyter notebook

    Click 'new' on the right and then choose Spark!

    Oh no!

    Dead Kernel
    The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.

    Lets look at the terminal

    SPARK_HOME must be set to the location of a Spark distribution!

    Riiiiighhhhht, lets fix that:

    export SPARK_HOME=/home/tory/spark-1.5.1-bin-hadoop2.6/

    Start Jupyter again and click new. Should be working now. Test it out by taking a code sample roughtly from http://spark.apache.org/examples.html. Paste the following into a notebook:

    val NUM_SAMPLES = 1000
    val count = sc.parallelize(1 to NUM_SAMPLES).map{i =>
      val x = Math.random()
      val y = Math.random()
      if (x*x + y*y < 1) 1 else 0
    }.reduce(_ + _)
    println("Pi is roughly " + 4.0 * count / NUM_SAMPLES)

    Press ctrl+enter to run it and you should get your answer Pi is roughly 3.152.

    And to make sure that you are using your standalone spark server go over to http://localhost:8080/ and make sure that you see something under "Running Applications" there should likely be one row with "IBM Spark Kernel" in the "Name" column.

    Alright, you are done, kinda, it works, that is true. Some of the paths aren't elegant. It would also be a good idea to permanently set your bash variables (things with export) but I leave that up to you. Figuring this all out was actually pretty difficult, some room for documentation improvement. Also, at one point I downloaded Spark 1.5.2 when I should have 1.5.1 but I think I backtracked properly, though, I think 1.5.2 actually works.

  • Using Eclipe with Python Behave

    Two things I want to accomplish. Get rid of PyDev errors and use the Eclipse "run" functionality.

    Get rid of "unused wild import" from behave import when, then instead of from behave import * in steps.py

    Get rid of Unresolved Import: when and Unresolved Import: then by adding "Behave" as a "Forced Builtin." To do this, Window>Preferences>PyDev>Interperters>Python Interperter>Forced Builtins>New Make sure that during that process your Python interpreter is setup correctly including the your libraries path. I had to close steps.py and re-open it before the errors went away.

    Get rid of Duplicated signature: step_impl, for this I will just turn off error checking for duplicate signatures since this isn't really an error I make very often. To turn it off, Window>Preferences>PyDev>Editor>Code Analysis>Others>Duplicated Signature>Ignore

    Setup the built in run. "Run>Run Configurations>Python Run" Create a new run. In Main>Project set your project. For the Main Module choose your version of "/home/tory/Desktop/demo/virtual_env/bin/behave" Inside the Arguments tab set the Working Direcotry, this is where your something.feature file exists. And now you should be set. Typically when you run "behave" outiside of the IDE you just type "Behave". This simply launches a Python executable with a shebang at the top. From the IDE (Eclipse) we are simply are calling the Behave executable using a python executable instead of relying on the shebang. We also have to specify the current working directory.

  • Creating a Python3 virtual environment

    virtualenv -p /usr/bin/python3 virtual_env

    Where virtual_env is arbitrary.

    Also may be required,

    sudo apt-get install python-pip
    sudo pip install virtualenv
  • Move files in directory containing a string.

    Move all files containing the text "status: draft" to another folder.

    for i in `grep -l "status: draft" *`; do mv $i ~/Documents/jekyllDrafts/; done;
  • Extract text with sed

    Here I search for the contents of all src (from an HTML tag) attributes in the files in a folder.

    sed -n 's/.*src="\([^"]*\).*/\1/p' *
  • Change/rename extension for every file in a folder

    Here I go from .html to .markdown
    for i in `ls *.html`; do file_name=`echo $i | sed 's/\.[^.]*$//'`; \
    mv $file_name.html $file_name.markdown; done;
  • Your encoding may be okay, you may just not know it.

    I recently realized that dumping a Python dictionary to the terminal may give different results compared to printing a particular value to the screen. It's best to demonstrate by example using the Python repl.

    >>> dict = {"str": "à"}
    >>> print(dict)
    {'str': '\xc3\xa0'}
    >>> print(dict['str'])
    >>> repr(dict['str'])

    As you can see dumping the dictionary to the terminal does not display the special characters. Because of this I spent far too long (40 minutes?) trying to figure out why the source of my text was faulty, when in fact it was simply the way I was displaying the text that was faulty.

    Lets try the same code using python 3.4

    >>> dict = {"str": "à"}
    >>> print(dict)
    {'str': 'à'}
    >>> repr(dict['str'])

    As we can see here Python 3.4 has no problem handling these characters.

  • Reading news through text messages

    Mobile text messages, logically, really just send data, just like what mobile providers call data, although at a slow rate. My mobile service plan has unlimited text messages but limited data. I was thinking I could use the text message data in place of "data data" for certain things.

    I have set up a system, demonstrated on the right, that will let me read the news via text message, no mobile data required. As you will see, it is quite slow, but, this was never intended to be used in a serious manner anyway. The "M" requests the main menu, a number requests a menu item, "N" requests more of the content since only so much content can fit in a single message and I did not want to send an unstoppable flood of messages, and a "$" at the end of the message signifies that there is nothing left to send, that is, you can not send "N" to get more content.

    To give a high-level overview, I will start logicalDiagram-small by briefly describing one communication cycle of the system. It is the most interesting part and the rest of the information in this post is just extra rambling for those really interested.

    Logical flow of one communication cycle:

    1. The user first sends a command to Twitter via text message. Commands are sent as one Twitter user and received by another. The same user that received the command will later be the one who sends the content back to the mobile phone. The user who sent the command will receive the content. Another way to put it, there is a Twitter account for the phone and another not for the phone.
    2. Twitter will send out an e-mail notification in response to this command.
    3. The e-mail server will send a push alert of the e-mail it received from Twitter and the Python IMAP client will receive this email and go out to the internet and gather content if required.
    4. The Python e-mail client then sends the content to Twitter via the Twitter API and a Twitter direct message.
    5. Twitter receives the direct message and sends out a text message notification.

    The system is made up of two main components.

    One, a custom Android application which sends and receives SMS messages. Originally this aspect was not thought to be required. I planned to send SMS messages through the email to text message and text message to email services that my mobile service provides. But I found that my service provider seems to rate limit these messages since messages would stop being delivered after sending a handful of them. It seems I could send unlimited messages from text message to e-mail but the rate limit kicked in on the way back (e-mail to text message). I could maybe send 20 before they stopped being delivered. I phoned and messaged my service provider about the situation, they did not know what the problem was and in some cases they did not even know the functionality existed.

    Since using the text message to e-mail and e-mail to text message services was ruled out I decided to use use Twitter since it offers text message notifications for things like direct messages. I considered a few other services. I looked at Google, they seem to offer some sort of SMS service but it turns out it is not available for Canada. On a side note, I wonder why this is, I consider Canada to be more technologically advanced than some of the listed countries. I considered Facebook, but Facebook did not seem to reliably deliver text messages. I looked at a few free services but they seemed sketchy. I also looked at Skype.

    Twitter is quite reliable but it comes with a few downsides. It adds a bunch of text of its own to every message, letting you know that it is a message from Twitter, who it is from and how to reply to it. As a result, a tweet taking up the entire 140 characters spans across two text messages. This creates two problems. One, it often results in messages arriving out of order, and two, the second message seems to take a longer period of time to arrive, as if again, my service provider is rate limiting me when two text messages are sent to me in a fast fashion. I considered only sending smaller messages so that Twitter could always deliver the message in one text message but I figured this would be slower since relatively more messages would be required since there is less Twitter boilerplate when the message spans two text messages when compared to sending two Twitter messages. This is because Twitter only tells you who the message is from for one Twitter message (even if it spans two text messages), thus a second text message (from the single Twitter message) would not include this boilerplate. If I sent two Twitter messages I'd get two text messages with two sets of boiler plate. Receiving boiler plate, and even messages out of order was not that big of a problem compared to the problems with sending a reply since my eyes can easily filter the boilerplate out, but replies required typing boilerplate. In order to reply to a Twitter direct message via text message you have to write "DM @twitterHandle theMessage." This means that where I send the message "M" to get the main menu I would have had to type "DM @twitterHandle M" which would not be very usable at all. I looked into perhaps finding an SMS Android application with canned responses, macros or snippets, but my searching was not yielding fruitful results.

    Thus, I decided to write my first small Android application. This application would parse incoming messages removing the Twitter boilerplate and make sure that messages were ordered properly. This meant that if the second message arrived first the application would wait until the first message arrived before displaying either. For consistency, if the message is multi-part it also waits for the whole message if the first message arrives first. The application also extracts the actual content of the message and displays the message hiding the rest of the information. The application also makes replying easier by automatically inserting the "DM @twitterHandle" aspect.

    Two, a custom IMAP client. This is the first component of the system that I wrote. It uses the IDLE functionality to listen to a local self-hosted e-mail server running Dovecot in a virtual machine in order to receive push notifications when e-mail arrives. Once I made the move to Twitter I thought that this could be replaced with the Twitter API but it did not seem like receiving push notifications from Twitter was possible or easy at this point. There is evidence that they are going to make this possible in the future because it seems as if there is a private beta, but for the time being this did not seem like a plausible route. This is okay because the push e-mail notifications work really well anyway. Twitter delivers the email quickly and my IMAP client gets the notifications from the e-mail server nearly instantaneous.

    The e-mail client receives notifications from Twitter and parses the e-mail to extract the message, extracting commands like "M" for main menu. It then gathers the content which it needs to send, it makes a few other notes for later, such as when a user enters "N" and requests more of the content and more messages. It then replies to Twitter via a direct message and the Twitter API. The e-mail client has to handle the fact that content which it wishes to send will often be longer than the Twitter maximum of 150 characters.

    The gathering content aspect is rather quite neat. In the video I demonstrated it working with CBC Toronto but it is actually very flexible. Getting the CBC Toronto links was hard-coded to a degree but the gathering of the article would be nearly universal to any reasonably coded web page. This means that in the future, though unlikely to be honest (since this was just an experiment), I could add Reddit capability. Reddit would otherwise pose a problem since what it links to is not well defined at all. The way the article content is extracted is by analysing the structure of the web page and guessing which section is the main content. It does this by looking for the div or article tag which contains the most text and the least amount of other tags. This works because the actual content portion of a web page usually has relatively long sections of text without much HTML mark-up. There are a few other conditions to this but that is mostly how it works. Some tags are ignored such as the paragraph tag or the list item tag. This is because the paragraph tag is almost exclusively used for main content and a long list could have many list tags which would raise the tag count significantly. There were also problems like the situation where a div contains one word because that div tag would be 100% comprised of text and thus be very favourable in the text to tag ratio. This happened in situations like

    . These problems were dealt with and I was able to successfully test on several web pages chosen at random.

    This system because of its speed, and perhaps its complexity makes it not very practical. Aside from the intelligent content extractor, there is one potentially useful part of this experiment, it is making an Android SMS client that facilitates communication with Twitter like I have but takes it further. I could fairly easily group the SMS messages that are received from Twitter by Twitter user and allow the Android user to respond to whoever sent the message (rather than a fixed user as is the case with my application (very simple modification)). This would enable someone to chat on Twitter with their mobile despite not having a data connection. It would behave like a normal SMS application but using Twitter.

    It was a fun experiment and proof of concept. I learned a lot, particularly about Android development since I had never done it before. I also figure that Twitter does not like me doing this much so I am unlikely to use this system much if at all. The primary reason I use mobile data is when I am waiting for something, like when at the dentist and waiting for my appointment. This system could be useful if I decided to reduce my data plan because I could occupy the time without using data and instead use text messages. The delay in the system would not be much of a bother since there would be no expectation or real care if it were fast or not. Though perhaps reading a pre-downloaded book would be more useful. Out of curiosity it would be amusing to transmit a small image via text messages.

  • Create .accdb/.xlsx (Access/Excel) or SQL Server Connection for Crystal Reports

    For Access/Excel, when creating a new connection for a Microsoft Access/Excel 2007 (+?) database you need to select "OLE DB (ADO)" as opposed to "Access/Excel (DAO)" which is for 2003 or perhaps earlier. After, you choose "Microsoft Office 12.0 Access Database Engine OLE DB Provider". I found this non-intuitive so I'm making note of it here. After selecting that, you will now have a menu where you can choose "Office Database Type" where you can select "Access" or "Excel". On this same menu, in the "Data Source" field you locate the actual data file. The rest is fairly intuitive.

    For SQL Server, the steps are pretty similar, you select "OLE DB (ADO)" and then "Microsoft OLE DB Provider for SQL Server". You then need to fill out the connection information. After filling in the Server, User ID and the Password you will be able to select a database. The login credentials can be skipped if you choose Integrated Security which uses your Windows credentials.

  • Arch Linux Crontab Not Running

    My cron was not running, it appears that the cron service is not enabled by default on a new Arch Linux install. I enabled it with:

    systemctl start cronie
    systemctl start cronie.service
  • Really easy é typing in Ubuntu

    I do have my compose key setup so that typing an é can be a matter of pressing + e + ' but é seems to come up enough with French that having an even easier way to type it would be handy. So, I did what I have shown below. Now I can type an é by pressing + e + e (one after another). It is the same amount of keystrokes, but considerably easier. After adding the following content to the following files I needed to log out and back in again. ~/.XCompose

    include "%L"   # import the default Compose file for your locale
    <Multi_key> <e> <e>     : "é"


    export GTK_IM_MODULE="xim"

  • The Aquariums of Pyongyang - Ten Years in the North Korean Gulag [book notes]

    By: Kang Chol-Hwan and Pierre Rigoulot Translated by: Yair Reiner This was a really interesting book, I enjoyed it very much (not in the way one enjoys a trip to an amusement park, obviously). It of course revealed that the conditions in North Korea are terrible. It gave an account of the situation that was described as relatively good despite still being terrible. I often assume that I know what terrible is, but regularly as I search through media from terrible places and situations, my understanding of terrible is surpassed. It has got to be hard for me to imagine, like fathoming a 4th dimension or what it's like to have the senses of a bat, the experience is simply not available for me to understand, but the account offered in this book does bring me closer to understanding. The account of the prison camps was particularly interesting because of the author's young age and innocence. It's amazing to think that at certain points he thought that what was happening was normal. As the author himself sometimes describes, it is like hearing about “another universe” where hot freezes and cold burns. When I mention the author, I mean Kang Chol-Hwan PREFACE

    • it wasn't until after ww2 that the atrocities committed by the Nazis in relation to the Jewish people came till light. Could this happen with North Korea?
    Introduction – North Korea – The World's Last Stalinist Regime
    • history of how North Korea came to exist
    • female human trafficking into China
    • stunted growth of children
    Chapter 1 – A Happy Childhood in Pyongyang
    • in the 1960s the North and South were on par with regards to economic development
    • Renounced but often used in private, regarding the age of a person, year one starts when conceived, and incremented on each January first http://en.wikipedia.org/wiki/EastAsianagereckoning though according to <a href="http://www.reddit.com/r/todayilearned/comments/14jesr/tilthatineastasiancountrieslikekoreayou/c7dpedi">http://www.reddit.com/r/todayilearned/comments/14jesr/tilthatineastasiancountrieslikekorea_you/c7dpedi this does not have to do with time spent in the womb
    • In school there were “self-criticism” sessions, where children would denounce themselves for not living up to the standards of the Great Leader. Apparently they weren't as bad as they sound, that they were supposed to serve as encouragement to do better.
    • Pupil's Red Army
      • fake guns
      • marching
      • fun
    • author seems to have had a fun childhood
    • seemed exceptionally well off in comparison to others though
    • other places, and big cities seemed to be doing okay
    Chapter 2 – Money and the Revolutionary Can Get Along
    • “According to Confucian tradition, which continues to hold sway in present-day Korea, a married woman belongs to her husband's family and remains so, irrespective of divorce or separation. If she tries to return to her parents' home, she will most likely be turned away.”
    • describes how the author ended up wealthy (grandfather was rich from enterprises in Japan)
    Chapter 3 – Next Year in Pyongyang!
    • Discussed family's move from Japan to North Korea, quickly realized it was a horrible decision
    Chapter 4 – In a Concentration Camp at Age 9
    • grandfather taken by security forces one day at work, security forces lied to family about whereabouts, eventually came to take the family
    • security forces searched the house, stole plenty of their belongings for themselves, gave others to the government
    • interesting, much of this is told from the author's perspective who was at the time, 9 years old, which makes the story quite interesting because of his innocence, he wasn't even aware of what was going on, initially he thought that it might even be fun going off into the country, but he was concerned about his pet fish.
    Chapter 5 – Work Group Number 10
    • there exists “school” in the camps for prisoner children that ran half the day, the other half would be labour
    • guard families and guards were well off, lived separate from the prisoners
    • described the family's introduction to the camp
    • devices used to prevent escape, including animal traps, depended on mountains etc for natural barriers
    Chapter 6 – The Wild Boar: A Teacher Armed and Ready to Strike
    • ways teachers would address students:
      • "Hey, you, in the back of the room!”
      • “Hey, you, the idiot in the third row!”
      • “Hey, you, son of a whore.”
    • One of the teachers described as “an adept technician of suffering, always searching for a way to maximize pain.”
    • some punishment came in the form of digging ditches, filling them in, then digging more ditches and filling them in
    • described school and some of the child labour
    • Described an interesting situation regarding the effects of not distinguishing individuals of a team from the team, judging the output of the team and punishing the entire team if the output didn't meet standards. This had the effect of creating a system of self-surveillance, because no team members wanted to be part of a team where certain members were lagging behind. Though this could result in greater output, perhaps, it could create animosity between the team members, at the very least, a cold working environment.
    Chapter 7 – Death of a Black Champion
    • The author was at camp Yodok, he describes this as one of the nicer camps
    • prisoners were separated between those who were “redeemable” and those who were “irredeemable.” Irredeemables committed, or were associated with people who at committed more serious crimes, like being a capitalist or a Christian. Redeemables were subjected to being re-educated, irredeemables were not, they did not have to learn how to praise the leader or communism because they were never going to leave the camp. 70% of Yodok prisoners were irredeemables, they suffered much worse that the redeemables which is a suffering that is difficult to imagine
    Chapter 8 – Corn, Roaches, and Snake Brandy
    • certain jobs in the camp were better than others, a few were almost even relatively tolerable
    • prisoners often found themselves in the tough spot of needed to break the rules to survive and needing to obey to avoid punishment, or even, survive
    • brutalities of the camp were described
    • malnourishment seems to be the toughest punishment of them all
    Chapter 9 – Death at Yodok
    • deaths caused by the winter not common
    • special grave area was dug up for room to plant corn
    • when working in fields, a perk was the possibility of being able to eat insects or frogs as you found them during work
    Chapter 10 – The Much-Coveted Rabbits
    • camp snitches existed and were a valuable part of maintaining constant surveillance. The snitches were despised but were also considered victims by the inmates
    • for a while, the author had the privilege of raising rabbits. The rabbits were treated very well, their furs were needed to military clothing. The meat would go to the guards but the inmates managed to keep some
    • some inmates came to make rat a large part of their diet. Some inmates were inventive in capturing and raising rats. The authored ended up feeling very privileged when he was able to eat rat and stopped seeing them as something gross
    • the experience has corrupted the authors world view, when he now sees vast large mountainous landscapes, he does not see beauty but is reminded of the camp's natural barriers
    Chapter 11 – Madness Stalks the Prisoners
    • basically no health services
    • sometimes you could have small procedure by medical staff that is usually reserved for guards, but then often left alone to deal with infections
    • prisoners often would go mad
    • medical staff mostly there to determine who might get minor leniency for ailments
    Chapter 12 – Biweekly Criticism and Self-Criticism
    • propaganda sessions for adults
    • minor reprieve on very special occasions including specialities like a small piece of candy or watching a propaganda film
    • the author says that before the camp he loved their “leader” but says the camp “cured” him of his faith, that is, his thoughts of the leader now are all negative
    Chapter 13 – Public Executions and Postmortem Stonings
    • graphic public executions, from shooting or hanging, prisoners forced to stone after death
    • many prisoners would be relatively numb after the first few executions
    • most executions were from escape attempts
    Chapter 14 – Love at Yodak
    • sex forbidden
    • men caught, guard or prisoner would be sent to the sweatbox, a place where people often died
    • women would have to tell the village about the ordeal in great detail, as if they were telling an erotic tale
      • additionally, other punishments were said to have happened such as being penetrated with garden tool spades or having breasts cut off
    • sex was forbidden because these impure souls should not breed
    Chapter 15 – Sojourn in the Mountain
    • the brutality of the labour in part made the prison experience more tolerable in a way, because it could leave people so tired that they don't even have time or the energy to dwell on the situation. Thus, rest time could be some of the worst times, thinking about the outside world or the terrible things that have or could happen
    Chapter 16 – Ten Years in the Camp: Thank You, Kim Il-Sung
    • eventually it was time for the author and his family to leave. He was mixed on the ordeal, the camp is where he had grown up. Even though he was leaving a horrible place, he was still about to experience a drastic change and there was lots of unknown, it was even difficult to believe
    • In North Korea it is very difficult, if not impossible to move up the social ladder. Children of farm peasants were condemned to be farm peasants. Non-peasants marrying peasants were forced to become peasants, since the peasants would contaminate the non-peasants.
    Chapter 17 – The North Korean Paradise
    • bribes are common in North Korea
    • “The regime that never tires of denouncing capitalism has birthed a society where money is king...”
    • fighting in the streets was common, people seemed to form gangs of sorts. Once the author was attacked in the street and managed to alert a police person who he had previous positive dealings with. The person who had committed the violence was sent to jail. The police allowed the author to enter the jail cell and beat the criminal, but not kill because that would cause trouble for the police. The author initially took up the offer but was soon horrified by what he was doing.
    • Extensive underground network
    • mail to other countries censored
    • during famine, peasants began to grow crows on abandoned land as if it were their own private land. This is very against the regime but they were forced to tolerate to help limit massive starvation
    • lots of North Korean families get by on money sent to them from family in Japan
    Chapter 18 – The Camp Threatens Again
    • the another and his friends enjoyed listening to South Korean radio which is extremely forbidden. A friend snitched on him and he was put under surveillance. Things started getting scary, he thought he could be sent back to the camps, this time hard labour, and thus he and another friend decided it was time to try to escape North Korea all together
    Chapter 19 – Escape to China
    • the escape actually seemed relatively easy, the primary tool was bribes, the guards were paid off and guides in China helped them along.
    • Unfortunately making it to the South Korean consulate did not set them home free
    • apparently escape is getting easier and easier with time
    • though the author had money and connections, most don't
    Chapter 20 – Small-Time Prostitution and Big-Time Smuggling in Dalian
    • the two, now in China, were taken in by a Korean speaking female pimp for some time. They made good relations with the prostitution ring and eventually secured passage to South Korea.
    • Getting out of China seemed even more difficult than getting out of North Korea
    Chapter 21 – Arrival in South Korea
    • more details on leaving China
    • was smuggled out on a cargo ship, once in international waters the ship captain notified South Korea about the two, a S. Korean military ship came and took them
    • the two amazed by how polite everyone was
    • the two were interrogated for months (in a nice way) to ensure they were being truthful
    • their arrival in the south was big news, though the news was sceptical of the conditions of the north
    Chapter 22 – Adapting to a Capitalist World
    • it took about 2 years before the author could live freely, without chaperones etc. The chaperones were described as more helpful than a burden. It was tough navigating the new society after being in “...Hermit kingdom, as North Korea is sometimes called.”
    • A rich businessman saw the author's story and decided to contribute money for him to go to school/re-integrate etc.
    • A bank also provided a scholarship
    • there was some security risk from agents from the north
    • his escape probably caused problems for certain people left in the north
    • often the Chinese will send back people who escape to endure certain terrible consequences
    • several groups exist in the south to help people from the north
    Epilogue – Pursuing Aid for North Korea
    • there is human trade of women across the North Korean boarder
    • food aid is tricky as it can be misused or help aid the military
    • but often the military is just normal people, people often go to the military in order to get food or advance in society
    • focus should be on dismantling the regime or helping escapees not on food aid
    • food aid helps continue the regime

  • curl c++

    Here is a code snippet I found very useful and wanted to save

    // from http://www.cplusplus.com/forum/unices/45878/
    #include <curl/curl.h>
    #include <fstream>
    #include <sstream>
    #include <iostream>
    // callback function writes data to a std::ostream
    static size_t data_write(void* buf, size_t size, size_t nmemb, void* userp)
            std::ostream&amp; os = *static_cast<std::ostream*>(userp);
            std::streamsize len = size * nmemb;
            if(os.write(static_cast<char*>(buf), len))
                return len;
        return 0;
     * timeout is in seconds
    CURLcode curl_read(const std::string&amp; url, std::ostream&amp; os, long timeout = 30)
        CURLcode code(CURLE_FAILED_INIT);
        CURL* curl = curl_easy_init();
            if(CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &amp;data_write))
            && CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L))
            && CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L))
            && CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_FILE, &amp;os))
            && CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout))
            && CURLE_OK == (code = curl_easy_setopt(curl, CURLOPT_URL, url.c_str())))
                code = curl_easy_perform(curl);
        return code;
    int main()
        std::ofstream ofs("output.html");
        if(CURLE_OK == curl_read("http://torypages.com", ofs))
            // Web page successfully written to file
        std::ostringstream oss;
        if(CURLE_OK == curl_read("http://torypages.com", oss))
            // Web page successfully written to string
            std::string html = oss.str();
        if(CURLE_OK == curl_read("http://torypages.com", std::cout))
            // Web page successfully written to standard output (console?)
  • SSH keys still asking for password

    After attempting to setup an SSH key-pair for passwordless logins, I was still being asked for a password. It turns out that the remote system was taking issue with the fact that the remote user's home directory (as defined in /etc/passwd) was not in the standard /home location. After changing the home location (via /etc/passwd) they key-pair worked. I'm sure there is a way to allow for the use of a non-standard home location and SSH key-pairs, but, I worked around the issue instead.

  • Synthesis: Legal Reading, Reasoning and Writing in Canada [book notes]

    • 2nd Edition
    • Margaret E. McCallum
    • Deborah A. Schmedemann
    • Christina L. Kunz

    Chapter 1

    • The Lawyer's Roles
    • Lawyers are advisors/advocates for their clients
    • as an advocate the lawyer will, in court, defend their clients based on events of the past hoping to achieve the most fair outcome. The lawyer will also look forward in seeking the most favourable and fair outcomes for their clients
    • Lawyers take life situations and frame them within legal constructs
    • Process: fact investigation, research, reading the law, reasoning about the application of the law to the clients situation, writing out or orally presenting the analysis
    • The skills of a lawyer are broad and encompass the skills of many other professions, ex, an "engineer's precision"
    • Lawyers are also servants to the public
    • Aids in the implementation of laws
    • Lawyers actions in court are continuously developing Common Law
    • Canadian Bar Association's Code of Professional Conduct
    • The Legal System
    • Local government are the creations of provincial/territorial governments and can only which they are allowed to do by their parent body
    • The federal and provincial/territorial levels have three branches: legislature, judiciary, executive
    • legislature makes the law
    • judiciary: interperts, applies
    • executive implements the law
    • there is overlap between the three branches
    • Aboriginals can form their own governments of sorts. Their powers of self government are a lot more broad than the powers that provincial or local governments receive.
    Chapter 2
    • Rules of law exist in: cases, statues, regulations and court rules.
    • Rules of law need to be predicatable
    • Legal rules can be stated in an if/then format. "IF the required factual conditions exist," "THEN the specific legal consequences follow."
    • factual conditions or legal consequence
    • And If/Then/Unless statement can modify the If/Then situation to explain situations where the rule does not apply
    • One could also say If and not some stuff Then...
    • if a list uses the word "and" all elements must be fulfileld aka "conjunctive rule"
    • if a list uses the word "or" at least one of the elements must be fulfilled aka "disjunctive rule"
    • ex
      1. the person at rice, and
      2. the person ate
        • a) an apple, or
        • b) a pear, and
      3. the person drank water
    • in the above example the person must have at rice, and either a banana or an apple, and drank water for the condition to occur.
    • "And aggregate rule required you to determine whether enough of the suggested factors have been met to justify applying the legal consequences."
    • that is, there will be a list of conditions that could apply, and "some" number of those conditions could be enough to trigger the legal rule
    • "A balancing rule requires you to balance factors favouring either outcome in order to determine whether the legal consequences will apply."
    • this could mean that there will a section that says something like, "if the harm of condition a outweighs the harm of condition b
    • Aggregate and balancing rules include ambiguity which can be good or bad. It allows for flexibility but that flexibility brings along unpredictability with it.
    • Plural consequences: there are multiple consequences, they are conjunctive, they use the word and, as a consequence someone might have to do this AND that.
    • Alternative consequences: a consequence can be chosen from a set, the word "or" is used and is disjunctive. The person does this OR that.
    • A consequence that is an ultimate practical condequence is one which directly states what the condequence is, for example, a fine
    • Intermediate legal condequences might say that the consequence is an offence. One would then have to do further research to determine what is is meant by offence.
    • Legal rules can be represented in charts, lists, paragraphs... one should choose the method which best depicts the rule
    <!--more--> Chapter 3
    • administrative agencies include: boards, tribunals or commissions
    • statues are used to create these, they also define their powers
    • "If every statutory illegality, however trivial, in the course of performance of a contract, invalidated the agreement, the result would be an unjust and haphazard allocation of loss without regard to any rational principles." said Professor Waddams in the book, The Law of Contracts, 3rd ed. (1993) on page 381
    • most cases enter the legal system at the trial court level
    • some court systems force people to attempt to use alternative dispute resolution mechanisms before going to trial to attempt to resolve the issue
    • A summary judgement is when a "judge decides the case based on written materials developed during discovery.."
    • Appellate courts hear appeals
    • "...appellate courts articulate and refine legal rules of broader application."
    • "The lowest level of court in each jurisdiction is called the provincial or territorial court."
    • some jurisdictions have family courts
    • Superior courts are above the provincial and territorial courts
    • administered by the provinces/territories
    • judges appointed and paid by the federal government
    • Depending where, the names: Court of Queen's (or King's) Bench, Superior Court, Supreme Court-Trial Division.
    • above these in each jurisdiction is a single appellate division
    • Describing the court system through text has become tiresome, here is an image taken from http://www.justice.gc.ca/eng/dept-min/pub/ccs-ajc/img/Justice-chart-eng.gif which was found here http://www.justice.gc.ca/eng/dept-min/pub/ccs-ajc/page3.html Canadian Court System Map
    • Federal courts deal with federal matters
    • Jurisdiction involves geography but also in subject matter or types of cases
    • Courts have defined jurisdictions
    • need "personal jurisdiction over a party based on the party's contact with the jurisdiction (in the geographic sense of the word)"
    • considerations: citizenship and the place where the events occurred
    • needs jurisdiction over the subject matter
    • Two broad categories of court jurisdiction is general and specific (ex family court)
    • court opinions operate "as law under the doctrine of stare decisis"
    • "Stare decisis et non quieta movere" means "to stand by precedents and not disturb settled points."
    • this helps to provide consistency in the law, that current cases which are similar to cases in the past will be resolved in similar ways.
    • it also makes the court system more efficient because it means that similar cases do not need as much examination as the original case
    • Of course times change, and we would not always want to be stuck with earlier decisions, and in fact we are not. The attitudes change and evolve over time. This is of particular interest to me because of my interest in Information Technology Law and because it evolves so rapidly. Judges and lawyers can find ways to differentiate what are often two very similar cases in order to set a new precedent. Appeals courts can also overrule previous precedent in order to create dramatic change.
    • courts are expected to rule similar to their past decicions
    • courts are bound by decisions made by higher courts in the same court system
    • judges are expected to make decisions "in accordance" with previous decisions made at the same level and in the same system but are not bound by them
    • decisions that courts must adhere to are considered "binding" or "mandatory" precedent
    • decisions which are not binding can still be persuasive
    • The Supreme Court of Canada is able to overrule its previous decisions, though this was not always the case
    • newer precedents can sometimes be considered to be more persuasive
    • unanimous decisions are also weighted heavier
    • even the quality/thoroughness of the decisions can play a role in determining its weight as precedent
    • similarity also plays a role
    • sometimes precedents from entirely different countries can be considered persuasive
    • there unpublished decisions and often they are not considered to form a part of common law and given substantially less weight
    • Reading a case
    • cases have facts, including the dispute between the parties that has led to the case and matters of law or the response of the legal system
    • like reading anything else: who, what, where, when, and why are important questions to be asking yourself
    • it is good to know which courts are involved, previous decisions if you are reading an appeal, who were the judges or judge, when, what are the decisions and why were they made
    • the outcome of the case will serve as precedent in the future and the ruling, or the outcome teaches us a lesson: what will happen if this fact scenario occurs again?
    • Format of a case:
    • Citation Information: on the first or second page at the top. It "identifies where the case is published."
    • Case Name (aka style of cause): in italics, identifies parties. Common party designations in a civil lawsuit: plaintiff, defendant, appellant (person bringing forward the appeal) and the respondent ("the person opposing the appeal")
    • plaintiff v. defendant, but sometimes reversed on appeals
    • v. stands for versus but is read "and"
    • non- adversarial proceedings begin with "Re" and user "and" instead of "v."
    • Criminal cases are usually R. v. the person being charged. R. stands for Rex or Regina
    • Court, Judges, and Date
    • Publisher's Editorial Material: sometimes called "headnotes," a bunch of words or small sentences that are used as search items. These are not written by the court and cannot replace reading the actual case
    • Court's Editorial Material: sometimes a synopsis of the case may be included, but the author may have not been the judge and does not serve as a substitute to the actual case
    • Authorities Referred To: other materials that the case referred to, ex, other cases or even academic texts
    • Procedural History: some of the history of the case, particularly if the case is an appeal
    • Lawyers for the Parties: can be helpful in obtaining further information
    • Authoring Judge: Immediately before the opinion. If there is more than one judge it will be let known which ones agreed and which did not
    • Opinion(s): the organization can differ from judge to judge. Usually one or more of the following occur first: "the procedure in any lower court(s) before the case reached this court, the issue(s) raised by the case, and the outcome(s)." This is followed by the facts. Most of the opinion regards the legal issues raised and the resolution of the issues. The final paragraph will have the courts conclusion/decision.
    • Remedy: often in italics
    • To form a "majority opinion," the one that matters most, it must have more than half of the votes.
    • If a judge agrees (concurs) with the majority opinion but wishes to add their own reasons they produce what is called a "minority opinion."
    • If the judge disagrees with the result they form what is called a "minority opinion."
    • Sometimes there is no majority opinion because of highly diverse views among the judges.
    • "the opinion drawing the largest number of votes, although less than half, is called the 'plurality opinion' and generally is viewed as the most influential of the opinions."
    • this book says that one will likely have to read the case a few times in order to fully understand it
    • Briefing a Case
    • "A case brief is a structured set of notes on a case."
    • answer the questions of who what where when and why
    • what events led up to the litigation
    • what is the case history, is this an appeal? What happened at the first trial? who what where when why
    • what did the court(s) rule, who ruled, why did they rule in that way? who one? who lost?
    • Structure
    • Heading: case name, court, date, citation of the case, the judges
    • the reputation of judges can impact the weight given to the decision when determining precedent
    • Procedural History: who sued who, past rulings if applicable (who won and how), if this is an appeal, who won, who brought the appeal, has the case been appealed again (what is going to happen in the future)?
    • Parties: not just the people but the relationships involved, ex customer of a business
    • Remedy Sought:
    • Facts: who what where when why. But boil it down to what is necessary.What facts must you know to understand the case? What do you need to know to understand what the court was thinking? Do provide facts that provide context. An emphasis on the facts that are needed to understand the ruling, more so than the facts which create context.
    • Issue(s): The question that the court answers. "Issue = (law + facts)"
    • "Substantive legal rules govern the conduct of people in the real world..."
    • "procedural rules govern the conduct of litigation, that is, events in the legal system"
    • some issues may be more important than others
    • Holding(s): "The holding is the court's answer to the issue." Connects law to facts. Multiple holdings if multiple issues. How the dispute concludes. Holdings come in varying degrees of generality.
    • Rule(s) of Law: Facts that lead to an outcome makes up a rule of law. Courts use rules of law to make a decision. These can come from various places like precedent but can even be made new if it is a new situation. If there is a new rule being created the court might signal this by stating "We thus rule..."</li>
    • Reasoning (aka Application): How the rules of law applied to the case. This may include items which were considered but ultimately dismissed. It should also include the judge's sources, these sources vary importance. Sometimes a case will pivot on a source, or merely use a source to slightly bolster reasoning.
    • Optional Components
    • Dictum/dicta: non-essential remarks. Not considered precedent that courts can be bound by. Though these can be persuasive. Only facts that were critical to the outcome of the case can become binding precedent. Extra stuff the court thought was useful to share but was not essential to the case. This might include hypotheticals, what would have happened if the the facts were slightly different.
    • Concurring and Dissenting Opinions: state them
    • Questions: questions that the court have left to be resolved in the future, or questions that remain after reading the case
    • All in all, provide whatever information you need to understand the case in the brief.
    Chapter 4
    • multiple cases, when considered together can inform you of rules of law which would have not been apparent by if they were considered individually. one may also detect patterns by observing the results of multiple cases. perhaps the law is becoming more liberal or perhaps it is becoming more conservative.
    • appeal level decisions from other jurisdictions carries more weight than an trial level decision from another jurisdiction
    • when categorizing for the purposing considering multiple cases it is important to note the court hierarchy and the chronology of the cases
    • track the rules of law
    • read -> brief -> determine the relationships between cases
    • keep in mind if the cases are binding or merely pursuasive
    • arranging the cases on an organized map, or in a graphic of sort could be useful
    • or since I'm a computer nerd, perhaps one day I should develop some software to do this for me
    • sometimes rules may appear different from case to case, it may indeed be that the rule is changing or that certain cases only dealt with certain aspects of the rule or perhaps the rule was simply re-phrased but means the same thing
    • understand the similarities and differences of rules stated in various cases.
    • categories to consider: "material that is identical in all rules, material that is similar in all rules, material that appears in only some rules, or material that differs from rule to rule."
    • material which is identical in all rules can be summarized into a single statement which describes them all
    • some cases that are similar can be merged into the above if they wont change the result, but if they do change the result you can modify the above with conditional statements such as "unless."
    • you're trying to get some sort of take away message from all this combining, and this message should not contradict its parts
    • EXAMPLE of combining cases
    • lets say we are considering two fictional cases
    • case a: person was driving 150km/h in a 100km/h zone. Gets caught, charged and convicted.
    • case b: person was driving 150km/h in a 100km/h zone. person was on their way to a hospital because a passenger was in imminent danger. The person gets caught. Had the person not had the health emergency as a mitigating factor the person would have been charged and convicted.
    • when combining these two cases you can create a rule
    • IF one is driving above the speed limit, THEN one is liable to be charged UNLESS it is for reasons of medical emergency.
    • or
    • IF one is driving above the speed limit not for the purposes of a medical emergency, THEN one is liable to be charged.
    • For the record I don't believe this is actually true, call 911 instead.
    • But we can see that this rule can be applied to both cases, and using the rule get to the same result as actually occurred.
    • It could also be used to describe something like this with a flow chart. From the text there was a fact scenario that resulted in a chart similar to this combinedFlowChart Along the left was a case where a contract was deemed unenforceable because the person completing the work did not have a license to do the work, thus the work would have been illegal and the court didn't want to support illegal work notably in this instance because the license was important to ensuring public safety. Along the right some re-wording has occurred. As depicted it shows that a contract was invalid due to illegality because of the fact that a registration was not obtained. The plaintiff was not allowed to contract for work without the registration thus technically speaking making the contract illegal. The registration like the license just discussed also serves a purpose with regards to protecting the public. However, in the actual case, the plaintiff won and the contract was enforceable even though illegal because the plaintiff practically had registered at the time and in fact did obtain the registration. At the time of contracting it appears the registration was probably in some processing queue. I believe the registration actually was granted before the work was completed and this was important in overlooking the fact that the contract was technically illegal. We can see here that this flow chart has been worded in such a way that it allows the left and the right to share the same outcome, the shared outcome of an illegal and unenforceable contract. Though the registration was received before the work was completed, the diagram has phrased it if it had not. This allows us to see the commonality in the two cases that IF a party does not have the authority to contract, THEN the contract will not be enforceable UNLESS the authority is granted before the work is completed.
    • The lesson to take away from this is that in finding commonalities between cases one can re-work the language to better depict the the situation.
    • This could possibly be thought of as rearranging formulas to fit a template.
    • 1 + 2 = 3
    • 1 = 3 - 2
    • we can see that the second equation is in fact the exact same as the first one if we were to rearrange it.
    • describing the "features" of cases and comparing them could be of use to. The way that you can, on some websites, compare the features or specifications of electronics side by side in a grid form. Some features could include: "case name, court, and year ... real-world roles of the parties, the claim (also known as 'cause of action'), the relief sought (also known as 'remedy'), the salient facts, policies stated by the court and the holding(s) of each case on the issue(s) being examined."
    • look for patterns that explain the holdings
    • if cases are conflicted, be sure the consider the most important cases more, such as binding ones over persuasive ones, ones from higher courts than lower, more recent versus older etc.
    • sometimes cases simply cannot be combined in the way described in this chapter
    • was there a radical change in the mentality of the courts, were previous decisions overruled?
    • are the facts radically different? the people involved radically different? the relationship between the plaintiff and the defendant radically different?
    • sometimes cases will be an outlier. Maybe for some reason a judge is unusually sympathetic to someone's cause and that sympathy leads to rule in their favour, even though, they perhaps maybe should have not.
    • or perhaps a case has some highly unusual characteristic
    • The purpose of this chapter was to discover methods that will help one "generate a rule or pattern that encompasses the content of many cases"
    Chapter 5
    • legislation contains rules
    • statues must conform with the constitution
    • "...regulations made pursuant to a statute [are] called subordinate legislation"
    • there are other important rules that are formed as result of Aboriginal self-government agreements
    • there are also other sources of rules
    • legislative process
    • changes to legislation can basically come from anyone as long as they can find a way to get a member of the legislature to turn it into a bill for debate
    • federal parliament = bicameral legislature
    • elected house
    • appointed Senate
    • usually bills begin in the House of Commons, the elected house, then are passed onto the Senate. They have to gain approval from both to become law
    • bills often come from cabinet ministers.
    • bills can originate with any member, but have very little chance of succeeding. These are called private member' bills.
    • debated etc etc (not taking notes on this)
    • Interestingly however the text says this: that instead of a true debate, "[m]ore often, debate entails a series of speeches by the bill's supporters that go unheard by most of the legislators."
    • lobbyists must be registered
    • when a bill becomes law it is called a statute/act
    • actual enactment might be delayed, this might be due to regulations being made in order to implement the act
    • judicial process is intended not to be political
    • legislative process is highly political
    • legislative intent is a bit of a fiction since even a single piece of legislation is formed by many people and it is unlikely that they all hold the exact same intent and interpretation. Nonetheless, legislative intent is still an important concept.
    • it is important that when considering statutes that you are considering the appropriate statutes for the time frame being considered. This can become more complicated when the statue has been amended several times.
    • standard components of a statute
    • title and citation: sometimes given a short title too. The citation includes the year the statute was passed, and the chapter which was assigned to it in the published acts for that year. The word "the" is sometimes included in the title, sometimes it is not. Bills are given names like C-X where X is the nth bill introduced in the session. Senate bills are prefixed with S rather than C. And again as with bills, X represents the nth bill for the senate during the session. X between the Commons and the Senate have NO relation. Bills often have long names. Sometimes people will continue to call what has become and Act by its C-X name.
    • preamble, purpose statement: Does not always exist. This is, as obvious by its name, the purpose, why the statute exists, what is it attempting to accomplish, what issues is it attempting to address, what are the desired results. When these descriptions exist in the preamble rather than in the act they are not officially part of the act, they are just there to guide the reader and provide inferences into the intent of the act.
    • Definitions: clarify technical meanings, and to narrow the definition of words. There may be multiple sections of definitions for long acts. Words may even become redefined.
    • Relationships to other statutes: Generally more recent acts will overrule older acts if there is overlap or conflict. This section can make how to deal with overlap/conflict explicit. It is possible to give ultimate authority to another act.
    • Power to make regulations: statues often intend that regulations will be created in order to implement the statue. The regulations will likely be created by the body which will administrate the act. In other words, legislature might delegate power to another body to make regulations
    • Effective date: when the legislation becomes active. Sometimes it is necessary to do further research to determine this date. Knowing this date is important before one relies on it. An additional reason why such a delay might occur is in order to have time to inform the public about the upcoming changes in the law.
    • General Rule: what the statute encourages or prohibits. This is the main part of the statute. Often there are multiple rules.
    • Exceptions:
    • Consequences and Enforcement: some statues require you to look elsewhere for consequences and enforcement provisions.
    • Briefing a statute
    • condense, make it relevant to you and if you are reading it for specific purpose, make it relevant to that purpose
    • IF... THEN... can also be useful here
    Chapter 6
    • plain meaning vs. purpose approach
    • resolving ambiguity: "case law, indications of the legislatrue's intent, canons of construction (maxims for reading the words chosen by the legislature), and the user of similar statues and persuasive precedent."
    • vague statues may have resulted because legislators were unable to agree on precise wording
    • among many other reasons of course
    • purposive approach: figure out what the purpose of the statue is, what "evil" or "mischief" was being corrected? Then interpret the statue in a way that is in line with correcting the evil which needed correction.
    • golden rule approach: read the statue plainly unless it results in an absurd/unconstitutional result.
    • With respect to interpretation the Canadian Supreme Court says, "Today there is only one principle or approach, namely, the words of an Act are to be read in their entire context and in their grammatical and ordinary sense harmoniously with the scheme of the Act, the object of the Act, and the intention of Parliament." This is called the "modern approach."
    • past cases provide guidance on interpretation
    • courts: provide authoritative interpretation and assess constitutionality
    • statutes can be declared unconstitutional in whole or in part
    • "... if the court interprets a statue in a way that the legislature did not intend, the legislature can overturn the court's decision by amending the statute. The amendments will not change the outcome for the parties to the dispute that produced the objectionable interpretation, but they will change the rule for the future."
    • legislative history plays a role in helping discern legislative intent. This could includd a recommendation made by a legislative comitee, the debates had as the bill was going through the process of becoming a statue. Different aspects are considered more authoritative than others. Formal documents will be weighted heavily, so has content from the sponsors of the bill.
    • "In the end, and Act means what the court says that it means, not what a member of the legislature thinks that it means."
    • The legal context will also be considered when interpreting statutes. Is the statute attempting to codify what already existed in common law? Is there a pattern to be seen from reviewing the history of amendments? How do other rules of law interact with the statute in question? Is one interpretation in conflict with another rule of law while another is not? It is probably the case that legislators were aware of the constitution and did not intent to be in conflict with it.
    • There are rules in each jurisdiction that set out rules on how to interpret statutes. For example, sometimes the preamble of a statue is part of the statute, in some cases it is not.
    • Sometimes policy issues that existed at the time of the creation of the statute can provide interpretation guidance
    • Sometimes government bodies will produce interpretation guides, this might come in the form of an FAQ. If this were to happen there is a good chance that it would come from the administrating body. The Canadian Revenue Agency might create guides in order to help people with their taxes.
    • imagining a fact scenario that, or a case, that would fall right into the hands of the statute can also aid in helping interpret a case. Often it is the case that legislators are responding to incidents which have actually occurred, is it possible to guess what such an incident may have been?
    • "Cannons of construction are maxims for reading and writing statues."
    • unless defined, words should be interpreted in there every day meanings.
    • "Ejusdem Generis:" "of the same class." For example, if the statue lists several documents relating to real property, then has a catch all at the end that says something like "and any other document" it is to be understood that this would be any other document about real property, that is, in the same class as the documents which were explicitly listed.
    • Specific items take prevalence over general. If there is a conflict in rules, the more specific one would more likely to be considered to of precedence.
    • Provisions enacted later (the newest ones/the most recent ones) take precedence over provisions that were enacted earlier
    • "Expressio Unius:" "expressio unius est exclusio alterius" if there is a lit of items, and there isn't a specific catch all like "any other documents" only the items on the list are included.
    • It should be assumed that all language is there to add something. If something could be interpreted as meaningful or completely non-meaningful, it should be considered to be meaningful. If all items in a statute are all given a penalty, the same penalty, for example, then in one part of the statute it speaks of a penalty to be had for a specific action, this penalty should be considered in addition to the blanket penalty which has already been established for all aspects of the statute. The fact that the statute states a penalty for a specific part of the statute could be considered non-meaningful since it overlaps with what has already been established, but this is not the norm in which should be used to interpret statute. Or, just because the there are variable rate charges on your taxi cab fare, it does not mean that the fixed rate charge is no long there.
    • "In Pari Materia:" "of the same matter" if there is more than one statute on the same topic they should be considered together. A manifestation of this is that if a word is defined in one and not the other, there may in fact be a definition for both as a result.
    • interpretation of criminal laws should be done narrowly
    • using persuasive opinions from other jurisdictions is more likely to occur if the relevant law in the persuasive jurisdiction is modelled from a common source as the relevant law where the decision is being made. Based on my memory, this could happen for instance with PIPEDA and related law as PIPEDA serves as a model law which the provinces themselves are supposed to eventually implement.
    Chapter 7
    • commentary is just that, it is not law, it is not absolutely authoritative but it can help in furthering your understanding of the law
    • always check that lower court decisions have not changed on appeal
    • was the case you are investigating later used/referenced as precedent setting?
    • Recording your bad search methods van be handy in making sure that you don't repeat your past failed attempts
    • commentary should be used to supplement your legal understanding not supplant it.
    Chapter 8
    • deductive reasoning: apply elements of law to a real case.
    • reasoning by example: compare facts of a case yet to be resolved to a similar case which has been resolved
    • the rest of this chapter pertains to deductive reasoning
    • use legal rules to predict the outcome of cases
    • align case facts with legal rule requirements
    • sometimes assumptions will be required to make a legal analysis. Since assumptions are not certain, it may be beneficial to consider the outcomes based on various assumptions
    • a chart can be used in helping analyse of the facts of the case you are analysing relates to the law. A sample of this could look like this.
    element case facts element met?
    IF List the legal elements required list how the elements relate to the facts of the case has it been met?
    THEN list the legal consequences  list how it relates to the case
    • if elements of a legal rule are not met in a case being analysed it sometimes can be useful to restate the legal rules in their negative IF THEN form.
    • IF 1 and 2 would become IF not 1 or 2
    • IF 1 or 2 would become IF not 1 and 2
    • the same transformation would happen with the THEN portion
    Chapter 9
    • drawing on analogy
    • distinguishing cases
    • the degree to which a case can be distinguished can suggest the degree to which the result may or should differ
    • two important criteria in order to be able to use a case as an example
      • needs to address the same, or very similar legal rule
      • facts should be similar or same, the facts relevant to the legal rule are the most important
    • some similarities and differences are more important than others
    • the narrowness or the generalness of the case in which you are comparing to can guide how narrow or general your interpretation should be
    • intentionality incorrectly interpreting overly narrow or broad in or to find a favourable result is unlikely to be adventageous
    • Venn Diagrams to show similarities and differences
    • reasoning by example cannot be used alone but supplements deductive reasoning
    • policy analysis
      • it may be the case that deductive reasoning and reasoning by example may not be enough
      • broad society goal of laws
      • policy often drives law
      • considers society's interests
      • based on conceptions of societal good
      • could be called: legislative, government, or social policy. Is NOT "public policy"
        • Public policy: "... a term of art used to identify the basis on which judges can refuse to enforce contracts or conditions attached to land transfers if they are against the good of the community or contrary to established conceptions of justice and morality."
      • policy is tricky and often doesn't do a very good job of representing everyone. It is often one sided.
      • stakeholder analysis can be performed here
      • understand policy behind law and apply it to cases, what was the goal of the law and how does it relate to the case?
      • if there is more than one policy at play, is one more important than another?
      • dose one outcome of the case better serve a policy more than another?
      • what outcome would result in the greatest amount of policy being served?
    Chapter 10
    • Reader-Centred Writing
      • when writing, take into account the characteristics of the reader
      • keep to relevant points
      • consider how the reader will actually go through the paper, are they likely to skim?
      • What does the reader already know?
      • What does the reader still need to know?
      • Legal writing has specific conventions
        • following these are important for many reasons including maintaining professional credibility
    • legal writing is formal
    • should not contain first person
      • for one, it gives a more objective appearance
    • Function / Format of legal memo
      • aka file memo, intraoffice memo, or internal memo
      • good if there is more than one lawyer involved
      • can contain all sorts of information, anything that needs to be communicated
      • analytical memo
        • records known facts
        • documents research
        • sets of reasoning
        • predictions of resolution
        • strategy
      • don't forget that the memo might be referenced in the future for similar cases
      • the writer is also likely to be an audience for the memo
      • common memo components
        • caption: recipient's name, writers name, date, subject (client's name, file number, brief description).
        • Issue(s): the legal issue
        • Short Answer(s): provides the writer's position on the legal issues. Provides bottom line answers.
        • Facts: The client story. If the whole story is not known it may discuss the future
        • Discussion: This makes up the majority of the memo. Intro, presentation of rule of law, application of rules to facts, conclusion.
        • Conclusion / Recommendations
        • appendices

Page: 1 of 6