* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Comunication between running processes
« Last post by sash on Today at 09:58:45 pm »
Both TProcess and SimpleIPC are straightforward. Just try it, then ask in case of trouble.
However note, it seems like SimpleIPC implemented with asynchronous queue model, so it is unidirectional.
Thus you will need a pair client+server per process for bidirectional communication, or consider use of tcp (http?) server for synchronous communications. There's no much to suggest without knowing your actual requirements.
2
General / Re: False positive Windows10 message
« Last post by user5 on Today at 09:52:26 pm »
    I should have mentioned that the program I talked about in my previous post is no longer WindowsXP based. Now I use an old version of Lazarus on my Windows10 machine to compile the program but it runs fine on WindowsXP. Well, since all the code and components were created mostly on WindowsXP then the program is still WindowsXP based I guess.
    I should also mention that when the Windows (Program Not Responding) appeared in the previous program version, an outline of the form would first appear, the message might appear and then the rest of the page's content would appear. Now that page appears all at once, with no preliminary outline so that message may well still be trying to appear though it's never actually seen. Good riddance, I say. That page merely initials some variables, does some text reading and several other simple tasks with no loops or anything else like that but something caused it to appear though I don't know what it was or is.
3
Indeed. I use such a pattern myself.

other option:
How about:
Code: Pascal  [Select]
  1. program untitled;
  2. {$ifdef fpc}{$mode delphi}{$H+}{$endif}
  3. type
  4.   TBaseclass<T> = class
  5.   public
  6.      class var level:T;
  7.   end;
  8.  
  9.   TFirstRange = 10..19;
  10.   TFirstclass = class(TBaseClass<TFirstRange>)
  11.   end;
  12.  
  13.   TSecondRange = 20..29;
  14.   TSecondclass = class(TBaseClass<TSecondRange>)
  15.   end;
  16.    
  17.   // deeper inheritance:
  18.   TThirdClass<T>= class(TBaseClass<T>)
  19.   end;
  20.  
  21.   TFourthRange = 30..49;
  22.   TFourthClass = class(TThirdClass<TFourthRange>)
  23.   end;
  24.    
  25. begin
  26.  writeln(Low(TFirstClass.Level));
  27.  writeln(Low(TSecondClass.Level));
  28.  writeln(Low(TFourthClass.Level));
  29. end.
That might also do the trick.
You can use the existing inheritance and specify the range as a generic.

4
General / False positive Windows10 message
« Last post by user5 on Today at 09:07:32 pm »
    Just thought I'd pass along an anecdote about a program problem that I recently had and what fixed it in case someone finds it interesting. I just finished phase 1 of a Lazarus prototype demonstrator program but one thing that had bothered me for a long time was that often when this WindowsXP based program was run on Windows10 in non-compatibility mode a brief message would sometimes appear at the top of the opening form which read "(Program Not Responding)". I believe that that this message was a false positive message and it gives a false impression that the program may have problems, which it doesn't.
    The opening form didn't do anything that would justify that unflattering message.
    To fix it I made a copy of all the buttons, text and everything else on that opening page as well as a copy of the code which runs that page and then I destroyed that opening page and removed it from the program entirely. I recreated it, added the copies of the code and page contents, reconnected them and put it all back into the VirtualU program.
    I didn't change the code or anything else in any way. The new opening page was an exact duplicate of the previous opening page.
    The result is that now this program never appears with a Windows (Program Not Responding) message.
    Not ever.
    I'll probably never know what caused this anomaly.
    Whatever was causing this message to appear was fortunately removed somehow during the destruction and subsequent resurrection of that form. Sort of what happened to Lazarus, hah, hah. Best wishes.
5
Quote
A class var can be a list....or better a tree..
Interesting idea. Each Class would then retrieve the specific data from the list via its ClassType ?
6
General / Comunication between running processes
« Last post by simone on Today at 08:43:26 pm »
Hello everyone. I have to create two programs that communicate between them during execution. The first program starts the second. The two processes, while they are running, exchange information in a bidirectional way and both perform operations that depend on the information exchanged. I'm considering TProcess and SimpleIPC, but I have no previous experience in this context. Does anyone have any suggestions? Thanks in advance.
7
I was installing the sgcWebSokets library but when i try to compile it says that it doesn't found the IdGlobal unit, i installed de Indy library trying to fix this, but it keeps poping the same error, another question, is how i add the indy library in the paths on the package installation, in the routes added to the library there are ../Lazarus/Indy and ../Source but i don't know if this is correct, so please help guys!! Y-Y .
8
General / Re: DBGrid Mouse Wheel "hesitation"
« Last post by bobonwhidbey on Today at 07:47:17 pm »
I discovered an approach which works well for me, although it seems a bit 'kludgy'.
I've added a tDBNavigator [NavBar] to the form with the DBGrid, and wired it up appropriately. I set visible to false because I don't really want to see it.

On FormShow I execute

  NavBar.DataSource.DataSet.First;
  NavBar.DataSource.DataSet.Last;

which establishes the range of the DB and sizes the scroll button correctly.

Then I use a Query.Locate to position the scroll bar in the correct place and make the desired record visible.

YMMV
9
Is there a way between ? Something like class vars but which can be redefined in inherited Classes ?
A class var can be a list....or better a tree..
10
General / Universal Virtual Array Random Generator
« Last post by Nitorami on Today at 06:35:27 pm »
For those interested in pseudo random number generation, Jean Debord's dmath package contains an interesting one I had not been aware of by now.

https://sourceforge.net/projects/dmath/

It is the "universal virtual array generator" in unit uranuvag.pas, which is a pascal adaptation of an algorithm proposed 2013 by Alex Hay on github https://github.com/seehuhn/dieharder/blob/master/libdieharder/rng_uvag.c

The author says his genrator "evolved over years of playing around", and "does not yield easily to mathematical analysis unlike well researched prngs like MT and RC4", so it certainly lacks a solid theoretical basis, and might potentially have flaws. I am also sceptical about the claim in uranuvag.pas that it is suitable for cryptographic purposes. But apart from that it is pretty fast, does not require multiplications, is easily scalable to integers of different size, and passes all statistical tests I tried, even with poor seeding. It looks like this has not become widely known, and except for the links above there is hardly a notion on the Internet. I think it is not bad at all, and may deserve a bit more attention.

 

Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus