* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: RC1 to RC4?
« Last post by KarenT on Today at 07:13:19 pm »
So, for my own programs I can say that transitioning from 1.6 to RC3 and RC4 has been smooth.

Thanks, I knew about RC and the risks, but just wondering how I go about installing RC-4. Do I need to un-install RC-1 first, or just drop RC-4 on top of the RC-1 installation?

2
General / Re: break, exit, continue sintaxhighlight and documentation
« Last post by cpicanco on Today at 06:43:59 pm »
https://bugs.freepascal.org/view.php?id=32281

He said they are compiler intrisics.
3
General / Re: Formatting textbox result
« Last post by Thaddy on Today at 06:41:03 pm »
And bad things will happen if (at the time of OnExit) the text in the control is NOT a valid float.

Yes, that why I use my function called StrToFloatDef, which defaults to a value, in case the string can't be converted to a float.
That's a false sense of protection.
I think what Bart means is that even if you use StrToFloatDef and choose a wrong value - like you did - like zero you will still get an exception if the divisor happens to be zero....EDivByZero
4
General / Re: Stream processing
« Last post by taazz on Today at 06:13:16 pm »
There are basically two problems with threads:

1. They are only active while the main application is running.

True then again if the application is not running there is no event interest or generation .

2. It is not a good idea to access methods and properties of another thread.
False, code is usually safe to access from multiple threads, no problem, data on the other hand not so much and when I say data I do not mean the methods local variables those are safe excuding pointers classes and other reference type variables, so as long as the method accesses the thread's queue in a thread safe way and spend as little time as possible in there then you have no problems.

The first one can be fixed by starting a new process for each thread, but that gives a lot of overhead (in most cases the OS loads a new executable from disk). That's even a requirement if you want to run them on multiple computers.
actually no a single application with multiple threads per machine is my preferred way of processing. This makes things easier to handle?
Also, if you want to make it scalable, some process has to monitor workload and spawn more threads when they get swamped. And alternatively, disable the ones that aren't used. Or they can do that themselves.
the only thing that my application monitors are three things 1) the maximum number of running threads 2) the minimum number of pooled threads and 3)when a thread finished processing to instruct it to sleep or free. 

You can communicate with threads through message queues, but who is allocating those queues? That should be the main process, otherwise it still has to access properties of the other threads.
That is impossible to avoid, in some way on an other there has to be some sort of information exchange. It matters very little which thread initiates it. so Each thread allocates its own queue the main process will only allocate and manage its own queue even if that queue is simple a thread queue.
And if it goes down (for example, because the thread doesn't exist anymore, or an exception occurred in one of the threads), all of the threads go down with it.
that is a no no. There should be no uncaptured exception in the thread all exception must be captured and handled inside the thread it self. If for some reason your application goes down which is not recommended even if there is unrecoverable exception happened that requires an application restart the application should restart it self.

And that prevents two-way communication.
That is false. Nothing prevents two way communication but we tend to minimize the two way communication to absolutely necessary to keep things simple and manageable, you can always have the thread inform the main application that it finished processing or frees it self that should be enough.

No asking: "Are you still alive?",
Why not?
and if you require it to post a message periodically, it has to start another thread before doing something that takes a long time.
that is why the main application does nothing only manages the threads that "do something".
And of course, you cannot access the properties of threads that don't run in the same process.
that is why I said message queue.
So, you need a manager anyway.

erm yes you do for 3 reasons. 1) thread pooling to speed things up 2)thread constraint to avoid overwhelming the CPU and spend more time in switching instead of processing. 3) inform the user of the current process usually through logging not GUI updates to keep everything on constant timing.

An exception are one-shot worker threads, that terminate when they're done. That's what I prefer to do. A much less nice alternative is a thread pool, where you run a self-contained function on a thread when one is available. Most web servers and such use one of these.
well not very friendly solution but overall acceptable in my book. I use it too but I always inform the main application when a thread is destroyed (ondestroy event usually runs in the main thread context).

If you use sockets for accessing the services, you also don't need to write all of them in the same language. Or run them all on the same kind of CPU and OS.
again read up on message queues they are external servers that mange a many producers to many consumers relationship zeroMQ has is headers translated to delphi which makes it an easy test platform for learning.
Accessing a service on another computer on a LAN is normally much faster than starting a new process on the same computer.
unless you are talking about linux which did not had threads up until recently and forking was the only way for multi threading, I agree no multi process on windows. On Linux on the other hand it was faster the last time I checked (coupl of years back that is). I really do not see the problem of a single application with multiple threads.

Windows messages have two problems as well: they're really short (two dwords, and sending a pointer to some random data is not something I would want) and they require that the manager (Windows) knows exactly what the state of veach thread is. Your own application can't do that.
sorry you lost me, as far as I know windows does not track the state of a thread that is why it is not recommended to use calls like suspend resume etc. Then again I might have missed something.
Anyway, all that's why things like servlets (shudder) exist, IMO. And why people write "Micro"-services in C# ASP.NET MVC, that require a dedicated database and run on an IIS server...
erm sorry you lost me here too. IIS/apache, cgi, micro services etc are all used for reason of comfort, instead of learning something like CORBA, DCOM etc. that already support something along those lines it is far easier to bash them as inadequate.

It seems that I do not understand your reasoning behind such a framework especially with all the frameworks that do exactly that. The more I read up the more I'm convinsed that a message queue server is your solution and yes please use threads not processes.
5
General / Re: break, exit, continue sintaxhighlight and documentation
« Last post by Thaddy on Today at 05:52:03 pm »
Indeed, for the docs I always do approach Michael via mantis. The wiki is free to edit.
6
General / Re: Stream processing
« Last post by Thaddy on Today at 05:46:09 pm »
The old programming model is serial and uses functions. That scales badly and is not interactive.
That is soooo wrong! And that is the first sentence. Don't mix up serial and sequential. Having read the whole thread I have a headache: How can I politely ask to take computer science classes first.
I leave out any grumpy's or angry's. I am dead serious. Almost all of your reasoning is flawed. Especially the part about threads and processes. You lack knowledge.

I will not even begin to show you what is wrong and why.... Takes too much time and it is already in the public realm.
7
General / Re: break, exit, continue sintaxhighlight and documentation
« Last post by howardpc on Today at 05:44:57 pm »
I think you should discuss this directly with Michael, since he writes the docs, and if he does not approve the wiki wording or its use of terms, it will need to be changed again. I don't think he reads the wiki, or edits it (but I could be wrong).
8
General / Re: Lazrus-1.8.0RC4-fpc-3.0.4RC1 IDE problem
« Last post by Pascal on Today at 05:41:45 pm »
Okay. But then Top is wrong as the shadow is also on the top of the window :D
9
Beginners / Re: class of graphical objects
« Last post by howardpc on Today at 05:41:23 pm »
Perhaps the attached project gives you some hints (with no memory leak).
10
General / Re: break, exit, continue sintaxhighlight and documentation
« Last post by Thaddy on Today at 05:37:42 pm »
Well the docs here use "reserved words" and "keywords" as synonyms.
Interestingly, "Exit" is not listed as a Turbo Pascal reserved word, or an Object Pascal reserved word or as a "modifier".
"Break" and "continue" are both in the modifiers list.

I have editted part of that wiki entry to reflect http://wiki.freepascal.org/User_Changes_3.0#True_and_False_are_not_keywords_anymore
But there are a couple of (public) todo's that I will discuss: reserved words are not keywords, they are not interchangeable. Something like (premature):
- keywords: recognized by the compiler, have a unique meaning. Keywords can not be overridden by the user. 
- reserved words: recognized by the compiler, but can be overridden by the user if they are not keywords.
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