Recent

Author Topic: CATWW  (Read 11188 times)

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #30 on: August 23, 2020, 09:37:06 pm »
Tron wants to change now the timezone of Berlin. And at the end of October  change it back???
Yes, exactly !

As said: it is already working for me  :D

Quote
And there are always changes in the daylight saving:
I should have that covered as well.

Quote
Russia and Turkey abolished it in the last years.
Their loss ... or gain... not sure :D

I thank you for your extended reply winni but tbh I am/was already aware of all these things.

Please have a little faith and patience.

User Handoko was/is prioritising on graphics and related speed issues. The rest will (eventually) be added.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: CATWW
« Reply #31 on: August 23, 2020, 09:52:06 pm »
Hi!

Okay. Did not want to disturb work in progress ...

But lets look at the speed:

BGRABitmap is fast.
I don't know nothing about its speed on the Raspi toys  but a normal PC should draw 6 whole clocks in < 100 ms.

So is the cashing realy needed for the toys?
On a PC it is useless and consumes a lot of RAM.

Winni

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #32 on: August 23, 2020, 10:30:44 pm »
Okay. Did not want to disturb work in progress ...
No problem. I thank you for your expressing your concerns.

Quote
I don't know nothing about its speed on the Raspi toys  but a normal PC should draw 6 whole clocks in < 100 ms.
On a tiny pi3b (no +), no hardware accelerated drivers in place, it takes 5-7 seconds (3b closer to 7, 3b+ closer to 5) to update all clocks when drawing it into a window about a quarter of the size of a 1920x1080 screen resolution.

Quote
So is the cashing realy needed for the toys?
If you noticed the prepare progress bar every time you make a change with regards to the placement of the clocks, that time-lapse you see there is needed for every update. I am aware that the caching includes drawing half of all the positions so that time can be roughly divided by 30 to get an actual indication on how long it actually takes to draw the hands (each second). Then you would have to multiply that time-duration by 6 (for 6 clocks).

That takes a whole lot of time on such hardware like a Pi.

With the latest changes made by Handoko it is now possible to actually update each clock every second, with a minor hick-up if 2 or more hands need to be drawn/updated as well. Note, it is only a hick-up that you'll be able to notice in case you are focusing on 6 clocks that occupy the whole screen (1920x1080, full size window) as humans tend to notice when a timely pattern is disturbed (for only the tiniest of moments). It isn't even noticeable on a smaller sized window, although there again humans tend to focus on the pattern (of the seconds hand) and might be able to observe even the tiniest of a delay that so that the time-frame between two (graphical) updates isn't exactly 100% the same as the previous one.

Perhaps Handoko or someone else is able to explain this better.

PS: It is not my motive to have catww actually run presentable on a pi, but the lowest of specs can usually act as a good indicator. Whether or not you wish to actually act on such indicators is an entirely other discussion  :)

Quote
On a PC it is useless and consumes a lot of RAM.
There are a couple of implications whit saying that
1. it is always a fine line between speed and caching
2. What exactly is a PC ? Should your old pentium/core duo still running XP (or even older) also count as a PC ? Should catww be able to run there acceptable too ?
3. What is a lot of ram ? These days, a standard machine runs with 8 cores and should at least have 32gb of ram. How much ram does the caching actually take ? Even the pi (1 GB memory !) is able to handle that ...

My reply is not meant to criticise, rather to hopefully make you understand that there are pastures everywhere. Some are green, others yellow or even pink. Picking the right color is a major headache. Put them all into a bowl and stir it and you have a great chance of ending up with a terrible colour  :D

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: CATWW
« Reply #33 on: August 23, 2020, 10:49:19 pm »
Hi!

@ Tron

Thanx for the explanations.

Question: Did Circular meanwhile implement the XOR feature for drawing?

This could help a lot to speed up the drawings of the clocks.

Old tricks with Delphi Canvas:
Draw a line ( a hand).
On the next second:
Set drawMode to XOR. Draw the line again: it is deleted.
And now draw the new line.

I don't  now nothing about Raspi and other toys.
But from my history I know a lot of slow computers .....

Winni

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: CATWW
« Reply #34 on: August 24, 2020, 02:26:37 am »
Actually we have the easiest DST calculation in the US. We don't have a DST. We are MST 24/7/365 and we like it that way.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: CATWW
« Reply #35 on: August 24, 2020, 05:46:07 am »
See what happens if you select same timezone than your local time.

In my previous posts, I already mentioned:
- I quickly generated the time zone data (which I wasn't sure they were correct)
- I do not have solution for time zone calculation (because I didn't follow the previous discussions)
- v0.2 used a fake time calculation

And honestly, it was my first time to learn what daylight saving is from my pm with winni. The v0.2 did not take daylight saving into account.

 :-[ But the most serious problem is, if you look into the DataSync.pas there is no code to get the computer's time zone. That means it will treat the user time zone as GMT +0.00.

It's just version 0.2, many things haven't implemented yet. And as far as I know, TRon is now working on the database and synchronization. It should be working correctly on version 1.0.

Draw a line ( a hand).

No, I do not want to use line drawing. I knew it fast but it doesn't look good. You will understand why if you see the version 0.3, which I'm still working on.

The first things came into my head when I hear a community clock project:
  • It should look good
  • Can run on wide range of environments and hardware
  • Others can study the code easily
It is a community project, it should not look amateurish. Lazarus/FPC has cross compile ability, the program should be able to run on different OSes, hardware and even old machines. I like KISS concept and I want others to be able to study the code easily. That's why I put many comments inside the code and it is written using traditional procedural style. I know many novice programmers can understand procedural approach easier than OOP style. If it were my own project, I would write it in full OOP approach.

On a PC it is useless and consumes a lot of RAM.

I already mentioned on previous post, in case you miss it. It had a memory leak issue on v0.2. It has been fixed on v0.3. Memory usage is highly depended on the form size. My my test on 1920x1080 full screen, the memory usage CATWW v0.3 never reaches 140 MB.




Why it is slow and need much memory?

Hey, now is 2020 do you think we should program a clock that looks like the one 3 decades ago?

Line drawing is fast but they looks jaggy. Antialiased lines are better, with a bit sacrifice of performance. But instead of using drawing functions, I use image scaling and rotating. Unfortunately scaling and rotating is expensive especially on non-hardware-accelerated engine.

The clock painted is using 4 layers of images:
- The background
- The hour hand
- The minute hand
- The second hand
Also if user choose to show 6 clocks, that will be repeated six times.

To make it faster, I use cache. It greatly improves the performance. But a problem happens when resizing the clock. If user resize the clock (by resizing the form), all the caches will need to be refreshed. That why it has performance drop when resizing.

So, I implemented a new trick: runtime-generated multi-resolution image. When refreshing the cache, it chooses the nearest larger images. The more resolutions prepared the more performance improved when resizing.

I did some research, nowadays many users use 1920x1080 resolution or more. On my test, 1200x1200 is the best for the clock images even running it on a large screen. Keeping such huge images in memory consumes a lot of memory. If I choose to prepare 20 different resolutions, it will greatly improve the performance. But for memory friendly, CATWW v0.2 only uses 5 different resolutions: 1200, 1000, 800, 600, 400.

Do you know how much images need to be generated for simply 5 different resolutions? Not 5, but 5 x 4 = 20 images.

The caching system and multi-resolution image concept explain why it requires a lot memory. But memory is cheap, I think it's okay.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: CATWW
« Reply #36 on: August 24, 2020, 06:13:05 am »
It works great on my machine.

And it works great on my $275 laptop, both  run Windows 10 Pro:

A Samsung Chromebook 4 Chrome OS 11.6" HD Intel Celeron Processor N4000 4GB RAM 32GB eMMC Gigabit Wi-Fi - XE310XBA-K01US $275
 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #37 on: August 24, 2020, 06:29:01 am »
Thanx for the explanations.
You are very welcome.

A bonus treat for you (working test output):
Code: [Select]
Creating timer
Entering sleepmode
Every 5 secs a timer event will write the current clock's information to the console
0 ->  local computer time | 25 October 2020 02:59:51 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:59:51 (CEST)
2 ->      Atlantic/Faeroe | 25 October 2020 01:59:51 (WEST)
3 ->       America/Bogota | 24 October 2020 19:59:51 (-05)
4 ->           US/Arizona | 24 October 2020 17:59:51 (MST)
5 ->          Asia/Taipei | 25 October 2020 08:59:51 (CST)

0 ->  local computer time | 25 October 2020 02:59:56 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:59:56 (CEST)
2 ->      Atlantic/Faeroe | 25 October 2020 01:59:56 (WEST)
3 ->       America/Bogota | 24 October 2020 19:59:56 (-05)
4 ->           US/Arizona | 24 October 2020 17:59:56 (MST)
5 ->          Asia/Taipei | 25 October 2020 08:59:56 (CST)

0 ->  local computer time | 25 October 2020 03:00:01 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:00:01 (CET)
2 ->      Atlantic/Faeroe | 25 October 2020 01:00:01 (WET)
3 ->       America/Bogota | 24 October 2020 20:00:01 (-05)
4 ->           US/Arizona | 24 October 2020 18:00:01 (MST)
5 ->          Asia/Taipei | 25 October 2020 09:00:01 (CST)

0 ->  local computer time | 25 October 2020 03:00:06 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:00:06 (CET)
2 ->      Atlantic/Faeroe | 25 October 2020 01:00:06 (WET)
3 ->       America/Bogota | 24 October 2020 20:00:06 (-05)
4 ->           US/Arizona | 24 October 2020 18:00:06 (MST)
5 ->          Asia/Taipei | 25 October 2020 09:00:06 (CST)
Does that sound about right for your timezone and the listed date/time ?

Quote
Question: Did Circular meanwhile implement the XOR feature for drawing?
I have no idea tbh. I am not very familiar with BGRABitmap/Tools/Utils  :-[

Quote
Old tricks with Delphi Canvas:
Draw a line ( a hand).
On the next second:
Set drawMode to XOR. Draw the line again: it is deleted.
And now draw the new line.
I am aware of the tricks that can be used on under-powered/old machines. Although for most of them they 'invented' assembler or nice custom chips such as a blitter, but the basic principles are still the same.

Quote
I don't  now nothing about Raspi and other toys.
But from my history I know a lot of slow computers .....
With regards to the latter, I am as well and with regards to the former... I just happen to have some around.... actually used for quite other purposes but this will do as well :)

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: CATWW
« Reply #38 on: August 24, 2020, 02:20:16 pm »
Code: [Select]
Creating timer
Entering sleepmode
Every 5 secs a timer event will write the current clock's information to the console
0 ->  local computer time | 25 October 2020 02:59:51 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:59:51 (CEST)
2 ->      Atlantic/Faeroe | 25 October 2020 01:59:51 (WEST)
3 ->       America/Bogota | 24 October 2020 19:59:51 (-05)
4 ->           US/Arizona | 24 October 2020 17:59:51 (MST)
5 ->          Asia/Taipei | 25 October 2020 08:59:51 (CST)

0 ->  local computer time | 25 October 2020 02:59:56 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:59:56 (CEST)
2 ->      Atlantic/Faeroe | 25 October 2020 01:59:56 (WEST)
3 ->       America/Bogota | 24 October 2020 19:59:56 (-05)
4 ->           US/Arizona | 24 October 2020 17:59:56 (MST)
5 ->          Asia/Taipei | 25 October 2020 08:59:56 (CST)

0 ->  local computer time | 25 October 2020 03:00:01 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:00:01 (CET)
2 ->      Atlantic/Faeroe | 25 October 2020 01:00:01 (WET)
3 ->       America/Bogota | 24 October 2020 20:00:01 (-05)
4 ->           US/Arizona | 24 October 2020 18:00:01 (MST)
5 ->          Asia/Taipei | 25 October 2020 09:00:01 (CST)

0 ->  local computer time | 25 October 2020 03:00:06 (lct)
1 ->        Europe/Berlin | 25 October 2020 02:00:06 (CET)
2 ->      Atlantic/Faeroe | 25 October 2020 01:00:06 (WET)
3 ->       America/Bogota | 24 October 2020 20:00:06 (-05)
4 ->           US/Arizona | 24 October 2020 18:00:06 (MST)
5 ->          Asia/Taipei | 25 October 2020 09:00:06 (CST)
Does that sound about right for your timezone and the listed date/time ?

Good to know you already have the code for time calculation/synchronization. But because the version 0.3 is all about cosmetic improvements, I will integrate it into CATWW on version 0.4 or higher.

It works great on my machine.

And it works great on my $275 laptop, both  run Windows 10 Pro:

A Samsung Chromebook 4 Chrome OS 11.6" HD Intel Celeron Processor N4000 4GB RAM 32GB eMMC Gigabit Wi-Fi - XE310XBA-K01US $275

Thank you for informing that it also runs good on Intel Celeron hardware.
« Last Edit: August 24, 2020, 03:54:50 pm by Handoko »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: CATWW
« Reply #39 on: August 24, 2020, 03:15:51 pm »
The version 0.3 is in the middle of finish, it is the time to discuss the non-programming things.

Name and Logo


CATWW - Clock Around the World-Wiser is the name. Is it okay? Or maybe any of you have a better suggestion?

The name CATWW makes me think a cat and 2x letter w. So I drew a logo, see the attachment below. Any better idea for the logo?

License

Can anyone tell me as the original authors of the program (me, JLWest, TRon), can we dual-license it in proprietary and GPL? Is there any GPL's rule that prohibit the original author of the software to dual-license or re-license it to closed software.

The CATWW published on this forum is in GPL, anyone can study, modify and improved it as long as they follow the GPL's rules. I may keep maintaining and improving it and it will be stay in GPL.

But who knows, maybe some time in the future me, JLWest and TRon will team up to start a software development company and we may improve the CATWW, re-license it as commercial product and make money from it.  ;)

I checked the license of the tools/libraries are used by CATWW:
  • Lazarus - GPL
  • LCL - LGPL
  • BGRABitmap - LGPL-3.0-only (modified to allow linking)
  • PascalTZ - Modified LGPL
Those above are used to build CATWW, it seems none of them prohibits us to release it as closed/commercial software.

Also, I want to use this opportunity to declare:
Quote
Me - Handoko as the graphics programmer of CATTW, give permission to JLWest and TRon to use the code and any resources I contributed for CATTW, and to modify and improve, and to re-license it to whatever they like in the future including proprietary and commercial licenses.

Database and Online Service

CATWW need data for time zone. Does anyone know where can we download the database and use it freely including for closed/commercial projects.

CATWW will have to ability to synchronize the data with online services. Does anyone know any of such service that provide it free? It will be better if it can be used on closed/commercial projects.
« Last Edit: August 24, 2020, 03:19:27 pm by Handoko »

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #40 on: August 24, 2020, 08:54:56 pm »
Good to know you already have the code for time calculation/synchronization. But because the version 0.3 is all about cosmetic improvements, I will integrate it into CATWW on version 0.4 or higher.
No problem Handoko, as I was kind of expecting that would be the case.

As for a fun fact: the moment planet earth consists of 3 days (look for the last 3 entries).
Code: [Select]
0 ->  local computer time | 24 August 2020 12:00:07 (lct)
 1 ->        Europe/Berlin | 24 August 2020 12:00:07 (CEST)
 2 ->      Atlantic/Faeroe | 24 August 2020 11:00:07 (WEST)
 3 ->       America/Bogota | 24 August 2020 05:00:07 (-05)
 4 ->           US/Arizona | 24 August 2020 03:00:07 (MST)
 5 ->          Asia/Taipei | 24 August 2020 18:00:07 (CST)
 6 ->           Asia/Kabul | 24 August 2020 14:30:07 (+0430)
 7 ->        Asia/Katmandu | 24 August 2020 15:45:07 (+0545)
 8 ->        Europe/London | 24 August 2020 11:00:07 (BST)
 9 ->         Pacific/Niue | 23 August 2020 23:00:07 (-11)
10 ->       Pacific/Tarawa | 24 August 2020 22:00:07 (+12)
11 ->   Pacific/Kiritimati | 25 August 2020 00:00:07 (+14)
Being able to work/experiment with virtual dates and times actually turns out to be quite fun !  :)

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #41 on: August 24, 2020, 09:04:29 pm »
CATWW - Clock Around the World-Wiser is the name. Is it okay? Or maybe any of you have a better suggestion?
For me it was a simple suggestion , to at least have a working title....

... however....
Quote
The name CATWW makes me think a cat and 2x letter w. So I drew a logo, see the attachment below. Any better idea for the logo?
... you hit the nail there with that awesome logo and now I feel inclined to stick with the name as that logo perfectly matches the name.

Thank you for that.

It really calls out for having that as a clock background, using the whiskers as indicators, just above the nose as middle for the clock-hands  :D

Quote
Can anyone tell me as the original authors of the program (me, JLWest, TRon), can we dual-license it in proprietary and GPL? Is there any GPL's rule that prohibit the original author of the software to dual-license or re-license it to closed software.
Hmz, I do believe the GPL prohibits that. I would have to look into that more closely and get back to that unless someone else has an answer to that.

Same goes for your other questions.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: CATWW
« Reply #42 on: August 24, 2020, 09:22:36 pm »
Hi!

And here is the slogan:

"CATWW - The World Wide Cat!"

Winni

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: CATWW
« Reply #43 on: August 24, 2020, 11:53:38 pm »
Quote
Can anyone tell me as the original authors of the program (me, JLWest, TRon), can we dual-license it in proprietary and GPL? Is there any GPL's rule that prohibit the original author of the software to dual-license or re-license it to closed software.
Hmz, I do believe the GPL prohibits that. I would have to look into that more closely and get back to that unless someone else has an answer to that.

Not quite. Nothing can prohibit the original author(s) licensing their work as they see fit so you can dual-license (or triple-license, or quad- or penta-license ;)) if you want.

A different thing is whether it makes sense to do so; for a project that wants to allow both closed and free/open source derivatives I would just select one of the permissive license (say, MIT or 3-clause-bsd, etc.) and leave it at that.

Note that all the used libraries allow this: they all are LGPL with implicit (or explicit) linking exception so having them as a requirement doesn't interfere; that is, in fact, the reason for the existence of the LGPL.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

TRon

  • Hero Member
  • *****
  • Posts: 2435
Re: CATWW
« Reply #44 on: August 25, 2020, 12:18:23 am »
Thank you for your answer lucamar.

Not quite. Nothing can prohibit the original author(s) licensing their work as they see fit so you can dual-license (or triple-license, or quad- or penta-license ;)) if you want.
I was taking (literal) note of what Handoko wrote: Release now as GPL and later decide to make it proprietary. And imho that is something that is in fact prohibited as the GPL clearly states that all changes must be made public again. But I do also believe we need to get into version details of the GPL there, as re-licensing seems allowed starting from v4 ? (https://www.gnu.org/licenses/license-compatibility.html)

Quote
A different thing is whether it makes sense to do so; for a project that wants to allow both closed and free/open source derivatives I would just select one of the permissive license (say, MIT or 3-clause-bsd, etc.) and leave it at that.
I agree to that.

Quote
Note that all the used libraries allow this: they all are LGPL with implicit (or explicit) linking exception so having them as a requirement doesn't interfere; that is, in fact, the reason for the existence of the LGPL.
Thank you for refreshing my memory on LGPL :)

@Handoko:
As I wrote in PM, my only goal is to share. I do not even mind not being an official participant of the project as long as what we present here (as I am contributing) stays open for others to be able to learn from (or put me/us back in place on things what went wrong :D ). I do not care if someone is able to learn enough from it (as that is the whole point) to be able to write his/her own commercial closed source application, even though I prefer the "pay it forward"-thought. Licenses always tend to get in my way of thinking.

 

TinyPortal © 2005-2018