Saturday, 23 March 2013

Why are there stars?

For anyone who can remember the old projector at Lollipop, you will probably also remember what has lovingly been referred to as the "startfield" which appeared in the conference room. This pattern of a mixture of flickering and static white dots were, as you might have already guessed, dead pixels. Or more accurately stuck pixels.

Our DLP projector uses an array of tiny mirrors to reflect light at just the right time as each color filter on a spinning wheel moves in front of the lamp to produce a recognizable image. These mirrors are stuck, reflecting the light constantly. Why? My guess is that since the projector sat so low and at an angle on the conference table that it needed the keystone to be highly adjusted to make it seem straight. This cut off a large section of the DMD and these mirrors were kept off, I think they just got tired out.

So, where did these stars come from exactly? Well I tore down the projector and got an "inside look."
Here are some images of the DMD:

Here we see the tell-tale "burn" of where the keystone was focused.


A closer version with outlines highlight the keystone "burn." A blue line shows where the Macintosh menu bar has left its print.
And here, the origin of our star field.



"All that glitters is not gold." It's true, it's aluminum.

Friday, 1 February 2013

Websockets in Bugzilla

During a recent project a co-worker and I were trying to diagnose some issues with a Websocket implementation. We were testing in Firefox and brought up Firebug to see what was going on. To our surprise while we could see the UPGRADE request to create the Websocket, but we couldn't see the Websocket data itself. We ended up, at first, resorting to using Google Chrome and using its Websocket monitoring "functionality" (horrible, horrible, horrible!) to try and debug. We later settled into using Charles to monitor the Websocket data, this was pretty nice and had the added benefit of being able to easily test from a mobile divice as well. Even with that okay solution I feel that there should be a quick easy way to view any and all data passing to/from the browser by default, and that an implementation should be neat and clean, much like the rest of Firebug but unlike Google Chrome's attempt.

What has been done so far:

Firefox Bugzilla

https://bugzilla.mozilla.org/buglist.cgi?quicksearch=websocket+bugzilla

-0 results

Firebug Google Issues

code.google.com/p/fbug/issues/list?q=Websockets

-0 results

So... nothing.

Has anyone else noticed this lacking?

MrEcho has: 
https://groups.google.com/forum/?fromgroups=#!topic/firebug/Z4f0UON_ebk
but he never got a response. :(

enq... did, and even got a good response!
https://groups.google.com/forum/?fromgroups=#!topic/firebug/DXF5KjionVQ
and then never followed up!

Yes, others have notice, but there doesn't seem to be much of a drive to get the functionality.

Quick fixes (in order from cleanest/easiest to most problematic)

  1. Use Charles
  2. Use Google Chrome
  3. Intercept all websocket data (with console messages for example) in your implementation
  4. Bind to the "message" callback
Number four was of particular interest to me. While I was looking in to a way to capture data from the websocket implementation in Firefox I ended up following the actual notifications all the way up to the Javascript level. This was interesting because it could be done without modifying the Mozilla code base, and at a very high level. As a matter of fact I created a Scriptmonkey script that would bind to the Websocket object in the project we were working on. The problem was that it is difficult to have it detect any Websocket being created and binding to it. An idea as to why this is difficult is that the the MutationObserver doesn't seem to trigger on mutations (such as the creation of a Websocket) as high as the window object, which is where it would be happening.

What to do about it

Firebug has awesome extension capabilities, which is great, but alone isn't enough. Looking at the HTTPobserver usage in Firebug gives us an example of just how much it is dependent on observer implementation deep in the Necko framework.

We will first have to modify the Websocket implementation in Necko to allow Firebug to hook into it as an observer. Then give Firebug the ability to hook in and display the data, either as an extension or built in. Though hopefully in the case of the former, creating it in such a way that  it could easily be ported as built in to Firebug.

Tuesday, 22 January 2013

Multiple version of gcc on Mac OSX

Sometimes you might find yourself in a situation where you want to run one version of gcc on your Mac while maintaining a previous version, instead of simply upgrading via overwrite. For instance, I have XCode installed (with gcc4.2) but want to compile with gcc4.7. However, if I have problems with XCode using gcc4.7 I want to be able to switch to gcc4.2 on the fly.

First thing to do is install gcc4.7, I will be using MacPorts.


If you want to see what versions of gcc you have at your disposal you can run:
$sudo port search gcc
If you are interested in gaining C++0x/ C++11 functionality you might want to consult http://gcc.gnu.org/projects/cxx0x.html to select a version that suites your needs.

Now to install the new/other version:

$sudo port install gcc47
If I were to see what version of gcc I was running by executing:
$gcc -v
I would see that it still points to a 4.2 version of gcc. What you need to do is "select" the version of gcc you wish to use. You may need to install gcc_select first, but it might already be installed:

$sudo port install gcc_select
To actually select the working version of gcc[1], first see what you have to choose from:
$port select --list gcc
Then make the choice:
$sudo port select --set gcc mp-gcc47 
At this point running gcc (even to display the version number) may result in an error message as such:
gcc-mp-4.7: error trying to exec '/opt/local/bin/i686-apple-darwin10-llvm-gcc-4.2': execvp: No such file or directory
In which case you have to rehash your links[2]. To see if gcc is indeed hashed run:
$hash
You will probably see gcc listed in there, rehash gcc's link:
$hash gcc 
Checking the version number of gcc you should see the version you selected as working! In my case gcc4.7 is now working!

[1] http://stackoverflow.com/questions/837992/update-gcc-on-osx 
[2] http://superuser.com/questions/423254/macports-gcc-select-error-trying-to-exec-i686-apple-darwin11-llvm-gcc-4-2 

Wednesday, 5 September 2012

Get rows from multiple statements

While I was trying to return rows from a SELECT statement at the end of a list of multiple statements passed through PHPs PDO with MySQL I ran in to a few problems.

1.) First, if you send multiple statements, you have to go through each rowset that is returned for each statement. This is accomplished using the nextRowset() function. Which is talked about on a StackOverflow question and discussed in depth on this Internet Super Hero blog post.

It seems that the standard pdo-mysql driver cannot do this, or has some other difficulty. The suggested solution is using the pdo-mysqlnd patch. Sounds simple enough with the instructions here, but I am running MAMP and so have a separate PHP version running for MAMP. Luckily there are instructions for upgrading MAMP's PHP on David Golding's blog post Upgrading PHP in MAMP.

2.) I had an issue with the error:
cannot open /Applications/MAMP/Library/build/config_vars.mk: No such file or directory at /Applications/MAMP/Library/bin/apxs line 218.
during the configure process. As noted in the comments (by: Khang Nguyen) from the previously mentioned blog post the solution is changing:
-–with-apxs2=/Applications/MAMP/Library/bin/apxs
to
-–with-apxs2=/usr/sbin/apxs

3.) And for the purpose of compiling PHP with pdo-mysqlnd we change:
--with-pdo-mysql=shared,/Applications/MAMP/Library

to

--with-pdo-mysql=mysqlnd,/Applications/MAMP/Library
NOTE: For the following I use "/opt/local" since I use MacPorts, you might have to use something different like just "/opt".


4.) Next error:

configure: error: libjpeg.(a|so) not found.
Solution: Change:
'--with-jpeg-dir=/Applications/MAMP/Library' '--with-png-dir=/Applications/MAMP/Library' '--with-zlib' '--with-freetype-dir=/Applications/MAMP/Library'
to
--with-jpeg-dir=/opt/local --with-png-dir=/opt/local --with-zlib --with-freetype-dir=/opt/local
5.) Fix t1lib error. Make sure t1lib is installed:
sudo port install t1lib
Change:
--with-t1lib=/Applications/MAMP/Library
to
--with-t1lib=/opt/local
6.) 'configure: error: Cannot locate header file libintl.h'
Change:
--with-gettext=shared,/Applications/MAMP/Library
to
--with-gettext=shared,/opt/local
6.) Error: 'configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.'
Change:
--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007e
to
--with-imap=shared,/opt/local

If you need to install:
sudo port install php54-imap

Uggghh, know what? Just update MAMP, it works now! :p


Hayley Smith on Burning Man

"No, it's all about a bunch of naked morons drinking and doing lots of drugs."

Wednesday, 11 July 2012

i-Tech W3200 information

I've recently came across a 32" touchscreen from i-Tech, model W3200. I didn't have the fortune of receiving an install CD with it, and finding drivers or information on-line was quite difficult. Here is what I gathered however, and how I eventually found out the proper drivers.



i-Tech Model:W3200

http://www.itechLCD.com

32" High Brightness Sunlight Readable Behind Window Display HB LCD, 1100 Nits
http://www.i-techcompany.com/32inch-high-brightness-sunlight-readable-window-display-hb-lcd-w3200.html

http://www.suntroniclcd.com

32" W3200 (1100nits)
http://suntroniclcd.com/products-w-series.html

Made up of:
1.) eGalaxTouch controller?
    -http://home.eeti.com.tw/web20/eg/Touch_Drivers.html

Why did the instructions tell me to do this?!
1.) a visualplanet Touchfoil

http://www.visualplanet.biz

Drivers: http://www.visualplanet.biz/get-interactive/driven-to-interaction.php
If the shortcut on the desktop fails:
Point it to: /Applications/Touch screen?????/MMA9Launch

If the driver fails to run:
On mac, make sure you are using Java RTE 10.7: Applications/Utilities/Java Preferences

Selecting the drivers: ???????? Where is that bar-code?!


2.) Realtek LCD monitor controller monitor
    -Thankfully no drivers necessary!

Monday, 21 May 2012

Facebook canvas resize for an app tab

As a tip, if you are having trouble getting a Facebook API canvas function, such as FB.Canvas.setSize() or FB.Canvas.setAutoGrow(), to work it may be FB._https = true tripping you up. If you have FB._https = true set anywhere, try commenting it out or straight up removing it and see it the problem persists. You may be surprised.