Adobe Shadow

This is probably the greatest thing since sliced bread: Adobe Shadow (Sd).

In summary, it synchronizes your desktop (PC and Mac) browser with your hand-held touch device (both Android and iOS) for streamlined mobile design, development, and troubleshooting. You can get up and running in 3 easy steps:

  1. Download Adobe Shadow from Adobe Labs
  2. Download the app on your mobile device
  3. Download the Google Chrome Browser extension

I haven’t used it yet, but will give it a whirl within the next few days… and probably post my experience.

AS3: BitmapData.draw with Video

When drawing video/camera data to a BitmapData object the original size is not respected. After a quick search, this page as the answer: “Size mismatch when getting BitmapData from Camera”

The solution:

AS3 Stage3D: Away3D

So Away3D has been around for some time now (they’re currently in v4.0.0 beta) and I have not tasted this new hardware-accelerated library for Flash. In my previous years I worked with Papervision3D in AS2 (yes, version 2) and quickly moved to Papervision3D 2 for AS3. Papervision3D was pretty easy to use (I have a small Maya background) and actually got a chance to teach it to my students a few times as an intro to high-level 3D in my Intermediate ActionScript class. The problem was performance: I couldn’t get everything I wanted out of p3d like advanced UV mapping and high poly scenes; I should give it credit though, it did pioneer 3D for flash (AFAIK) and eventually implemented shader support and did a great job at it (e.g. phongs). It eventually fell off of my radar due to random professional reasons (like working around the clock on projects that $$) and other techy stuff.

Overview

I was looking for something with direct hardware acceleration and a few other clever native techniques. A colleague of mine told me about this thing called Stage3D, a.k.a “Molehill,” which i totally forgot about. This part of Flash renders separately from the DisplayList but just on top of the StageVideo, and utilizes the GPU (holy shit!). I was leery at first since my experience with Flash in previous had been 2.5D (two-n-a-half-D) and I wasn’t impressed especially coming from a P3D background. Apparently in my absence it had come a long way (at the time of this writing the current version is 11.2 beta). So I gave it a whirl.

I have a Gentoo mindset (even though my weapon of choice is RHEL), so I naturally downloaded the v4 beta, which I came to find had severely limited documentation (found some generated docs here, although not perfect). Found the v4 documentation, I guess someone flipped a switch at a datacenter somewhere… Not good for entry-level development into this new lib! Not to mention, the examples were AMAZING… amazingly overdone – I just wanna see how the stupid thing works; that’s great that you can generate trees and import 3DS models, congratu-fuckin-lations, but what about us n00bs, i need some practical and minimalist examples.

TL;DR: Right to the Code

After an hour of toying with it, skimming through some haphazard docs, watching for code hints and perusing around the source code I wrote this little ditty…

Hope that helps. Think of it as a kickstarter.

Development Setup

So, I completely forgot the installation steps for using Away3D. BTW, I use FlashDevelop (currently have the latest version 4.0.1RTM) and am building against Flex SDK v4.6.0, AIR 3.1 (which I think was auto-downloaded by FlashDevelop) for flash player 11.

  • For portability (but not flexibility or debugging) download the away3d core 4.0b SWC.
  • Create a new project in FlashDevelop
  • Put the SWC in the ./lib folder (or wherever… just do the lib folder)
  • In FlashDevelop right click on “away3d-core-fp11_4_0_0_beta.swc” and choose “Add to Library” – it should turn blue
  • That’s it, you’re ready to go.

I can see myself getting deeper and deeper into this sexy beast of a lib. And the fact that my CPU utilization is a big fat ZERO and i’m getting uber sweet FPS, i’m hooked. About friggin’ time Flash, about time!

Working SWF

Away3D in the player window (screen shot)

Download the ZIP containing the demo (no source code): away3d-simple-demo

Resources

MaxMind GeoIP + PHP PECL

Overview

Getting around to writing a geo IP look-up script and needed to leverage maxmind’s geoip database. First things first, get the geoip lib installed and ready to go or else the dat file isn’t going to do me any good.

Initial Setup: First Try

At first I went with the PEAR route just because it wouldn’t require make installing’ing any dynamic PHP extensions (.so). Went to do a pear update-channels for the first time and got a boat load of eregi errors – off to a great start. Turns out CentOS 5.7 php53 (php 5.3.3) package w/ php-pear is not compatible – bastards! RedHat has an update available but is only available to their customers which doesn’t include me (since i go the free route of  centos). Did some extra googling and found this: php-pear-1.4.9-8.el5.noarch.rpm.html (version 8.el5 versus centos 5.7’s native version 6.el5). Did a little wget magic followed by a yum install <path to package> and ta-da, no more eregi errors. Did a pear install Net_GeoIP and it worked too.

After all that hard work and fidgeting around, I read this little line on MaxMind’s website:

PHP Extension on PECL
Download a PHP extension that allows you to embed the GeoIP C Library inside PHP for improved performance. There is a new fork with a more complete implementation.

Crap! I love good performance and I’d take a compiled lib over an interpreted one any day. PEAR headache: all for naught. Proceeded with a pear uninstall Net_GeoIP, then cried for a half an hour since i just wasted 15 minutes (for a total of 45 man minutes wasted, yes).

Next stop, PECL.

Initial Setup: Second Try (start tl;dr)

  1. Started with a pecl update-channels, and all went well. That’s a first.
  2. pecl search geoip – got results, sweet.
  3. pecl install geoip… got through maybe 40 lines of the ./configure and it bombed, can’t find a valid compiler
  4. no worries, do a little yum groupinstall “Development Tools” and now I’ve got a C compiler (as well as automake and a few other required tools)
  5. pecl install geoip… configure bombs again, this time I’m missing the geoip linux packages, and at this point i’m thinking, “how many friggin dependencies are there?” holy overhead batman.
  6. yum install geoip-devel, wait, no,yum install GeoIP-devel since yum is case sensitive – this gets me everything i need.
  7. 3rd times a charm: pecl install geoip – install completes, tells me to add “extension=geoip.so” so I do like the robot I am, doing what a linux prompt tells me to do.
  8. service httpd restart – cycling apache allows for the geoip section to appear in the phpinfo() call, not sure why this is (more mysteries!)

OK, I got the libs installed and the commands are asking for me to call them.

Installing the MaxMind database

  1. mkdir /usr/share/geoip
  2. wget and extract geoip db to /usr/share/geoip (http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz)
  3. chmod -R 755 /usr/share/geoip
  4. nano /etc/php.ini
  5. add a [geoip] config section:

  1. service httpd restart
  2. check the phpinfo() for custom_directory
Let the scripting begin. I’ll stop writing now; from this point forward it’s all about RTFM (link below…)

Resources

RHEL + SELinux: Managing Confined Services

What this post is really about: http://linux.web.cern.ch/linux/scientific6/docs/rhel/Managing_Confined_Services/

Found this gem of a guide when it comes to managing SELinux. This page is a mile-n-a-half long, but a great read when you’ve got nothing to do but research linux security policies. I stumbled across it when searching for the section #sect-Managing_Confined_Services-The_Apache_HTTP_Server-The_Apache_HTTP_Server_and_SELinux (i think the docs are taking SEO to a whole new, overkill, level – or perhaps its just scripts “do what it do”). This doc has an awesome intro to custom selinux policy generation.

What this post ended up being about (the title is completely misleading):

I was configuring a utility server with a “utilwww” user (needed to test some geoip scripts, using maxmind db api,  on a boat load of IP addresses). For easier access i wanted to grant FTP access using vsftpd – crap, in retrospect I could have just used SCP, oh well – but was having some problems with selinux blocking the reads on the dir. This was expected since the type wasn’t set to httpd_sys_content_t (the VM is running centos 5.7 btw).

Another problem was that by default the home dir’s mode was 700. Not sure why useradd does this and not 744 (or it might have been 744, don’t recall exactly). After scratching my head a bit more wondering why the sucker wasn’t working, i realized that apache (httpd) needs execute perms as well, so a little chmod 755 utilwww did the trick.

In summary (might be missing a few steps here, but this is at least the high level):

puttin’ stuff down.

putting tips and tricks here that are in my head. at least WP will retain the information, rather than FB… sometimes I ask myself how the hell I did something and go to search for it: not in my browser history, not in old fb posts (plus there’s too much other crap to sift through), and I don’t post to anything else.
…also rolled this thing into twitter, maybe it’ll help someone.