Author Topic: Date time assert error in a slick-c module...  (Read 19370 times)

mikesart

  • Community Member
  • Posts: 56
  • Hero Points: 11
Re: Date time assert error in a slick-c module...
« Reply #15 on: March 02, 2011, 07:21:40 AM »
Not sure if there is a way to Load Module before the assert fires, but I changed the date to 3/2, then Slickedit didn't crash for me on startup. That allowed me to do the Load Module, exit slickedit, then restore my date.

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Date time assert error in a slick-c module...
« Reply #16 on: March 02, 2011, 08:13:55 AM »
What a howler! Somebody deserves fifty lashes for not knowing how to calculate a leap year ;)

Code: [Select]
static public boolean isLeapYear (int iyear) {
      return(!(iyear % 4) && (!(iyear % 400) || (iyear % 100)));
   }

Shouldn't that be?

Code: [Select]
static public boolean isLeapYear (int iyear) {
      return(!(iyear % 4) && ((iyear % 400) || (iyear % 100)));
   }

BTW, is there no NDEBUG in slickc?

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Date time assert error in a slick-c module...
« Reply #17 on: March 02, 2011, 10:25:27 AM »
What a howler! Somebody deserves fifty lashes for not knowing how to calculate a leap year ;)

Code: [Select]
static public boolean isLeapYear (int iyear) {
      return(!(iyear % 4) && (!(iyear % 400) || (iyear % 100)));
   }

Shouldn't that be?

Code: [Select]
static public boolean isLeapYear (int iyear) {
      return(!(iyear % 4) && ((iyear % 400) || (iyear % 100)));
   }

BTW, is there no NDEBUG in slickc?

The first version is correct and your version is wrong
http://www.dataip.co.uk/Reference/LeapYear.php

Quote
A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400.

      return(!(iyear % 4) && (!(iyear % 400) || (iyear % 100)));

Which is (year is divisible by 4) AND  ( (year is divisible by 400)  OR  (year is not divisible by 100) )


Well I was just gonna run slick to check on the NDEBUG situation but lo and behold I get the date time assertion Slick C stack followed by "Slickedit has encountered a problem and has to close"!  I think I'll wait for the 3rd of March which is 30 minutes away!  What an interesting bug :)

Graeme

DaveyC

  • Senior Community Member
  • Posts: 169
  • Hero Points: 9
Re: Date time assert error in a slick-c module...
« Reply #18 on: March 02, 2011, 10:51:26 AM »
Oops, my mistake! I still don't think your code is correct, although I did jump the gun!

Shouldn't it be like this?

Code: [Select]
static public boolean isLeapYear (int iyear) {
      return(!(iyear % 4) && ((!iyear % 100) || (iyear % 400)));
   }

DanLuchinski

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Date time assert error in a slick-c module...
« Reply #19 on: March 02, 2011, 12:41:44 PM »
Ok, so I messed something up.  I am trying to run the x64 Beta1 on Windows 7.  If I remember correctly, here is what I did...

1.  I backed up the DateTime.e file, and put the new file in the same location.
2.  I changed the date on my computer so I could get into the application.
3.  I tried to load the macro.  At the bottom of the screen, I received a message about unable to create DateTime.ex. (well, the message was along those lines).
4.  I backed up the DateTime.ex file.
5.  I tried the same things and got the error again.
6.  So, I tried to unload the module.  This is where I got into trouble.  I started getting errors.  Don't remember what errors.
7.  So, I uninstalled the application and reinstalled it.

I am still getting errors.  I assume these are the same errors I received as soon as I unloaded the module.  I am getting Procedure se.datetime.DateTime.fromTimeB not found   file=pip.ex offset=954.  A window named vsapi.dll opens up too.  When I click the OK button from the procedure error window, another popup opens saying Invalid argument -- file=DateTimeInterval.ex offset=5388. I then click OK and the SlickEdit frame opens.  There is nothing in it.  The only thing I can do is click the exit button and then Windows tells me that SE is not working.

So, any suggestions on how to get me out of this mess? Uninstalling and reinstalling did not do the trick.  I even restarted in between without any success.

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Date time assert error in a slick-c module...
« Reply #20 on: March 02, 2011, 12:56:01 PM »
I should have put the part about putting your system date forward in the instructions. I had enough time to load the new module before getting the error. I will edit my response, but my guess is that everybody has moved beyond the dreaded date that causes the crash.

For those having problems because you unloaded DateTime.ex, you can always delete your state file, or use a clean-config. I think instructions have been posted by other users often enough that I don't have to repeat them.

--rodney

cxbr

  • New Community Member
  • Posts: 1
  • Hero Points: 0
Re: Date time assert error in a slick-c module...
« Reply #21 on: March 02, 2011, 02:51:30 PM »
but my guess is that everybody has moved beyond the dreaded date that causes the crash.
I was getting this crash this morning, not yesterday (but I may have left slickedit open all night Monday).  I don't know if that makes any difference, but anyway, thanks for posting this fix.

BTW: If it wasn't provided by my employer I wouldn't have even heard of it, but slickedit is pretty awesome.

Kohei

  • Senior Community Member
  • Posts: 192
  • Hero Points: 25
Re: Date time assert error in a slick-c module...
« Reply #22 on: March 02, 2011, 03:27:29 PM »
I was also getting this and I thought I was going crazy. ;-)  It never occurred to me this was due to a leap day....

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6879
  • Hero Points: 530
Re: Date time assert error in a slick-c module...
« Reply #23 on: March 02, 2011, 04:33:00 PM »
2. Load from Macro>Load Module
How do I run Macro>Load Module?  After I click OK on the assertion error box, SE closes!  I can't do anything within SE because of the assertion error. (Mac OSX, SE v15.0.1)

Is there a way to compile the new DateTime.e from the command line or something?

EDIT: I was able to get SE to launch by deleting the vslick.stu and vrestore.slk files from my config directory (after making backups first, of course.) I don't know which file (or both) actually needed to be deleted.

However, I still wasn't able to load the new DateTime.e macro because the Mac OS file selection dialog box doesn't let me descend into the SlickEditV1501.app directory! Thank you, Apple!  So I put the DateTime.e file on my Desktop, and told SE to load it from there.

Here's a way to load DateTime.e without having to change the date, delete vrestore.slk, or delete your config:

Run the following for a command prompt:

     <path-to-vs-here>vs "-#load DateTime.e"

For the above command line to work, DateTime.e needs to be in the current directory.

IMPORTANT: Make sure the directory where you put DateTime.e has write permissions. Otherwise, the macro compiler won't be able to create the .ex file .
« Last Edit: March 02, 2011, 07:21:20 PM by Clark »

microcode

  • Community Member
  • Posts: 59
  • Hero Points: 10
Re: Date time assert error in a slick-c module...
« Reply #24 on: March 02, 2011, 05:19:15 PM »
For the above command line to work, DateTime.e needs to be in the current directory.
Thanks, Clark.

For me, on Windows 7, the above command didn't work for me when the current directory was the standard location of the DateTime.e macro (i.e. <path_to_vs>\macros\se\datetime).  But if I put the new DateTime.e macro in some other directory (e.g. C:\Download\SlickEdit), and run the command from there, then it worked fine.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Date time assert error in a slick-c module...
« Reply #25 on: March 02, 2011, 05:40:25 PM »
For anyone who has not already fixed the problem using the methods described, a new hot fix is available that includes the fix for this issue. See http://community.slickedit.com/index.php?topic=6751.0 for complete details.

Again, you have our most sincere apologies for this problem. We are making every effort to make sure something like this does not occur again.

alyanm

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Date time assert error in a slick-c module...
« Reply #26 on: March 02, 2011, 07:12:41 PM »
Thanks for the hotfix, this worked great for my v 15 -- what do I do for the Beta 16?

Oh -- I figured it out, never mind!  Rename vrestore.slk, load DateTime.e, restore vrestore.slk, voila!
« Last Edit: March 02, 2011, 07:22:48 PM by alyanm »

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Date time assert error in a slick-c module...
« Reply #27 on: March 02, 2011, 07:16:19 PM »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6879
  • Hero Points: 530
Re: Date time assert error in a slick-c module...
« Reply #28 on: March 02, 2011, 07:23:01 PM »
Thanks for the hotfix, this worked great for my v 15 -- what do I do for the Beta 16?

Load the DateTime.e macro Rodney posted. Sorry we don't have something better for the Beta.

alyanm

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Date time assert error in a slick-c module...
« Reply #29 on: March 02, 2011, 09:03:26 PM »
Thanks guys, I got it all sorted out.