Skip to content

Instantly share code, notes, and snippets.

View ochilab's full-sized avatar

おちラボ ochilab

View GitHub Profile
@ochilab
ochilab / judgeSample.vba
Last active August 27, 2015 20:58
VBAにて正誤判定する処理のサンプル(講義資料)
Private Sub CommandButton1_Click()
'正誤判定
Dim judge As Integer
'解答番号
Dim answer As Integer
'正解番号
Dim collect As Integer
@ochilab
ochilab / loginSample.vba
Created August 27, 2015 21:00
ログイン処理サンプル(講義資料
Dim txt As String
'解答モード
If OptionButton1.Value = True Then
'テキストボックスに入力されたIDを評価画面に渡す
UserForm2.id = TextBox1.Text
UserForm2.init
'解答画面表示
UserForm2.Show
'評価モード
ElseIf OptionButton2.Value = True Then
@ochilab
ochilab / showProblem.vba
Created August 27, 2015 21:03
問題表示サンプル(講義資料
Sub showProblem(num As Integer)
With Worksheets("Sheet1")
Label1.Caption = .Cells(num + 1, 1).Value '問題文
OptionButton1.Caption = .Cells(num + 1, 2).Value '選択肢1
OptionButton2.Caption = .Cells(num + 1, 3).Value '選択肢2
OptionButton3.Caption = .Cells(num + 1, 4).Value '選択肢3
OptionButton4.Caption = .Cells(num + 1, 5).Value '選択肢4
End With
End Sub
@ochilab
ochilab / EnumerableConcat.cs
Created January 31, 2014 12:14
C#:配列の連結
int[] intArray1 = { 1,2,3,4,5};
int[] intAray2 = { 6,7,8,9 };
int[] result = Enumerable.Concat(intArray1, intArray2).ToArray();
@ochilab
ochilab / CvBlobsLabel.cs
Last active August 29, 2015 13:56
OpenCVSharpでのラベリング処理(2.4.5 以降対応)
private CvBlobs blobsLabelling(IplImage binSrc) {
CvBlobs blobs = new CvBlobs();
//ラベリング処理
//IplImage imgLabel = new IplImage(binSrc.Width, binSrc.Height, CvBlobLib.DepthLabel, 1);
//blobs.Label(binSrc, imgLabel);
blobs.Label(binSrc);
return blobs;
}
@ochilab
ochilab / AmazonSimpleDBClient.cs
Last active August 29, 2015 13:56
AWS2.0 からのSimpleDBクライアントの呼び出し
//static AmazonSimpleDB sdb; //1.5まで
static AmazonSimpleDBClient sdb;
AmazonSimpleDBConfig config = new AmazonSimpleDBConfig { ServiceURL = endpoint };
//sdb = AWSClientFactory.CreateAmazonSimpleDBClient(config); //1.5まで
sdb = new AmazonSimpleDBClient(config);
//その他もろもろの変更点 #######
//ドメインリストの呼び出し方法
//foreach (string domain in response.ListDomainsResult.DomainName)
@ochilab
ochilab / gwtOnPasteEvent.java
Created February 16, 2014 09:40
GWTでペーストイベント検知
//コンストラクターで記述しておく
sinkEvents(Event.ONPASTE);
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
switch (event.getTypeInt()) {
case Event.ONPASTE:
// event.stopPropagation(); //ここは不要?
System.out.println("paste");
break;
@ochilab
ochilab / showGraphToForm.vba
Last active August 29, 2015 13:56
Excelのグラフをユーザフォームに表示する
With Worksheets("sheet3")
.ChartObjects(1).Chart.Export "C:\temp\Graph.jpg"
End With
Image1.Picture = LoadPicture("C:\temp\Graph.jpg")
@ochilab
ochilab / FormClosingDialog.cs
Created March 7, 2014 07:10
C#: フォームのクローズボタンが押された場合の処理。このイベントは追加すること。
void Form1_FormClosing(object sender, FormClosingEventArgs e){
DialogResult result = MessageBox.Show("終了しますか?", "システム終了",MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.No){
e.Cancel = true;
}
}
@ochilab
ochilab / kinectInit.cs
Last active August 29, 2015 13:57
C#: Kinectのシンプルな初期設定
private void kinectInit(){
//Kinectの初期化
kinect = KinectSensor.KinectSensors[0];
//イベントハンドラの登録
kinect.ColorFrameReady +=
new EventHandler<ColorImageFrameReadyEventArgs>(kinect_ColorFrameReady);
kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeltonFrameReady);
kinect.DepthFrameReady += new EventHandler<DepthImageFrameReadyEventArgs>(kinect_DepthFrameReady);
//カメラの有効化