Search found 3431 matches

by Little John
Thu Dec 02, 2021 8:10 am
Forum: Off Topic
Topic: MiniScript
Replies: 1
Views: 279

Re: MiniScript

That looks good. Thanks for the tip!
by Little John
Mon Nov 29, 2021 10:13 pm
Forum: Bugs - C backend
Topic: [6.00 Beta 1 x64] For/Next with pointers
Replies: 8
Views: 404

Re: [6.00 Beta 1 x64] For/Next with pointers

@mk-soft:
Using another pointer in the For/Next loop, and then assigning its value to the wanted character pointer is a good idea. Thank you!
by Little John
Mon Nov 29, 2021 6:22 pm
Forum: Bugs - C backend
Topic: [6.00 Beta 1 x64] For/Next with pointers
Replies: 8
Views: 404

Re: [6.00 Beta 1 x64] For/Next with pointers

It looks that the C compiler already uses a step 2 for Character pointers. Yep, that's it. Thank you, infratec! I'm now using this: CompilerIf #PB_Compiler_Backend = #PB_Backend_Asm #CharStep = SizeOf(Character) CompilerElse #CharStep = 1 CompilerEndIf And then in my actual code, I replaced ... Ste...
by Little John
Mon Nov 29, 2021 8:00 am
Forum: Bugs - C backend
Topic: [6.00 Beta 1 x64] For/Next with pointers
Replies: 8
Views: 404

[6.00 Beta 1 x64] For/Next with pointers

EnableExplicit #SOC = SizeOf(Character) Procedure.i FindAny (source$, charList$, start.i=1) ; in : source$ : string to sift through (empty string => return value = 0) ; charList$: list of characters to search for (empty string => return value = 0) ; start : position in 'source$', where the search b...
by Little John
Mon Nov 29, 2021 7:55 am
Forum: Announcement
Topic: PureBasic 6.00 Beta 1 released !
Replies: 316
Views: 68998

Re: PureBasic 6.00 Beta 1 released !

That's pretty cool! 8)
Many thanks to Fred and the team!
by Little John
Thu Nov 18, 2021 12:17 pm
Forum: Tricks 'n' Tips
Topic: Uniformly distributed random permutations
Replies: 11
Views: 3073

Re: Uniformly distributed random permutations

@WiliamL: My Shuffle() procedure always shuffles the whole concerning array. So if you want to shuffle say array a() with x elements, you have to use Dim a(x-1) PureBasic's arrays always start with index 0, see https://www.purebasic.com/documentation/reference/dim.html Ignoring one of the array elem...
by Little John
Wed Nov 03, 2021 6:17 am
Forum: Feature Requests and Wishlists
Topic: Protected 'already declared'
Replies: 26
Views: 5713

Re: Protected 'already declared'

Demivec wrote:Just a reminder that my viewpoint is that allowing redeclaration using protected is a positive thing.
This is just a reminder that my viewpoint is that allowing redeclaration using “protected” is a negative thing, :-)
see viewtopic.php?p=547898#p547898
by Little John
Tue Nov 02, 2021 8:43 pm
Forum: The PureBasic Editor
Topic: Opensource PureBasic IDE now much easier to build
Replies: 26
Views: 3777

Re: Opensource PureBasic IDE now much easier to build

That's interesting news for people like me. :-) Thank you!
by Little John
Tue Nov 02, 2021 7:49 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

Re: TimeDiff(), TimeStr()

New version 1.00, 2021-11-02 Main improvement : You can now control in which units a result is expressed. So e.g. for a time span of 1 week, TimeDiff() now can also return e.g. 7 days or 336 hours, if you want (see examples in the code). This new functionality entailed other changes. The function Ti...
by Little John
Sun Oct 31, 2021 9:00 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

Re: TimeDiff(), TimeDiffS()

Davido, you are welcome!
I'm already working on another improvement, so stay tuned. :-)
by Little John
Sun Oct 31, 2021 5:51 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

Re: TimeDiff(), TimeDiffS()

Debug TimeDiffS(Date(2012, 6,30,23,59,59), Date(2012, 7, 1, 0, 0, 0)) ; Leap second is missing Debug TimeDiffS(Date(2017, 3,26, 1,59,59), Date(2017, 3,26, 3, 0, 0)) ; Changeover to daylight saving time Debug TimeDiffS(Date(2017,10,29, 2, 0, 1), Date(2017,10,29, 2, 0, 1)) ; No 2:00:01B Debug TimeDif...
by Little John
Sun Oct 31, 2021 2:26 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

Re: TimeDiff(), TimeDiffS()

Please do it! Done. :-) The first post here now contains completely new code: As suggested, this code works differently than the old one. Also I've split the old function into two. The function TimeDiff() does the calculations and returns pure numbers for further usage, and the function TimeDiffS()...
by Little John
Sat Oct 30, 2021 8:33 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

Re: TimeDiff(), TimeDiffS()

Hi, you are both welcome! I'm glad that the code is useful for you. @davido: Because my above function only receives the length of a time span as parameter, it cannot calculate whether or not that time span contains a leap day. Say a span of 400 days is given: If this span is e.g. from January 1st 2...
by Little John
Sat Oct 30, 2021 1:08 pm
Forum: Tricks 'n' Tips
Topic: TimeDiff(), TimeStr()
Replies: 13
Views: 1983

TimeDiff(), TimeStr()

Express the difference between two given dates in wanted units. TimeDiff() populates a structure with the numbers of years, weeks, days, etc. This function is so to say a counterpart of PB's built-in function AddDate() and is compatible with it (see validation in the code). You can control in which ...