Search found 1104 matches

by jj2007
Mar 06, 2019 9:02
Forum: Beginners
Topic: Unicode and files
Replies: 10
Views: 757

Re: Unicode and files

I am trying to teach Unicode to FreeBasic. This works so far: #Include "windows.bi" #Include "LoadSaveFile.bi" ' works fine ' #Include "لغة البرمجة الأساسية مجانية.bi" ' no luck Dim As Wstring * 100 ip = "لغة البرمجة الأساسية مجانية.bi" ' works fine Dim As Str...
by jj2007
Mar 03, 2019 17:52
Forum: Beginners
Topic: Does FBC compile some small code in command line?
Replies: 8
Views: 519

Re: Does FBC compile some small code in command line?

I didn't want to say that the compilation with FB takes too long, I just wanted to mention that the purpose for this an interpreter language such as Autoit might be the better choice. Once upon a time, people tested their code in a BASIC interpreter, and when they judged it OK, they compiled it to ...
by jj2007
Mar 03, 2019 3:51
Forum: Beginners
Topic: Does FBC compile some small code in command line?
Replies: 8
Views: 519

Re: Does FBC compile some small code in command line?

I assume FB must compile the code before it can be executed. As Tourist Trap noted, fbc is pretty fast. I use my own editor ( RichMasm ) to build FB code, and it takes usually less than one second between hitting F5 and seeing the result. That is almost like using an interpreter. It requires an IDE...
by jj2007
Mar 01, 2019 8:41
Forum: General
Topic: Closing Child window - winapi Case WM
Replies: 8
Views: 394

Re: Closing Child window - winapi Case WM

peter-cat wrote:When I try to close the created child window
If you click the "x" of a child window, it sends two WM_PARENTNOTIFY messages. The first one has WM_LBUTTONDOWN in the loword of wParam, the second one WM_DESTROY.

Another way to handle this is subclassing, of course.
by jj2007
Feb 27, 2019 18:27
Forum: General
Topic: Alternative for Randomize Timer
Replies: 4
Views: 305

Re: Alternative for Randomize Timer

Looks ok, but is it really necessary to have good randomness of the seed? You typically use it once in a program, then you produce Millions of really random numbers with e.g. PCG32
by jj2007
Feb 22, 2019 14:07
Forum: Beginners
Topic: Random numbers not the same
Replies: 26
Views: 1019

Re: Random numbers not the same

How can you print 200 unique numbers between 0 and 99?! Difficult indeed, especially with integers! Another little problem: Dim MyInt() As DWORD ; tested pseudo code For_ ct=0 To 999 ; load a unique random number between 1000 and 1999 into the array Rand(1000, 2000, MyInt(ct), unique) Next ArraySor...
by jj2007
Feb 20, 2019 10:56
Forum: General
Topic: Checking if a computer is ON on the network
Replies: 11
Views: 430

Re: Checking if a computer is ON on the network

(if you know that it is local, you can reduce the timeout with -w <ms>) Thanks. I had tested that before and saw no effect. Now I retried, and got it to work (no idea what was different...). Interesting: - without any wait interval (no "-w"), the answer is "host cannot be reached&quo...
by jj2007
Feb 20, 2019 2:19
Forum: Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 1021

Re: Numerical optimizer

Code: Select all

TmpFb.bas(62) error 57: Type mismatch, at parameter 2
Is this a demo why code should be thoroughly tested for T+T?
by jj2007
Feb 19, 2019 14:09
Forum: Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 1021

Re: Numerical optimizer

You can't expect people to maintain 2 systems and two compilers before they post some code. You can expect people who post here in the Tips & Tricks section that they compile their code at least with standard Gas, Gcc32 and Gcc64. It's only a mouseclick or a keystroke away, right? People who co...
by jj2007
Feb 19, 2019 13:07
Forum: Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 901

Re: Bit duplication

Multiplication is costly (and division is much worse).
by jj2007
Feb 19, 2019 12:10
Forum: Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 1021

Re: Numerical optimizer

deltarho[1859] wrote:Actually, I did not write that
Sorry, I quoted badly - of course, I support the spirit of your comment.
by jj2007
Feb 19, 2019 8:51
Forum: Tips and Tricks
Topic: Numerical optimizer
Replies: 25
Views: 1021

Re: Numerical optimizer

deltarho[1859] wrote:don't post your code without including an explanation
Exactly. And don't post code that isn't thoroughly tested. This code compiles in 32-bit land but then throws exceptions, definitely no good for the Tips & Tricks section.
by jj2007
Feb 18, 2019 21:46
Forum: Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 901

Re: Bit duplication

dodicat wrote:Here is a string variety.
What do you mean with "string variety"? The lookup code? It's blazingly fast, nice idea...
by jj2007
Feb 18, 2019 8:59
Forum: Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 901

Re: Bit duplication

coderJeff wrote:specify a low optimization level
That distorts the result in favour of the "naked" assembly routines. What often works instead is to fake an interest in the results generated in the loop by adding them up and displaying the sum after the loop has finished.
by jj2007
Feb 17, 2019 23:49
Forum: Tips and Tricks
Topic: Bit duplication
Replies: 17
Views: 901

Re: Bit duplication

Assembly version, it's pretty fast. That's an understatement, it's almost three times as fast as mine ;-) function dup8bits naked cdecl ( byval x as ulong ) as ulong 'CoderJeff asm #ifdef __FB_64BIT__ .align 16 #ifdef __FB_LINUX__ mov rax, rdi #else mov rax, rcx #endif #else .align 4 mov eax, [esp+...

Go to advanced search