2012年04月10日

同一セグメントでDSRバランサー

Windows2008の場合は以下のコマンド必須
netsh interface ipv4 set interface "net" weakhostreceive=enabled
netsh interface ipv4 set interface "loopback" weakhostreceive=enabled
netsh interface ipv4 set interface "loopback" weakhostsend=enabled

http://blog.loadbalancer.org/direct-server-return-on-windows-2008-using-loopback-adpter/



2011年08月09日

SkypeAPI OCX/ActiveX でがんばるのだ

個人の携帯をAndroidに機種変しました。
不思議とiPhoneは4台も手元にあるので、今回のAndroid端末「IS11SH」とテスト機で使用しているDocomoのXPERIA「SO-01B」も含め、私の周りはスマートフォン天国です。

Softbankとは違い(Docomoは知りませんが)、AUはSIMカードを機種変前のガラケーに差し替えて使う事が普通に出来ますので、ガラケー開発にも困る事はありません。(^^
(Softbankは、黒SIMを解約して銀SIMしかありません。銀SIMを使う為にiPhone3Gを脱獄してしまいました。)

で、Skypeの話ですが、仕事でSkypeのやり取りが頻発しています。
Skypeに限らずオンラインのチャット系は、タイムロスもなくサクサク話が進むため重宝してます。
PCの前にいる時は問題ないのですが、外に出てしまうとSkypeに書き込まれても返答のしようがありません。
オフラインとか、退席中とかにしておけば良いのですが、それではメリット半減です。

なので、外に出かけるときはスマートフォンでスカイプになります。
がー、しかし、問題が2つあります。

1つめは、料金。
完全定額ではなく、ダブル定額のままで機種変したため、極力データ通信はさけたい意向であります。
上限まで使っても数千円の事なのでさほど大きな問題でもないですが、普段はWiFiでがんばっているので、出来る限りパケットは減らしたい気分なのです。

もう1つが結構大きな問題で、バッテリーです。
すぐに帰るときは問題ありませんが、1日中外出する場合、Skypeをバックグラウンドで動かしっぱなしはとても精神的に不安です。
肝心な音声通話に影響が出るようでは、それはもう携帯電話じゃなくなっちゃいます。
常時稼動しているアプリは最小限にとどめるべきでしょう。
でも、それではスカイプへの書き込みに反応する事が出来なくなる、又は定期的にスカイプを立ち上げて確認してもかなりレスが遅くなりる・・という事になってしまいます。

で、前からなんとなく考えてはいたんですが、スカイプに書き込みが有ったときにメールを飛ばしてくれる機能って無いかなー・・と。
探してもなかなか無かったんですが、機種変をきっかけに本腰を入れ始めました。
・・すると、あっさり解決策が見つかりました。

タイトルのとおり、Skpyeを外部から操るDLLが本家Skypeから配布されていました。
それも結構前からです。
Skype4COM.DLLをRegsvr32で登録して、あとはプログラムを書くだけです。
プログラムもActiveXへアクセスできるものであれば何でもよく、Javascriptからでも操作できます。

PCのスカイプは常時立ち上げておいて、書き込みが有ったときに書き込んだ人のID付きでメールを飛ばすようにしました。
わおー、満足・・。
ちなみに、他の方々もいろんな使い道を考えているようです。

モバイルのバッテリー問題は、昔から付きまとってなかなか解決されないですね。
使い倒しても1日は余裕で持ちこたえるようにならないと安心していられないと思うんですが、何故オプションでもいいからLLバッテリーとか出ないんでしょうか。
(昔は一部機種であったんですが、今はまったくないですよね。外部バッテリーが有るからそうしとけって事なんでしょうか。)



2010年09月13日

route add を記憶させるには

Windowsだよ。
route -p add 111.222.222.0 mask 255.255.255.0 192.168.3.1
-p



2008年10月02日

windows 2000 server 自動ログイン


rundll32.exe %SystemRoot%\system32\netplwiz.dll,UsersRunDll



2008年09月14日

Windows7


2010年初頭に登場することが予定されているマイクロソフトの最新OS「Windows 7」ですが、今年中にベータ版の提供が開始されるかもしれないそうです。





2006年09月20日

Visual C++ さまざまな文字列型間で変換する

Visual C++
方法 : さまざまな文字列型間で変換する

このトピックでは、さまざまな C++ 文字列型を他の文字列に変換する方法について説明します。説明する文字列型には、char *、wchar_t*、_bstr_t、CComBSTR、CString、basic_string、および System.String が含まれています。どの場合も、新しい型に変換すると文字列のコピーが作成されます。新しい文字列に何らかの変更を加えても元の文字列には影響しません。また、逆に、元の文字列に何らかの変更を加えても新しい文字列には影響しません。

char * からの変換
サンプル
このサンプルでは、char * から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_char.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

using namespace std;
using namespace System;

int main()
{
char *orig = "Hello, World!";
cout << orig << " (char *)" << endl;

// Convert to a wchar_t*
size_t origsize = strlen(orig) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, orig, _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(orig);
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CComBSTR
CComBSTR ccombstr(orig);
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a CString
CString cstring(orig);
cstring += " (CString)";
cout << cstring << endl;

// Convert to a basic_string
string basicstring(orig);
basicstring += " (basic_string)";
cout << basicstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String(orig);
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (_bstr_t)
Hello, World! (CComBSTR)
Hello, World! (CString)
Hello, World! (basic_string)
Hello, World! (System::String)
wchar_t * からの変換
サンプル
このサンプルでは、wchar_t * から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_wchar_t.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

using namespace std;
using namespace System;

int main()
{
wchar_t *orig = L"Hello, World!";
wcout << orig << L" (wchar_t *)" << endl;

// Convert to a char*
size_t origsize = wcslen(orig) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, orig, _TRUNCATE);
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(orig);
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CComBSTR
CComBSTR ccombstr(orig);
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a CString
CString cstring(orig);
cstring += " (CString)";
cout << cstring << endl;

// Convert to a basic_string
wstring basicstring(orig);
basicstring += L" (basic_string)";
wcout << basicstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String(orig);
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (wchar_t *)
Hello, World! (char *)
Hello, World! (_bstr_t)
Hello, World! (CComBSTR)
Hello, World! (CString)
Hello, World! (basic_string)
Hello, World! (System::String)
_bstr_t からの変換
サンプル
このサンプルでは、_bstr_t から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_bstr_t.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

using namespace std;
using namespace System;

int main()
{
_bstr_t orig("Hello, World!");
wcout << orig << " (_bstr_t)" << endl;

// Convert to a char*
const size_t newsize = 100;
char nstring[newsize];
strcpy_s(nstring, (char *)orig);
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a wchar_t*
wchar_t wcstring[newsize];
wcscpy_s(wcstring, (wchar_t *)orig);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a CComBSTR
CComBSTR ccombstr((char *)orig);
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a CString
CString cstring((char *)orig);
cstring += " (CString)";
cout << cstring << endl;

// Convert to a basic_string
string basicstring((char *)orig);
basicstring += " (basic_string)";
cout << basicstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String((char *)orig);
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (_bstr_t)
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (CComBSTR)
Hello, World! (CString)
Hello, World! (basic_string)
Hello, World! (System::String)
CComBSTR からの変換
サンプル
このサンプルでは、CComBSTR から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_ccombstr.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"
#include "vcclr.h"

using namespace std;
using namespace System;
using namespace System::Runtime::InteropServices;

int main()
{
CComBSTR orig("Hello, World!");
CW2A printstr(orig);
cout << printstr << " (CComBSTR)" << endl;

// Convert to a char*
const size_t newsize = 100;
char nstring[newsize];
CW2A tmpstr1(orig);
strcpy_s(nstring, tmpstr1);
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a wchar_t*
wchar_t wcstring[newsize];
wcscpy_s(wcstring, orig);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(orig);
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CString
CString cstring(orig);
cstring += " (CString)";
cout << cstring << endl;

// Convert to a basic_string
wstring basicstring(orig);
basicstring += L" (basic_string)";
wcout << basicstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String(orig);
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (CComBSTR)
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (_bstr_t)
Hello, World! (CString)
Hello, World! (basic_string)
Hello, World! (System::String)
CString からの変換
サンプル
このサンプルでは、CString から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_cstring.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

using namespace std;
using namespace System;

int main()
{
CString orig("Hello, World!");
wcout << orig << " (CString)" << endl;

// Convert to a char*
const size_t newsize = 100;
char nstring[newsize];
strcpy_s(nstring, orig);
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a wchar_t*
// You must first convert to a char * for this to work.
size_t origsize = strlen(orig) + 1;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, orig, _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(orig);
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CComBSTR
CComBSTR ccombstr(orig);
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a basic_string
string basicstring(orig);
basicstring += " (basic_string)";
cout << basicstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String(orig);
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (CString)
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (_bstr_t)
Hello, World! (CComBSTR)
Hello, World! (basic_string)
Hello, World! (System::String)
basic_string からの変換
サンプル
このサンプルでは、basic_string から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_basic_string.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

using namespace std;
using namespace System;

int main()
{
string orig("Hello, World!");
cout << orig << " (basic_string)" << endl;

// Convert to a char*
const size_t newsize = 100;
char nstring[newsize];
strcpy_s(nstring, orig.c_str());
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a wchar_t*
// You must first convert to a char * for this to work.
size_t origsize = strlen(orig.c_str()) + 1;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, orig.c_str(), _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(orig.c_str());
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CComBSTR
CComBSTR ccombstr(orig.c_str());
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a CString
CString cstring(orig.c_str());
cstring += " (CString)";
cout << cstring << endl;

// Convert to a System::String
String ^systemstring = gcnew String(orig.c_str());
systemstring += " (System::String)";
Console::WriteLine("{0}", systemstring);
delete systemstring;
}

出力
Hello, World! (basic_string)
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (_bstr_t)
Hello, World! (CComBSTR)
Hello, World! (CString)
Hello, World! (System::String)
System::String からの変換
サンプル
このサンプルでは、System.String から上に示したそれ以外の文字列型に変換する方法について説明します。

// convert_from_system_string.cpp
// compile with /clr /link comsuppw.lib

#include
#include
#include

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"
#include "vcclr.h"

using namespace std;
using namespace System;
using namespace System::Runtime::InteropServices;

int main()
{
String ^orig = gcnew String("Hello, World!");
Console::WriteLine("{0} (System::String)", orig);

pin_ptr wch = PtrToStringChars(orig);

// Convert to a char*
size_t origsize = wcslen(wch) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, wch, _TRUNCATE);
strcat_s(nstring, " (char *)");
cout << nstring << endl;

// Convert to a wchar_t*
wchar_t wcstring[newsize];
wcscpy_s(wcstring, wch);
wcscat_s(wcstring, L" (wchar_t *)");
wcout << wcstring << endl;

// Convert to a _bstr_t
_bstr_t bstrt(wch);
bstrt += " (_bstr_t)";
cout << bstrt << endl;

// Convert to a CComBSTR
CComBSTR ccombstr(wch);
if (ccombstr.Append(L" (CComBSTR)") == S_OK)
{
CW2A printstr(ccombstr);
cout << printstr << endl;
}

// Convert to a CString
CString cstring(wch);
cstring += " (CString)";
cout << cstring << endl;

// Convert to a basic_string
wstring basicstring(wch);
basicstring += L" (basic_string)";
wcout << basicstring << endl;

delete orig;
}

出力
Hello, World! (System::String)
Hello, World! (char *)
Hello, World! (wchar_t *)
Hello, World! (_bstr_t)
Hello, World! (CComBSTR)
Hello, World! (CString)
Hello, World! (basic_string)



2006年04月04日

Microsoft VirtualServer2005R2 インストールしてみました

マイクロソフトがVirtual Server 2005 R2(バーチャルサーバー)を無償配布し始めました。

VMwareは今まで使ってましたが、さてどのくらい違いがあるのでしょうか・・無償配布が非常に気に入ってるので、多少の差(Microsoftが劣ってても使うつもりですが)であれば良いのですが・・・

早速ダウンロードしてインストールしてみます。

ダウンロードしたファイルサイズは約30Mでした。

Setup.exeを実行です。でっもっ・・・途中で止まってしまいますぅ。レジストリの読み込みが出来ません・・エラーでとまってしまいますぅ。

うーん、ナゼ?・・

さっぱり原因が分からないので、仕方なくエラーが出る都度、読み込みできないと言ってるレジストリ項目のアクセス権を変更していきます。

全部で10項目くらいありました。・・ふうぅー、つかれた。XPProなんですが、他にこんな現象になった方いますかー?

出足をくじかれながらも何とかインストールは完了しました。

次はサーバーのセットアップです。

まず、DISKの作成です。
○作成する場所(フォルダ)を指定。
○サイズ・固定Or可変(サイズ分確保するか、動的に作ってくかのちがいでしょう)の設定
○サーバーの作成(上で作ったDISKを指定)
○起動
ここらはさっくりといきました。

専用の窓(VMwareは一つのアプリケーションといった感じがしましたが)があるのではなく、作成したサーバーの画面を見るにはActiveXで作られたプログラムをブラウザで開き、その中に画面が出てくるのには、ちょっと戸惑いました。

管理画面(ブラウザですが)を閉じてしまえば、まったく意識せずに裏で動き続けているので不注意でバーチャルサーバーを止めてしまうといった事もおきなさそうで、ここまでは良い感じです。

CDにインストールDISKをセットし、管理画面でバーチャルサーバーにマウントします。(ISOなどのDISKイメージをお持ちの方は、直接マウントも出来ますよ。)

基本的な使い方はまったくといってよいほどVMwareと同じでした。(まー、それもそうだね。)

このブログを書いているうちに、OSのインストールの完了しました。

VirtualServer1
OSのインストール中です。

インストールしたマシンはSONYのVAIO(うすーいやつです)、メモリ512・セレロンの1ギガくらいですが、動きが気になるところです。VMwareはかなーり遅くなってしまいます。

使用感・・どちらも遅さは同じくらいです。当たり前ですが・・メモリの割当量も、どちらも細かく調整できるし、それ以上も以下もしようがありません。

使い心地・・慣れたらマイクロソフトの勝ち

お値段・・当然マイクロソフト

でマイクロソフトの勝利です。いままでこのようなソフトでマイクロソフトが有利になったことが(僕の中で)あまり無かったのですが、今回は圧勝です。(今のところです。しばらく使ってみないことには安定度なんかは分からないので。)

VMware+Redhat9での長期運用は経験していますが、Microsoft+Fedoraの組み合わせをもうワンセット作って、運用してみます。



 

ハワイ旅行| サトピの子連れグアム旅行記| グアム旅行の情報サイト| ガーデニング|

Copyright (C) 2009 Anne Corporation. All Rights Reserved.