Ура! Первый отзыв.
151 раз скачали.
Один отзыв: Add exception handling for invalid nagios urls and you get 5 stars. Пользователь поставил три звезды и написал что исправит на пять звёзд (максимум) если я выпущу обновление , в котором добавлю чтобы программа ругалась если пользователь ввел неправильный адрес Nagios сервера.
неділя, 16 червня 2013 р.
понеділок, 20 травня 2013 р.
субота, 11 травня 2013 р.
неділя, 5 травня 2013 р.
Доделал пуши.
Регистрация/удаление с сервера нагиоса оттестирована.
Переделал дизайн страниц одиночных хостов и сервисов.
ТоДо:
- сделать сайт демо с пушами м.б.
- нарисовать эбаут - статик html с текстом и ссылкой на закачку и СЧЕТЧИКОМ
Перфекто нахренато:
- перевод на русский , украинский и немецкий;
- наваять пуш на питоне и чистоперле;
- на php перевести весь скрипт на SimpleXML;
- нормальное время в сообщениях;
- нормальное отображение логов
- забыл ...
Регистрация/удаление с сервера нагиоса оттестирована.
Переделал дизайн страниц одиночных хостов и сервисов.
ТоДо:
- сделать сайт демо с пушами м.б.
- нарисовать эбаут - статик html с текстом и ссылкой на закачку и СЧЕТЧИКОМ
Перфекто нахренато:
- перевод на русский , украинский и немецкий;
- наваять пуш на питоне и чистоперле;
- на php перевести весь скрипт на SimpleXML;
- нормальное время в сообщениях;
- нормальное отображение логов
- забыл ...
четвер, 11 квітня 2013 р.
Вылечил диспетчера во ViewModel
public Action<Action> CallWithDispatcher;
void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
AppSettings settings = new AppSettings();
if (CallWithDispatcher != null) {
CallWithDispatcher(() =>
{
settings.PushURLSetting = String.Format("Channel Uri Updated, new Received\n");
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=14?&push=" + e.ChannelUri.ToString()); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnRegisterPushCompleted;
webClient.DownloadStringAsync(uri);
});
}
}
void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
AppSettings settings = new AppSettings();
if (CallWithDispatcher != null) {
CallWithDispatcher(() =>
{
settings.PushURLSetting = String.Format("Channel Uri Updated, new Received\n");
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=14?&push=" + e.ChannelUri.ToString()); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnRegisterPushCompleted;
webClient.DownloadStringAsync(uri);
});
}
}
При развертывании
System.NullReferenceException не обработано
Message=NullReferenceException
StackTrace:
at wp7nag.MainViewModel.PushChannel_ChannelUriUpdated(Object sender, NotificationChannelUriEventArgs e)
at Microsoft.Phone.Notification.HttpNotificationChannel.OnDescriptorUpdated(IntPtr blob, UInt32 blobSize)
at Microsoft.Phone.Notification.HttpNotificationChannel.ChannelHandler(UInt32 eventType, IntPtr blob1, UInt32 int1, IntPtr blob2, UInt32 int2)
at Microsoft.Phone.Notification.HttpNotificationChannel.Dispatch(Object threadContext)
at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()
подсвеченный код:
void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
AppSettings settings = new AppSettings();
CallWithDispatcher(() =>
{
settings.PushURLSetting = String.Format("Channel Uri Updated, new Received\n");
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=14?&push=" + e.ChannelUri.ToString()); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnRegisterPushCompleted;
webClient.DownloadStringAsync(uri);
});
}
up 06.05.2013 :
Выяснил, что проблемы вызывается тем что между открытием канала и получением урла проходит относительно много времени. Закостылил пустым циклом:
// Try to find the push channel.
pushChannel = HttpNotificationChannel.Find(channelName);
// If the channel was not found, then create a new connection to the push service.
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
pushChannel.Open();
// Bind this new channel for Tile events.
settings.PushURLSetting = String.Format("Push Channel Activated\n");
while (pushChannel.ChannelUri == null)
{
// Wait for receiving Channel URI
}
// DeviceRegister(pushChannel.ChannelUri.ToString());
}
else
{
System.NullReferenceException не обработано
Message=NullReferenceException
StackTrace:
at wp7nag.MainViewModel.PushChannel_ChannelUriUpdated(Object sender, NotificationChannelUriEventArgs e)
at Microsoft.Phone.Notification.HttpNotificationChannel.OnDescriptorUpdated(IntPtr blob, UInt32 blobSize)
at Microsoft.Phone.Notification.HttpNotificationChannel.ChannelHandler(UInt32 eventType, IntPtr blob1, UInt32 int1, IntPtr blob2, UInt32 int2)
at Microsoft.Phone.Notification.HttpNotificationChannel.Dispatch(Object threadContext)
at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()
подсвеченный код:
void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
AppSettings settings = new AppSettings();
CallWithDispatcher(() =>
{
settings.PushURLSetting = String.Format("Channel Uri Updated, new Received\n");
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=14?&push=" + e.ChannelUri.ToString()); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnRegisterPushCompleted;
webClient.DownloadStringAsync(uri);
});
}
up 06.05.2013 :
Выяснил, что проблемы вызывается тем что между открытием канала и получением урла проходит относительно много времени. Закостылил пустым циклом:
// Try to find the push channel.
pushChannel = HttpNotificationChannel.Find(channelName);
// If the channel was not found, then create a new connection to the push service.
if (pushChannel == null)
{
pushChannel = new HttpNotificationChannel(channelName);
// Register for all the events before attempting to open the channel.
pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);
pushChannel.Open();
// Bind this new channel for Tile events.
settings.PushURLSetting = String.Format("Push Channel Activated\n");
while (pushChannel.ChannelUri == null)
{
// Wait for receiving Channel URI
}
// DeviceRegister(pushChannel.ChannelUri.ToString());
}
else
{
середа, 3 квітня 2013 р.
понеділок, 25 березня 2013 р.
2013.03.25
Обновился наконец-то Lumia 800 до версии WP 7.8
Скачал SDK для 7.8, пересобрал приложение, залил на телефон
Скачал SDK для 7.8, пересобрал приложение, залил на телефон
вівторок, 29 січня 2013 р.
function savePushURI($file,$uri)
{
$fh = fopen($file,"r+");
if ($fh) {
echo "File $file found<br>\n";
$xmls = "";
while (!feof($fh)) {
$buf=fgets($fh, 4096);
$xmls = $xmls . $buf;
}
libxml_use_internal_errors(true);
$sxe = simplexml_load_string($xmls);
if ($sxe) {
echo "File $file has right XML structure<br>\n\n";
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not open file $file for writing. Do nothing. <br>\n";
return;
}
$channel = $sxe->addChild('channel');
$channel->addChild('uri',$uri);
$channel->addChild('count',"0");
$channel->addChild('toast',"1");
fwrite($fh, $sxe->asXML());
fclose($fh);
echo "New record to $file had added successfully<br>\n\n";
return;
} else {
echo "File $file has wrong XML structure. Erasing and creating new one.<br>\n\n";
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not create file $file. Do nothing. <br>\n";
return;
}
}
} else {
echo "File $file not found, creating new one <br>\n\n";
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not create file $file. Do nothing. <br>\n";
return;
}
}
$string = <<<XML
<channels>
<channel>
<uri></uri>
<count></count>
<toast></toast>
</channel>
</channels>
XML;
$sxe = new SimpleXMLElement($string);
$sxe->channel[0]->uri = $uri;
$sxe->channel[0]->count = "0";
$sxe->channel[0]->toast = "1";
fwrite($fh, $sxe->asXML());
fclose($fh);
echo "New file $file had created successfully<br>\n\n";
return;
}
Building an Address Book with OpenLDAP
LDAP. Часть 1. Настройка отказоустойчивого LDAP сервера
SimpleXML
Проверка портов
{
$fh = fopen($file,"r+");
if ($fh) {
echo "File $file found<br>\n";
$xmls = "";
while (!feof($fh)) {
$buf=fgets($fh, 4096);
$xmls = $xmls . $buf;
}
libxml_use_internal_errors(true);
$sxe = simplexml_load_string($xmls);
if ($sxe) {
echo "File $file has right XML structure<br>\n\n";
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not open file $file for writing. Do nothing. <br>\n";
return;
}
$channel = $sxe->addChild('channel');
$channel->addChild('uri',$uri);
$channel->addChild('count',"0");
$channel->addChild('toast',"1");
fwrite($fh, $sxe->asXML());
fclose($fh);
echo "New record to $file had added successfully<br>\n\n";
return;
} else {
echo "File $file has wrong XML structure. Erasing and creating new one.<br>\n\n";
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not create file $file. Do nothing. <br>\n";
return;
}
}
} else {
echo "File $file not found, creating new one <br>\n\n";
fclose ($file);
$fh = fopen ($file,"w");
if (!$fh) {
echo "ERROR: can not create file $file. Do nothing. <br>\n";
return;
}
}
$string = <<<XML
<channels>
<channel>
<uri></uri>
<count></count>
<toast></toast>
</channel>
</channels>
XML;
$sxe = new SimpleXMLElement($string);
$sxe->channel[0]->uri = $uri;
$sxe->channel[0]->count = "0";
$sxe->channel[0]->toast = "1";
fwrite($fh, $sxe->asXML());
fclose($fh);
echo "New file $file had created successfully<br>\n\n";
return;
}
Building an Address Book with OpenLDAP
LDAP. Часть 1. Настройка отказоустойчивого LDAP сервера
SimpleXML
Проверка портов
вівторок, 22 січня 2013 р.
Поговорки, подслышанные в подкастах
Не показывай дураку половину работы.
Я не могу размазывать себя слишком тонким слоем.
Сформулировать цель - половина работы. "Завтра женюсь на английской королеве". Теперь осталась вторая половина.
Фразы "нужно попробовать всё" и "один раз не 321" придумал один и тот же человек.
Если ты хочешь пробиться, зачем пробиваться через толпу?
Я не могу размазывать себя слишком тонким слоем.
Сформулировать цель - половина работы. "Завтра женюсь на английской королеве". Теперь осталась вторая половина.
Фразы "нужно попробовать всё" и "один раз не 321" придумал один и тот же человек.
Если ты хочешь пробиться, зачем пробиваться через толпу?
пʼятниця, 11 січня 2013 р.
четвер, 10 січня 2013 р.
Windows Phone 7 Pivot ListBox SelectionChanged
Ура. Поборол ложное срабатывание SelectionChanged в Pivot ListBox. Детали ниже:
Обработчик события нажития на ListBox:
private void ServicesListBox_SelectionChanged (object sender, SelectionChangedEventArgs e)
{
if (!App.ViewModel.IsAllServicesLoaded)
{
this.ServicesListBox.SelectedIndex = -1;
return;
}
if (ServicesListBox.SelectedItem != null)
{
Service selectedService = (Service)ServicesListBox.SelectedItem;
string hostName = selectedService.HostName;
string serviceDescription = selectedService.ServiceDescription;
this.ServicesListBox.SelectedIndex = -1;
NavigationService.Navigate(new Uri("/ServicePage.xaml?HostName="+hostName+"&ServiceDescription="+serviceDescription, UriKind.Relative));
}
else
{
return;
}
}
App.ViewModel.IsAllServicesLoaded - это true если завершилась загрузка и сериализация списка класса Service:
Сами вызовы суть тупо затычки с присваиваниями:
public bool IsAllServicesLoaded
{
get;
private set;
}
public void AllServicesLoaded()
{
this.IsAllServicesLoaded = true;
}
public void AllServicesLoaded_Disable()
{
this.IsAllServicesLoaded = false;
}
Загрузка списка отправляется в фон:
public void LoadServices()
{
AppSettings settings = new AppSettings();
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=3"); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnDownloadServicesCompleted;
webClient.DownloadStringAsync(uri);
}
По окончинии загрузки 1) ставим false флагу для предотвращения срабатывания SelectionChanged 2) десериализуем для обновления привязки 3) врубаем true для флага и разрешаем таким образом обработку события SelectionChanged:
void OnDownloadServicesCompleted(object sender, DownloadStringCompletedEventArgs args)
{
AllServicesLoaded_Disable();
StringReader reader = new StringReader(args.Result);
XmlSerializer xml = new XmlSerializer(typeof(ServiceBody));
ServiceBody = xml.Deserialize(reader) as ServiceBody;
AllServicesLoaded();
}
Помогла ссылка на stackoverflow:
http://stackoverflow.com/questions/7679586/listbox-selectionchanged-firing-when-setting-to-1-within-function-wp7
Обработчик события нажития на ListBox:
private void ServicesListBox_SelectionChanged (object sender, SelectionChangedEventArgs e)
{
if (!App.ViewModel.IsAllServicesLoaded)
{
this.ServicesListBox.SelectedIndex = -1;
return;
}
if (ServicesListBox.SelectedItem != null)
{
Service selectedService = (Service)ServicesListBox.SelectedItem;
string hostName = selectedService.HostName;
string serviceDescription = selectedService.ServiceDescription;
this.ServicesListBox.SelectedIndex = -1;
NavigationService.Navigate(new Uri("/ServicePage.xaml?HostName="+hostName+"&ServiceDescription="+serviceDescription, UriKind.Relative));
}
else
{
return;
}
}
App.ViewModel.IsAllServicesLoaded - это true если завершилась загрузка и сериализация списка класса Service:
Сами вызовы суть тупо затычки с присваиваниями:
public bool IsAllServicesLoaded
{
get;
private set;
}
public void AllServicesLoaded()
{
this.IsAllServicesLoaded = true;
}
public void AllServicesLoaded_Disable()
{
this.IsAllServicesLoaded = false;
}
Загрузка списка отправляется в фон:
public void LoadServices()
{
AppSettings settings = new AppSettings();
Uri uri = new Uri((string)settings.URLwpNagSetting + "?cmd=3"); // , UriKind.Relative);
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential((string)settings.UserNameSetting, (string)settings.UserPasswordSetting);
webClient.DownloadStringCompleted += OnDownloadServicesCompleted;
webClient.DownloadStringAsync(uri);
}
По окончинии загрузки 1) ставим false флагу для предотвращения срабатывания SelectionChanged 2) десериализуем для обновления привязки 3) врубаем true для флага и разрешаем таким образом обработку события SelectionChanged:
void OnDownloadServicesCompleted(object sender, DownloadStringCompletedEventArgs args)
{
AllServicesLoaded_Disable();
StringReader reader = new StringReader(args.Result);
XmlSerializer xml = new XmlSerializer(typeof(ServiceBody));
ServiceBody = xml.Deserialize(reader) as ServiceBody;
AllServicesLoaded();
}
Помогла ссылка на stackoverflow:
http://stackoverflow.com/questions/7679586/listbox-selectionchanged-firing-when-setting-to-1-within-function-wp7
Підписатися на:
Дописи (Atom)