2016 Favorites

Favorite Movie

Deadpool

Was right up my alley. I really enjoyed Kick-Ass and this felt like more of the same but in the Marvel cinematic universe.

Favorite Video Game

Dying Light: The Following

Bought it at the end of 2015 with the season pass. Received The Following right when I reached the end of the base game’s story. Loved the game as a whole. Fun to grapple across the cityscape and generally aggravate the undead.

Raspberry Pi WiFi via USB

I’ve been playing with my Raspberry Pi again. Actually, I ordered a Pi Zero and a Pi 3 as well.

I really didn’t need the Pi Zero. It was a bit of a Black Friday impulse purchase. Ordered it from Pimoroni in the UK and took just about a month to arrive. On a related note, Amazon Canada had better Pi 3 deals during Black Friday than they did for Boxing Day (I’m looking at you, Canakit).

I’m still waiting on the Zero4U (USB board) I ordered for the Pi Zero and I don’t have any microUSB adapters so the Zero is sitting unused in its antistatic bag. By coincidence, both the Pi Zero I ordered from the UK and the USB WiFi dongles I ordered from China arrived on the same day.

All that aside, both my 1st gen Pi Model B and the Pi Zero need WiFi capabilities. I barely use my Model B because it’s a nuisance to plug it in where my router is.

Here’s how I got wifi working on my Pi. Credit goes to the two articles I found here and here, because the first article mostly worked, and the second article had the command to actually connect to my access point.

From the pi command line:

wpa_cli
add_network

It’ll give you a number. 0 in my case.

scan
scan_results

Locate the access point you want to connect to.

set_network 0 ssid "your-access-point"
set_network 0 psk "the-passphrase-goes-here"

The first article tells me the Pi should connect to the network now. Mine didn’t. So the second article says to

select_network 0

Provided your settings are correct it should connect. Now to figure out how to connect every time the Pi is rebooted.

Getting it to connect on startup

Turns out wpa_cli wasn’t enough. Or if it is sufficient, I’m missing steps to add the required values. According to this other article you need to edit the wpa_supplicant config.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

I then added the lines that were missing from mine and actually deleted one (disabled=1).

EDIT: In the case of my Pi Zero I actually had to type out the entire block below.

network={
ssid="YOUR_NETWORK_NAME"
psk="YOUR_NETWORK_PASSWORD"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

I then added a required line to the network interfaces file.

sudo nano /etc/network/interfaces

Which required the following line added somewhere near the top (I put it just below auto lo).

auto wlan0

The Pi now connects to my network after a reboot.

July’s Geek Beers Meetup

I don’t have a voice that carries very well. When I’m out in a crowded place, with a lot of chatter all around me, even I have trouble hearing myself.

Last night I attended my city’s monthly tech meetup, #GeekBeers, where other work-from-home types and tech enthusiasts meet up for a night of good food and drink and conversation.

Some of the conversation turned to what we’ve been doing to keep ourselves entertained in the month since we last saw each other. We covered music, movies & documentaries, television, and books. The following is what I had to offer in terms of what I’ve been reading/listening/watching and what I had recommended for those interested to read/watch/listen to.

Books

I’ve been listening to the Wayward Pines series by Blake Crouch on my 1-month trial of Kindle Unlimited. It’s a strange story that follows a secret service agent as he investigates the disappearance of two other secret service agents in the seemingly perfect town of Wayward Pines. Everyone behaves too perfect, like they’re all in on a secret. Lots of unexpected turns in the story, and I’ve been highly entertained in the series so far. I’m half done the second book in the three-book series.

God is Not Great: How Religion Poisons Everything” by Christopher Hitchens. Another audio book I listened to during my drives to and from work. I was previously unaware of Christopher, and I haven’t looked too much into his other work. I watched a few YouTube videos where he argues against religion. The book, read by Christopher himself, is basically an essay on why he thinks religion is bad.

That led me to seek out another God-related book and I settled on Penn Jillette’s “God, No! Signs You May Already Be an Atheist and Other Magical Tales“. I loved it. Very light on religion, it’s more of an autobiography structured around “one athiest’s ten suggestions”. Very funny, highly recommended. Especially in audio book form as it’s read by Penn himself. Note: It does not answer why he paints one of his fingernails red, but my hypothesis is it’s meant to distract his audience while Penn performs magic.

Movies & Documentaries

The God stuff was kicked off by http://unbelieversmovie.com/ which follows evolutionary biologist Richard Dawkins and theoretical physicist Lawrence Krauss as they tour the world lecturing about the importance of science. There’s an anti-religion agenda to the documentary which is what brought Christopher Hitchens to my attention. There’s a scene before Lawrence lectures at a university where he’s reading “God Is Not Great”.

I mentioned the eclectic collection of documentaries I have at home which span everything from games development (Indie Game The Movie, Us And The Game Industry, and the upcoming GAME LOADING: Rise Of The Indies) to obscure game genres (Get Lamp: The Text Adventure Documentary) and Nerdcore (Nerdcore Rising and Nerdcore For Life). Those last ones begged the question, “What is Nerdcore? And what would you recommend as an introduction to someone who wants to learn?” which I’ll get to in the music section below.

TV

I finally finished watching “Cosmos: A Spacetime Odyssey”, hosted by Neil deGrasse Tyson. I loved it. I thought it was pretty cool that only two days after the last episode aired on TV, the series was available for purchase in stores.

At the suggestion of another, I started watching “Through the Wormhole”, hosted by Morgan Freeman. Coincidentally, the first episode focused on the creation of the universe and whether a God was responsible for its creation. While I have in the past month sought God-related media, this one was unintentional though not unwelcome. Someone at #GeekBeers asked about the difference between Cosmos and Wormhole. Someone else told him that Cosmos focuses on the how and why of a specific topic, while Wormhole covers a topic with broad strokes, more as a documentary form. I agree. I love both series.

Music

One person, he appeared to stream most of his music through the Google Play Music service. He mentioned XX which got a, “Me too!” from someone else. I’d never heard of XX before. I was asked to elaborate on what Nerdcore was, and I struggled to give examples of what made Nerdcore Nerdcore. I used MC Frontalot, the god-father of Nerdcore, as example. But when I thought back through his catalog nothing came to mind as inherently geeky. The best I came up with is “Tongue Clucking Grammarian” and “Hassle, The Dorkening”.

I also offered Schaffer the Darklord as example (The Bender, as a nerd rapping goofy about a serious topic) and MC Chris as a more mainstream artist (Fett’s Vette, because Star Wars).

As for what I listen to, at work I mostly listen to “The Ultimate 100” channel on Songza. I’ve downvoted probably half the songs in the stream, but the ones left in rotation are great. It’s helping me branch out from what I’d normally listen to, and new songs make it into the mix every week or so.

This is all from memory, with a little more elaboration here. As I said before, my voice doesn’t carry well in a noisy place so for those there last night who may have misheard me or not heard at all, above is my summary.

Feel free to reach out to me via Facebook or Twitter if you want to carry on the conversation.

Startup Weekend Okanagan, Remote Working Panel

On Tuesday I was part of a panel on remote working moderated by Kazia Mullin and sponsored by Sproing Creative. I’m not big on public speaking and wasn’t sure I would have much to contribute to the discussion, especially since for the last month I’ve been a regular old employee who drives into work every day, working with other developers in an office. I was given a list of questions to prepare for but only glanced over them and may not have delivered quality answers during the panel. Having 2 kids and a full time job, and a 45 minute commute to work both ways, I don’t have much free time. The questions were as follows:

  1. Why did you decide to work remotely?
  2. How did you find or create your remote position?
  3. Tell me about the culture of the company you work for? How do they facilitate having remote workers?
  4. What tools do you use to make working remotely possible?
  5. What are your biggest challenges working remotely?
  6. What networks would you like to see in place to better support remote workers?
  7. What advice do you have for someone looking for remote work?

Why did you decide to work remotely? I was previously employed to a local software development studio. A small team with only two developers (myself included) which relied largely on a government contract. That contract dried up and I found myself unemployed. I wasn’t looking for remote work, I was just looking for a job. A friend was looking to subcontract another developer and I fell into the position. Once again working with a small team with only two developers (myself included) but this time I’d get to work from home.

How did you find or create your remote position? As above, I wasn’t looking for remote work. I needed work and a friend offered me a job. But once I worked remotely I told myself I never wanted to work in an office again. Four years later, when that contract dried up, I found myself once again looking for work. Any work. And I’m once again working in an office.

Tell me about the culture of the company you work for? How do they facilitate having remote workers? The company I worked for, in the beginning, was mostly local. Everyone lived within 30-45 minutes of each other, scattered across 4 local cities, with the exception of one support personnel who lived in the Philippines. We were each responsible for our own hardware. Us two developers chose Linux while the owners/marketers, accounting/QA, and support used various versions of Windows. The only commonality was the use of Skype which we’d use for semi-frequent but usually sporadic meetings. Though we all lived relatively in the same location, we’d rarely see each other. Maybe once a month or so, a few of us might meet for wings. Later, when the company sold, a more structured management system was put in place. One with regular weekly meetings, still done over Skype. The main body of the company was shifted to Vancouver where an office was set up and employees were hired to work in the office. The remote workers started dropping, starting with the lead developer and then lead support. Eventually I was let go, due to budgetary issues, and soon after that they gave up the office. Of the people left, they began working from home again.

What tools do you use to make working remotely possible? Skype for instant messaging and one-on-one or group voice chat. Company email addresses. Free and open source software to keep costs low. And since I worked from home, a room in the house dedicated to my work space. A lock on the door is optional, but a spouse who understands that work time is work time was a definite requirement. At least for me.

What are your biggest challenges working remotely? Taxes. I was a contractor so I was responsible for keeping track of business-related taxes and making sure I was paying them on a regular basis. Another challenge was getting paid enough. I don’t think I was very good at negotiating wages on my own. One contract I was getting $50/hour but the main 4-year long contract I was averaging in the mid-$20/hour range. Another contracting-related challenge was finding work. I looked for a remote employed position after the big contract dried up for a full 8 months. Mid-May through to the end of January. When you’re looking for work locally you compete against a local workforce. When you’re looking for work remotely, on sites such as http://weworkremotely.com and http://careers.stackoverflow.com, you’re competing with a global workforce. That’s a lot of competition.

What networks would you like to see in place to better support remote workers? I’d like to see a local co-working space. Working from home has its advantages, but in a house with small children it’s often hard to get the quiet that’s often needed to get “in the zone”.  The job I’m working right now, it’s a 45 minute drive away. I’d happily trade 45 minutes for a 15 minute drive to a local co-working office. As an aside, I found that working from home, by myself, that my skills were stagnating. I find it beneficial to be able to just walk over to someone to ask them a question, or to start a conversation with someone face to face to discuss the latest trends. Especially over lunch, which wouldn’t happen in isolation.

What advice do you have for someone looking for remote work? Know someone. Not everyone has that luxury, but networking has always played an important part in my professional life. Go to http://www.meetup.com and look for a group in your area that suits your interests. You might find a WordPress meetup, or even a Telecommuter group. Where I live, there is http://startupvernon.com which has been a huge boon to my social life. And that’s saying something, since as a geek I typically only left the house once a month to have #GeekBeers with the rest of the Startup Vernon community. And if you can’t find the time to know someone (people really do want to help place you in a job), check the remote-oriented job sites on a daily, or even hourly, basis. They’re linked two paragraphs above. Also, don’t talk yourself out of a position. Let the potential employer decide whether or not you’d make a good fit. Don’t let yourself be the biggest barrier to entry. Apply to everything you think you might be capable of.

Additional thoughts follow.

Someone asked the panel about how an employer with remote employees can help keep the employees motivated. That made me think of a previous remote position I had where, when the company exchanged hands to new owners, they removed everyone’s yearly bonus. Don’t do that. It did the opposite of motivate.

Though he made many good points, Justin Jackson’s “single point of failure” really made me nod my head. When an entire staff works under a single roof, the company is dealing with a single point of failure. The power goes out? A router died or the internet is flaky that day? Everyone stops working. Today at my job, the power went out at 10:10am. We had 8 minutes of battery backup to save our work. We did what little work we could with the outage, and though the power was back on within 30 minutes, that’s 30 minutes across maybe 70 employees. That’s 35 man-hours. Compound that with the fact the network wasn’t back online for another hour and a half after that. Had the team been distributed across the valley, or even the world, the downtime could have been mitigated. Work would have continued as normal.

A big reason to work remotely? Higher rate of pay. You can live in a town with a small tech scene with average wages in the $50k/year range, but find a wealth of employed remote positions online paying big-city competitive wages in the $70k-$90k/year range. Tonight I met a guy who works remotely for a company based out of Australia. Their support positions start at a higher salary than I make as a developer who works locally. Think about that.

Companies that have embraced remote working really have their finger on the pulse. Managers do not have to mistrust remote employees because they know those employees are happier and less likely to leave their jobs, all the while doing quality work. And employees get the benefit of competitive perks. During my remote-job search, I found companies that supplied personal-use cell phones, gym memberships, 401k plans, medical and dental, 5 weeks of vacation (to start), and regular in-person meetups at exotic locations.

Why not work remotely?

Remove Items While Iterating List In Java

Edit: Some (better) alternatives here and here

Edit 2: @kattehus was awesome enough to compare the three methods. 1) my graveyard method, 2) Joe’s iterator method, and 3) Kattehus’ standard for-loop method. Go with the standard for-loop. I’ll leave the rest of my post so others can see one method of doing so, though it’s not the best method.

1
2
3
4
5
6
for (int i = items.size()-1; i >= 0; i--) {
	SomeItem item = items.get(i);
	if (item.value < 25) {
		items.remove(i);
	}
}

End of edit 2.

So you have a list of something and you want to remove some of those things from the list. So you loop through them, check to see if the item should be removed, and you remove it from the list.

*CRASH*

What happened? You likely ended up with the following stack trace.

java.util.ConcurrentModificationException
 at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
 at java.util.ArrayList$Itr.next(ArrayList.java:791)
 at RemoveFromListExample.thisWillNotWork(RemoveFromListExample.java:36)
 at RemoveFromListExample.<init>(RemoveFromListExample.java:13)
 at RemoveFromListExample.main(RemoveFromListExample.java:79)

Oops. So what went wrong? As far as Java sees it, it was happily looping through the list of items, knowing exactly how many items were in the list, when suddenly the list size changed. Java didn’t like that and so it put an end to the loop.

But you still need to remove those things from that list. What do you do? Build a second list!

I like to call the second list the “graveyard”. Basically, loop through the list and when you find something you want removed from the list just add it to the graveyard. Outside the loop just tell the first list to remove all items found in the second list. Like this:

1
2
3
4
5
6
7
8
9
public void thisOneWorks(List<SomeItem> items) {
	List<SomeItem> graveyard = new ArrayList<SomeItem>();
	for (SomeItem item : items) {
		if (item.value < discardBelowValue) {
			graveyard.add(item);
		}
	}
	items.removeAll(graveyard);
}

Below is the full source code for an example of what does and does not work, followed by the output of the program. Give it a try to see for yourself. It’s not limited to ArrayList, either. It also works with LinkedList and I presume whatever else you find in Collections.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import java.util.ArrayList;
import java.util.List;
 
public class RemoveFromListExample {
 
	protected int discardBelowValue;
 
	public RemoveFromListExample(int discardBelowValue) {
 
		this.discardBelowValue = discardBelowValue;
 
		try {
			thisWillNotWork(getList());
		} catch (Exception e) {
			e.printStackTrace();
		}
 
		thisOneWorks(getList());
	}
 
	public List<SomeItem> getList() {
		List<SomeItem> items = new ArrayList<SomeItem>();
 
		items.add(new SomeItem("Penny", 1));
		items.add(new SomeItem("Nickle", 5));
		items.add(new SomeItem("Dime", 10));
		items.add(new SomeItem("Quarter", 25));
		items.add(new SomeItem("Dollar", 100));
 
		return items;
	}
 
	public void thisWillNotWork(List<SomeItem> items) {
		printList(items);
		System.out.println("Try to delete while iterating...");
		for (SomeItem item : items) {
			if (item.value < discardBelowValue) {
				items.remove(item);
			}
		}
		printList(items);
	}
 
	public void thisOneWorks(List<SomeItem> items) {
		printList(items);
		System.out.println("Delete after iterating...");
		List<SomeItem> graveyard = new ArrayList<SomeItem>();
		for (SomeItem item : items) {
			if (item.value < discardBelowValue) {
				graveyard.add(item);
			}
		}
		items.removeAll(graveyard);
		printList(items);
	}
 
	public void printList(List<SomeItem> items) {
 
		System.out.println("Items in list");
		for (SomeItem item : items) {
			System.out.println(" * " + item.name + " (" + item.value + ")");
		}
	}
 
	private class SomeItem {
 
		protected String name;
		protected int value;
 
		public SomeItem(String name, int value) {
			this.name = name;
			this.value = value;
		}
 
	}
 
	public static void main(String[] args) {
		int discardBelowValue = 25;
		System.out.println("Discard below " + discardBelowValue + " cents");
		new RemoveFromListExample(discardBelowValue);
	}
 
}

Output:

Discard below 25 cents
Items in list
 * Penny (1)
 * Nickle (5)
 * Dime (10)
 * Quarter (25)
 * Dollar (100)
Try to delete while iterating...
java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819)
	at java.util.ArrayList$Itr.next(ArrayList.java:791)
	at RemoveFromListExample.thisWillNotWork(RemoveFromListExample.java:36)
	at RemoveFromListExample.(RemoveFromListExample.java:13)
	at RemoveFromListExample.main(RemoveFromListExample.java:79)
Items in list
 * Penny (1)
 * Nickle (5)
 * Dime (10)
 * Quarter (25)
 * Dollar (100)
Delete after iterating...
Items in list
 * Quarter (25)
 * Dollar (100)

Staypressed theme by Themocracy