General method for error handling
if(env.IsDevelopment()){
app.UseDeveloperExceptionPage();
} else {
app.UseExceptionHandler("/Error");
app.UseHsts();
}
ソフトウェアエンジニアの技術ブログ:Software engineer tech blog
随机应变 ABCD: Always Be Coding and … : хороший
General method for error handling
if(env.IsDevelopment()){
app.UseDeveloperExceptionPage();
} else {
app.UseExceptionHandler("/Error");
app.UseHsts();
}
昔入れたmono、versionは4.8.0です。
[vagrant@localhost csharp]$ . /opt/mono/env.sh
[vagrant@localhost csharp]$ mono --version
Mono JIT compiler version 4.8.0 (Stable 4.8.0.495/e4a3cf3 Thu Feb 23 18:33:47 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-/)
GC: sgen
cs
using System;
class MyApp {
static void Main(){
Console.WriteLine("Hello World");
}
}
compileはmcs
[vagrant@localhost csharp]$ mcs MyApp.cs [vagrant@localhost csharp]$ ls MyApp.cs MyApp.exe [vagrant@localhost csharp]$ mono MyApp.exe Hello World
using System;
class MyApp {
static void Main(){
string msg = "Hello csharp";
Console.WriteLine(msg);
}
}
定数:const string msg = “Hello csharp”;
visual studio

inputとtodoが多すぎて混乱してきた。
1.mongo DBを使ってanalyticsをつくる
2.c# + visual studioでazure cosmosDBに接続する
3.c#でアプリケーションをつくって、azureで公開する
-> c#、visual studioは基本から学ばなければならないので、習得しながら疑似GAの完成までもっていくには恐らく時間がかかりすぎる
-> azure + c# は慣れるまではもっと簡単なテーマ・アプリケーションから作りたい
-> まずは analyticsは VPS + PHP + mongoDB + chart.jsで作り上げる
よし、これで行こう!
centOSによるC#の実行環境を整えるため、monoの公式サイトより、Linux向けインストールを実行します。
cd /etc/yum.repos.d yum install epel-release wget https://copr.fedoraproject.org/coprs/tpokorra/mono-opt/repo/epel-6/tpokorra-mono-opt-epel-6.repo yum install monodevelop-opt nunit-opt . /opt/mono/env.sh mono --version
[vagrant@localhost yum.repos.d]$ mono --version
Mono JIT compiler version 4.6.0 (Stable 4.6.0.245/746756c Sat Sep 24 06:33:41 UTC 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-/)
GC: sgen
Monoのコンパイルコマンド
[vagrant@localhost csharp]$ mcs MyApp.cs [vagrant@localhost csharp]$ ls MyApp.cs MyApp.exe [vagrant@localhost csharp]$ mono MyApp.exe
ポケモンGOやってますか?
ボールが直ぐなくなってしまいますが、なんとかならないでしょうか?
さて、ポケモンGoにも出てくる位置情報ですが、どんな仕組みが気になりませんか?
AppleのDeveloper向けのサイトで、”Location and Maps Programming Guide“があります。
数時間で読めると思いますので、是非ご参照ください。
その中で、
Core Location framework, which defines Objective-C interfaces for obtaining information about the user’s location and heading
Maps app(Map Kit framework)
と記述があり、Core LocationというFrameworkがあることがわかります。
Core Locationはこちら。

参照アカウント方式では、参照された側が死活管理を行っています。
参照する際に、「参照します」と通知し、参照が終了した際に「参照が終わる」と送ります。参照カウントが0になったときに終了処理を実行します。「オブジェクトを参照する」という通知は、.NETにより自動的に行われます。
参照を減らすという通知がMarshal.ReleaseComObjectです。
Application app = null;
try
{
app = new Application();
app.DisplayAlerts = false;
Workbook book = null;
try
{
book = app.Workbooks.Add();
((Range)(Worksheet)book.Worksheets[1]).Cells[1, 1].Value =
book.SaveAs(Filename: @"c:¥temp¥abc.xlsx");
book.Close(SaveChanges: false);
app.Quit();
MessageBox.Show("finish");
}
finally
{
if (book != null) Marshal.ReleaseComObject(book);
}
}
finally
{
if ( app != null )Marshal.ReleaseComObject(app);
}