Thursday, December 12, 2013

PHP, Symfony2, and general development learning

I'm doing some PHP learning and figuring how to use the Symfony2 framework. It really takes out the crusty edges of PHP, and helps to create clean, powerful web apps.

Presentation on extensible code using event dispatcher:

Slide Deck:

It was like that when I got here: Steps toward modernizing a legacy code base:

It Was Like That When I Got Here: Steps Toward Modernizing a Legacy Codebase from NashvillePHP on Vimeo.

Slide deck:


Another Paul Jones Presentation about the insanity of development:

All You Jokers from Atlanta PHP User Group on Vimeo.

Slide Deck:


This has been helpful for me. I hope it is helpful for you, as well.

Sunday, November 10, 2013

SyntaxHighlighter Highlighting in new Blogger Templates

I've been having issues with SyntaxHighlighter with my new Blogger theme, so I'm using this post to get the bugs worked out.

SELECT *
FROM users
WHERE user_hasClue = true;


I was having issues with posting XML code, but I think I've resolved them.
Here's an example of my XML problems. The image below and the code above it should be the same:

 
  
  
  
  
  
  
  
  
  
  
 
 
  
  
  
  
  
  
  
  
  
  
 
 
  
  
  
  
  
  
  
 


For a period of time, the XML code snippets looked like this:


The two StackOverflow questions that have been helpful in researching this topic are here:

http://stackoverflow.com/questions/12464924/blogger-syntaxhighlighter-doesnt-work-at-all 

http://stackoverflow.com/questions/6849890/syntax-highlighter-3-0-not-working-on-blogspot/15328620#15328620

Here is the stuff I added to the "head" of my template HTML (feel free to use it if it's helpful):


Wiimotes (with Classic Controllers) and RetroPIE - a HOWTO

This tutorial shows how to get one to four wiimotes (the controller of Nintendo Wii) running with RetroPie with or without a classic controller (attached to the wiimote).

This is a repost (not original material).  It originally was posted by "rolsch" in the RetroPIE forums here:
http://blog.petrockblock.com/forums/topic/tutorial-to-get-wiimotes-with-classic-controllers-to-work-with-retropie/
This guide is also available on the RetroPIE wiki, but it's just too cool not to share.

Prerequisites


1. For the following I assume that RetroPi was installed and is running with other controls (like keyboard, joystick etc.). I followed the excellent tutorial http://supernintendopi.wordpress.com/2013/01/23/an-a-to-z-beginners-guide-to-installing-retropie-on-a-raspberry-pi/ for this (using the “RetroPie Project SD Card Image”).

2. You have a blue-tooth dongle (sometimes called blue-tooth adapter). For a list of dongles known to work with Raspberry Pi see http://elinux.org/RPi_USB_Bluetooth_adapters#Working_Bluetooth_adapters ).

Note: Put the dongle in one of the USB ports of the Raspberry Pi directly, don’t put it into a USB hub (I read somewhere that it doesn’t work even with an active USB hub).

Installation


Now install the needed parts:

sudo apt-get install bluetooth 
sudo apt-get install python-cwiid 
sudo apt-get install wminput

Getting the wiimotes to work


The "uinput" device needs to work with non-root users. To do so, create a file called /etc/udev/rules.d/wiimote.rules with the following line:
KERNEL==“uinput“, MODE:=“0666“

Reboot the Raspberry Pi to make this change active.

. Check that the blue-tooth dongle works: Command
/etc/init.d/bluetooth status
should return that bluetooth is working

. Scan for the wiimotes. Start
hcitool scan
and press 1+2 on your wiimote(s). After a short while, the output should be something like

Scanning ...
        00:19:1D:87:90:38 Nintendo RVL-CNT-01
00:19:1D:88:EF:12 Nintendo RVL-CNT-01
Take a note of the addresses of your wiimotes (the 00:19:1D:87:90:38 in the output above), we need that later.
Note: If the scan is not successful try it again. Sometimes you need to try it several times (I read that somewhere, but it always worked for me the first time).

Correct usage of wminput

For every wiimote, we need one wminput command to map the wiimote (and the classic controller) buttons to something emulationstation and the emulators can work with. wminput comes with configuration files (in directory /etc/cwiid/wminput). I created my own configuration file, which works if you use a wiimote with or without a classic controller. Create the file /home/pi/mywminput with the following content:

Classic.Dpad.X = ABS_X
Classic.Dpad.Y = ABS_Y
Classic.LStick.X = ABS_HAT0X
Classic.LStick.Y = ABS_HAT0Y
Classic.RStick.X = ABS_HAT1X
Classic.RStick.Y = ABS_HAT1Y
Classic.A = BTN_A
Classic.B = BTN_B
Classic.X = BTN_X
Classic.Y = BTN_Y
Classic.Minus = BTN_SELECT
Classic.Plus  = BTN_START
Classic.Home  = BTN_MODE
Classic.L  = BTN_TL
Classic.R  = BTN_TR
Classic.ZL = BTN_TL2
Classic.ZR = BTN_TR2
Wiimote.A = BTN_A
Wiimote.B = BTN_B
Wiimote.Dpad.X = -ABS_Y
Wiimote.Dpad.Y = ABS_X
Wiimote.Minus = BTN_SELECT
Wiimote.Plus = BTN_START
Wiimote.Home = BTN_MODE
Wiimote.1 = BTN_X
Wiimote.2 = BTN_Y
If the Raspberry Pi is started and emulationstation starts, we want to register the wiimotes so they can be used with emulationstation and the emulators.
I did it the following way:
mkdir /home/pi/bin
create file /home/pi/bin/attachwii.sh with the following content:

#!/bin/bash
hcitool dev | grep hci >/dev/null
if test $? -eq 0 ; then
wminput -d -c  /home/pi/mywminput 00:19:1D:92:90:38 &
wminput -d -c  /home/pi/mywminput 00:19:1D:84:EF:33 &
else
echo "Blue-tooth adapter not present!"
fi
Note: You need one wminput line for every wiimote you want to use (i.e. the above is for two wiimotes)
Note 2: You need to replace the addresses of the wiimotes above by the addresses of your wiimotes (shown by command "hcitool scan" as shown above).
make the script executable with
chmod 775 /home/pi/bin/attachwii.sh
have the script be started just before emulationstation starts. To do so, edit the file /etc/profile
The last line should be
[ -n "${SSH_CONNECTION}" ] || emulationstation
right before this line, add the line
/home/pi/bin/attachwii.sh
and save the file.

If you now do a reboot, wait until emulationstation has been started. When it did, press 1+2 on all of your wiimotes to register the wiimotes. Now you can "tell" emulationstation and the emulators to use the wiimotes (and the classic controllers). Here are my configuration files.
For emulationstation:
Content of /home/pi/.emulationstation/es_input.cfg for two wiimotes:


 
  
  
  
  
  
  
  
  
  
  
 
 
  
  
  
  
  
  
  
  
  
  
 
 
  
  
  
  
  
  
  
 


For retroarch:
End of file /home/pi/RetroPi/configs/all/retroarch.cfg (for two wiimotes):

input_player1_joypad_index = "0"
input_player1_b_btn = "0"
input_player1_y_btn = "2"
input_player1_select_btn = "8"
input_player1_start_btn = "9"
input_player1_up_axis = "+1"
input_player1_down_axis = "-1"
input_player1_left_axis = "-0"
input_player1_right_axis = "+0"
input_player1_a_btn = "1"
input_player1_x_btn = "3"
input_player1_l_btn = "4"
input_player1_r_btn = "5"
input_player1_l2_btn = "6"
input_player1_r2_btn = "7"
input_player1_l3_btn = "10"
input_player1_r3_btn = "10"
input_player1_l_x_plus_axis = "+2"
input_player1_l_x_minus_axis = "-2"
input_player1_l_y_plus_axis = "-3"
input_player1_l_y_minus_axis = "+3"
input_player1_r_x_plus_axis = "+4"
input_player1_r_x_minus_axis = "-4"
input_player1_r_y_plus_axis = "-5"
input_player1_r_y_minus_axis = "+5"
input_player2_joypad_index = "1"
input_player2_b_btn = "1"
input_player2_y_btn = "3"
input_player2_select_btn = "8"
input_player2_start_btn = "9"
input_player2_up_axis = "+1"
input_player2_down_axis = "-1"
input_player2_left_axis = "-0"
input_player2_right_axis = "+0"
input_player2_a_btn = "0"
input_player2_x_btn = "2"
input_player2_l_btn = "4"
input_player2_r_btn = "5"
input_player2_l2_btn = "6"
input_player2_r2_btn = "7"
input_player2_l3_btn = "10"
input_player2_r3_btn = "10"
input_player2_l_x_plus_axis = "+2"
input_player2_l_x_minus_axis = "-2"
input_player2_l_y_plus_axis = "-3"
input_player2_l_y_minus_axis = "+3"
input_player2_r_x_plus_axis = "+4"
input_player2_r_x_minus_axis = "-4"
input_player2_r_y_plus_axis = "-5"
input_player2_r_y_minus_axis = "+5"
Make sure that the settings are only one time in retroarch.cfg file (i.e. if you have a line
input_player1_b_btn = "0"
in the retroarch.cfg file before adding my lines, remove (or out-comment) the whole section. If you want to use more than two wiimotes, search for the line
input_player1_joypad_index = 0
in retroarch.cfg and add the a corresponding line for the other wiimotes. For example you should have the following lines in retroarch.cfg for four wiimotes:

input_player1_joypad_index = 0
input_player2_joypad_index = 1
input_player3_joypad_index = 2
input_player4_joypad_index = 3
Finally, add the following two lines at the end of /home/pi/RetroPi/configs/all/retroarch.cfg:

input_enable_hotkey_btn = "0"
input_exit_emulator_btn = "1"
This will exit the emulator when you press A+B simultaneously on the wiimote (or the classic controller).

Note: the config files above work for wiimotes with or without classic controller.
Note 2: If you want to use the wiimote (i.e. not only the classic controller) and you are using my config files, you need to hold the wiimote horizontally (with the power button on the right).

Hope that helps.

Monday, September 9, 2013

Embedding Google+ Posts, for newbies

Looking to embed Google+ posts in your blog?  Google wants to help you do it!  Check out the embedded Google+ post below for more info.



For those looking for the quick and easy way to do it, click the options menu on the post in question and select "Embed Post". Copy, paste, and done. This should be pretty straightforward for people. Enjoy!

Tuesday, September 3, 2013

Arcade games in a museum?

Recently, I had the privilege of making a visit to the Neville Public Museum's "The Golden Age of Video Arcade Games".  it is an exhibit dedicated to the classic era of arcade games from the personal collection of area video game collector Bradley Czech.

Here are some of the pictures I took when visiting the exhibit.

Everyone loves advertising!

The Neville Museum in all its glory.

The entrance to the arcade exhibit.

Death Race.  Very controversial in its time.

Tapper and its safe-for-kids alternative, Root Beer Tapper.

Mortal Combat?  Pan-Mania?  Spell check is great, just not for arcade game titles.

Fix it, Felix!

Wait a minute, are those people PLAYING arcade games?  

Free play does make it a little easier to try games like Super Pac-Man for the first time.
If you're looking to find out more about the games in the exhibit, the exhibit has been extended to September 15th, 2013 for those living in the Green Bay area.  For the rest of you, Bradley Czech does give video explanations of some of the games in his collection via his YouTube page.  Keep in mind that this exhibit focuses on games up to 1985, so don't come expecting to play Teenage Mutant Ninja Turtles, WWF WrestleFest, or The Simpsons Arcade Game.



Robot Turtles: Teaching programming to kids in our analog world

There is currently a Kickstarter campaign going on for a game called Robot Turtles, and it is a board game that helps teach children the fundamental concepts of programming. I think that is incredible.

 I have backed this project, and I look forward to playing it with the young humans in my life.

Hurry! The Kickstarter campaign only lasts until September 27th.

MagPi - Robots and Old School Games! Hooray!

I can't get enough of these MagPi releases.

Issues 15 and 16 of MagPi focus on retro games and robotics, respectively.

Enjoy!

Friday, June 21, 2013

Appleton Makerspace tour

Behold: a tour of the Appleton Makerspace!

Sega Genesis Cartridge USB Hub Hack

Here are some photos from my most recent project. I decided to put a powered USB hub inside of a Sega Genesis/Mega Drive cartridge. It will mainly be used as an accessory for my Raspberry Pi (which is also inside of a Genesis cartridge).  I had a cartridge left over from that project and an ugly powered USB hub, so I figured that it would be fun to put the hub in the other cartridge.  Also, the hub has a 2.6A power supply, so I'll probably use the hub to power the Pi and cut down on extra power cables.
Mockups and measurements of the original Dynex USB hub.
A picture of the actual board inside of the Dynex USB hub.  It is about 65.2mm wide.
The board fit almost perfectly between the two screw holes.  I had to grind off about a millimeter on the inside edge of each screw support.
I marked the ports with an x-acto knife and ground the plastic off to fit the hub inside.
Here is a closeup of the grinding that was done.  it's not pretty, but it was effective.
An image of the hub inside its new home.  The hub probably feels like a hermit crab.
Using equal parts precision measurement and random guessing, I ground holes into the back of the cartridge to expose the top two USB ports.
A first look at the two halves together.  The space for the actual cartridge meant that I only needed to grind one half of the opening.
Now that I know the board fits, it's time to use some sugru to keep it in place!  One 5 gram package should do the job nicely.
Here is an image with the board held in place by sugru.
I went to the local hardware store to replace the 4.5mm security bit that comes standard on the cartridge with a plain Phillips screw.  I'm probably not going to be a hand model in the near future.
The screws cost me a whopping 8 cents each.  If the helpful person at the store is to be believed, they are #4 sheet metal screws, 1/4 inch long, with a combo pan head.
A closeup with the screws in place.
Verifying that the board still fits with the sugru in place.  Luckily, it fits like a glove.
The USB ports stick out of the back of the cartridge a couple millimeters, but that doesn't bother me, as long as it still fits in the case........
Hooray!  The cartridge still fits into the original case!
I haven't updated the artwork on the case or cartridge, because it's fun to open the case up to show that these two random football games are much more than meets the eye.

A tip of the hat to +Morgan Burton at Retro Reused for giving me the idea of putting the USB hub in a cartridge.  Thanks!

Many thanks go to the Appleton Makerspace, who provided all of the grinding tools and workbench space to me.  It allowed me to finish the entire project during one evening at the space!

Wednesday, June 19, 2013

Ben Heck's Portable Raspberry Pi Gaming System

Ben Heck is an amazing hacker.  Yet another example of his maker chops is on display in the Raspberry Pi portable gaming console.

Sunday, June 2, 2013

Impressive Neo Geo Bartop Build

Here is the design: Here is one of the process videos: Here is a video showing off the finished product:

That is a very clean custom job.  I commend the maker, UnstupidTube.  Note the clever hack to enable two player mode.  Check out UnstupidTube video feed for more videos, as well!

Monday, May 6, 2013

DHMN Augments the Artemis Bridge Simulator Experience with TurBULL Encabulator!


Do you like space? Gaming?  Clever hacks?  If so, read on!
Members of the Distributed Hacker/Maker Network (DHMN) have used the 2013 version of the Red Bull TurBULL Encabulator from the Red Bull Creation Contest to create an interesting augmentation to the Artemis Bridge Simulator interface. This is the 2013 qualifier build for the Red Bull Creation Contest. The setup intercepts the communications between the Artemis client and the Artemis server, and decodes the packets with Python. It then displays informational items such as a ship movement indicator, shield status, damage detection, and "red alert" status. Check out the video:

This setup is currently installed in the main room of the Appleton Makerspace, powered by DHMN.

As noted later in the video, the installation also includes a "rave mode" that visually changes based on the music being played.

Judging for the Red Bull Creation contest will occur from May 6-11. The winners will be flown to New York to compete in the 72 hour Red Bull Creation main event and exhibition. The main event will be held in McCarren Park, Brooklyn NY from June 12-16.

EDIT: The code has been posted online to github: https://github.com/dhmn/artemispy

EDIT #2: I've decided to upload another gameplay video from the Appleton Makerspace.  It shows how the setup works with the lights on.  I think it's still quite effective, although I apologize for the shaky footage from my camera:

Sunday, May 5, 2013

Friday, April 12, 2013

Raspberry Pi - April NEWLUG meeting video!

I was the presenter at the April 2013 NorthEast Wisconsin Linux Users Group (NEWLUG) meeting. They asked me to talk about the Raspberry Pi, and I was happy to comply.
Here are some links to items mentioned in the presentation (listed in no particular order):


OK, I think that's enough links.  Have a nice day!


Tuesday, April 9, 2013

Steam for Linux, Humble Indie Bundles, Shadowrun, and Linux Gaming

In this video, I give an impromptu presentation on Steam for Linux, Humble Bundles, and the upcoming Shadowrun Returns video game.  The presentation occurred during the March 2013 NEWLUG meeting.  Check it out!

March NEWLUG video #1 - OpenSCAD

Tim Bolz gives the lowdown on OpenSCAD during the March 2013 NEWLUG meeting - check it out!

Friday, April 5, 2013

DHMN - Appleton Makerspace - pictures before the move-in!

During the Distributed Hacker/Maker Network make session on Thursday, April 4th, some of the DHMN officers offered to take make session attendees on a tour of their newly obtained facility before the move-in date.  I happily complied, and took some pictures for posterity's sake.  The facility is located at 120 N. Morrison Street in Downtown Appleton, close to the Appleton Public Library and Harmony Cafe.  It is the basement of The Avenue HQ coworking facility.


View Larger Map

This image is of what may become the "lobby" of the space, situated at the foot of the stairwell from the The Avenue HQ co-working facility upstairs.


Here is the back hallway, giving access to some of the back rooms.


Here is the opening to the main makerspace room.  Drywall is still drying on the walls.


Here is a blurry look at the mainspace.  Our DHMN President is in the foreground.


Here is the excellent kitchen. I can almost smell the Hot Pockets!


One of the storage rooms contains a positively ancient phone system.




Check out the awesome hand soldering!

That's about all for now. If you're interested in being a member and watching this space develop, consider giving a donation or becoming a member!

Thursday, April 4, 2013

MagPi Issue 11 is out!

The cover article is about the Minecraft Pi Edition. Also check out the article about setting up your own Wifi access point using the Pi.

Monday, March 4, 2013

Saturday, February 2, 2013

MagPi - Issue 9 is out!

Issue #9 of MagPi is out! LadyAda is on the cover, so you know it has to be awesome!

 Check it out:

Thursday, January 17, 2013

Wednesday, January 9, 2013

Pebble's CES Announcement Presentation

Pebble is coming out!  Really!  For real!
Video of the presentation starts at 11:45.
It seems like the old "crazy color blue people" video has been taken down from the livestram. A trimmed and color corrected version has been posted to youtube here:

Thursday, January 3, 2013

Twitter History

Apparently, embedding your recent Twitter history is pretty easy. I might add this to the blog layout in the future.

 

Tuesday, January 1, 2013

OUYA Unboxing!

This unboxing comes courtesy of Ian Boswell, for Rush Bros development.