The Blog of Maxim Porges
  • How to Build An Arduinome (Part 3): Diodes and LEDs

    How to Build an Arduinome (Part 3): Diodes and LEDs from Maxim Porges on Vimeo.

    In this part of the series, we take a look at the diodes and LEDs, and I solder them on to the SparkFun PCBs.

    2010.08.14 - Tags: Arduinome Electronics Making / no responses / add a response

  • How to Build an Arduinome (Part 2): Components

    I’m working my way through the Arduinome making-of videos, and this is the first one I’ve been able to upload.

    How to Build an Arduinome (Part 2): Components from Maxim Porges on Vimeo.

    Unless I decide to spend $60 a year on a Vimeo pro account, it might be slow-going with the uploads, but please bear with me! The whole entire process will be documented, and you’ll be able to see the whole collection of videos on my Arduinome page once they are all done.

    2010.08.01 - Tags: Arduinome Electronics Making / no responses / add a response

  • The Arduinome is Finished!

    Loads more to come in the way of a detailed video build log, but here’s me messing with the Arduinome running the mlrv patch in MaxMSP. It basically turns the Arduinome in to a sample player, which was the primary reason I built it.

    This is my first time messing with mlrv, so please excuse the fact that I suck. Your ears should bleed slightly less during the second half as I start to get the hang of it.

    2010.07.26 - Tags: Arduinome Electronics Making / 3 responses / add a response

  • Loom Becomes as3commons-bytecode

    As you know if you follow my blog, I was working for a while on a bytecode parsing/weaving library for AS3 called Loom. I worked on this library during the six months coming up to my wedding, and then after we got back from our honeymoon I decided I just couldn’t be bothered to dig through binary with a hex editor any more.

    I offered the project up to the people on the Loom forums, but there were no takers… until now! Roland Zwaga has been emailing me on and off for a few weeks asking questions about the library, which he’s been digging in to in order to add functionality to as3-commons and Spring Actionscript. They needed a way to extract the private and protected class data (amongst other things) during reflection, and the only way to do that in AS3 at the moment is to parse the bytecode. Rather than starting from scratch, Roland used Loom as a basis for understanding the AVM2 spec, and built from there.

    After asking me if I minded (which of course I didn’t), Roland’s decided to publish the guts of Loom with his additional work as as3commons-bytecode. He sent out a message to the as3-commons dev list today as follows.

    Good day gentlemen,

    as3commons has a new addition: as3commons-bytecode. This library used to be known as Loom-as3 (http://code.google.com/p/loom-as3/), sadly before Loom was completed its creator, Maxim Porges, didn’t have the personal time anymoe to invest in its completion. Which is a huge shame since Loom is one of the most complete Actionscript implementations of the AVM spec.

    A while ago I was sifting through the Loom sources to try and get a better understanding of all of this bytecode business and came to the conclusion that Loom would be an excellent addition to as3commons and would, as a first, be a great basis to implement bytecode based reflection on.

    I just committed version 0.5 which will give you just that, the ByteCodeType class is the main entry point and c an be used like this:

    1
    
    ByteCodeType.fromLoader(FlexGlobals.topLevelApplication.loaderInfo);

    or if you want to parse the loaded RSLS as well:

    1
    2
    3
    
    for (var info:* in systemManager.preloadedRSLs) {
    	ByteCodeType.fromLoader(info);
    }

    After that the ByteCodeType instance can be retrieved through these methods:

    1
    2
    3
    
    ByteCodeType.forInstance();
    ByteCodeType.forClass();
    ByteCodeType.forName();

    or, if you’d like to inspect all of them, loop through the cached instacnes like this:

    1
    2
    3
    4
    5
    6
    
    var typeCache:TypeCache =
    ByteCodeType.getTypeProvider().getTypeCache();
    for each (var key:String in keys) {
    	var type:ByteCodeType = typeCache.get(key) as ByteCodeType;
    	/* ... do something... */
    }

    The resulting reflection classes are all inherited from the ones found in as3commons-reflect but augmented with the extra information we can extract from the bytecode. This includes private and protected members, optional parameter values, parameter names (allthough those values are not always reliable), initialized member values, and more.

    Anyways, I think there’s PLENTY of room for improvement and other functionality for this library but for now I would really appreciate it if you guys could check it out, give it a test drive and give your opinion, criticism, etc,.

    100 million kudos and the same amount of respect in tons go to Maxim Porges who did all of the heavy lifting in this library, I only finished some little details added the reflection bits.

    have fun with the code!

    cheers,

    Roland

    Although I didn’t have any interest in finishing Loom, I didn’t want all of the work I put in to it to be completely in vain. One of the things I really like about the open source community is that you can take somebody else’s work and put it to use for whatever you have in mind for it. In this way, people can learn so much from each other and push the envelope forward in to new areas the original authors never thought of. Loom certainly wouldn’t have been possible if I hadn’t been able to look deep in to the source of the Mozilla Tamarin and hurlant eval projects.

    In closing, I’m really glad to see my work on Loom contributing value to the community now as part of ascommons-bytecode, and I look forward to seeing where things go under Roland’s leadership.

    2010.06.27 - / 5 responses / add a response

  • Arduinome Coming Soon!

    I ordered the parts for my Arduinome today, referencing the excellent sources at FlipMu and CuriousInventor.com.

    I’ll be documenting my journey in to Arduinome construction as the parts come in, so stay tuned! I’m also going to be maintaining a page on my site with all my Arduinome reference materials for others to follow in the future.

    In the interim, here’s the guy from Pretty Lights jamming out on his monome (the thing that inspired the Arduinome). He’s using a sample manipulation app for the *nome devices called mlr, which is a Max/MSP patch. You can run pre-compiled patches in the runtime without having to buy Max/MSP.

    2010.06.20 - Tags: Arduinome Making / no responses / add a response

  • Setting up WebDAV on OS X

    I was interested in setting up a WebDAV server on my Mac so that I could send files to and from it on my iPad with GoodReader. I found an article about setting up WebDAV on OS X, which was almost correct. Here’s my updates with the proper process and correct configuration.

    Before you start, note that any changes made to the Apache configuration files require a restart of the Apache server. This can be done by either checking and unchecking the Web Sharing checkbox under Sharing in System Preferences, or running the following command:

    1
    
    sudo apachectl graceful

    These instructions help you to set up a WebDAV server on your machine which exposes the directory /Library/WebServer/WebDAV as your document root. If you want to set up a different directory, then change that path accordingly in all the remaining instructions. Note that the Apache user seems to need to own the path that you expose over WebDAV, so keep that in mind as you are setting things up.

    1) Start Apache via System Preferences
    Open System Preferences => Sharing and click the checkbox for Web Sharing.

    2) Modify /etc/apache2/extra/httpd-dav.conf
    Open this file and remove any existing WebDAV entries. Modify accordingly to end up with something like this. You should only have one DavLockDB entry anywhere in the file; in my case, one was already there so I left it alone.

    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
    
    ...
    DavLockDB "/usr/var/DavLock"
     
    # Locks down all directory access by default. You can then override
    # this with additional <Directory/> entries
    <Directory />
        Order Deny,Allow
        Deny from all
    </Directory>
     
    # Exposes the contents of /Library/WebServer/WebDAV on the
    # URL http://hostname/webdav/
    Alias /webdav "/Library/WebServer/WebDAV"
     
    # Sets up WebDAV with access controls. Uses digest auth so you
    # don't need SSL for your credentials (although note that none
    # of your file transfers will be encrypted, so don't pull anything
    # sensitive over the wire without SSL). Specifies a file with
    # usernames/passwords, and dictates the realm applicable
    # to this configuration
    <Directory "/Library/WebServer/WebDAV">
       Dav On
       Order Deny,Allow
       Allow from all
     
       AuthType Digest
       AuthName WebDAV-Realm
       AuthUserFile "/usr/var/webdav.passwd"
       Require valid-user
    </Directory>
    ...

    If you want to get fancy, there is some additional information on these directives for mod_auth_digest and mod_dav at the Apache web site.

    3) Open /etc/apache2/httpd.conf and make sure these lines are uncommented
    This enables the appropriate Apache modules that will make use of the configuration you just created.

    1
    2
    3
    4
    5
    
    LoadModule dav_module libexec/apache2/mod_dav.so
    ...
    LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
    ...
    Include /private/etc/apache2/extra/httpd-dav.conf

    4) Create directories with appropriate permissions

    1
    2
    3
    4
    
    sudo mkdir -p /usr/var
    sudo mkdir -p /Library/WebServer/WebDAV
    sudo chown -R www:www /Library/WebServer/WebDAV
    sudo chown -R www:www /usr/var

    5) Create the password file and set appropriate permissions

    1
    2
    3
    4
    5
    6
    
    maxbookpro:usr mporges$ sudo htdigest -c /usr/var/webdav.passwd WebDAV-Realm "mporges"
    Adding password for mporges in realm WebDAV-Realm.
    New password: 
    Re-type new password:
     
    maxbookpro:usr mporges$ sudo chgrp www /usr/var/webdav.passwd

    6) Restart Apache

    1
    
    sudo apachectl graceful

    7) Test
    As the original article suggests, the easiest way to test is to mount your WebDAV server via Finder.

    To do this, open Finder and select Go > Connect to Server (⌘K). Type your WebDAV URL, or http://localhost/webdav/ if you are on the server locally. Note that the trailing slash (“/”) is important, and you will not be able to connect without it.

    You will be prompted by Finder to type in your username and password, and you need to be careful to enter these exactly as specified for the htdigest command.

    Upon success, you will have mounted your WebDAV folder within Finder, and you should be able to copy a file to the folder.

    I found that the trailing slash was not required when mounting the WebDAV drive in Snow Leopard, but it doesn’t hurt. You’ll be able to both read and write files to the WebDAV share.

    Troubleshooting
    If you have any issues, check Console for logs from Apache. It will yell at you if your config is bad.

    2010.06.19 - / 3 responses / add a response

  • Possible Fix for iPad Wifi Problems

    There’s a well-known issue with iPad wifi. While I don’t have the chronic wifi problems that I have heard of others having, I did have some issues with my wifi connection being pretty weak from my home router in certain rooms of the house (typically the ones furthest from the router). I have an Airport Extreme base station, one of the newer square models.

    The problem I have had is a one-bar signal when furthest away from the router. This is not a problem on my laptop, so I knew it had to be something with the iPad reception. The low reception can be a pain on the iPad when watching videos and other high-bandwidth activities. Just for giggles, I switched my base station over to 802.11n-only from 802.11g/n-compatible, staying in the 2.4 Ghz spectrum. I’m getting much better connection speeds all over the house now, with five bars in every room.

    2010.06.07 - Tags: iPad / no responses / add a response

  • Bluetooth Headphones and iPad

    After successfully pairing my new Bluetooth headphones with my iPad, I had issues getting them to reconnect after the headphones were turned off and on again. I would turn Bluetooth back on on the iPad, and hold the headphones near the device, but they would never reconnect. I tried un- and re-pairing the devices, and while the pairing operation worked and would stay connected following the pairing until the headphones were turned off, the headphones still wouldn’t reconnect after turning them off and on again.

    To make sure it wasn’t an issue with the headphones, I tested reconnecting them to my Mac after turning them off and on again. This worked flawlessly in the usual fashion – turn them on, put the devices near each other, and the Mac connects to the headphones automatically.

    In staring at the Bluetooth menu on my iPad, it suddenly occurred to me that the name of my headphones in the list of devices might have been a button. Sure enough, I turned the headphones on again and clicked the name of the device in the list, a spinner showed up, and then they reconnected.

    Checking the iPhone manual, there’s nothing in there that describes this process. I suppose it’s one of those things that should be intuitive, but in this case it was not intuitive for me since I’m used to my Macs greedily reconnecting to any devices they have been connected to before without being asked. I actually prefer this process with the iPad, since I have several devices that I share Bluetooth accessories with, and once the accessory is connected it won’t make itself available to be connected to anything else until it is disconnected. I’ve had issues with this a few times when I’ve turned my work laptop and personal laptop on at the same time in my home office. They’re both paired with my Bluetooth keyboard so whichever one binds to the keyboard first wins, regardless of which one I actually want to use the keyboard with. The only way around this is to turn off Bluetooth on one of the devices until the one I want to use the keyboard with has claimed it, which is kind of a pain.

    2010.05.30 - Tags: iPad / 4 responses / add a response

  • Fixing “Bluetooth audio failed” Error Message on Mac OS X with Sony DR-BT50 Headphones

    I’ve been using my iPad to watch movies on YouTube and Air Video while wandering around the house, usually on my studio headphones (quite simply the best headphones I have ever put on my head – super comfy for as long as you care to wear them and amazing sound). I like close-ear headphones since they don’t fall out of my ears like earbuds do, and I can watch movies without disturbing my wife’s mission to watch every reality TV show episode ever produced.

    More often than not, I’ll get hungry or a hankering for a cup of tea halfway through a movie, and I’ll wander in to the kitchen to make something to eat. Typically, I throw the iPad on the counter and will wander around fixing a snack while listening to the movie. Although my studio headphones have a nice long cable, I’m always worried that I’m going to pull the iPad off the counter and smash the screen.

    A week or so back I caved and bought a set of Bluetooth headphones. My criteria were great sound, comfort (most closed designs hurt my ears since I have a giant head), travel-ready, and reasonably priced. I found two pairs I really liked on Amazon: the JayBird SB1Bs and the Sony DR-BT50s. The JayBirds looked cooler and got similarly good reviews to the Sonys. I was expecting to spend about $100 for a decent set, so pricing was decent for both. Ultimately, I bought the Sonys because they were foldable for travel; I plan on using these headphones both at work and at home, and I was afraid I might crush the JayBirds in my backpack.

    Headphones arrived today, and paired seamlessly with my iPad on the first try. One of the reviewers of the Sonys said that they introduced latency when watching movies (causing lip sync issues), but I’ve seen none of that with either my iPad or my MacBook Pro running Snow Leopard so the latency must have been an issue with their device. Sound quality is excellent, they are comfortable, and they came with travel bag which I was not expecting – so, mission accomplished. The only minor glitch I have noticed is occasional static when working in proximity with my Bluetooth keyboard. This hasn’t been a big deal so far.

    Although iPad pairing was seamless, pairing with OS X was not. I went through the Bluetooth Setup Assistant, which paired right away and gave me the all-clear that the pairing had worked. About five seconds after closing the assistant, I got the following error:

    Bluetooth audio failed.
    There was an error connecting to your headset. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    I tried removing the device and pairing again; same issue. So, I selected the headphones in the Bluetooth menu under System Preferences and clicked the little drop-down menu beneath the list (next to the + and – buttons). One of the options says “Configure this device…”, so I opened that up. A Bluetooth Headset Setup application opened, showing me two checkboxes for the device: “Use device as a headset for this computer” and “Use device as headphones for this computer.” I deselected the headset option, leaving only the headphones option selected. Sure enough, everything worked, and my headphones showed up with a green light in the list of Bluetooth devices, connected and ready to use.

    For those of you who might be considering a pair of these headphones for an iPad or Mac, know that the controls on the headphones for volume and stop/play are the only ones that work on the iPad/iPhone at the moment. The fast forward/rewind controls also work on the Mac, and I haven’t tried the previous/next group ones yet so I can’t comment on them.

    2010.05.29 - Tags: iPad / 16 responses / add a response

  • Programming the Meggy Jr.

    I built my Meggy Jr. about a month or so back, and since I was having a pretty lazy weekend I figured I would mess around with programming it.

    The device comes with an “advanced” API that can manipulate the finer details of the device, and a simple wrapper API. The simple API is the one that 99% of people will use to program games and other applications, since it lets you do things like play sounds, turn the LEDs on and off while specifying their color, check for button presses, etc. Code is C/C++ written in whatever editor you want, and compiled and shipped to the device over a USB cable using the Java-based Arduino IDE. It’s a really neat little package and very easy to get started with.

    Here’s a picture of my Meggy hooked up via the USB adapter cable. The cable plugs in to the headers on the top right, and can be easily unplugged for taking the device with you.

    I wrote a basic program to test things out, and then decided to start on a library for a game (since I have been thinking about some kind of multi-colored Othello/Reversi that might be fun to figure out). However, as soon as I tried going from a monolithic one-file procedural application to something using classes, I started to get compiler errors about duplicate method implementations. Cracking open the code, I found out that the guys who wrote the Meggy API put all the simple API calls inline in a header file. As a result, whenever you want to include the header more than once, you end up with compiler errors for the duplicated object code.

    I posted a question to the forums about whether there were any specific reasons why this design approach had been chosen over a classic header/class file, but after taking a quick look at the code I couldn’t see any reason and decided to port the library to a header/class setup. If anybody is interested, the final code for the solution is posted on the Meggy forums. Also, if you want to download the library files you can get them here.

    I originally wanted to be a computer engineer in college, but chose software engineering instead since the market was so full of jobs at the time and I seemed to have some natural ability with it. My recent foray in to learning electronics has resulted in a keen interest in building devices and writing software for them, so apparently this passion for hardware has been laying dormant for over ten years. My original goal when I bought Make: Electronics was to get enough expertise to build an Arduinome, which looked really daunting at the time. Having assembled the Meggy last month, and having looked at the plans again in detail this weekend, building an Arduinome now looks like a walk in the park. To that end, I ordered an unsped Arduinome shield PCB from BatchPCB.com on Saturday, and will order the rest of the parts when the board goes off to China for fabrication.

    After that’s done, I’m going to get really ambitious and try to build an MB-6582. The project itself looks somewhat tougher from every angle (construction, case assembly, etc.), although by far the hardest part will be tracking down 8 SID chips. I’ve got one in my SIDStation, but that’s not going anywhere. There are plenty of C64s to be had on eBay, but when you only want the SID chip it’s a little hard to justify dropping $30+ 8 times. Luckily, the main board for the MB-6582 is set up to have as many or few SID chips as you have on hand, so I can start off with 2 and work my way up as my budget allows.

    2010.05.23 - Tags: Making / no responses / add a response