sunnuntai 8. tammikuuta 2017

Raspberry Pi 3 no monitor & no keyboard: setup with Windows – Tutorial

Raspberry Pi 3 Model B
In this post I'm succinctly going to explain how to setup a Raspberry Pi computer that does not have a monitor or a keyboard (a "headless" setup), using a Windows PC. I'm using a Raspberry Pi 3 Model B. The microSD slot is under the circuit board, at the other end where the USB and Ethernet connectors aren't. At the time of writing this post the latest version of the Raspbian Jessie Lite operating system is the version that was released on 2016-11-25.
  1. Download Raspbian Jessie Lite (pro tip: the Torrent file loads faster)
  2. Download Etcher
  3. Run Etcher to install the Raspbian Jessie Lite on your microSD card 
  4. Contents of the microSD card
    Etcher may unmount the card after it's done: remount it, then add a new file into it, called "ssh". No extension, no contents in the file. This enables the SSH daemon on the Raspbian. 
  5. Optional: If you want to use your Raspberry with a WIFI connection instead of an Ethernet cable, add another new file called "wpa_supplicant.conf". In this file add the following:

    network={
      ssid="NAME OF YOUR WIFI"
      psk="PASSWORD OF YOUR WIFI"
    }
  6. Insert the microSD card into your Raspberry Pi, then start it by connecting the power cord. Make sure the Ethernet cable is connected too – or that you completed the optional step 5 above. The system will be ready in about 15 seconds. 
  7. Advanced IP Scanner
    Using either your router's admin view or the Advanced IP Scanner program find the IP address of your Raspberry.
  8. Use Putty to connect to your Raspberry 
  9. Username "pi", password "raspberry". 
  10. You are now logged in. Now update your system: first do "sudo apt-get update" and then "sudo apt-get dist-upgrade". 

Logged in
Congratulations, your Raspberry Pi is now ready for use!

PS. If you don't have a case for your Raspberry, why not find a 3D printer and print one? Thingiverse has for example this one that also fits perfectly for a Raspberry Pi 3 model B.

lauantai 16. tammikuuta 2016

Hexcells, Hexcells Plus & Hexcells Infinite

Level 6 from Hexcells Plus, in its initial state.
Hexcells is a casual puzzle game in the spirit of the good old Minesweeper. It differs from Minesweeper with a few key points, though: 1) all the puzzles are solvable by logic only, you never need to guess (even if the logic may be a bit tricky to figure out!); 2) the board consists of hexes instead of squares; and 3) there are other kinds of hints besides just the number of "mines" (blue hexes) next to a number hex, such as the number of hexes on a column, or a hint that the blue hexes around a number hex are joint with no gaps (number in curly braces: {2}) or that they are not all adjacent (number with dashes around them: "-3-"). Also the game looks nice and has an ambient background "music" that can only be described as "soothing".

It took me less than two hours to perfect the original Hexcells and I figured I could've played some more, so I bought Hexcells Plus and Hexcells Infinite too. All of the games have initial tutorial levels to teach the mechanics, but the difficulty level in Hexcells Plus goes up way quicker than in Hexcells -- there are few really easy levels. The more difficult levels can even take up to 30 minutes or so, which started to feel like too much, especially given that you cannot save the game in the middle of a level! Also, it does feel irritating if you make a mistake towards the end of a level after having spent 20 minutes on it, especially if you're after the Perfectionist achievement without cheating.

Level 29 from Hexcells, almost solved.
Both Hexcells and Hexcells Plus have 36 levels, but it took me between 5 and 10 times longer to complete Hexcells Plus than Hexcells. All the levels in both games are hand-crafted and sometimes almost made me laugh at the beauty of the puzzle, which is a good sign of a good puzzle game. I'm still in the middle of Hexcells Infinite, which also has 36 hand-crafted levels, but in addition to that, millions of randomly generated levels and a possibility to load in community-made levels.

Playing all the three games is starting to feel a bit laborious, but the games are strangely addicting and you often feel like playing one more level even though the last one already took too much time. I can warmly recommend any of these games to any puzzle-lover out there. I liked the original Hexcells the most, as it offered a short Flow-state of puzzle-solving, whereas the other games make you put much more effort into them. Hexcells is also priced the same as Hexcells Plus, Hexcells Infinite being a bit more expensive. All the games are sold in a bundle too, which you might find at a nice discount in some Steam sale.

sunnuntai 11. toukokuuta 2014

Peter Watts: Blindsight

Blindsight is a neurological condition where there's nothing wrong with your eyes, but you cannot see. Your brain cannot access the image data consciously, but you are still able to reflexively react to visual stimuli, such as by ducking an object flying at you. Blindsight is kind of related to the perhaps more famous condition of body integrity identity disorder, where one might think that their leg or some other limb is not theirs but just a dead piece of meat and needs to be amputated.

Blindsight, on the other hand, is a 2006 novel by Peter Watts. The events of the story take place in the 2080s, when a spaceship called Theseus is sent to investigate an alien object somewhere far beyond the Kuiper belt. Technology has advanced greatly since our days. 3D printers, called fabricators, can print just about anything, including computers and robots. Medical treatment can also cure almost anything short of a major brain damage, including severe radiation poisonings. People get their brain rewired for attitude adjustments and DNA augmentation isn't uncommon either. The minds of deceased people are copied into a virtual world called Heaven, and the living can visit them there.

The story follows the events in and around Theseus. The crew consists of an AI called the Captain and five people: Siri Keeton, Susan James, major Amanda Bates, Isaac Szpindel and Jukka Sarasti. Keeton is a synthesist, trained (with the help of some brain augmentations) to understand complex systems and to explain them to others. He is also the narrator of the story and is included in the crew to observe everything that happens and report back to Earth regularly. Susan James is the "mother" of the Gang of Four, the other minds living in her brain: regularly any of the Gang of Four may take control of their common body, and together they form a highly functional unit specialized in linguistics, to speak with the aliens. Amanda Bates is the soldier in case things get bad, and Isaac Szpindel is the biologist, to study the aliens. Finally, Jukka Sarasti is the commander in charge of the operation. He is also a vampire, brought back from extinction by the science of paleogenetics.

If at this point you flinched, don't. Vampires aren't some magical creatures, but the author has actually devised a plausible evolutionary history for Homo sapiens vampiris. It is, for example, noted that vampires are sociopaths: "Vampires had to be sociopaths. They're too much like their own prey—a lot of taxonomists don't even consider them a subspecies, you know that? [...] If the only thing you can eat is your own kind, empathy is gonna be the first thing that goes. Psychopathy's no disorder in those shoes, eh? Just a survival strategy." The reason why there's a vampire commanding the crew is that vampires have superior pattern-matching and analytic skills compared to humans. It's basically hinted that in a traditional IQ test a vampire could score four digit numbers, whereas the average human IQ is 100. That makes sense, since if you are going to hunt something as clever as man, you'd better be smarter than your prey. Additionally, vampires are solitary hunters: very territorial and never team up.

In many works of fiction long distances in space are covered in some kind of cryogenic sleep. Watts has cleverly combined this with vampires, as the crew's DNA has been augmented with some vampire DNA, allowing them to be "dead" for a long period of time and then be woken up again.

Regarding Susan James, it's important to note that the Gang of Four (her and Michelle, Sascha and Cruncher, who is the only male in the gang) aren't Susan's alter egos or anything like that, but indeed completely other people. While Susan's brain has become "multi-core" with the help of a surgery, it is noted that a simple, strong enough stress could also split the brain the same way. The story makes a clever remark about the multi-core people of the past: "People were fucking barbarians about multicores back then—called it a disorder, treated it like some kind of disease. And their idea of a cure was to keep one of the cores and murder all the others. Not that they called it murder, of course.".

A few times during the book there's a nice recurring narrational feature, where a section would start with "Imagine you are [someone or something]" and the story would progress for a while describing what you usually do and how you usually think, and reflect that to the events at hand. That's a nice break from the other narration and I haven't seen it used in other books. Just when you might think the trick is getting old, it disappears for a couple of hundred pages, just to resurface to wrap the entire story up. So the narration (as well as the vocabulary) is clearly way, way above that of, say, Dan Brown's works.

On the cover of the book there's a quote from a British author Charles Stross: "Blindsight is a tour de force, redefining the First Contact story for good.". That should already give it away that aliens are indeed encountered when Theseus reaches its target. But what do you do when you don't even know if the aliens are way smarter than you, or if they are as stupid as dandelions? The book explores interesting concepts such as the Chinese room and the relationship between sentience and intelligence. The author has clearly seen a lot of trouble making everything so different from other stories, yet plausible, and also manages to make you think.

I recommend the book for anyone interested in hard-SF. I'd also recommend the novel for anyone who's not interested in science fiction, as this might be a good starting point with the more realistic setup than, say, Star Trek. The author has published the entire book on his web site at Rifters.com in PDF and HTML formats as well as in some e-book formats.


sunnuntai 12. tammikuuta 2014

The best Firefox plugins for web developers

Tamper Data
JSONView
XPath Checker
Here's a bunch of Firefox plugins for the web developers out there. If you are only going to install one, then Firebug is obviously a no-brainer (and you should already have it if you are a developer), but these others are very useful as well. Listed in alphabetical order:
  • Advanced Cookie Manager: Inspect and easily edit and/or remove any cookies there are
  • JSONView: Makes JSON documents easily inspectable with syntax highlighting and collapsible structure
  • Live HTTP Headers: Makes it trivial to inspect the HTTP headers of all requests and their responses
  • Tamper Data: Modify HTTP and HTTPS post parameters and headers
  • XPath Checker: View and test XPath expressions on the current page
Finally, there's a whole array of plugins for Firebug and there's something for everyone, so I'm not going to list any individual plugins from there. Just take a look and pick whatever you might like. :)

lauantai 14. syyskuuta 2013

Humble Indie Bundle 9

Name your price for four excellent indie games -- six, if you pay above the average, which is currently mere USD 4.59! The above-average-price games are Fez and FTL: Faster Than Light which have both received highly favorable reviews. Within the four games that you can get for any price there's for example such a gem as Mark of the Ninja. All the games work for Windows, Linux and Mac. You'll get Steam keys and you also get to download them, free of any DRM technologies that would hinder the gaming experience.

maanantai 1. huhtikuuta 2013

iPad games

Aside from all the Rovio's Angry Birds and Bad Piggies games, there are many other great games for iPad. I present three of them here, in no particular order.


Need for Speed: Most Wanted


Need for Speed: Most Wanted is a beautiful and well implemented racing game. There are several different tracks with different types of races. More tracks are unlocked when you do well, and more cars become available for purchase with the money you earn from winning the races. There are many types of cars and not all races are open to, say, sports cars, but you need to drive, for example, a Hummer every once in a while as well. Aside from their looks the cars have a few different attributes that make them different: speed, acceleration and handling, and there's also implicitly the weight. These attributes can be modified per race by adding various modifications to the car. These mods include engine tweaks, lightweight chassis and reinflating tyres (Yes, reinflating tyres are needed -- the races in the game are "illegal", so there are police cars that may try to stop you using spike strips). You control the car by steering your entire iPad (or iPhone), which is quite a nice and intuitive way of driving. You can also touch the right side of the screen to drift. NFS:MW does not support the Apple Game Center but it has its own in-game social system called Origin, for which you might actually already have an account if you have played any other Electronic Arts games recently, even on PC.


Fieldrunners 2


Fieldrunners 2 is a tower defense game where almost endless hordes of enemies try to cross the playing area on which you must build a maze for them using various lethal obstacles, including machine gun towers, flamethrower towers and radiation towers. The game is pretty and humoristic, has many levels of a few different types, and it has quite a few different types of towers as well. At the beginning only some quite basic towers are available, but more can be purchased with the in-game gold. Compared to Plants and Zombies I prefer Fieldrunners 2 by far. Some maps of Fieldrunners 2 even contain director's commentary on how the map came to be. There are also many different enemies with different traits: some are very fast, some fly over your defense towers, some are immune to radiation. The Heroic difficulty level also basically requires you to use items that you can drop on the field for some brief additional effect, such as freezing, poisoning or exploding the enemies. Fieldrunners 2 integrates nicely with the Apple Game Center, allowing you to compare you scores with those of your friends.


SpaceChem


Reactor splitting Nitrogen and Oxygen molecules
A production assignment in action
SpaceChem is an excellent puzzle game unlike any other I have ever played. In the game your task is to build reactors to transform molecules and atoms to other molecules. You do this by creating "tracks" for molecule transporters (called "waldos") and by adding instructions to those tracks: input atom, grab an atom, drop the atom, rotate the molecule, etc. While this all might sound or look incomprehensible at first, the game actually has a good tutorial that slowly introduces you to all the concepts little by little. On some levels (so called research assignments) you must only build one reactor, whereas in others (production assignments) you actually design several reactors and how they connect to each other. The game is also available for Windows, Linux and Android, which may be one reason why it unfortunately does not integrate with the Apple Game Center. However, this game as well has a social component: on each level you can see statistics about all other plays of the level by everyone else. The statistics include the number of reactors used, number of cycles used and number of instructions used, so you can try to optimize your solution according to different attributes, if you want to. There are also in-game achievements to earn by, say, completing a certain level in a certain amount of cycles (in-game "ticks of time"). SpaceChem has a few dozen levels built in and more can be downloaded from the Research Net, so it should provide hours of fun.

That's it for this time, but finally, a tip: you can use the AppShopper.com site to watch for price drops and new apps. It also shows the price history of all the apps in the App Store, and you can browse apps by popularity and category.

torstai 28. helmikuuta 2013

iPad Mini for dummies

The Home Screen
I recently became an owner of an iPad Mini. Having never used any Apple products (despite reading the biography of Steve Jobs) it took some time to get the logic of the system. For those in the same situation, here are some random pieces of information that I personally found useful.

Enabling the Safari bookmarks bar

First, I tried the Safari browser. It's quite minimalistic, and by default you don't even see a bookmark bar. The weird thing compared to, say, Android or Windows is that you cannot control the settings of Safari from the app itself! This seems to be true with many other apps as well. Instead, you need to go to the Home Screen with all the icons and navigate to the Settings app. In there, select Safari and then toggle on the Always Show Bookmarks Bar setting.

Adding a bookmark
Now, how to add links to that bar? Navigate to the site you want to bookmark and click the rectangle-with-an-arrow -icon next to the address bar. You normally associate this icon with sharing content through email/Facebook/Twitter/whatever, but in Safari you also find the Bookmark option in the menu that opens. The dialog is simple: there's the name of the site, then the address, and finally a category, where you should obviously choose Bookmarks Bar.

Muting the keyboard sounds and using the Side Switch

The physical volume buttons of the device don't affect the keyboard sounds. By default you can mute those too with the little switch above the volume controls, but since muting the other sounds of the device is just a matter of briefly holding the 'volume down' button, it seems like a waste to use the switch only to mute the keyboard sounds.

Settings
To get completely rid of the keyboard sounds for good, navigate to Settings again, then Sounds, and then toggle off Keyboard Clicks. Now you can change the Side Switch function from Mute to Lock Rotation, which I find to be more useful. You can do that in the General panel of the Settings.

Multitasking Gestures

Multitasking Gestures are a way of quickly switching between apps. They are enabled from the same General panel where the Side Switch function is changed. The gestures are done with four or five fingers:
you can pinch to show the Home Screen, swipe left or right to switch between apps, or swipe up to reveal the multitasking bar.

Volume controls in the
multitasking bar
The multitasking bar shows you the most recent apps you have used. There's one very useful, non-obvious feature there too: swipe the bar right to bring up volume and brightness controls! Tapping the speaker symbol mutes the device, just like the Side Switch used to do before you switched it to rotation lock. ;) So if you'd prefer to hear the keyboard clicks at least sometimes, this might be a better option than to remove them altogether.

Disabling Auto-Correction

In theory, Auto-Correction fixes your spelling mistakes. In practice, however, it usually just makes you write things horribly wrong. To disable Auto-Correction, go to Settings -> General -> Keyboard and just toggle Auto-Correction off.