Run R Dashboard from command line on Windows 10

From the sales dashboard project I developed using R and shinydashboard, please read it if you haven’t. I created a small command line batch script to run it at the backend. In that project, I use Windows 10 with R package installed in the PC.

It is very simple script to run your finished R script from cmd batch command line. Use your R Studio, create a new text file, then save it as batch file, for example startserverdashboard.bat. Type the following line into your batch file:

"your-R-path-installation-bin\Rscript.exe" \your-R-script-folder\salesdashboard.R

Change your-R-script-folder to your actual folder where you saved your script.

To run the server script, open a terminal/cmd, got to the folder where you stored the script, then just type the batch file from command line:

startserverdashboard.bat

That’s all you have to do. The batch will run the script including web server with port to run the dashboard report. To stop the web server, click Ctrl-C, or just close the command line window.

Access the Dashboard from Mobile Phone

The above approach is simple, and already good enough for the needs. The owner can get sales numbers in chart dashboard as he/she wish. It is secured enough, since the dashboard is only accessible from the POS PC, where only the cashier and the owner can see it.

However, if you want to have easy access to the dashboard, for example by owner’s mobile phone as long as connected in the same network/wifi. This approach can be achieved by opening the IP and the port on the firewall setting. You can search from internet how to do it. You can still secure the dashboard by limiting who can access to the PC on the security setting.

Depends on your network settings, by default, the router on the network will give dynamic IP and the port. You need to change it so you will have static IP and port address to access the report. To do this, R web server need to be set to a specific static IP address and Port. Create new R script from your R Studio, type the following script:

require(shiny)
folder_address = '\\path-to-your-code-folder\\salesdashboard.R'

x <- system("ipconfig", intern=TRUE)
z <- x[grep("IPv4", x)]
ip <- gsub(".*? ([[:digit:]])", "\\1", z)
print(paste0("the Shiny Web application runs on: http://", ip, ":3838/"))

runApp(folder_address, launch.browser=FALSE, port = 3838, host = ip)

Change the path-to-your-code-folder to your R script folder. The port 3838 is default port setting that is used by shiny web server. You can change it as you wish. Don’t forget to allow the port number access in your firewall setting.

Now the owner can access the dashboard report, anywhere using mobile phone as long as he/she is in the cafe, in the same network/wifi.

Access Dashboard anywhere

If there are many shops in different locations you will need cloud solution. The dashboard can be access by the owner from home or from anywhere in the world. The R server is stored in the cloud. There are many R cloud based services available in AWS, Google, Microsoft Azzure, etc.

Source data is generated from each store, and then upload to the database in the cloud. R server then process all the data into dashboard reports. The cost is vary depends on what solution do you use. But nowadays the cost is scalable and adjust automatically accordingly as the growth of your business, means the bigger your business, the more data you will have, means more server resources you will need, at the end will add the cost you have to spend.

Mac OSX Mountain Lion 10.8.5 Just Released

image

Mountain Lion 10.8.5 just released and available for download. All users with 10.8.4 are recommended to upgrade.

I just upgraded my macs without any issues. All apps work fine including my Time Machine setup using shared folder in Ubuntu. No additional setting needed.

The New Arduino Esplora

The New Arduino Esplora

Arduino Esplora is a new Arduino board just launched today. It has game joystick shape.

The Esplora uses an Atmega32U4 AVR microcontroller with 16 MHz crystal oscillator and a micro USB connection capable of acting as a USB client device, like a mouse or a keyboard. Esplora also has lots of input/ouput:

– Analog joystick with central push-button two axis (X and Y) and a center pushbutton.
– 4 push-buttons laid out in a diamond pattern.
– Linear potentiometer slider near the bottom of the board.
– Microphone for getting the loudness (amplitude) of the surrounding environment.
– Light sensor for getting the brightness.
– Temperature sensor reads the ambient temperature
– Three-axis accelerometer measures the board’s relation to gravity on three axes (X, Y, and Z)
– Buzzer can produce square-waves.
– RGB led bright LED with Red Green and Blue elements for color mixing.
– 2 TinkerKit Inputs to connect the TinkerKit sensor modules with the 3-pin connectors.
– 2 TinkerKit Outputs to connect the TinkerKit actuator modules with the 3-pin connectors.
– TFT display connector connector for an optional color LCD screen, SD card, or other devices that use the SPI protocol.

With a lot of features so you can do almost everything using Esplora.

Setup Shared DVD in Ubuntu for Mac OSX Lion

For you who have diskless Macs like MacMini, or Macbook Air with OSX Lion loaded will obviously need to have access and use the external DVD drive. I have Ubuntu 11.04 and would like to use its DVD drive. It’s a bit tricky to do it in Ubuntu 11.04 box. This guide will help you how to solve the problem.

 

Continue reading “Setup Shared DVD in Ubuntu for Mac OSX Lion”

OSX Lion Theme for Natty Narwhal

Mac OSX Lion Theme for Ubuntu

There is a new version of Elementary Lion Theme 1.1 by Dolsilwa. It is pretty close to what you see in real Mac OSX on the window — the red-yellow-green buttons. Unlike Leopard, in OSX Lion has smaller buttons more elegant buttons. The rest of OSX Lion are similar to Leopard. Another difference is the scroll bar which has a grey solid color rather than shiny blue in the older version.

I’d like to have combination of the two version. Download the theme provided above. Extract the file. You will see two versions one is for Classic Ubuntu, and the other is for Unity. Select the theme you like for Natty. I choose to use The Classic Ubuntu version.

To get as the picture above, I apply the theme and I change icon using Macbuntu theme. Read my previous post if you’d like to activate the Dock and Launcher. What do you think? Let me know if you like.

Windows 8 Developer Preview

I have been using the Windows 7 just a year. Today, Microsoft releases the next version of Windows for developers. It is worth to try? Let’s see what are new in it and whether it will be a good or another bad version of Windows.

What’s new from Microsoft is they release this version for free to public, never happened before. As shown in the ads below, no activation self support.

 

Settings

First we have to setup new virtual machine in VirtualBox. Open VB then click New button at the top bar. In the OS type, select Microsoft Windows, and Version choose Windows 7.  I downloaded version 64 bit version, so I choose Windows 7 64 bit. I think it should work if you choose just Windows 7. Continue reading “Windows 8 Developer Preview”