Category Archives: Blog

A new year, a new NAS (for the NAS the last year was 2012)

Hi,

It came the time to say goodbye to the old NAS, which has served about 6 years for now with RAID 1 2TB.. The OS was at first the CentOS 5 and then CentOS 6.

The hardware with the previous NAS was like this (I don’t mention the manufacturer because I don’t advertise). The system and the shared drives were installed on the 2TB RAID 1 array.

The previous NAS had a following configuration:

Ps. **** means proprietary and/or commercial software.. 😇

And the new system – a bit larger box to fit 12 3.5″ HDDs

Configuration (pretty much the same as the last one):

So pretty much the same configuration on both of them..

The clients

The funeral 😭

I saved the fist and last email the previous NAS did sent and put it on top of a shelf (the size is about 2 CubeSat’s) in case I might have missed to copy something. It can wait there for a while before moving it to a unheated storage.

Ps. I do “deep-format” my old/failed HHDs with a sledgehammer (i don’t have so many secrets if anyone wishes to try to restore the data😴) 😜

And the last mail:

From: root@warehouse.localdomain
To: warehouse@warehouse.localdomain
Subject: Alive signal from warehouse.

Date: 07.01.2018 06:00:01
Installed on: 22.02.2012 16:01:10

Downtimes:
down 2017-06-21 16:46:13 -> up 2017-06-21 16:46:44 = 00:00:31 (31 s)
down 2017-07-19 17:52:17 -> up 2017-07-19 17:52:49 = 00:00:32 (32 s)
down 2017-09-02 13:28:13 -> up 2017-09-02 13:29:25 = 00:01:12 (72 s)
down 2017-09-13 16:52:11 -> up 2017-09-13 16:52:43 = 00:00:32 (32 s)
down 2017-09-30 08:19:18 -> up 2017-09-30 08:19:50 = 00:00:32 (32 s)
down 2017-10-11 17:02:01 -> up 2017-10-11 17:02:33 = 00:00:32 (32 s)
down 2017-11-22 17:08:06 -> up 2017-11-22 17:08:38 = 00:00:32 (32 s)
crash 2017-11-28 04:33:32 -> up 2017-11-28 06:24:03 = 01:50:31 (6631 s)
down 2018-01-04 18:41:29 -> up 2018-01-04 18:42:01 = 00:00:32 (32 s)
crash 2018-01-05 19:12:11 -> up 2018-01-05 20:19:29 = 01:07:18 (4038 s)

Seconds from install time: 185428801

eth0 states:
—————————————————————————-
Down: 9.569 days. Up: 2136.014 days. Age: 2145.583 days. Down percentage: 0.446.
—————————————————————————-
Uptime: 06:00:01 up 1 day, 9:40, 0 users, load average: 1.26, 1.18, 1.11

Happy new year.. I’LL BE BACK 😳

Deadlocking threads

Hi,

I thought about writing about a common thread deadlocking problem with Windows Forms.

I do use the Google to search solutions to my programming “problems”, but this solution I actually had to use my own brain😳

If the thread uses invokes to the GUI thread to delegate something to be done on the main thread the application’s message pump sort starts. This may result that when you close your program the simple Thread.Join() deadlocks.

So the simple solution is to do the message pumping until the thread joins:

while (!aThread.Join(1000)) // we wait for a second, then let the main thread do the message pumping..
{
  Application.DoEvents();
}

 Have a nice weekend..

.. and sorry if the English gets too complicated as the native language of me is Finnish – as:

Moi,

Ajattelin kirjoittaa yleisestä ongelmasta, jossa säie estää toisen säikeen toiminnan Windows Formsin kanssa.

Yleensä käytän Googlea etsiäkseni ratkaisuja ohjelmointi-“ongelmiini”, mutta tämän keksimiseen piti käyttää omia aivoja😳

Kun säie blokkaa pääsäikeen, pitää käyttää pääsäikeen viestipumppua ja kutsua Thread.Join() -metodia aikaviiveellä.

Hyvää viikonloppua..

Well done spam..

Hi,

It seems that I have a SEO (Search Engine Optimization) service. Weird that I keep getting these messages about two to ten “notifications” / year. I would advise not to take any action regrading to these emails.

Of course I do not have such service account and the location from whence these emails come seem to be questionable… However as I get one bill / year of owning the domain it might look like a bill you would just accept to be  a warning that I forgot to pay 🔒 The spammer seems to use whois database to send these emails. So, just to give an advice, do not give them any money 😎.

Now I might be breaking the “law” as I publish parts of message… i did some editing however, but if you wish, the information is available somewhere..

Thunderbird seems to “think” this is a junk mail – for some unknown reason – haha 😯

And the breaking the “law” part (the small print):

As we see this was not a bill after all.. have fun again and I’ll be back with some bug fixes in a some period of time..

A simple ISP check script (bash)

Hi,

I recently wanted to log internet outages (ISP) so I wrote this script. The script it self has no license – so call it a free to modify, publish and use. I did set the script to run every five minutes via cron.

The code:

#!/bin/bash

current_date_time="`date "+%Y-%m-%d %H:%M:%S"`";

curl --head http://www.google.com > /dev/null 2>&1
OUT=$?

last_msg_start=""

if [ -e /var/log/ISP_Log ]
then
    last_msg_start="`sed -n '$,$ p' /var/log/ISP_Log | cut -c1-16`"
fi

if [ $OUT -eq 0 ]
then
    if [ "$last_msg_start" != "CONNECTION:[YES]" ]
    then
      echo "CONNECTION:[YES] $current_date_time" >> /var/log/ISP_Log
    fi
else
    if [ "$last_msg_start" == "CONNECTION:[YES]" ]
    then
      echo "CONNECTION:[N/A] $current_date_time" >> /var/log/ISP_Log
    fi
fi

sed '1,500 d' /var/log/ISP_Log

The log file contents:

CONNECTION:[YES] 2017-08-09 19:03:29
CONNECTION:[N/A] 2017-08-11 21:10:01
CONNECTION:[YES] 2017-08-11 21:15:02
CONNECTION:[N/A] 2017-08-12 20:40:01
CONNECTION:[YES] 2017-08-13 10:45:01

Commenting the code

As I have previously done, all the C# code is documented with XML documentation (private/public) and sort of vowed to do so in the future.

Sometimes this is the most boring part of the programming procedure as I have been commenting my recent library for a week now 🤷‍♂️ … about a minute to a hour per day. See – Incredible MOTIVATION!

Well, soon another library will be released fully documented..

I’ll be back soon..

Hobbies on a summer holiday

Hi everyone,

In a summer holiday sometimes you have time to do some “serious” programming..

This time it is a sort of a Task Manager, which also watches file system changes and it will probably spawn some libraries which will be published here too.

Do note that this is still a work in progress.

I’ll be back 😛

Pen and paper

Hi,

Even though you have a high-end desktop PC and numerous software installations to help sometimes you just need pen and paper to visualize some “complex?” stuff.

This paper was used when I was developing the first version of SunMoonCalendar. The paper seems to be covered with cat hair (four cats) 😀, coffee cup markings and a few cat paw markings with dirt as they do like to go outside from a window to a cat pen to hang around.

One of four cat’s

By the way I’m called “Señorita” 😛

.NET custom date time format

Hi,

I recently found a bug in my software because it was using a custom date time format string DateTime.Now.ToString(“yyyy-MM-dd HH:mm:ss.fff”), which should lead to a date time string like this “2016-01-16 09:47:00.045”.

The time separator “:” however is not absolute, it can output a character such as “.”. So learning from the mistake the previous piece of code is now DateTime.Now.ToString(“yyyy-MM-dd HH’:’mm’:’ss.fff”). This makes the time separator absolute.