Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@smzn
smzn / graph.ctp
Created October 6, 2016 11:18
WordCloud
<script src="https://d3js.org/d3.v3.min.js"></script>
<?php echo $this->Html->script('d3.layout.cloud.js');?>
<script>var tags = [
<?php for($index = 0; $index < count($weight); $index++){ ?>
{"key": "<?php echo $weight[$index][0];?>", "value": <?php echo $weight[$index][1];?>},
<?php }?>
]
</script>
<div id="vis"></div>
<?php echo $this->Html->script('word-cloud.js');?>
@smzn
smzn / bubble.js
Created October 23, 2016 00:03
bubble.js
var svgWidth = 2080; // SVG領域の横幅
var svgHeight =1080; // SVG領域の縦幅
var diameter = 1080; // 一番大きい円のサイズ
var color = new Array(100);
color[0] = "none";
for(var index = 1; index <= 100; index++){
color[index] = rgbTo16("rgb("+Math.floor(Math.random()*256)+","+Math.floor(Math.random()*256)+","+Math.floor(Math.random()*256)+")");
}
//var color = ["none", "#ff0000", "#", "orange", "#ffe090", "#a0ff90", "cyan", "#ccc", "#ff8080", "#c0ffc0", "#4090ff"];
@smzn
smzn / bubble-view
Created October 23, 2016 00:11
bubble-view
<div id="myGraph"></div>
<script>
var list = {
"name": "Keyphrase",
"children": [
{
"name": "twitter",
"children": [
<?php for($index = 0; $index < $count; $index++){ ?>
{ "name": "<?php echo $weight[$index][0];?>", "households": <?php echo $weight[$index][1];?> },
@smzn
smzn / MySQL.R
Created January 20, 2017 07:17
MySQL.R
mysql.connect <- function(){
dbconnector <<- dbConnect(dbDriver("MySQL"),dbname="XXXXX",user="YYYYY", password="ZZZZZZ")
}
mysql.getSelect <- function(){
mysql.data <<- dbGetQuery(dbconnector, "SELECT `attack`, `defence`, `hp`, `exp`, `gold`, `water` FROM `monsters` ")
}
@smzn
smzn / Basic.R
Created January 20, 2017 08:51
Basic.R
basic.summary <- function(){
summary(mysql.data)
write.csv(summary(mysql.data), file="summary.csv")
}
basic.boxplot <- function(name){
boxplot(name)
}
basic.hist <- function(name){
@smzn
smzn / Cluster.R
Created January 20, 2017 11:31
Cluster.R
cluster.agnes <- function(name){
cluster.agnes <- agnes(name, stand = T)
plot(cluster.agnes, which = 2, main = "", xlab = "", ylab = "")
}
cluster.diana <- function(name){
cluster.diana <- agnes(name, stand = T)
plot(cluster.diana, which = 2, main = "", xlab = "", ylab = "")
}
@smzn
smzn / PCA.R
Created January 21, 2017 21:39
PCA.R
pca.pca <- function(name){
pca_result <<- prcomp(name, scale=T)
pca_result
}
pca.summary <- function(name){
summary(name)
}
pca.biplot <- function(name){
package com.example.mizuno.prog17_01;
import android.os.AsyncTask;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Latitude"
android:id="@+id/latitude"
package com.example.mizuno.prog17_02;
import android.os.AsyncTask;
import android.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;