Search found 1245 matches

by collectordave
Mon Jul 21, 2025 2:10 pm
Forum: Coding Questions
Topic: GetFilePart
Replies: 7
Views: 297

Re: GetFilePart

Debug GetFilePart(~"/folder/a/b")


Works on MAC
by collectordave
Wed Nov 23, 2022 2:22 pm
Forum: Coding Questions
Topic: Wrong amount returned by FileSize()
Replies: 17
Views: 4090

Re: Wrong amount returned by FileSize()

Yes it does appear that Apple have decided that there are 1000 bytes in a kilobyte etc.

So 50 years of learning that there are 1024 bytes in a kilobyte all for nothing.

Apple cheating me out of 2.5% of storage space?
by collectordave
Wed Nov 23, 2022 10:02 am
Forum: Coding Questions
Topic: Wrong amount returned by FileSize()
Replies: 17
Views: 4090

Re: Wrong amount returned by FileSize()

Seems to be same problem.


Maybe a little confused.

I have a file on my hard drive which in finder is shown with a size of 16,3MB.

When I use FileSize() on the file it returns 16295002 which I assume are bytes

Now I thought that there are 1048576 bytes in a mega byte so in 16,3MB should there ...
by collectordave
Tue Nov 08, 2022 3:38 pm
Forum: Coding Questions
Topic: [SOLVED] Path separators #PS, #NPS, #PS$, #NPS$
Replies: 8
Views: 1462

Re: Path separators #PS, #NPS, #PS$, #NPS$

I have found that #PS$ returns "\" on windows and "/" on the Mac which seems to be correct.

Can anyone explain the use of #NPS$ it is the N which is getting me.
by collectordave
Mon Sep 05, 2022 9:27 am
Forum: Coding Questions
Topic: Vector drawing clear image to transparent
Replies: 5
Views: 1966

Vector drawing clear image to transparent

Is it possible to clear an image to transparent using the vector drawing commands?

I start with a transparent image add a box then try to clear the image but the box remains.

the code I am using:

StartVectorDrawing(ImageVectorOutput(DrawImg))

VectorSourceColor(RGBA(255,255,255,0 ...
by collectordave
Sun Sep 04, 2022 2:42 pm
Forum: Coding Questions
Topic: uneven gauge?
Replies: 14
Views: 2370

Re: uneven gauge?

When you something which just cannot be expressed as a linear or exponential function such as in your case the way to go is to use a lookup table.

For example

Your value Gauge Value
0 0
0.1 50
1 100
10 150
100 200
500 250
1000 300

You can keep adding pairs of values up to the gauge limit of 300 ...
by collectordave
Sun Sep 04, 2022 9:50 am
Forum: Coding Questions
Topic: uneven gauge?
Replies: 14
Views: 2370

Re: uneven gauge?

As a small example to display %

First a small procedure to change your % value to 0-300
Procedure.i DisplayPercent(Value.i)

Define Result.f


Result = (Value/100) * 300

ProcedureReturn Result

EndProcedure

Then in the event loop add this

If Event = #PB_Event_Timer And EventTimer() = 123 ...
by collectordave
Sun Sep 04, 2022 9:08 am
Forum: Coding Questions
Topic: uneven gauge?
Replies: 14
Views: 2370

Re: uneven gauge?

Just rescued some code.

Draws a circular gauge with pointer first up to maximum (300) then back to zero

Any use?

Global Pathx,Pathy

Global Reverse.i

Procedure DrawGauge(Value.i)

Define EndAngle.i


EndAngle = 120 + Value

If EndAngle > 360

EndAngle = EndAngle - 360

EndIf ...
by collectordave
Fri Sep 02, 2022 8:02 am
Forum: Coding Questions
Topic: m3u playlists
Replies: 1
Views: 1412

Re: m3u playlists

Long time to wait for a reply but just in case any other novices end up here as I did check out this thread.

https://www.purebasic.fr/english/viewtopic.php?p=566557&hilit=playlists#p566557

M3U are a list of file names so read them find the files and play as normal.

the routines from kenmo work ...
by collectordave
Tue Aug 23, 2022 8:30 am
Forum: Mac OSX
Topic: error: invalid preprocessing directive
Replies: 4
Views: 1646

Re: error: invalid preprocessing directive

Yes read that and the M1 chip does report as a 64bit when you use.

CompilerIf #PB_Compiler_Processor = #PB_Processor_Arm64 ; not #PB_Processor_x64

Debug "Arm 64"

CompilerElse

Debug "Not ARM64"

CompilerEndIf

This bit of code selects some assembler code but even selecting the correct ...
by collectordave
Tue Aug 23, 2022 7:45 am
Forum: Mac OSX
Topic: error: invalid preprocessing directive
Replies: 4
Views: 1646

Re: error: invalid preprocessing directive

Just trying a few more things and used this code

Debug SizeOf(Integer)

If #PB_Compiler_Processor = #PB_Processor_x64

Debug "X64"

Else

Debug "X32"

EndIf

This returns 8 for the integer size indicating a 64bit processor?

but the compiler directive reports 32bit

I am on an iMac 24 , M1 ...
by collectordave
Mon Aug 22, 2022 3:26 pm
Forum: Mac OSX
Topic: error: invalid preprocessing directive
Replies: 4
Views: 1646

error: invalid preprocessing directive

Just moving some code from an earlier MAC to the new M1

Code compiles perfectly and runs on the earlier machine (PB 5.72LTS) but I get this error when using PB 6LTS for the MAC M1.

error: invalid preprocessing directive
#Slices = SizeOf(Integer); Use 8 slices on x64 and 4 on x86
^
purebasic.c ...
by collectordave
Fri Aug 12, 2022 3:22 pm
Forum: Coding Questions
Topic: (Solved)How to use purebasic to operate autocad?
Replies: 9
Views: 1870

Re: How to use purebasic to operate autocad?

I do not know if this will help.

I did some Autocad work many years ago, mainly electric control panel design which broke down into a list of standard blocks, about 200 of them.

After a lot of messing around I used the Autocad DXF format just a straight forward text file.

I first created the ...
by collectordave
Fri Aug 12, 2022 3:04 pm
Forum: Off Topic
Topic: Recipe management software?
Replies: 180
Views: 57971

Re: Recipe management software?

Hi

One of the big bottlenecks is getting data into into a meaningful table that can be indexed.

May I try to give a little explanation?

With a recipe database I can start with just two tables.

Recipes

Recipe_ID plus other details of the recipe without ingredients.

Ingredients

Ingredient_ID ...
by collectordave
Fri Aug 12, 2022 1:44 pm
Forum: Mac OSX
Topic: Adding menu items dynamically possible?
Replies: 4
Views: 1694

Re: Adding menu items dynamically possible?

Maybe I am missing the point but I use PB to create the menus etc including adding new titles and or sub items.

Using a procedure to create the menu each time.

I normally store the menu items I want in a structured list.

Hope this helps.

Tested on Mac with M1 chip running Bigsur and latest PB ...