Search found 1738 matches

by kenmo
Sat Oct 09, 2021 8:31 pm
Forum: The PureBasic Editor
Topic: IDE and Icon bar on 4K monitor
Replies: 14
Views: 3790

Re: IDE and Icon bar on 4K monitor

I'd absolutely LOVE to help with the IDE (and have bucketloads of free time to do it!), but I have no idea how to make edits to it; and when I asked for specific help, none was given (https://www.purebasic.fr/english/viewtopic.php?p=565191#p565191). So that's why I can't contribute to this Open Sou...
by kenmo
Sat Oct 09, 2021 8:12 pm
Forum: General Discussion
Topic: Wondering if anybody might be able to point me to a way with PB to Encode / Decode Tones
Replies: 6
Views: 882

Re: Wondering if anybody might be able to point me to a way with PB to Encode / Decode Tones

Hi Baldrick! It is pretty simple to map text characters to audio frequencies, then generate sinusoidal audio sample data. Writing that audio data to a basic WAV file is simple too. Now the two hard parts: 1. Decoding audio sample data to a frequency, then matching that frequency to your closest defi...
by kenmo
Thu Oct 07, 2021 3:26 am
Forum: Bugs - Windows
Topic: SoundLength Error
Replies: 4
Views: 834

Re: SoundLength Error

Sounds like a bug in the SoundLength() function. It would be useful to share the problematic WAV, if possible. Or even just the WAV header, as viewed in hex editor etc. Probably whatever program wrote the WAV wrote invalid or incomplete header data, OR it's a variant of the WAV format which PureBasi...
by kenmo
Thu Oct 07, 2021 3:20 am
Forum: Coding Questions
Topic: Strange behavior of Base64 or something else?
Replies: 7
Views: 808

Re: Strange behavior of Base64 or something else?

@sec :lol: Well, I have written my own Base64 library before https://github.com/kenmo-pb/includes/blob/master/Base64Lib.pbi which @doctorized might be interested in? (Encode/decode in all directions between strings, memory buffers, and files. Always converts strings to UTF-8 first for results consis...
by kenmo
Mon Oct 04, 2021 4:46 am
Forum: Coding Questions
Topic: Strange behavior of Base64 or something else?
Replies: 7
Views: 808

Re: Strange behavior of Base64 or something else?

Yeah, just be careful with Base64 and buffers and strings. There are a lot of "lengths" involved, careful not to mix them up. example: "maria" is 5 chars (6 if you include null terminator) in Unicode that is 10 bytes (or 12) to encode 10 or 12 bytes requires 16 Base64 characters ...
by kenmo
Mon Oct 04, 2021 4:39 am
Forum: Coding Questions
Topic: Calculate first day of last month
Replies: 15
Views: 1101

Re: Calculate first day of last month

If you can spare a few lines... isn't this an easy, understandable way to achieve it? Procedure.q FirstDayOfLastMonth() d=Date(2022,1,15,0,0,0) ; Test with 15 Jan 2022 because we want 1 Dec 2021 returned. ;d=Date() If Month(d) = 1 ; January f = Date(Year(d) - 1, 12, 1, 0, 0, 0) Else f = Date(Year(d)...
by kenmo
Sun Oct 03, 2021 4:59 am
Forum: Coding Questions
Topic: Strange behavior of Base64 or something else?
Replies: 7
Views: 808

Re: Strange behavior of Base64 or something else?

Try this... converts to Base64 and back to verify. Procedure XOrCrypt(*Buffer,Len.l, KeyS.i, KeyE.i) ;just some weird xor encryption algorithm by JLC Protected i, Byte.b, KeyByte.b Protected KeyLength = KeyE - KeyS, KeyPos For i=0 To Len-1 Byte = PeekB(*Buffer+i) KeyByte = PeekB(KeyS+KeyPos) ;PeekB(...
by kenmo
Sun Oct 03, 2021 4:35 am
Forum: Coding Questions
Topic: Strange behavior of Base64 or something else?
Replies: 7
Views: 808

Re: Strange behavior of Base64 or something else?

The first half: Why the Length * 2??? In Base64, all those AAAAA... are 0x00 bytes. You have data that is "Length" bytes, but then you encode "Length * 2" bytes, beyond the end of the string. (Which happens to contain nulls, so you get AAAA....) The second half: Something similar...
by kenmo
Sun Sep 26, 2021 9:41 pm
Forum: Coding Questions
Topic: Dynamically define highlight colour
Replies: 13
Views: 1010

Re: Dynamically define highlight colour

You might be interested in this IncludeFile I put on GitHub, "OSTheme" https://github.com/kenmo-pb/includes/blob/master/OSTheme.pbi You could use GetOSSelectionColor() and GetOSSelectionTextColor() to color the highlighted item, or perhaps GetOSAccentColor() and do some color blending as a...
by kenmo
Tue Sep 14, 2021 2:25 pm
Forum: Coding Questions
Topic: error available from cmd prompt, but not in PureBasic
Replies: 4
Views: 511

Re: error available from cmd prompt, but not in PureBasic

You are overwriting error.s every loop! ReadProgramError() is not set-once and then retains its text value. It is a data stream, like ReadProgramString() (I wish the PB functions handled these streams equally). So once you read an error string, it's gone the next time you check it. Check that ReadPr...
by kenmo
Mon Sep 13, 2021 3:27 am
Forum: Feature Requests and Wishlists
Topic: StrD() Inconsistency
Replies: 10
Views: 1807

Re: StrD() Inconsistency

Glad you have a working solution :) Maybe your feature request will simplify this in the future.
by kenmo
Mon Sep 13, 2021 3:26 am
Forum: Feature Requests and Wishlists
Topic: Allow redefinition of PureBasic functions within modules
Replies: 16
Views: 3420

Re: Allow redefinition of PureBasic functions within modules

+1

Somebody (I think Luis) did a good writeup on the conflicts of PB modules, which make them less useful than they truly could be.
It's partially why I ended up staying with regular IncludeFiles.
by kenmo
Mon Sep 13, 2021 3:23 am
Forum: Off Topic
Topic: Advertising banner on Purebasic Forum
Replies: 14
Views: 2743

Re: Advertising banner on Purebasic Forum

I wonder how much they really make from these ads, whether a few of us could pay enough to "sponsor" the forum and no longer need the ads :mrgreen:
by kenmo
Fri Sep 10, 2021 4:34 am
Forum: Feature Requests and Wishlists
Topic: StrD() Inconsistency
Replies: 10
Views: 1807

Re: StrD() Inconsistency

Right, Int(MyDouble) = MyDouble is just a guess of whether it "seems" to be an integer or not. What I don't understand is your real usage: Do you control the JSON being parsed? If you know the meanings of the numbers being parsed, you can assign them to integers or doubles, whatever makes ...
by kenmo
Fri Sep 10, 2021 4:17 am
Forum: Feature Requests and Wishlists
Topic: GetJSONRaw(JSONValue)
Replies: 4
Views: 1156

Re: GetJSONRaw(JSONValue)

+1 but with a slight suggestion Really your request is for numbers, right? Like for the value 13, you want the original "13.000" as it's written. That's not useful for the other JSON types: null is always "null", boolean is always "true" or "false", string is ...