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)

Ranking Players and Declaring a Winner

I’ve written about comparators once before but only just realized that the usefulness of that post hinges on the availability of the site it links to. Not wanting to rely on a third party site and the owner’s ability to pay hosting fees, here’s my quick blurb on how comparators work in Java.

But first, why do I need a comparator in the first place? Simply put, to declare a winner at the end of a round of Board Rogue. When a player reaches the board’s exit, the game is over. Scores are tallied, players are ranked, and the player with the highest score wins.

So you know how to sort numbers. You probably know how to sort alphabetically. There are functions for that sort of stuff built into most every programming language. But how do you take something like a PLAYER and sort them? You use a custom comparator, and the Collections class.

So you’ve got a player.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class Player {
 
	private int score;
	private String name;
 
	public Player(String name) {
		this.name = name;
	}
 
	public int getScore() {
		return score;
	}
 
	public void setScore(int score) {
		this.score = score;
	}
}

And the game itself has a list of Players.

List<Player> playerList = new ArrayList<Player>();

And through the course of the game, each player accumulates a varied amount of treasure and items. Each piece of loot has a value associated with it, and the player with the highest loot value wins.

You could just loop through all of the players, look for the highest score, and declare a winner. But what’s the fun in that? You can’t easily tell who’s in second, third, or last place. But you can if you sort them! So create a comparator class that we’ll use to compare scores.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class PlayerScoreComparator implements Comparator<Player> {
 
	public int compare(Player p1, Player p2) {
 
		int p1score = p1.getScore();
		int p2score = p2.getScore();
 
		if (p1score > p2score)
			return -1;
		else if (p1score < p2score)
			return 1;
		else
			return 0;
	}
 
}

And now, to sort the playerList, simply apply the comparator to the Collection.sort function.

Collections.sort(playerList, new PlayerScoreComparator());

Finally, putting it all together you get the following.

Code.

1
2
3
4
5
6
7
8
9
for (Player player : playerList) {
	System.out.println ("Unsorted " + player.getName() + " has " + player.getScore() + " points");
}
 
Collections.sort(playerList, new PlayerScoreComparator());
 
for (Player player : playerList) {
	System.out.println ("Sorted " + player.getName() + " has " + player.getScore() + " points");
}

Output.

Unsorted Player One has 116 points
Unsorted Player Two has 616 points
Unsorted Player Three has 129 points
Sorted Player Two has 616 points
Sorted Player Three has 129 points
Sorted Player One has 116 points

New Game: Board Rogue

I’ve started on my next game. At the moment it’s called Board Rogue, though that’s subject to change. I said the same thing about Squishy Bugs. Squishy Bugs was supposed to be the code-name for the project, like Helicopter Ninja and Space Fight before it. But Squishy Bugs stuck, and who knows if Board Rogue is going to get another name by the time it ships. The name is really growing on me.

So I’m feeling a little inspired by this article on open board game design. It basically boils down to don’t be afraid to openly share your game’s development because other people are too busy working on their own killer game and ideas area cheap. At least that’s what I got out of it. So without further ado, here’s a little glimpse into what Board Rogue is going to be about.

First, a couple definitions.

Board game
 A board game is a game that involves counters
 or pieces moved or placed on a pre-marked
 surface or "board", according to a set of rules.
Roguelike
 The roguelike is a sub-genre of role-playing
 video games, characterized by level
 randomization and permanent death.

So what is Board Rogue?

A board game, played on a single Android tablet, played by and passed between 1 to 6 players. Players take turns rolling dice to traverse the randomly generated dungeon in search of the big treasure at the end of the board.

There are currently only 4 types of “squares” that make up the board. Each square is a type of room. Either empty, monster, trap, or treasure.

Empty rooms are just that. Generally safe rooms that don’t help or hinder player progress.

Monster rooms are occupied by monsters. Landing in a monster room prompts you to fight with the monster. Killing the monster rewards the player with loot which may alter the player’s skills when used. It’s not in place yet but there will probably be an option to flee the fight if the battle is going poorly for you. Player death sends the player back to the board’s entrance. And they drop all of their loot on the floor of the monster’s room. The good news, the monster remains hurt so anyone else who comes across that monster square later will have an easier fight… unless the monster has regenerative abilities. Trolls typically regenerate when not in battle, so be aware!

Trap rooms mostly do bad things to players. They might cause the player to lose a turn, go back 2 squares, or take damage. If a trap kills you then you drop your loot and go back to the beginning of the board. Noticing a theme here?

Death is permanent. Your hero dies and you go back to the beginning of the board as a brand new hero with no special loot or skills.

Last, the treasure room. The game is points based, where the player with the highest score at the end of the game wins. Treasure counts toward your total points. A bar of gold might be worth 750 points. A small gem might be worth 100. But treasure rooms aren’t limited to jewellery and gems. Players might get lucky and find special armor or a weapon. Or an unset trap…

Unset traps are the game’s way of allowing a player to hinder other players. When a player is in an empty room, and they have an unset trap in their inventory, the player can trap that room. That room will remain a safe room for that player, for the duration of their hero’s life. The trap springs only for a hero that didn’t set the trap. In most cases this means all of the other players, but what if the trap’s hero dies? Then the trap is now hostile toward that player’s new hero as well.

So that’s the general outline of the game. Take your turn, pass the tablet to the next player, and so on. Collect as many points as you can before someone reaches the exit. Highest score wins the game.

Stay tuned for more Board Rogue tidbits as development continues. As usual you can follow along with the game’s development at the task tracker or discuss it at the WaggSoft Forums.

Find me as @kdnewton on Twitter and the WaggSoft Facebook page.

Staypressed theme by Themocracy