骨のダイスを転がそう

2009|01|02|03|04|05|06|07|10|12|
2010|01|02|03|04|05|06|07|08|09|10|11|
2011|02|03|05|06|07|08|09|10|11|12|
2012|01|02|04|05|09|10|11|12|
2013|01|02|04|
2014|11|
2015|01|04|05|
2016|06|07|08|09|11|
2017|01|02|03|04|
2018|03|

2011-02-17

_ [C#] NUnit でイベントの発生を確認

http://opcdiary.net/?p=3954

を参考にイベントの発生をテストしていたけど、NUnit2.5 では、Timeout 属性をつければ、特定時間内にイベントが発生したかどうかを簡単に検証できる模様。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using NUnit.Framework;
using System.ComponentModel;

namespace TestEvent
{
   public class Class1
   {
       //指定した日付のデータをデータベースから取得する

       [Test(),Timeout(1000)]
       public void TestGetLogData()
       {
           //イベントが呼び出されたことを示すフラグを設定するよ
           bool evenFired = false;

           //テスト対象のインスタンスを作るよ
           var model = new LogModel();

           //イベントメソッドを定義してやるよ
           model.LogGetted += (o, e) =>
           {
               Console.WriteLine("Record Count {0}", model.Logs.Count);

               //イベント発生のフラグを立てるよ
               evenFired = true;
           };

           //Event Fire!!
           model.GetLogData(new DateTime(2010, 4, 26));

           //イベント発生のフラグが立っていたらテスト成功!!
           Assert.IsTrue(evenFired, "GetLogData Fired.");
       }
   }

   class LogModel
   {
       public event EventHandler LogGetted;

       public void GetLogData(DateTime date)
       {
           LogGetted(this, new EventArgs());
       }

       public List<string> Logs
       {
           get { return new List<string> { "", "" }; }
       }
   }
}

_ [Ruby][Rails][debian] lenny を squeeze に、redmine を 0.8.4 から 1.1.1 へ

まあ、昔のこと思えば随分、楽になってるよね……。

まず、lenny から squeeze への移行の中で postgresql が 8.3 から 8.4 へ移行。これが、手作業でのDB移行が必要だった。(アップグレードのときにメッセージを読み逃した?)

  • ユーザーとDBの作成
  • pg_dump でデータベースのバックアップ作成
  • pg_restore で復活

次に、gems をアップグレード。squeeze で、gem は、1.3.7 になったんだけど、ここで

gem update

とやったら、gem が 1.3.7 から 1.5.2 にアップグレード。

gem list

とやると既存の gem がどこかへ行ってしまっている……。おーい。

gem install rubygems-update -v='1.4.2'
gem uninstall gem-update v='1.5.2'
update_rubygems

と、まあ無難なバージョンにしておく。

rails は、2.3.5、redmine は、1.1.1 、Passenger は 2.2.4 。移行作業そのものは、まあうまく行った。

http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

で、試しに何箇所か表示させてみると、

PhusionPassenger::Railz::ApplicationSpawner::Error

と。Passenger の問題らしいので、試しに Passenger を、最新の 3.0.2 へ。

gem install passenger
passenger-install-apache2-module

apache の passenger.conf でモジュールのパスを調整する。

これで問題なく表示されるようになった。

本日のツッコミ(全6件) [ツッコミを入れる]
_ gordon (2015-04-23 03:15)

Im87uC http://www.FyLitCl7Pf7kjQdDUOLQOuaxTXbj5iNG.com

_ Samual (2015-05-07 07:13)

Excellent work, Nice Design http://www.fabulousfordsforever.org/index.php/pulmopres-online buy nasutra Ethan Anderson's remains were not positively identified until Friday night, when the San Diego County Sheriff's Department said its crime lab had used DNA to determine Ethan's identity. An Amber Alert was initially issued for both children.<br>

_ Moses (2015-05-07 07:13)

Which team do you support? http://www.sniderscyclery.com/?vigorax-para-que-serve.pdf vigorax faz mal "I was trying to establish personal relationships," Filner said. "I sincerely apologize to all of you. ... For the part that I have played, for putting the city through a difficult time, I apologize."<br>

_ Trent (2015-05-07 07:13)

Canada>Canada http://www.maxicrop.co.uk/stendra-in-south-africa/ stendra menarini Though Eurostat, the EU's statistics office, said the unemployment rate across the 17-member eurozone held steady at 12% in August, it found the number of people out of work fell for the third month running. That's the first time the region has enjoyed such a run since April 2011.<br>

_ Ethan (2015-05-07 07:13)

I'm sorry, I didn't catch your name http://mobilewebghana.org/himcolin-gel-in-kuwait.pdf himcolin gel saudi arabia The 2013 cooking honor of “best cooked balls” went to 63-year-old Zoltan Levaj and his 12-year-old assistant, Marko Markovic, both of whom hail from a nearby village. "It means a lot, really a lot," Levaj said after winning the trophy, a wood-carved phallus. "But it's more about flavor and hospitality, not so much about competition."<br>

_ Warren (2015-05-07 07:13)

Do you play any instruments? http://www.samhardenburgh.com/where-to-buy-fildena.pdf fildena 100 dosage &ldquo;I realize that I haven&rsquo;t had a lot of chances to play this year or a lot of chances to play healthy this year, have had injuries and what have you,&rdquo; she said. &ldquo;So I&rsquo;m just going to have to keep working my way into it maybe more than some of the other players. But I know I can do that.&rdquo;<br>