Huidong Tian's Blog

Don't know? Google it!

Get Access to Raspberry Pi: Ethernet hub

The previous blog decribed how to get access to RPi through an Ethernet cable. One shorcoming of this method is your RPi has no internet connetion. In this blog I will show you how to get access to RPi through Ethernet cable which connected to an Ethernet hub.

Get Access to Raspberry Pi: Hotspot

In last blog, I described how to access to RPi through WiFi. The advantage of this method is that your RPi can now access to internet. But, still you need a WiFi environment. What if I want to connect my RPi in field? Of course the simplest way if use an Enthernet cable, but maybe you want to access to RPi remotely, for example, I have created a RPi controled car, and I want to test it in field where there is no WiFi. We can access to RPi through a smart phone’s hotspot, and control RPi using a smart phone.

Get Access to Raspberry Pi: WiFi

In previous blog, I described how to access to RPi through an Ethernet cable (RJ45). That’s a convenient way to connect your RPi when there is no internet connection. However, it’s almost useless of a computer without internet connection! In this blog, I will describe how to access to RPi through WiFi.

Get Access to Raspberry Pi: Ethernet Cable (RJ45)

Raspberry Pi is a credit-card sized (not the thickness) Linux computer, besides its small size, it has pins (GPIO) which allow you to connect other devices, like motors, servo, sensors, LED, etc. I felt in love with Raspberry Pi (RPi) this summer: as an IT advisor, the dream of making robot could come to true!

Add An Export Module to Shiny-app for Highcharts Figure

Highcharts is the best JavaScript chart library, I feel. By default, there is an export button which can let you save the interactive figure to PNG, JPEG, PDF and SVG format, and one important point is, you can use it in your shiny app through R package rCharts. However, there are some limits in such a way, the default exporting engine is based http, so if your shiny-app’s portal is https, then you can’t use the exporting feature (It seems Highcharts has also a https based export engine). I have spent a lot of time to configure a Highcharts export server, it works internally, but not outside. I can’t figure out the problem, but I found another solution.

Generate Distinct Colors

When plot with R (or some other software), it doesn’t bother you a lot for choosing colors if you have only several data series. For example, if I want to create a figure for 5 data series, I can easily choose red, green, dark green, blue and black. But what if I need to create a figure having 100 data series? Of course, we can choose different shape or pattern, like dash line, circle, triage, etc. However, to me, I feel that make the figure messy, I prefer all series in same style, except their colors. I created a Shiny-app which can generate random distinct colors in a certain color plate, would like to share it with public.

A Shiny-app Serves as Shiny-server Load Balancer

The Shiny-app on open-source edition Shiny-server has only one concurrent, which means it can run only for one user at a time point. But it can host multiple Shiny-apps, which can run synchronously. So, if we create severl Shiny-apps with different names but same function, then we can let more users use our service at same time. But users don’t how to choose the Shiny-app with small user number. This post will show you how to create a Shiny-app to redirect user to the Shiny-app with lower load.

Automatically Scrape Flight Ticket Data Using R and Phantomjs

I used to scrape static web pages with the R package RCurl. It’s a great package! When it comes to dynamic web pages, RCurl comes to be difficult to set up (actually, I never get it works). Then I met Phantomjs. PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. In this blog, I will show how you to scrape flight tickets data using Phantomjs, extract and filter the entries that meet some restriction, and then send the result to your email automatically.

Set Up Shiny-server on www.digitalocean.com

RStudio supplies several servers for hosting user’s apps, e.g. http://www.shinyapps.io/, http://spark.rstudio.com, http://glimmer.rstudio.com. Thanks a lot to RStudio who has contributed many excellent R libraries! I want to set my shiny-server on a virtual private server (VPS), because I have some other tasks and I feel a VPS is more stable than the PC under my desk.