2016-01-01から1年間の記事一覧

1行csv読み込みw

C#

static string[][] getCsv(string path) { return File.ReadLines(path).Select(x => x.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries)).ToArray(); }

簡単な内部結合

C#

var product = new[]{ new { Id = 1, name = "item1" }, new { Id = 2, name = "item2" }, new { Id = 3, name = "item3" }, new { Id = 5, name = "item5" }, }; var price = new[] { new { Id = 1, price = 100 }, new { Id = 2, price = 200 }, new { Id …

GroupByで重複しているIDをグループ化

C#

var ids = new[] { 1, 3, 5, 7, 9, 1, 2, 3 }; // {id, index}の匿名型作成 // idをグループ化 var group_index = ids .Select((x, index) => new {id = x, index = index}) .GroupBy(x => x.id); // id == 1のグループとりだす var check_id = 1; var group…

全角アルファベット → 半角アルファベット変換

C#

C#ではVisualBasicのStrConvを使えばできるみたいですが、 ちょっとめんどくさい設定が必要になるので、適当に自作。 // 全角アルファベット -> 半角アルファベット public static string convertHalf(string s) { var all = "abcdefghijklmn…

sublimetext3 windowsでGit bashを即時実行

ファイル作成 test.sh sublimetext3 Tools > Build System > New Build System bashのパス指定 { "cmd": ["C:\\Program Files\\Git\\bin\\bash.exe", "$file"] } echo "hello world" 実行コマンド Ctrl+Shift+B

ftpユーザアクセス確認

user_list (user-name,password) ftpuser ftpuser user001 user001 user002 user002 check-ftp.sh #!/bin/bash start() { local file_name="./user_list" local ip_addr="192.168.1.101" # アクセスしたいipアドレスを指定 cat ${file_name} | while read li…

PropertyGrid + xml用クラス

C#

追記 A Generic Clamp Function for C# - CodeProject clamp関数を作ればもうチョイ見やすくなる。

cocos-2dxでtest用に作ったインターフェイスとマクロ

C++

namespace tt { /* * test interface */ class ITest { public: virtual ~ITest(){} virtual void test(cocos2d::Node* parent) = 0; }; #define CREATE_TEST_CLASS(CLASS_NAME) \ class CLASS_NAME : public cocos2d::Node, public ITest { \ public: \ voi…

正規表現

正規表現 ファイル名 ディレクトリ var path1 = "C:/Users/Administrator/Desktop/test/hoge.html"; var path2 = "http://www.sample.com/test/hoge.html"; // directory console.log(path1.match(/^.*\//)); // file console.log(path1.replace(/^.*\//, ""…

sublime text - 個人的な最小限設定

よくQiita見てるので,これからQittaで記事書くと思います。 qiita.com