Hardware Prototyping: Raspberry Pi, Arduino, and Photon

I did a presentation earlier in the year about hardware prototyping. These are my notes from gathering information from experience and various sources online. On a side note, I can't believe i have not found out about the photon before. Amazing device that makes hardware prototyping a lot easier. 

Raspberry Pi

only digital pins
ADC and DAC: http://www.hardwaresecrets.com/how-analog-to-digital-converter-adc-works/

Can do analog out/in through external modules: https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/overview

Read More

Detecting URLs/Links Clicked on a Webpage

This has more to do with WebView in Windows Store APIs but it could apply to other situations since its just javascript. I wanted to find a way to detect what page the user navigates to, and unfortunately WebView does not have that functionality. So I had to resort to injecting javascript...

Now I'm not a javascript expert, so if there are any better ways to do this please let me know :)

Instead of changing each and every link and adding my own custom handlers, I decided to override the onclick event in the body. Whenever the user clicks anywhere on the page, my custom onclick handler will receive the event and handles it accordingly. 

It first checks to see if it is inside an <a> tag, if it is then we are pretty much done since we found the link. If it isnt, it continues to check the parent tag until it reaches the body. This handles cases where you have an <img> tag inside an <a> tag. So when the user clicks on the image, the onclick event will be received on the image and not the <a> tag. So we have to traverse upwards.

Read More