Search found 1496 matches

by jj2007
Jul 02, 2020 14:30
Forum: Community Discussion
Topic: Getting old
Replies: 39
Views: 1586

Re: Getting old

Translation, please!
by jj2007
Jul 02, 2020 8:04
Forum: Community Discussion
Topic: Getting old
Replies: 39
Views: 1586

Re: Getting old

David Watson wrote:I'm at the 2^6-2^4 border... does that make me a whippersnapper?
Kids, keep out of this discussion!
by jj2007
Jul 02, 2020 7:55
Forum: Community Discussion
Topic: Getting old
Replies: 39
Views: 1586

Re: Getting old

Nice story, David ;-) I can confirm that your brain is in good shape (and so can everybody else who follows your posts). What I find remarkable is that an awful lot of us programmers are beyond the 2^6 border. Is BASIC such an old dialect? Same for Masm coders btw - some are even beyond the 2^6+2^4 ...
by jj2007
Jul 01, 2020 21:53
Forum: Community Discussion
Topic: Windows 10 May 2020 Update
Replies: 16
Views: 682

Re: Windows 10 May 2020 Update

marcov wrote:the need to escape with \\.\ for the -W calls.
utf8 support in the terminal is also being worked on.
I've never used the \\.\ escapes, where do you need them? Re terminal: if you mean the console, there has been utf8 support since WinXP, just use chcp 65001
by jj2007
Jun 30, 2020 21:39
Forum: General
Topic: Open program by dragging file "onto it"
Replies: 15
Views: 590

Re: Open program by dragging file "onto it"

grindstone wrote:Why that complicated? It can be done with just one single line of code:

Code: Select all

Shell Chr(34) & Command(1) & Chr(34)
It seems to me that OP wanted something different:
nuxpergrandis wrote:Can I make a FreeBASIC program that can "open" a file in a sense most windows applications can do nowadays?
If you drag a txt file onto a text editor, usually the editor will start running and automatically display the file.
by jj2007
Jun 30, 2020 11:48
Forum: General
Topic: Open program by dragging file "onto it"
Replies: 15
Views: 590

Re: Open program by dragging file "onto it"

Here's a version that compiles under fbc 1.07.0 and related headers TmpFb.bas(12) error 23: File not found, "Gir/Gtk-3.0.bi" The OP, nuxpergrandis, has two posts, so he is a definitely a n00b. Throwing untested examples at him, or code that requires external libraries without even giving ...
by jj2007
Jun 30, 2020 8:07
Forum: General
Topic: Open program by dragging file "onto it"
Replies: 15
Views: 590

Re: Open program by dragging file "onto it"

Your gtk/gtk.bi header doesn't match the parameter list in the source at parameter 2. Why do you think that this is related to the operating system? Why do you compile a GUI program with option -s console ? Note: you've to rename the 'object' variable, since this symbol later became a keyword in FB...
by jj2007
Jun 29, 2020 22:54
Forum: General
Topic: How would you find the shortest distance in a set of points?
Replies: 23
Views: 857

Re: How would you find the shortest distance in a set of points?

@dodicat: I've tried to understand your code, and especially why you sum up the "total distance". You are not doing two loops as shown below, how will you identify the two closest points? Below pts() is the array of points. It's Assembly but I hope it's understandable. The instructions mov...
by jj2007
Jun 29, 2020 20:28
Forum: General
Topic: How would you find the shortest distance in a set of points?
Replies: 23
Views: 857

Re: How would you find the shortest distance in a set of points?

Thanks, that is much clearer now. Are you sure that dodicat's code sums up the elements (wrongly) as SQR(X1^2) + SQR(X2^2)?

Code: Select all

#define rawlength(a,b) ((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))
To me, it looks like the correct Pythagoras: A²+B²=C² or rather dx²+dy²=dist²
by jj2007
Jun 29, 2020 19:41
Forum: General
Topic: How would you find the shortest distance in a set of points?
Replies: 23
Views: 857

Re: How would you find the shortest distance in a set of points?

X1 = 1, X2 = 6 SUMi(Xi^2) = 37 SUMi(SQR(Xi^2)) = 7 X1 = 3, X2 = 5 SUMi(Xi^2) = 34 SUMi(SQR(Xi^2)) = 8 Between these two examples, SUMi(Xi^2) decreases while SUMi(SQR(Xi^2)) increases. Sorry, I can't follow you. What exactly is ...
by jj2007
Jun 29, 2020 19:26
Forum: General
Topic: Open program by dragging file "onto it"
Replies: 15
Views: 590

Re: Open program by dragging file "onto it"

Seems to be Linux only...
* compiling TmpFb.bas with -t 2000 -s console **
FreeBasic\tmp\TmpFb.bas(17) warning 3(1): Passing different pointer types, at parameter 2 of GTK_WINDOW_SET_TITLE()

Aborting due to runtime error 12 ("segmentation violation" signal)
by jj2007
Jun 29, 2020 16:29
Forum: General
Topic: How would you find the shortest distance in a set of points?
Replies: 23
Views: 857

Re: How would you find the shortest distance in a set of points?

dodicat wrote:I found a problem (with squared distance) in my first snippet in this thread.
I saw that one but didn't understand at all what you are doing, or what the problem is. Some comments might be helpful ;-)
by jj2007
Jun 29, 2020 14:25
Forum: General
Topic: Open program by dragging file "onto it"
Replies: 15
Views: 590

Re: Open program by dragging file "onto it"

Windows only - see end of WM_CREATE handler: #Include "windows.bi" ' JJ 29.6.2020 Dim Shared as Handle hEdit ' bat@\AllBasics\FreeBasic\TinyFB.bat Function WndProc(hWnd As HWND, msg As UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT Dim As RECT rc Dim As PAINTSTRUCT ps Dim As HANDLE P...
by jj2007
Jun 29, 2020 1:47
Forum: General
Topic: How would you find the shortest distance in a set of points?
Replies: 23
Views: 857

Re: How would you find the shortest distance in a set of points?

I couldn't resist: a graphical implementation of the problem. With 800 points, it takes 3 milliseconds on my trusty Core i5 to generate the random points and find the closest pair.
Image

Go to advanced search