Skip to content

Instantly share code, notes, and snippets.

View KentaYamada's full-sized avatar
🏠
Working from home

yamaken KentaYamada

🏠
Working from home
View GitHub Profile
@KentaYamada
KentaYamada / CsvRead
Created August 9, 2014 06:36
PythonでCSVファイル読み込み
#-*- coding:utf-8 -*-
import csv
def csvDownLoad():
f = open("test.csv")
data = csv.reader(f)
for row in data:
print(row)
@KentaYamada
KentaYamada / CsvDownloader.cs
Last active August 29, 2015 14:05
WebブラウザからCSVファイルをダウンロードするプログラム
//****************************************************
//Title:Web経由でCSVファイルをダウンロードするサンプル
//Author:Kenta Yamada
//Creation date:2014/08/09
//****************************************************
using System;
using System.IO;
using System.Text;
namespace WebApplication1
@KentaYamada
KentaYamada / TSql_Select
Created July 27, 2014 12:27
ストアドを使ってSelect文の結果を取得するサンプル
using System;
using System.Data;
using System.Data.SqlClient;
namespace StoredProcedureSelect
{
class Program
{
static void Main(string[] args)
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
//T-SQLのテーブル型変数を引数にしたプロシージャへデータを渡すサンプル
//List<T>で渡したいけどダメらしい…
namespace ADO_StoredProcedure_sample
@KentaYamada
KentaYamada / CalcIncludingTaxPrice
Created May 8, 2014 10:38
外税消費税額計算
/// <summary>
/// 税込金額取得
/// </summary>
public decimal CalcIncludingPrice(decimal price, decimal taxRate)
{
return price * (100 + taxRate) / 100;
}
@KentaYamada
KentaYamada / ExceptionLogWriter
Last active August 29, 2015 14:01
例外キャッチした時にログファイル出力する
using System;
using System.Configuration;
using System.IO;
using System.Text;
namespace LogFilerSample
{
class Program
{
private static readonly string _filePath = ConfigurationManager.AppSettings["LogFilePath"];
@KentaYamada
KentaYamada / NumericTextBox
Created April 28, 2014 00:28
適当に作った数値入力テキスト
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Usercontrols
@KentaYamada
KentaYamada / DataGridView_List
Last active August 29, 2015 13:56
List<T>のデータをDataGridViewへ格納、データ取り出しサンプル
// DataTable & DataSetは列名の指定と型のコンバート処理が発生して冗長
// データ構造を柔軟にかつインテリセンスで出てくれるように操作できないかと思って作ってみました。
// DBでList<T>で取得するには、LINQ to SQLがベスト!?と今のところ考えてます。
// 大雑把にコーディングしたので、利用される方は参考程度で見ていただけたらありがたいです。
// DataGridViewで生成した列とバインドしたい場合は、デザイナからDataPropertyNameに格納するプロパティ名を記述することでバインド可能です。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@KentaYamada
KentaYamada / SQLiteConnection
Created January 15, 2014 12:19
SQLite:DBファイル作成→ファイルパスを指定してDB接続する
using System;
using System.Data.SQLite;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
private static readonly string FilePath = @"E:\Users\Desktop\SampleDB.db";
@KentaYamada
KentaYamada / StudyObject
Created January 8, 2014 11:16
インスタンスオブジェクトとスタティックオブジェクトの違い(Written by C#) 「インスタンスオブジェクト」 newキーワードによってインスタンス化されたクラスをメモリをヒープ領域へ割り当てる。 インスタンス化された領域ごとに値を持つため、目的のオブジェクトの情報へアクセスする場合はオブジェクト経由でアクセスすることになる。 「スタティックオブジェクト」 インスタンス化できない固有のオブジェクト。 メンバーへのアクセスはクラスから直接行う。同じくヒープ領域へと割り当てられるが、インスタンスオブジェクトとは違い、システムが開始されたと同時にオブジェクトが作られ、終了するまで存在している。
using System;
class MainProgram
{
static void Main()
{
//インスタンス化されたクラスは、オブジェクト毎に情報を保持する。
var instance1 = new InstanceObject();
instance1.Name = "Yamada";