
Street wisdom

life, coding, technology, outdoors, photography
Playing around with some circuits, LEDs, and an Arduino. Pretty neat!
Saw them tonight at the UC Theater in Berkeley. They rank up there as one of my favorite bands of all time.
Do you have an iPad? Because you can totally play Civ on your iPad.
āWHAT?! NO. CIV REVOLUTION DOESNāT COUNT,ā you loudly yell.
JUST WAIT! Iām not talking about that. Iām talking about Civ V (and even Civ VI).
Photo Proof here:
How does this magic work?
Yes, you guys will think Iām crazy but I regularly play Civ on my iPad. (What?!). Iām also a masochist. But you can totally make it work.
There are a few options:
Pros: You get to play Civ on your iPad!
Cons: Kind of a pain to setup.
Through Remotr:
Pros: You get to play Civ on your iPad! And itās much easier to setup on your Windows PC, plus you arenāt tied to an Nvidia only GFX card.
Cons: The iPad app is free (good!). But whenever you disconnect from your game (or maybe something crashes), it will show you one of those cheesy popup ads that wonāt let you click away for 10 seconds or so. You can optionally pay for a monthly pro subscription through an in-app purchase. Also, Remotr tries to squeeze your (probably 16:9) resolution display into the iPadās 4:3 display. So things will look janky. Just change the resolution of Civ to 1024 x 768 and things will look good on your touch screen device. (Obviously, change it back when you get back to your real machine though).
Through Screens (I also have a Mac) or a similar VNC client.
Pros: You get to play Civ on your iPad!
Cons: While Civ isnāt what we think of as a graphically intense game, prepare for a bunch of jerkiness as you move the map around, delays while various modals pop up, screen tearing. But⦠you get to play Civ.
I rented aĀ Sony RX1R II. Obviously, I had to test it with my patented Canine Camera Calibration System. It seems to have passed.
Test driven development has become an important process in the software engineering world. It allows coders to develop functions by first creating a series of tests that the new function must solve. The benefit of this is that once your app grows more complex and you add new functionality, you can see if any existing tests have failed, meaning that something broke (and now you know where to find it). Look no further than any popular project on Github and youāll often see a ātestsā folder.
Today, weāre going to talk about setting up tests using Tape.
Tape is an alternative to popular testing suites such as Jasmine and Mocha. Like any tool related to software engineering, there are some developers that strongly prefer Tape over other options. Itās fairly easy to setup and can easily be run in automated task runner tools such as Grunt and Gulp.
To use it as part of your project, you can install it through npm:
npm install tape --save-dev
Once itās been added as part of your project, you can create a new tests.js file and require the module.
For our demonstration, weāre going to write a simple test that checks if my name is Dave, plus a few additional parameters.
Start off by setting up your test.js file like so (you can name it whatever you prefer). Iāve commented the code for some additional clarity on whatās happening here.
// Require the Tape module imported from npm
var test = require('tape');
// Write your tests in the code block
test('All about Dave', function (t) {
// The number of tests that you plan to run.
// NOTE: If this number doesn't match up with the number
// of tests that are run, your test will fail.
t.plan(2);
// Let's setup some variables to test
var name = "Seymore";
var city = "Oakland";
var favBaseballTeam = "Athletics";
// This test will check for my favorite baseball team.
// The first parameter is the result, the second is
// the value you're expecting, and the third is the message
t.equal(favBaseballTeam, "Athletics", "Favorite baseball team should be Athletics");
// This test will check for my name.
// As you can probably assume, it will fail.
t.equal(name, "Dave", "Name should be Dave");
// This test will check if city has been set:
if (city) {
t.pass("City set");
} else {
t.fail("City not set");
}
});
Thatās it! You can run Tape from your terminal and point it to your newly created test.jsĀ file in order to run it.
Weāve been working on many projects lately that have utilized MongoDB as the primary means of database storage. I have previous experience building and using MySQL databases, so the idea of these NoSQL databases is a new concept for me.
Iām not one to shy away from new technologies, so Iāve been trying to embrace MongoDB and learn how to use it.
One of the most important things Iāve been learning is how to view the databases, collections, and records that Iāve saved in my various applications through the MongoDB command line interface.
Letās do a quick walk through and pretend I have a database dedicated to baseball.
Once you have Mongo installed on your machine, you run the interface by typing mongo in your terminal. Now, you can bring up a list of databases by typing show databases.
How do we use a particular database? Easy! Just type use [database_name]
use baseball
Awesome! Of course, youāll want to do more than just āuseā the database. We want to see whatās inside it. This is accomplished by telling mongo to show us all collections (e.g., think of these as ātablesā in a traditional SQL database).
show collections
Awesome! Now we have a collection of teams and collection of players. Well, letās display everything within a particular collection. In this case, letās print out all teams that we have stored in our database.
db.teams.find()
Great!
Now, letās say youāre looking for a particular record. How do you limit your search to just one thing? Like this:
db.teams.find({team: ādodgersā})
Now, you can imagine that if we had more data, there are a lot more things that we could search for and find. Itās pretty powerful!
Anyway, this was a quick tutorial on how to use the Mongo DB CLI. I hope you found it helpful!