Hiển thị các bài đăng có nhãn digital-clock. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn digital-clock. Hiển thị tất cả bài đăng

Thứ Bảy, 8 tháng 4, 2017

Digital Clock created in FreePascal / Lazarus

By Vasudev Ram

Some months ago I created this digital clock in Free Pascal / Lazarus on Windows, in my copious free time. It's simple, without any frills, but works well for me. I have been using it daily as the Windows clock utility I use on my PC to check the current time whenever I need to [1]. Here is a screenshot of this clock:



[1] I do wear a watch (digital, natch :) and have a mobile phone which shows the time and even has a clock app, but see:

A simple alarm clock in Python (command-line)

and

Jal-Tarang, and a musical alarm clock in Python

I usually run it (this latest clock) manually at PC startup (it's called DC, so I just have to type that and Enter). (It could be put into some Windows script or folder so that it starts automatically.) To see the clock, I just have to Alt-Tab over to it, or click on it in the Windows taskbar. In fact, even if I just hover my mouse over its icon in the taskbar, I can see the clock and the current time that it shows - and watch it changing too, right there :)

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers



Thứ Sáu, 28 tháng 10, 2016

Red-Lang: Live-coding of a clock demo, EVE-style

By Vasudev Ram



Clock live-coding image attribution

This is cool. I was just reading this HN thread:

Eve: Programming designed for humans (witheve.com)

which, BTW, is at the top of the HN front page at the time of this writing, and is about a new programming language called Eve from Chris Granger (and maybe others).

The Eve web site.

The home page of the Eve site says: [ Eve is a programming language and IDE based on years of research into building a human-first programming platform. From code embedded in documents to a language without order, it presents an alternative take on what programming could be - one that focuses on us instead of the machine. ]

Chris Granger may be known to some as the person behind Light Table, an innovative "open source IDE that lets you modify running programs and embed anything from websites to games", that was also discussed quite a bit on HN some time ago. I'm guessing Eve builds upon Light Table, for the IDE part of it.

[ Update: Chris's HN profile says: Co-founder of Kodowa, the company behind Eve and Light Table. YC alum. Ex-Microsoft Program Manager for C# and VB in Visual Studio. Chris also says in this comment on the HN thread, that the language part of Eve (it has other parts too) is a variant of datalog. ]

I had not checked out Light Table but I had briefly checked out Noir (another project by Chris), a micro-framework that allows you to rapidly develop web sites in Clojure, and had liked what I saw of it.

Anyway, in the HN thread about Eve, someone posted a link to a demo of live-coding a digital clock, using the Red language, which I had also checked out some months ago. I found Red and its goals interesting; reducing the complexity of modern software development is a big goal, another is being cross-platform (to desktop and server and mobile) and being a full-stack language - that last point, a bit like the D language - i.e. from being able to use assembly (Red may not supports that, but D does), all the way up to high levels of modeling power - but Red does have a lower level language, which Red is in fact built upon, called Red/System, which is supposed to be at the conceptual level of C - but with Red-style syntax). Red is at a somewhat early stage of development - v0.6 or so, but usable. I could even compile a simple Red program to an EXE and run the EXE - it was quite small too. Yes, RED has both an interpreter and a compiler - and like REBOL, the whole Red package is astonishingly small in size.

Red is a sort of successor to REBOL, but by a different person / team. I had played around with REBOL some years earlier and liked it too.

Here is the clock live-coding demo in Red - the drawing of the clock actually updates on the screen, live, as the code for the clock is being written. This works due to some language features of Red, including, as they say on that page:

[ Yes, livecoding (using native widgets!) in Red can be that simple. As you can see, there's no built-in "livecode" widget or feature, it's an emergent behavior resulting from the combination of existing Red features, homoiconicity being the most fundamental. ]

Interestingly, as the Wikipedia article (linked in the preceding sentence) says, assembly language (at least for systems using Von Neumann architecture) can also be considered to be homoiconic - because both code and data are just bytes in memory.

The image at the top of the post is a screenshot I took, of when the live-coding, and hence the (iterative and exploratory) drawing of the clock was in progress.

The image below is another screenshot taken after the clock was fully drawn. If you load that page in your browser, you can see the whole thing happening.


- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes

Managed WordPress Hosting by FlyWheel