VisualStudio2013のセットアッププロジェクト

VS2013から http://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054dinstallshieldでなくなったかと思ったけど復活したらしい。

binary read

普通にバッファサイズをおもいっきりとって一回読むのでもいいのかなー public static byte[] GetData( this Stream input, int size ) { byte[] buffer = new byte[Math.Min( 1024, size )]; int totalSize = 0; using ( MemoryStream ms = new MemoryStrea…

エンディアン変更

IPAddress.HostToNetworkOrderとかIPAddress.NetworkToHostOrderがあるのは知ってるけど ネットワークで使うときでないときはなんか違う気がするんだ。 にしてもなんでsignedだけなんだ public static ushort ToBigEndianUInt16( this byte[] source ) { ret…

Mp4ファイル解析

Mp4の再生時間とか知りたかったので解析ツールは↓が便利 http://www.thinmultimedia.com/products/MP4Reader.htmlボックスについての情報 http://xhelmboyx.tripod.com/formats/mp4-layout.txt

Directory全部copy

File.Copyはあるのに! Static Classも拡張メソッドできたらDirectoryに突っ込みたい単純なCopyではなくて、複製?overwriteがtrueなら新しいファイルで上書き。こっちが古かったら上書きされる。CopyDirectoriesだけなら一方向そういえばWindows的にはFolde…

SQL SERVER 全テーブル削除

外部キーもあわせて begin try while(exists(select 1 from information_schema.table_constraints where constraint_type='foreign key')) begin declare @sql nvarchar(2000) select top 1 @sql=('alter table ' + table_schema + '.[' + table_name + '] …

アイコン集

http://www.publickey1.jp/blog/14/windows_azure_5.html

あるオブジェクトのプロパティを文字列で指定して呼び出す

あるオブジェクトのプロパティを文字列で指定して呼び出す拡張メソッド。 public static dynamic GetDynamicMember<T1>(this T1 target, string memberName) { if (target == null) { throw new NullReferenceException(); } var binder = Binder.GetMember(CSha</t1>…

フルスクリーン検出

完全にメモなので後で修正 ほかウィンドウがフルスクリーン時は最前面をやめるってのを考えるref:.d.hatena.ne.jp/ir9Ex/20060821/1156127138using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Runti…

jQuery UI - アイコン

アイコン一覧http://jquery.keicode.com/ui/icons.php <span class='ui-icon ui-icon-minusthick'></span> こんなかんじでhttp://www.webopixel.net/javascript/303.html

nsoup

jsoupの.net版http://nsoup.codeplex.com/ スクレイピングするときに便利

ListViewにソート用アイコンを表示する

http://stackoverflow.com/questions/254129/how-to-i-display-a-sort-arrow-in-the-header-of-a-list-view-column-using-c?answertab=votes#tab-topまだWinFormなんだが

C#でパケットスニファ

winpcap http://www.winpcap.org/SharpPcap http://sourceforge.net/projects/sharppcap/その他参考 http://sharppcap.sourceforge.net/htmldocs/index.html http://www.tamirgal.com/blog/page/SharpPcap.aspx http://sharppcap.git.sourceforge.net/git/gi…

ロックメモ

C#

ロック獲得できなければスルー static private object _lockObj = new object(); static public void Function() { if (Monitor.TryEnter(_lockObj)) { try { // 処理 } finally { Monitor.Exit(_lockObj); } } } ロック獲得できなければ待つ static private…

cssの:before:after

めもめもなのですー http://coliss.com/articles/build-websites/operation/css/css-tutorial-pseudo-element-before-after-by-hongkiat.html

IEqualityComparer ラムダ式で実装

Dictionry.Constantsでラムダ受け付けてほしい IEqualityComparerとかめんどい - Memo+を拡張メソッドに改変 /// <summary> /// ラムダ式を受け付けるIEqualityComparerの実装を提供します。 /// </summary> /// <typeparam name="T">比較するオブジェクトの型。</typeparam> static public class LambdaComparer…

ipv6 無効化 レジストリ設定

以下のコマンドを入力 reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 255

android driver

http://developer.android.com/tools/extras/oem-usb.html#Drivers

JAVAの日付に変換

C#

JSTのみ? private static readonly DateTime ORIGIN = new DateTime( 1970, 1, 1, 9, 0, 0, 0 ); private static DateTime JavaDateToDateTime( long javaDateTime ) { return new DateTime( ( javaDateTime ) * 10000 + ORIGIN.Ticks ); } private static …

オレオレ証明書回避

認証局信頼されていない自己証明書では↓の例外が出るSSL/TLS のセキュリティで保護されているチャネルに対する信頼関係を確立できませんでした ---> System.Security.Authentication.AuthenticationException: 検証プロシージャによると、リモート証明書は無…

クライアントからアップロード

/// <summary> /// ファイルをアップロードする /// </summary> class FileUploader { string _uploadUrl; string _postInputName; Encoding _encode; CookieContainer _cookies; /// <summary> /// 文字コード、アップロードのアクションを指定してImageUploaderのインスタンスを初期化</summary>…

Nullのときは値をいれてNullでないときはそのまま返す拡張メソッド

C#

なんとなく思いついたというか欲しかった。ナイの? 「IsNullOrEmptyはゆとり」と同レベル static public T IfNullUnderstudy<T>( this T source, T understudy ) where T : class { return source == null ? understudy : source; } Nullオブジェクトは大仕掛</t>…

WEBでシンタックスハイライト

スーパープレ記法的なgoogle-code-prettify http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-how-to-add-syntax-highlighting-to-any-project/jQuery Syntax Highlighter http://steamdev.com/snippet/

IISでURLを書き換える URL Rewrite Module 2.0

IIS

URLの変更なんて自作で HttpHandler つくるものだと思ってた それがMVCになって楽になったとか思ってたんだが、実際はこういったプラグイン入れるものだったんだなとか今更思った。 http://www.iis.net/download/urlrewriteApplication Request Routing 2.5 …

linuxからwindwosのActiveDirectory共有フォルダに接続する時のメモ。

Kerberos認証の設定 /etc/krb5.conf ファイルを編集する。 ネームサーバーの指定 /etc/resolv.conf ファイルを編集する。 システム時間の設定 DCと5分ぐらい差があると蹴られるはず。NTPはDCを参照する マウント mount.cifsが必要 samba3.5だとsamba-client…

Ajaxでも戻るボタンを使いたい!

SWFAddressってのが使える 要はアドレスに#で自己リンクを作るってやつhttp://www.asual.com/swfaddress/うわーすげーちょっと前の記事だけど http://www.atmarkit.co.jp/fwcr/rensai/ajaxrecipe06/ajaxrecipe06_2.htmlAptana Jaxerとか含めMSの標準で色々サ…

Ctrl+AでtextBoxを全選択する

windows fromなんてオワコンデフォルトで出来なかったんだっけtextBoxのKeydownイベントに登録 private void Form1_Load( object sender, EventArgs e ) { textBox1.KeyDown += ( eventSender, eventE ) => { if ( eventE.Control && eventE.KeyCode == Keys…

windows7でネットワークが不安定になったら

今はメインで使用しなくなったマシンはすぐにネットワークが切れて困っていたんだがコレ怪しいな http://itpro.nikkeibp.co.jp/article/COLUMN/20100824/351391/機会があれば試してみよう

web.config 暗号化

デプロイ後にAspnet_regiisを実行 pe:暗号化する構成セクションconfiguration以下で指定 app:Web アプリケーションの仮想パス prov:プロバイダ名 RSAProtectedConfigurationProvider。 これは、既定のプロバイダであり、RSA 公開鍵暗号化を使用して、デー…

弱いイベント パターン

.netはメモリーリークがないというのは都市伝説 やっぱり一番ネックになるのはイベントかなーなどと思っていたらWPFではこんなの使ってるのか弱いイベント パターン | Microsoft Docsやっぱりコード書かないとついていけないな