This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Real { | |
double r; | |
} | |
class Complex { | |
double r; | |
double i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Test { | |
static void main (String[] args){ | |
System.out.println("hello, world."); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class T, class F = decltype(!(std::declval<T>()==std::declval<T>()))> | |
// 自動的に定義される!=演算子。==演算子の結果に!演算子を適用した結果を返します。 | |
F operator!=(T a, T b) | |
{ | |
return !(a==b); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s.find(e) != s.end() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// つまり、長さ256の配列を確保するのに | |
int int_array[256]; | |
// でなく | |
int* int_array = (int*)malloc(256); | |
// なんてやるのは |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// バッファが足りないと結果が切り捨てられる文字列取得関数を、バッファを拡大しながら呼び出し続けて全内容を取得します | |
template<typename TChar, typename PFunc, typename... TParams> | |
std::basic_string<TChar> challenge_get_string(PFunc f, TParams... params) | |
{ | |
vector<TChar> buf(256); | |
size_t result_len; | |
for (;; buf.resize(buf.size() * 2)) | |
{ | |
result_len = f(params..., buf.data(), buf.size()); | |
if (result_len < buf.size() - 1) break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <regex> | |
namespace std { | |
#ifdef _UNICODE | |
typedef std::wstring tstring; | |
typedef std::wregex tregex; | |
typedef std::wsmatch tsmatch; | |
#else | |
typedef std::string tstring; | |
typedef std::regex tregex; | |
typedef std::smatch tsmatch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Mackerel Agent | |
After=network.target | |
[Service] | |
Type=simple | |
EnvironmentFile=/etc/sysconfig/mackerel-agent | |
ExecStart=/usr/local/bin/mackerel-agent --root=/var/lib/mackerel-agent $OPTS | |
[Install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ArrayOfCustomAction xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<CustomAction> | |
<Caption>ローカルで管理対象外に</Caption> | |
<OpenInSeparateWindow>false</OpenInSeparateWindow> | |
<ShowFullOutput>false</ShowFullOutput> | |
<Target>git</Target> | |
<Parameters>update-index --skip-worktree $FILE</Parameters> | |
</CustomAction> | |
<CustomAction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// 永続化操作 | |
} catch (SQLException sqle) { // SQLExceptionを投げるフレームワークの場合 | |
if ("40001".equals((sqle).getSQLState())) { | |
// デッドロック | |
} | |
else throw sqle; | |
} catch (PersistenceException pe) { // PersistenceExceptionを投げるフレームワークの場合 | |
Throwable cause = pe.getCause(); | |
if (cause instanceof SQLException && "40001".equals(((SQLException)cause).getSQLState())) { |