万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    2015-12-01から1ヶ月間の記事一覧

    Enumの中身展開 C#

    以下の様なEnumあるとする。 public enum HogeType { None, Bar, } Enumの中身展開 foreach(var val in System.Enum.GetValues(typeof(HogeType))) { Debug.Log("Value: " + val); } Objectになってしまうので、varは目的のEnum型に foreach(HogeType val in…

    浮動小数点型の誤差 C#

    小数(浮動小数点数型)の計算が思った結果にならない理由と解決法: .NET Tips: C#, VB.NET if(0.1f + 0.2f == 0.3f) { Debug.Log("ok"); } 一応ok ・17桁表示 Debug.Log((0.1f).ToString("G17")); 0.100000001 Debug.Log((0.2f).ToString("G17")); 0.200000…

    LINQでオブジェクトの一意の取り出し

    stackoverflow.com オブジェクトで比較するからDistinct()だと同じやつもそのまま別物扱い。 Distinctを拡張してやるのもいいかもしれないが・・。 GroupByがよさ気。 c# - Linq Distinct on a particular Property - Stack Overflow なんかGroupByのいち位…

    101 LINQ Samples

    101 LINQ Samples in C# LINQのサンプル

    Unity 5.3 & Web GL/HTML5 セミナー by Unity & Mozilla

    https://kenjin.unity3d.jp/events/show/307 開演、Unity Technologies Japan 大前広樹登壇 サバイバルシューター https://unity3d.com/jp/learn/tutorials/projects/survival-shooter-project ライトとかも入っている。 ・ビルド(Development Build) アセ…

    C# Unity EditorのInspector拡張で自前のクラスの変換

    Hogeクラスは何の変哲もないMonoBehaviorの継承でもないふつーのクラス。 シリアライズのため[System.Serializable] [System.Serializable] class Hoge { string bar; } そしてInsppectorを表示していたクラス public class MyMono : MonoBehaviour { [Seria…

    InitializeOnLoadとかInitializeOnLoadMethodとかRuntimeInitializeOnLoadMethod Unity

    どうしてもEditorのOnEnabledが遅くて、普通のMonoBahaviorのAwake()より遅くて困った。 [InitializeOnLoad] //これをつけるとstaticなコストラクタを定義すると呼ばれる. public class Test : Editor // 別にEditorの小クラスでなくても`InitializeOnLoad`…

    ラムダ式内でthisにアクセス出来ないC#

    Compiler Error CS1673 コード抜粋 // Try assigning to a local variable // S s = this; ←こうしろ MyDelegate d = delegate() { i = this.member; // CS1673 エラー // And use the local variable instead of "this" // i = s.member; return i; ここでC…

    2015 アドベントカレンダー

    React.js Advent Calendar 2015 - Qiita カノジョできないエンジニア Advent Calendar 2015 - Qiita すきなことをしよう(仮) Advent Calendar 2015 - Qiita

    yield return n C# Unity

    yield キーワード yield return n; とした。 foreach(object n in GetIterator()) { Debug.Log(n); } ちゃんと数字返るっぽい

    IL2CPPの略 Unity

    IL2CPPに関する軽い話 from Wooram Yang www.slideshare.net 中間言語(Intermediate Language)をC++(CPP)に変換

    Storyboadのメニューが消えた

    iOS

    万年素人なので分からなかった。 Storyboad(ストーリーボード)のメニューが消えた。 UnityのInspector(インスペクタ)的なやつ。 どこにあるのか? Inspectorで検索してみた。 「Show Identity Inspector」だった。 こいつは「Identity Inspector(アイデ…

    Simulatorがあまりにもトロい iOS

    Activity Monitor で確認してみる。 CPU使用率が100%とかではない。 「Slow Animations」がONになっていた! ショートカットは command + [T]

    Swift 2.1でPythonのrange的な

    for me in 3...4 { print(me) } 3 4 最後の数字は含む

    Swift 2.1でべき乗

    2の4乗したい。 2 ^ 4 でもなく pow(2, 4) infix operator ^^ { } func ^^ (radix: Int, power: Int) -> Int { return Int(pow(Double(radix), Double(power))) } こうすれば 2 ^^ 4

    Swift 2.1 Stringの任意の1文字

    let str1 = "9876" let index = 3 Int(str1[str1.startIndex.advancedBy(index)..

    C# LINQ Aggregate

    たまたまListの変数に対して.打つとかってにコードのサジェスチョンが出たので調べた。 日本語のブログ出たけどわかりにくいから今度まとめる。 【参考】 qiita.com Linq入門記-40 (LINQ To Object, Aggregate) - いろいろ備忘録日記 ameblo.jp 【単語の意味…

    T型にキャスト C#

    c# - Cast object to T - Stack Overflow private static T ReadData<T>(XmlReader reader, string value) { reader.MoveToAttribute(value); object readData = reader.ReadContentAsObject(); return (T)readData; } このときにreadDataをTにキャスト不可能。</t>…

    enumの数を数える C#

    Enum.GetNames(typeof(ここにenumの型)).Length

    SerializedPropertyでstring[]やint[]に変換する C#

    intValueやstringValueがあるのに int配列 public static int[] ToIntArrayValue(this UnityEditor.SerializedProperty aProperty) { int size = aProperty.arraySize; var arr = new int[size]; for(int i=0;i

    Enumをstringにしたりいろいろ相互変換 C#

    www.dailycoding.com

    BitBucketにpush不可

    いつもと違うキーの名前にしたせい? 僕が作ったSSHの秘密鍵はpersonalidの名前だった。 以下 > git push origin master master [9189f99] Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the co…

    カスタムインスペクタでプライベートメソッドにアクセス

    invoke a method from a Unity Inspector カスタムアトリビュートを作る? using System; // Place this file in any folder that is or is a descendant of a folder named "Scripts" namespace CatchCo { // Restrict to methods only [AttributeUsage(Att…

    TransformのCustomEditor C# Unity

    https://unity3d.com/learn/tutorials/modules/intermediate/live-training-archive/property-drawers-custom-inspectors UnityScriptもなんかある http://answers.unity3d.com/questions/39360/how-to-get-to-the-editor-to-display-a-childs-world.html

    string.Formatでのカッコ C#

    プレースホルダでカッコを使いたい時。 c# - How to escape braces (curly brackets) in a format string in .NET - Stack Overflow {を2つにする。

    Realm Swift0.96.3を入れたい

    > pod install master untracked Updating local specs repositories Analyzing dependencies Downloading dependencies Using Realm (0.95.0) Using RealmSwift (0.95.0) Generating Pods project Integrating client project Sending stats Pod installati…