• Welcome to Jose's Read Only Forum 2023.
 
Main Menu

Recent posts

#81
OxygenBasic / Re: PLOT and DRAW with APi
Last post by Theo Gottwald - February 11, 2023, 08:09:24 PM
if you like speed, make these commands in ASM.
You so know know ASM?
Ask ChatGPT he can give you the ASM Code for all these commands.
I have tried, it works. Ok, it may need small corrections here and there  but generally its fine.


section .data

; Define the width and height of the image
width   db 100
height  db 100

; Define the starting x and y position of the line
x_start db 50
y_start db 50

; Define the angle and length of the line
angle   dd 3.14159265358979 / 4
length  dd 50

section .bss

; Reserve space for the image buffer
image_buffer resb width * height * 3

section .text

; The main function
global _start

_start:
    ; Load the angle and length into the x87 FPU
    fld angle
    fsin
    fstp [sin_result]
    fld angle
    fcos
    fstp [cos_result]

    ; Calculate the end position of the line
    mov eax, [length]
    fild eax
    fmul dword [sin_result]
    fistp [y_end]
    mov eax, [length]
    fild eax
    fmul dword [cos_result]
    fistp [x_end]

    ; Add the starting position to the end position to get the final end position
    add [x_end], [x_start]
    add [y_end], [y_start]

    ; Calculate the delta x and y
    mov eax, [x_end]
    sub eax, [x_start]
    mov [delta_x], eax
    mov eax, [y_end]
    sub eax, [y_start]
    mov [delta_y], eax

    ; Calculate the address of the starting pixel
    mov ebx, image_buffer
    add ebx, y_start * width * 3
    add ebx, x_start * 3

    ; Draw the line
    mov eax, [delta_x]
    mov edx, [delta_y]
    cmp eax, 0
    jge .x_positive
    neg eax
    .x_positive:
    cmp edx, 0
    jge

#82
OxygenBasic / Re: Kick - o2 precompiler
Last post by Theo Gottwald - February 11, 2023, 08:00:13 PM
This looks like it should be added to the Compiler.
Unless you want to enhace it to a Preprocessor that will also make changes in the code.
#83
General Discussion / Re: AI discussion on the FreeB...
Last post by Theo Gottwald - February 11, 2023, 07:56:57 PM
For private people using Search engines and Strange AI does not matter so much.
For companies it may have implications on Company secrets.

Lets say the Secretary, the Engeener and all others all use ChatGPT (which will be soon integrated in BING)
and let it solve problems for them. Now imagine someone can bring all this data together to find out what your company is doing.
So you need to know that these AI not only tell you the wisdom of the world, but also look behind you while doing so.
They also collect your data.

At BING People suspect that the amount of harddisk space for all the collected data will double all 6 Month.
SO this is the price of this sort of AI.


#84
General Discussion / Re: Immunology of mRNA vaccine...
Last post by Theo Gottwald - February 11, 2023, 07:52:08 PM
@Charles, I can tell you more about this.

Bluetooth Signals in Fresh Graveyards Emitting Unknown MAC Addresses?

A friend of mine owns an older (Samsung?) "Notes1 Phone". With this phone you can set the Bluetooth settings to
"Show stations without name". He is a technician hired from large Car Companies, so he is not an technical nobody.

He told me that "85% of all vaccinated people my handphone can detect from them an MAC Adress".
He has tested it in many way. Now he actually even know who is in front of his door, because he made a list with the
MAC-Adresses from his bussines people around.

He told me that 85% of the people are now "branded" by these Companies.
I wonder most people just ignore it.
I did not test it myself.


#85
General Discussion / Re: Bayesian Statistics Questi...
Last post by Charles Pegge - February 11, 2023, 04:05:50 PM
Quote
Assume we have a drug test that tests for cannabis use. Now, this test has a 90% True Positive rate, that is, 90% of the time, it will detect a cannabis user. It also has an 80% True Negative rate, that is, 80% of the time it will confirm that a person has NOT used Cannabis. Unfortunately, it also generates 20% False Positives. Given that 5% of all people tested are cannabis users, what is the probability that a person who tests positive for cannabis using this test is truly a cannabis user? I'll give you a hint to get started, the first branch of your tree should be the cannabis users.

A Simple Guide to Solving Bayes' Theorem Problems
https://towardsdatascience.com/simple-guide-to-solving-bayes-theorem-problems-a594edc3e245
2020
#86
OxygenBasic Examples / Re: How Structure OVERLAPPED?
Last post by Zlatko Vid - February 10, 2023, 08:11:49 AM
hi Piere

i have some mess with this using CreateProcess example
but now work

thanks
#87
OxygenBasic Examples / Re: How Structure OVERLAPPED?
Last post by Pierre Bellisle - February 10, 2023, 08:07:19 AM
Also, if you prefer the simplified structure, I wrote a test to see if all was perfecto mundo in 32 and 64 bit.
So far, so good...


// KickSwitch -64 //-mem32 -32 -64 -run -dll (No Switch mean -mem32)
// KickEnd

uses Console
uses MinWin
uses Dialogs

%CREATE_NEW                     1
%CREATE_ALWAYS                  2
%OPEN_EXISTING                  3
%OPEN_ALWAYS                    4
%TRUNCATE_EXISTING              5
%FILE_FLAG_OVERLAPPED           0x40000000
%INFINITE                       0xFFFFFFFF
%FORMAT_MESSAGE_FROM_SYSTEM     0X1000
%FORMAT_MESSAGE_ALLOCATE_BUFFER 0X100
%ERROR_IO_PENDING               997
%FILE_BEGIN                     0
%FILE_CURRENT                   1
%FILE_END                       2

'struct OVERLAPPED{        // 32bit,   64bit
' sys internal             // 4 bytes, 8 bytes (dword pointer)
' sys internalhigh         // 4 bytes, 8 bytes (dword pointer)
' union{                   // 8 bytes, 8 bytes
'       struct{            // dummyStructName 8 bytes
'         dword offset     // 4 bytes, 4 bytes (dword)
'         dword offsetHigh // 4 bytes, 4 bytes (dword)
'       }
'       sys pointer        // 4 bytes, 8 bytes <- 4 bytes in 32bit but the 8 bytes union will pad it (void pointer)
' }                        //
' sys hevent               // 4 bytes, 8 bytes (handle)
'}

struct OVERLAPPED{ 'simplified
  sys   Internal
  sys   InternalHigh
  dword Offset
  dword OffsetHigh
  sys   hEvent
}
'_____________________________________________________________________________

SetConsoleTitle "overlapped structure"

long BitNess = sizeof(sys) * 8
printl "bitness             = " BitNess "bit"
printl

dword WrittenCount = 0
string sFileName = "overlapped.txt"
string sFileData = "filedata"

overlapped overlapp
overlapp.offset = 8
'overlapp.hevent = CreateEvent(BYVAL 0, %FALSE, %FALSE, "") '"someEvent")

sys hFile = CreateFile(sFileName, %GENERIC_READ OR %GENERIC_WRITE, %FILE_SHARE_READ, 0,
                        %OPEN_ALWAYS, %FILE_ATTRIBUTE_NORMAL | %FILE_FLAG_OVERLAPPED, 0)
If hFile <> %INVALID_HANDLE_VALUE
   if WriteFile(hFile, sFileData, LEN(sFileData), @WrittenCount, @overlapp) = 0 'nzok
    GetOverlappedResult(hFile, @overlapp, @WrittenCount, %true) 'nzok
   endif
   CloseHandle(hFile)
   printl "WrittenCount " str(WrittenCount)
end if
'WaitForSingleObject(overlapp.hevent, %INFINITE) '2000) '%INFINITE)

printl
printl "check the file " chr(34) sFileName chr(34)
printl
printl "any key to end"
waitkey

end
'_____________________________________________________________________________
'
#88
OxygenBasic Examples / Re: How Structure OVERLAPPED?
Last post by Pierre Bellisle - February 10, 2023, 02:28:41 AM
Hi Zlatko,

This structure is quite interesting.
I came out with the following two examples.
Two definitions, depending on how you like it.
Once more, I'm impress by the beauty of o2, thank to Charles!


// KickSwitch -64 //-mem32 -32 -64 -run -dll (No Switch mean -mem32)
// KickEnd

// C++ typedef struct _OVERLAPPED {
// C++   ULONG_PTR Internal;
// C++   ULONG_PTR InternalHigh;
// C++   union {
// C++     struct {
// C++       DWORD Offset;
// C++       DWORD OffsetHigh;
// C++     } DUMMYSTRUCTNAME;
// C++     PVOID Pointer;
// C++   } DUMMYUNIONNAME;
// C++   HANDLE    hEvent;
// C++ } OVERLAPPED, *LPOVERLAPPED;

struct OVERLAPPED{        // 32bit,   64bit
dword *internal          // 4 bytes, 8 bytes (dword pointer)
dword *internalhigh      // 4 bytes, 8 bytes (dword pointer)
union{                   // 8 bytes, 8 bytes
       struct{            // dummyStructName 8 bytes
         dword offset     // 4 bytes, 4 bytes (dword)
         dword offsetHigh // 4 bytes, 4 bytes (dword)
       }
       void *pointer      // 4 bytes, 8 bytes <- 4 bytes in 32bit but the 8 bytes union will pad it (void pointer)
}                        //
sys hevent               // 4 bytes, 8 bytes (handle)
}

include once "D:\Dev\Oxygen\o2\inc\console.inc"
'_____________________________________________________________________________

SetConsoleTitle "overlapped structure"

long BitNess = sizeof(sys) * 8

printl
printl "in 32bit overlapped = 20 bytes"
printl "in 64bit overlapped = 32 bytes"
printl

printl "overlapped size     = " sizeof(OVERLAPPED) " bytes"
printl "bitness             = " BitNess "bit"
printl

overlapped ov
@ov.internal     = 10
printl "ov.internal     = " @ov.internal
@ov.internalhigh = 20
printl "ov.internalhigh = " @ov.internalhigh
@ov.pointer      = 30
printl "ov.pointer      = " @ov.pointer
ov.offset       = 31
printl "ov.offset       = " ov.offset
ov.offsetHigh   = 32
printl "ov.offsetHigh   = " ov.offsetHigh
ov.hevent       = 40
printl "ov.hevent       = " ov.hevent

printl
printl "any key to end"
waitkey

end
'_____________________________________________________________________________
'


// KickSwitch -64 //-mem32 -32 -64 -run -dll (No Switch mean -mem32)
// KickEnd

// C++ typedef struct _OVERLAPPED {
// C++   ULONG_PTR Internal;
// C++   ULONG_PTR InternalHigh;
// C++   union {
// C++     struct {
// C++       DWORD Offset;
// C++       DWORD OffsetHigh;
// C++     } DUMMYSTRUCTNAME;
// C++     PVOID Pointer;
// C++   } DUMMYUNIONNAME;
// C++   HANDLE    hEvent;
// C++ } OVERLAPPED, *LPOVERLAPPED;

struct OVERLAPPED{        // 32bit,   64bit
sys internal             // 4 bytes, 8 bytes (dword pointer)
sys internalhigh         // 4 bytes, 8 bytes (dword pointer)
union{                   // 8 bytes, 8 bytes
       struct{            // dummyStructName 8 bytes
         dword offset     // 4 bytes, 4 bytes (dword)
         dword offsetHigh // 4 bytes, 4 bytes (dword)
       }
       sys pointer        // 4 bytes, 8 bytes <- 4 bytes in 32bit but the 8 bytes union will pad it (void pointer)
}                        //
sys hevent               // 4 bytes, 8 bytes (handle)
}

include once "D:\Dev\Oxygen\o2\inc\console.inc"
'_____________________________________________________________________________

SetConsoleTitle "overlapped structure"

long BitNess = sizeof(sys) * 8

printl
printl "in 32bit overlapped = 20 bytes"
printl "in 64bit overlapped = 32 bytes"
printl

printl "overlapped size     = " sizeof(OVERLAPPED) " bytes"
printl "bitness             = " BitNess "bit"
printl

overlapped ov
ov.internal     = 10
printl "ov.internal     = " ov.internal
ov.internalhigh = 20
printl "ov.internalhigh = " ov.internalhigh
ov.pointer      = 30
printl "ov.pointer      = " ov.pointer
ov.offset       = 31
printl "ov.offset       = " ov.offset
ov.offsetHigh   = 32
printl "ov.offsetHigh   = " ov.offsetHigh
ov.hevent       = 40
printl "ov.hevent       = " ov.hevent

printl
printl "any key to end"
waitkey

end
'_____________________________________________________________________________
'
#89
General Discussion / Explanation of Bayesian Statis...
Last post by Charles Pegge - February 09, 2023, 01:16:57 PM
An important concept in AI

Bayes' Theorem Problems, Definition and Examples
https://www.statisticshowto.com/probability-and-statistics/probability-main-index/bayes-theorem-problems/

Understand Bayes Rule, Likelihood, Prior and Posterior
https://towardsdatascience.com/understand-bayes-rule-likelihood-prior-and-posterior-34eae0f378c5

Posterior Probability: Definition + Example
https://www.statology.org/posterior-probability/

Posterior Probability – Explanation – Calculation – Example
https://daytradrr.com/financial-analysis/posterior-probability-explanation-calculation-example/