Saturday, 28 September 2019

20180213: Android Camera Black Screen After Flashing SlimROM

20180213: Android Camera Black Screen After Flashing SlimROM

posted Feb 13, 2018, 3:54 PM by Kevin Woo
This was fixed by wiping the cache and the wiping the dalvik cache. The Gallery app started to load photos as well afterwards.

Dygraphs + R: JSON Visualisation for Vanguard

library(ggplot2)
library(httr)
library(jsonlite)
library(dygraphs)   # zoomable graphs
library(fasttime)   # for fastPOSIXct
library(data.table) # like using data.table

vanguardData <- function (productIDStr, startDate, endDate) {
  urlStr <- paste0("https://api.vanguard.com/rs/gre/gra/1.7.0/datasets/auw-retail-price-history-mf.jsonp?",
                   "vars=portId:",productIDStr,
                   ",issueType:S,sDate:",startDate,
                   ",eDate:",endDate,
                   ",as_of:DAILY&callback=angular.callbacks._4")
  rawData <- GET(urlStr) 
  return (fromJSON(strsplit(content(rawData, "text"), "[()]")[[1]][[2]]))
}

plotDygraph <- function (i01.vgdata, i02.title) {
  dgObj.01 <- as.data.table(i01.vgdata)
  dgObj.01[, asOfDate.ft := fastPOSIXct(substring(asOfDate, 1, 10))] # this one fails
  dygraph(dgObj.01[, .(asOfDate.ft, price)],
          main = i02.title) %>%
    dyOptions(useDataTimezone = FALSE) %>%
    dyBarChart() %>%
    dyRoller(rollPeriod = 1)
}

globalStart <- "2017-02-20"
globalStart <- "1996-02-10"
globalEnd <- "2019-02-20"
vg.8129 <- vanguardData("8129", globalStart, globalEnd) # Vanguard Index Australian Shares Fund
vg.8145 <- vanguardData("8145", globalStart, globalEnd) # Vanguard Index International Shares Fund
vg.8146 <- vanguardData("8146", globalStart, globalEnd) # Vanguard Index Hedged International Shares Fund

# compare buy price of different products
ggplot() +
  geom_jitter(data=vg.8129$fundPricesBuy,
              aes(x=asOfDate,y=price), color='blue') +  # Vanguard Index Australian Shares Fund
  geom_jitter(data=vg.8145$fundPricesBuy,
              aes(x=asOfDate,y=price), color='red') +   # Vanguard Index International Shares Fund
  geom_jitter(data=vg.8146$fundPricesBuy,
              aes(x=asOfDate,y=price), color='green')   # Vanguard Index Hedged International Shares Fund

plotDygraph(vg.8129$fundPricesBuy, "Vanguard Index Australian Shares Fund")
plotDygraph(vg.8145$fundPricesBuy, "Vanguard Index International Shares Fund")
plotDygraph(vg.8146$fundPricesBuy, "Vanguard Index Hedged International Shares Fund")