BLOGS

OLIVIER DESCHANELS

warning: file_get_contents(http://www.telize.com/geoip/54.81.150.27) [function.file-get-contents]: failed to open stream: HTTP request failed! in /var/www/www.4d.com/docs/includes/common.inc(1762) : eval()'d code on line 4.

Have some style!

Don't think I'm going to reveal the remarks my PE teacher made when I tried to do my floor exercises in gym class. I've long erased those painful memories, even if they're slightly reawakened by the scent of the sweat and rubber mats of my childhood. However, my PE teacher's lessons also left me with some good lessons, which I'll take advantage of today.

 

Let's see how!

 

Let's examine the following example:

 

For several versions now, 4D has offered the use of rich, styled text. Whenever I've met with 4D developers, I've had the chance to see this element in action, and so it's now time for me to give it a role. 

 

Look at the following list:

Screenshot 1

Let's show some false results!

This isn't the latest slogan from a movement of angry accountants, but a very serious proposition that I'd like to cover today.

 

In our profession as application developers, we have ever-growing masses of data to store and to manipulate. More and more often we have to produce results based on this mass of data, and understandably our users don't want to wait too long for a response while they query the database, looking for a specific result, a list, or a dashboard.

 

The first idea is to calculate the responses on demand, and do our best to make it happen quickly. However, when the number of connected users (whether 4D clients or via the web) increases, or when the calculations are complex and require multiple requests, its sometimes difficult to get a satisfactory response time. We can also find ourselves faced with requests that eat up all the server resources or impede otherwise normal usage of the database by emptying the cache to make room for whatever's needed to produce the desired response.

 

The Star Trail: The Magic Dialog

This is the first post in a series dedicated to stars. I'm not talking about stars making hits on the radio, but of the stars punctuating the 4D language that themselves often ensure real hits.

 

One of the latest stars to arrive is the one that proudly raises the DIALOG command as of version 11. This little star doesn't seem like much, but changes everything. In effect, it allows you to divide the execution cycle of a process into two parallel and simultaneous cycles.

 

 

When a form is opened with the DIALOG command via a line such as:

Timestamp mon amour (4th and final)

 

This blog post is the final in a four-part series written in French in September 2009.


To finish this series, here are a few items allowing us to further appreciate the usefulness of timestamps.

 

 

- One could object that calculating timestamps takes time in interpreted databases. This is debatable, but there is nevertheless the possibility of doing better. in fact, with 4D v11 SQL, an interpreted database can callcompiled components. Nothing is is stopping you from accelerating your application, if need be, by offloading timestamp-related calculations to a specialized component.

 

Timestamp, Mon Amour (Part 3)

This blog post is the third in a four-part series written in French in September 2009.

 

In previous posts we’ve seen the use of a timestamp based on a long integer, which brings us much in terms of efficiency, saving space and performance. Let’s now look at how to code the conversion of a date and time into a timestamp and vice-versa.

In the end, the timestamp is calculated by the number of seconds compared to a reference date. To keep it simple, we’ll use January 1st, 2000 as our reference date. This allows us to go up until 2068. Why 2068 and not 2136, assuming that 136 years corresponds to 4 billion seconds? Because long integers in 4D are signed, we must remember that the value 0 is in the middle of the range of possible values. As a result, our timestamps allow us to navigate between the years of 1932 and 2068. Of course, there’s nothing preventing you from shifting your reference date to cover your needs better.

 

Here’s the code I’m proposing to encode a timestamp:

Timestamp, Mon Amour (Part 2)

 

This blog post is the second in a four-part series written in French in September 2009.

 

Following the example of using two fields to mark a record with date and time, let’s now look at timestamps.

 

The principle of the timestamp is to combine in a single field, in the most compact way possible, the information needed to memorize the date and time. Of course, the less space we attribute for storage, the smaller the amplitude of possible values.

 

Timestamp, Mon Amour

This blog post is the first of a four-part series written in French in September 2009.

 

Far be it from me to rip off Marguerite Duras (writer of Hiroshima, My Love) with such a title, just that I want to express how much timestamps have simplified my life and how much I love to use them. I could even say that timestamps are the bomb, pun somewhat intended…

 

But first and foremost, what’s a timestamp? Don’t look for it in the 4D documentation – this concept doesn’t exist as such in our beloved product. A little jaunt through Wikipedia tells us that a timestamp is a “sequence of characters, denoting the date and/or time at which a certain event occurred.” A-ha! So it’s a combination of various information and, indeed, in our matter of the day, we’ll be combining date and time.