The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,639 other followers

Archive for April 23rd, 2019

Should you convert your Visual Basic .NET project to C#? Why and why not… | Tim Anderson’s IT Writing

Posted by jpluimers on 2019/04/23

Since I get this question every now and then: [WayBackShould you convert your Visual Basic .NET project to C#? Why and why not… | Tim Anderson’s IT Writing.

Via [WayBack] Should you convert your Visual Basic .NET project to C#? Why and why not… https://www.itwriting.com/blog/11089-should-you-convert-your-visual-basic-net-… – Ondrej Kelle – Google+

–jeroen

Posted in .NET, Software Development, Development, C#, VB.NET, C# 6 (Roslyn) | Leave a Comment »

On my research list: Event Sourcing

Posted by jpluimers on 2019/04/23

On my research list: [WayBackEvent Sourcing

Capture all changes to an application state as a sequence of events.

I got there via a very interesting thread [WayBack] A foreword===Hello everybody, the two major things that were recently introduced into my software architecture which led to significantly better main… – Edwin Yip – Google+

–jeroen

Posted in Design Patterns, Development, Software Development | Leave a Comment »

InterBase/Firebird divisions: use E0 syntax to force floating point calculations

Posted by jpluimers on 2019/04/23

I was a bit baffled at the below results because in other other databases.

You need to use this kind of notation ####.0E0 to force an integer to be evaluated as floating point, which is an extra .0 than explained by [WayBacksql – Why does Firebird truncate decimal places when dividing? – Stack Overflow

I’m not the only person confused by this: [WayBack] [#CORE-2849] Simple mathematics gone wrong – Firebird RDBMS Issue Tracker.

I know that as of Firebird 2.1 you can use the [WayBackdateadd() function for calculations on timestamps, date or time values (hence the confusing name dateadd), but you don’t always have the delta readily available in one unit (second, minutes, etc) and for a mixed Firebird/InterBase deployment having one kind of logic is often preferred.

select 
        cast('now' as timestamp) as NowTimeStamp 
      , (15.0*(1.0/24.0/60.0)) as A15MinutesInDays 
      , (15.0/24.0/60.0) as B15MinutesInDays 
      , (15.0E0/24/60) as C15MinutesInDays 
      , cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)) as AIn15MinutesTimeStamp 
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0))) as ADifferenceInDays 
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)))) * 24 as ADifferenceHours 
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0*(1.0/24.0/60.0)))) * 24*60 as ADifferenceMinutes 
      , cast('now' as timestamp) + (15.0/24.0/60.0) as BIn15MinutesTimeStamp  
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0)) as BDifferenceDays  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0))) * 24 as BDifferenceHours  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0/24.0/60.0))) * 24*60 as BDifferenceMinutes  
      , cast('now' as timestamp) + (15.0E0/24/60) as CIn15MinutesTimeStamp  
      , cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60)) as CDifferenceDays  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60))) * 24 as CDifferenceHours  
      , (cast('now' as timestamp) - (cast('now' as timestamp) + (15.0E0/24/60))) * 24*60 as CDifferenceMinutes  
      -- Firebird 2.1 and up: use dateadd , dateadd(minute, 15, cast('now' as timestamp)) as DIn15MinutesTimeStamp , cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp)) as DDifferenceInDays , (cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp))) * 24 as DDifferenceHours , (cast('now' as timestamp) - dateadd(minute, 15, cast('now' as timestamp))) * 24*60 as DDifferenceMinutes from rdb$database /* Transposed results are below. Excected values for: A15MINUTESINDAYS 0.0104166666666667 B15MINUTESINDAYS 0.0104166666666667 Transposed results: NOWTIMESTAMP 20-9-2017 20:31:40 A15MINUTESINDAYS 0 B15MINUTESINDAYS 0.01 C15MINUTESINDAYS 0.0104166666666667 AIN15MINUTESTIMESTAMP 20-9-2017 20:31:40 ADIFFERENCEINDAYS 0 ADIFFERENCEHOURS 0 ADIFFERENCEMINUTES 0 BIN15MINUTESTIMESTAMP 20-9-2017 20:46:04 BDIFFERENCEDAYS -0.01 BDIFFERENCEHOURS -0.24 BDIFFERENCEMINUTES -14.4 CIN15MINUTESTIMESTAMP 20-9-2017 20:46:40 CDIFFERENCEDAYS -0.010416667 CDIFFERENCEHOURS -0.250000008 CDIFFERENCEMINUTES -15.00000048 DIN15MINUTESTIMESTAMP 20-9-2017 20:46:40 DDIFFERENCEDAYS -0.010416667 DDIFFERENCEHOURS -0.250000008 DDIFFERENCEMINUTES -15.00000048 */

–jeroen

Posted in Database Development, Development, Firebird, Software Development | Leave a Comment »

 
%d bloggers like this: