<ScrollViewer.Resources>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">5</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}">5</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">5</sys:Double>
<sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}">3</sys:Double>
</ScrollViewer.Resources>
Apollo 13 - Tao Liu's blog
Failure is not an option.
Tuesday, May 28, 2013
SelfNote: ListBox scroll bar size
Sunday, March 3, 2013
SelfNote: PowerShell on SQL Jobs
You know what. The lack of "Start" button on Win8 makes me really learn PowerShell. I feel I am more like a Unix admin than an average user. :-D
# disable backup job on a server
function Disable-BackupJob($serverName)
{
invoke-command -computerName $serverName -ScriptBlock { `
param($serverName); `
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null; `
$srv = New-Object Microsoft.SqlServer.Management.SMO.Server($serverName); `
$jobs = $srv.JobServer.Jobs | Where-Object {$_.IsEnabled -eq $TRUE} | Where-Object { $_.Name -like '*backup*' }; `
foreach ($job in $jobs) `
{ `
write-host "$serverName.$job is to FALSE"; `
$job.IsEnabled = $false; `
$jobs.Alter(); `
}; `
$jobs = $srv.JobServer.Jobs | Where-Object {$_.IsEnabled -eq $TRUE} | Where-Object { $_.Name -like '*backup*' }; `
if ($jobs.Count -eq 0) { write-host "$serverName Done." } else { write-host "$serverName failed!" }; `
}`
-ArgumentList $serverName
}
Saturday, March 2, 2013
SelfNote: PowerShell scripts
the following three functions are use PowerShell to set password, move cluster, and test connection to a database server.
#set account username and password
function Set-Password($computerName, $serviceName, $serviceAccount, $password)
{
invoke-command -computerName $computerName -ScriptBlock `
{ param($computerName, $serviceName, $serviceAccount, $password); `
write-host "on computer " $env:ComputerName "working on " $serviceName; `
$filter = "Name='" + $serviceName + "' "; `
$sqlservice=Get-WMIObject win32_service -filter $filter;`
$result = $sqlservice.change($null,$null,$null,$null,$null,$null, $serviceaccount,$password,$null,$null,$null);`
if ($result.ReturnValue -eq 0) { write-host $computerName " done!"; } else { write-host $computerName " failed!"; } `
} `
-ArgumentList $computerName,$serviceName,$serviceAccount,$password `
}
# move cluster
function Move-Cluster($computerName)
{
invoke-command -computerName $computerName -ScriptBlock `
{ `
import-module failoverclusters;`
$result = Move-ClusterGroup sqlgroup;`
write-host "owner node = " $result.OwnerNode; `
$result = Move-ClusterGroup sqlgroup;`
write-host "owner node = " $result.OwnerNode; `
}
}
#test connection
function Test-Connection($servername)
{
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection;
$SqlConnection.ConnectionString = "Server=$servername;Database=master;Integrated Security=True";
try
{
$SqlConnection.Open();
write-host "$servername connection OK."
}
catch
{
write-host "$servername connection failed"
write-host $error[0]
}
finally
{
$SqlConnection.Close();
}
}
Sunday, February 3, 2013
Hadoop Day 3
I got my first map/reduce job running on the HDInsight Services For Windows. The material provided by HDInsight team is very good. :-)
The Hadoop gives a new way to store and process data. We generate huge amount of data every day and the data schema changes constantly. Every times we design a database, we assume the data does not change that often, but this is not true. The possible solution is to dump all the data with low cost. If the portion of data suddenly becomes "valuable", a HIVE external table can be created and give a schema to these data. By using the ODBC driver, the data can be copied to SQL Server which is a high cost solution storage data. Traditional SQL Server will not be replaced by Hadoop, it only serves for the "valuable" data. For some "useless" data, let them stay in Hadoop.
I can't publicly discuss or blog the HDInsight feature right now. So this post is to summarize the public materials.
Personally I am more interested in finding a good solution to store the data and later process it as fast as possible. I know Hadoop is ready to for "big data", so I am more interested in
1. How to link with other technologies, such as SQL server and SQL Azure
2. Move data between different data storage
3. perform my own map/reduce work
The article about SSIS catches my eye. I covers question 1 and 2. The ASV protocol mentioned in the article is the way to access Azure blob from Hadoop. If you link to my previous post about Azure blob, you can tell where that post is from. The HIVE can point to a ASV folder by using the Create External Table statement (in section 8.3). You might want to use this link to check all HIVE data types.
Once the data is organized as a table, it can be accessed by using HIVE ODBC. The ODBC enables all kinds of connections and our existing tools and skills are connected. You can NOT write data by using ODBC.
The map/reduce program is very simple, it is basically a clone of C# sample. The only problem I found is debug. The execution log from UI is not that helpful. My trick is to export debug information to the output file. Once the algorithm is correct, the debug information can be eliminated.
The Hadoop gives a new way to store and process data. We generate huge amount of data every day and the data schema changes constantly. Every times we design a database, we assume the data does not change that often, but this is not true. The possible solution is to dump all the data with low cost. If the portion of data suddenly becomes "valuable", a HIVE external table can be created and give a schema to these data. By using the ODBC driver, the data can be copied to SQL Server which is a high cost solution storage data. Traditional SQL Server will not be replaced by Hadoop, it only serves for the "valuable" data. For some "useless" data, let them stay in Hadoop.
I can't publicly discuss or blog the HDInsight feature right now. So this post is to summarize the public materials.
Personally I am more interested in finding a good solution to store the data and later process it as fast as possible. I know Hadoop is ready to for "big data", so I am more interested in
1. How to link with other technologies, such as SQL server and SQL Azure
2. Move data between different data storage
3. perform my own map/reduce work
The article about SSIS catches my eye. I covers question 1 and 2. The ASV protocol mentioned in the article is the way to access Azure blob from Hadoop. If you link to my previous post about Azure blob, you can tell where that post is from. The HIVE can point to a ASV folder by using the Create External Table statement (in section 8.3). You might want to use this link to check all HIVE data types.
Once the data is organized as a table, it can be accessed by using HIVE ODBC. The ODBC enables all kinds of connections and our existing tools and skills are connected. You can NOT write data by using ODBC.
The map/reduce program is very simple, it is basically a clone of C# sample. The only problem I found is debug. The execution log from UI is not that helpful. My trick is to export debug information to the output file. Once the algorithm is correct, the debug information can be eliminated.
Saturday, February 2, 2013
Hadoop Big Data - Day2
Hadoop does open a door to so many possibilities. This blog is to store a local file to Azure blob storage. I will use Azure blob to host the data. Maybe I should call it "garbage can" as it can host any data.. :-D
Anyway, the following is the code to create a blob and create folder in the blob. The code will upload a text file to Data2 folder in the logdata1 container in the Azure blob.
class Program
{
static void Main(string[] args)
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=<account name>;AccountKey=<account key>");
var client = storageAccount.CreateCloudBlobClient();
var container = client.GetContainerReference("logdata1");
container.CreateIfNotExists();
var fn = "Data2/TextFile1.txt";
var blob = container.GetBlockBlobReference(fn);
//upload file to container
using (var fileStream = System.IO.File.OpenRead("TextFile1.txt"))
{
blob.UploadFromStream(fileStream);
}
//list items in the container
var blobs = container.ListBlobs();
foreach (var b in blobs)
{
Console.WriteLine(b);
}
}
}
Monday, January 28, 2013
Decide to use TypeScript on HTML5 + JavaScript
I decide to give my big data project a new face. A HTML5 face, not WPF or SilverLight.
Continue from the previous post about HTML5/JavaScript, I decide to spend several hours on a new tool to write JavaScript. I compared Dart and TypeScript. As a long time C# developer, I feel it will be easier to follow another Andres's language. One advance for TypeScript can host the JavaScript code and this can help me to learn JavaScript as well.
In order to make the debug work, you have to use IE as default browser. Adding a new item does not work well, I have to manually add a .ts file and fix the project file.
Continue from the previous post about HTML5/JavaScript, I decide to spend several hours on a new tool to write JavaScript. I compared Dart and TypeScript. As a long time C# developer, I feel it will be easier to follow another Andres's language. One advance for TypeScript can host the JavaScript code and this can help me to learn JavaScript as well.
After I install the TypeScript in VS2012, I have to reboot my computer. It was a little surprise as I did not expect a preview language needs reboot my computer while VS SP1 does not requires a reboot. But anyway, it does not take long.
I created the first TypeScript project and the sample code helps me understand what is going on. The first small project I did is a small animation on the Canvas. The following code is located in app1.ts which will be compiled to app1.js. In the HTML page, I have a canvas whose id is "canvas0".
var c = <HTMLCanvasElement> document.getElementById("canvas0");
var ctx = c.getContext("2d");
setInterval(() =>
{
var i = new Date().getSeconds() % 10 / 10;
var width = c.width
var height = c.height
// Create gradient
var grd = ctx.createLinearGradient(0, 0, width, 0);
grd.addColorStop(0, "red");
grd.addColorStop(i, "yellow");
// Fill with gradient
ctx.fillStyle = grd;
ctx.fillRect(0, 0, width, height);
}, 500)
In order to make the debug work, you have to use IE as default browser. Adding a new item does not work well, I have to manually add a .ts file and fix the project file.
Sunday, January 27, 2013
HTML5 First Day
My first HTML5 pages. I believe the big data needs a way to render. And I decide to use HTML5 as the way to go. The sample shows how to put script and call javaScript function.
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Hello HTML5</title>
</head>
<body>
<button title="Click Me" onclick="Javascript:alert('clicked')">Click Me!</button>
<button title="Click Me2" onclick="click2()">Click Me2</button>
</body>
<script type="text/javascript">
function click2() {
alert('Clicked Me2');
}
</script>
</html>
Subscribe to:
Posts (Atom)