Tuesday, May 15, 2012

Web to Mobile Conversion Using JSoup and XSLT


Overview

Spring 2012 I did research supervised Dr. Russel Clark from the College of Computing and GTRI at Georgia Institute of Technology in Atlanta GA. A team of 4 graduate students worked to implement an experimental web to mobile service. This conversion exploits industry standards in web development and applies clever algorithms for parsing web content and formatting it to XML. The XML data can be parsed by applications or XSLT scripts can be used to generate mobile specific pages. The group successfully implemented a web service which parses web content and converts the page to an easy to navigate mobile format, including functionality such as handling links and forms.

Background and Technologies Used

The project originally started as a class project. The goal was to scrape Georgia Tech's course websites (T-Square), extract roster photos from courses and display them using JQuery Mobile. The web scraper was implemented in Java using the JSoup libraries to navigate and parse web content (getting past security was a nightmare!) then submits image links and student info to a PHP 5 server through a public API. When the user visits the PHP server, they must login using Georgia Tech's central login system and will be presented with a lists of available images with courses. This has turned out to be a priceless resource as a teaching assistant of over 500 students in the past 2 years. GT Students and professors you can try it here, hosted on GtMob.


The current project is aimed to generalize that service to allow easier navigation in a mobile browser. We deployed the project on Google App Engine as a Java application. The Eclipse IDE provides useful developer plugins for App Engine. Git Hub was used a the repository since up to four developers were working on the code at once. The source code is open source and available here along with instructions for setting up the project in the Eclipse IDE. A thousands thanks go out to JSoup developers for their Java HTML-DOM library. It takes in html source and acts similar to JQuery selection, with regex, element, id and class queries available to name a few. Html parsing was done with custom algorithms and data structures. XML was converted with an XSLT script using Java transformation libraries. All information about 3rd party Java libraries can be found in the repository

My Role in The Project


I proposed the project to Dr. Clark after taking his Mobile Applications and Services course in Fall 2011. One of my project group members from the class continued on the project with me working in Dr. Clark's lab. I worked to define the problem and suggested solution, design the software architecture, define the XML syntax and structure, design/implement the parsing algorithms and design the mobile interface and write the XSLT scripts.

Defining the Project and Research Proposal


The original proposal can be found downloaded here. Dr. Clark accepted the project as part of his GTRNOC Lab in GTRI.

Abstract: We intend to develop a Java server application capable of intelligently converting content on a full size web site into a mobile friendly presentation. This will be accomplished using a custom markup implemented with multiple experimental scripts to dictate the behavior of the conversion algorithm. A custom script will be written to generate an optimal display for Georgia Institute of Technology’s T-Square website. A dedicated Java server will use the Jsoup web service library for parsing and conversion of HTML text while Jquery and Jquery-Mobile services will be used in the converted pages for a restful web experience and mobile specific formatting.

Project Architecture


 This general architecture diagram shows interactions between various aspects of the application.


The server architecture diagram is an expansion of the JMCS Server Side block. The design allows for development of a public and developer front end for mobile browsing and page parsing service for web applications respectively.


Two consideration are presented below for flow of content parsing and conversion. The diagram on the right allows for an extra step of token replacement in the final HTML code. This was considered to allow for the option of images and content to be kept separate. This would allow for the possibility of faster page loads and only loading images upon user request, lightening the network load and minimizing required data transfer to mobile devices.

Click for larger images.


The three images below illustrate our scale-ability problem. 
   LEFT: representes the ideal situation, a single parsing algorithm, single XML syntax and multiple "skins" or mobile output formats. This assumes that all pages can be parsed with a general algorithm. 
    CENTER: shows the most an alternate solution allowing specialized parsing algorithms for different sites and page formats e.g. blogs, image galleries, online shopping. Notice the common XML format, which has been a major goal in modularity of the project.
   RIGHT: shows the problems with allowing multiple parsing algorithms and XML structures. This forces multiple XSLT scripts to be written for each format, providing an exponential amount of coding to be done. The is conflicting to the goal of this project of providing a simple universal solution for web to mobile conversion. 





The final implementation for the java application can be seen below. Changes to the code have been made since exporting this UML diagram but the general dependencies remain the same.


Wednesday, May 9, 2012

Bindary - Binary Wrist Watch

Overview

The Bindary wrist watch is meant to be an easy, do-it-yourself project which allows users to build a novel wrist watch with basic functionality. This serve as a side project during Summer 2012 while I am taking math classes and would rather be working with CS and electronics.

Feature and Requirements

The Bindary watch will implement the following functionality:
  • Settable time including {second, minute, hour, day, month}
  • Auto-adjusting brightness with programmable override brightness
  • Toggle 12-hour and 24-hour time format
  • Toggle binary and scroll mode
  • Scroll Mode
    • Programmable scroll speed

Parts

Estimated Parts Cost: $14.00

Technologies

SPI - Serial Peripheral Interface. 4-wire serial communication.

Implementation



The following state machine represents the state transitions which will allow the defined functionality an user input. TODO: Add state for setting brightness.

While setting values the corresponding columns will be blinking. While setting brightness, the whole display will blink. While setting "Scroll/Binary" a large "S" or large "B" will be displayed. While setting the speed of scroll mode, the time will read "00:00am 00/00"


Notes

Note that a recent change has "DAY" representing the day of the month. This now requires 5 bits rather than 3 bits to represent days of the week. Therefore the "spinner" will be replaced by a "flashing" top row.


S800G Mod

Eventually...

Eventually I would like to slowly remove the structure and replace it with lightweight protoboards allowing for on-board computation. Using an ATMEGA328, a gyro, two IR sensors and an extended battery pack, I hope to build an autonomous wall following copter. Basic algorithms should allow it to navigate slowly and with a simple state machine. However a more advanced application will allow for more aggressive motion with the possibility of racing and obstacle courses.


Introduction:

I am working to improve the battery life and in turn flight time of my S800G radio controlled helicopter. If you remove the front covering you will see that the battery is a 3.7V 150mAh Li-ion battery.

With any experience in hobby electronics you will know that most Li-ion batteries have a 3.7V nominal voltage. So after checking a few old cell phones I found some replacement batteries. Originally I tried an old HTC 1230mAh. Before connecting the power terminals I attempted to mount it in multiple positions (to maintain the same center of gravity). However, it was easy to see that the battery simple weighted too much and would not let the copter take off. I have a few smaller 600mAh and 800mAh batteries which I will test soon.

Connecting The Extended Battery:

It is as simple as connecting the positive to the positive (red) and ground to the ground (black) of each battery. You will be able to use the factory charger since the cell phone batteries are designed to charge much faster. Note that charging will take a lot longer than usual. Be careful not to short the batteries at any time as this can damage the batteries or charging circuitry.


Remember when mounting the batter that you still need to access the power switch on the bottom of the  helicopter body. I used a piece of duct tape to act as a hinge and a rubber band to hold the batter secure to the skids during testing.

If you have another small battery you can also attempt to mount it inside the tail supports. This is untested but provides an easy to mount location for testing.

Conclusions:

I have not found a good location to mount the extra battery, since I am still tested lower mass batteries. Currently I suggest remove the tail and mounting the battery such that it maintains the center of gravity. This will remove un-used mass and provide extra flying time to an already great toy.

Hytech Racing Project Notes and Status

Electrical Systems Current Status:


  • CAN Bus
    • Function in loopback mode
    • Error during bus communication (most likely due to transmission identification)
  • Pedal Node
    • Both accelerator pots tested and working
    • Both brake pots giving bad values
    • Serial communication confirmed
  • Engine Node
    • Function voltage divider and servo control code for maintaining lower nominal voltages.
    • Racing error when approaching 72V. I think this is because the voltage curve non-linear. Possible fix, larger resolution with custom gearbox.
    • IMPORTANT: need to remove common bus between 12V and 72V line
  • Motor Node
    • Further testing needed for successful RS232 communication with Kelly Controllers
  • Battery Node
    • Need battery protocol
  • Display/Safety Node
    • Successful serial communication
    • Successful LCD output
    • Low power schematic and functional circuit defined
**NOTE: Serial communication is not the same as CAN Bus communication


Electrical Systems Add-ons: 


  • Display/Safety Node
    • Netbook or old Android Phone: 
    • Large full color GUI with live monitoring
    • Computationally powerful and WIFI enabled.
    • Would allow real time network communication over WAN
    • GPS enabled
  • Client/Server Application
    • Allow real time monitoring/tweaking
    • Real time analysis and graphing


Notes:

Tuesday, May 1, 2012

Solar Panel Research


Construction and Programming

(Videos)

(Blog)
MPPT - See attached parts list ($40)

Materials

DIY

3"x6" 36 @ 18V, 3.4A (64.8W)
$19.71 - Aluminum 27"x33"
$43.36 - Glass 26.5"x32"
$69.99 - 40 Solar Cells

3"x6" 72 @ 36V, 3.4A (129.6W)
$26.60 - Aluminum 33"x52"
$100.61 - Glass 32.25"x51.5"
$109.99 - 80 Solar Cells

Common
$57.99
 - Sylgard 184 Encapsulation Gel (covers two 36 panels or one 72 panel)
$5.00 - Clear Silicon Caulk (good for a few panels)
$5.00 - Nuts/Bolts/Hardware

Summary
64.8 Watt Panel (before shipping)
    $133.06 + $77.99 = $211.06
    $3.2 per watt

129.6 Watt Panel (before shipping)
    $247.20 + $77.99 = $325.19
    $2.50 per watt

Kits

$106.99 - 2 x 65W Kits (total $313.70 @ $2.41 per watt)
$89.99 - 130W Kit (total $296.70 @ $2.28 per watt)

Batteries

Calculation

Notes

- "Equalize batteries once a month."
- "I run my fridge off an inverter a good part of the time. I have 340 watts of panels here in Florida. An 800 watt inverter will carry a fridge easily."

Wine and Microsoft Office 2010 in Ubuntu 11.10

After jumping between a dual boot system (Ubuntu 11.10 and Windows 7) while writing 50+ pages of papers over a few days it was time to install Office on Ubuntu. Here are the steps I took and what I learned.

Installing Wine (and winetricks):


Install wine from the terminal:
sudo add-apt-repository ppa:ubuntu-wine/ppa


sudo apt-get update


sudo apt-get install wine1.5

Downloading winetricks:
wget http://winetricks.org/winetricks


chmod a+x winetricks


sudo mv winetricks /usr/local/bin

Note that winetricks is not required for this installation, but useful for other application.

Installing and Running Microsoft Word 2010:

Prepare Installation Environment
sudo mkdir ~/.wine/drive_c/Microsoft.NET/Framework/v2.0.5..../CONFIG


sudo cp /etc/mono/2.0/machine.config ~/.wine/drive_c/Microsoft.NET/Framework/v2.0.5..../CONFIG


Installing Microsoft Office
Download installation file, right-click => "Open With" => "Wine Windows Program Loader". Once you have entered the product key and agreed to terms of use, choose default installation.
(Sorry, but Ubuntu does not allow screen shots while right-click menus are open)

Running Applications

Application can be found through the Unity menu under the application name, e.g. "Microsoft Word 2010" "Microsoft Excel 2010" "Microsoft PowerPoint 2010"

Troubleshooting:
If there are problems see this blog and MS Office install guide from wine.org. Note that some posts state that installation requires that "winbind" be installed in wine and "riched20" be installed through winetricks. My successful installation (5/1/2012) did not require either.

Discussion
I chose port my Microsoft productivity suite to Ubuntu based on time required to switch between operating systems. The fact that windows take forever to load and decides to update every time I shut down also did not help its case.

Open/Libre Office were not a viable solutions since everyone else on my projects runs windows and with native Microsoft Office. Open/Libre Office do not do a good job maintaining formatting between applications. Also, templates and themes provided by Microsoft allow users to make documents look professional quickly and easily.

Why not LaTeX? I prefer LaTeX for research documents/reports or journal submissions but not enough people are comfortable enough to write (and competently layout) a document in LaTeX. If you are writing something that is equation heavy or uses lots of greek letters, LaTeX is the way to go. The Word equation editor is very point-click oriented.