Brook 1.0 - A new framework for web was born
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 03:27
Hello all,
More than 15,000 lines of source code, more than 90 test cases, more
than one year of work. Today, a new framework for web development was
born. It's name is Brook and its nice features are available for you.
I thank the FPWeb, the Freespider, the Powtils, the ExtPascal, the
CustCGI and the EazyCGI developers. I got inspiration in all of them
and and still in Rails and Slim Framework.
Special thanks, I drive to João Moraes, who gave me valuable advices
to decoupling the code. Thanks for Luciano de Souza, responsible for
the documentation and the name of methods and properties. Thanks also
for Marcos Douglas, the author of Greyhound, project wich started as
an inspiration and finished as a valuable partner in the new web ways.
Finally, I thank for the Free Pascal and Lazarus community for the
precious tips and quick helps.
I was thinking about what to write in the launching e-mail. But,
there's no much to say. The site of Brook and its documentation will
speak for me. So I present the Brook's house:
http://brookframework.org
Your visit will be appreciated.
Their, you find the documentation, you find examples running online
and you find also the hopeness this work will be very useful to the
Free Pascal and Lazarus commoties.
On Sunday, I am going to start my vacations. Thanks God. The work is
ready and the conscious is quiet.
Enjoy!
----------------------------------------------------------------------
Sternas Stefanos · 2012-12-15 04:05
Thanks Sir
Excellent work and have fun ...
----------------------------------------------------------------------
Leledumbo · 2012-12-15 05:20
Exploring
I hope it's something "different" from existing frameworks, including
mine (which is not ready enough to go public ). If it can fulfill my
requirements, I might migrate my existing web apps to it.
----------------------------------------------------------------------
Ask · 2012-12-15 05:50
Quotehttp://brookframework.org
The design is nice, but the text really needs some proofreading.
----------------------------------------------------------------------
BigChimp · 2012-12-15 09:49
Quote from: Ask on December 15, 2012, 06:50:42
amQuotehttp://brookframework.org
The design is nice, but the text really needs some proofreading.
Agreed that the texts could use some work; I'd be happy to help with
fixing English texts...
Edit: browsed the site some. Impressively complete: documentation,
samples etc, well laid out. With a site like this, the actual
framework must be marvelous
Edit2: however, this:
QuoteCopyright (C) 2013 Silvio Clecio.is... impossible
----------------------------------------------------------------------
BlueIcaro · 2012-12-15 11:53
QuoteCopyright (C) 2013 Silvio Clecio.May be can be change by:
Quote2013 Author:Silvio Clecio./BlueIcaro
----------------------------------------------------------------------
BigChimp · 2012-12-15 11:56
@BlueIcaro, well if he writes a book called 2013, no problem.
I'd change it to a more conservative:
QuoteCopyright (C) 2012 Silvio Clecio.though...
Edit: Yes, Silvio, that's how it goes: you spend a year on building
something marvelous and then people start arguing about the words on
the documentation/site. Sorry... guess it's human nature
----------------------------------------------------------------------
Fabio Souza · 2012-12-15 12:23
The Brook is amazing! I think to use in place of Delphi DataSnap /
WebBroker.
Congratulations on doing such a great job on developing this new
framework.
[] 'S
Fabio Souza
----------------------------------------------------------------------
Ask · 2012-12-15 12:33
After quick browsing of source and docs, I have a few additional
questions:
1) Is there some kind of template engine available?
2) Is there a provision to use something more efficient than CGI --
FastCGI or, even better, built-in web server?
If the above two questions have positive answers,
I might really consider using this framework for one of my upcoming
web projects.
----------------------------------------------------------------------
BigChimp · 2012-12-15 13:20
Quote from: Ask on December 15, 2012, 06:50:42
amQuotehttp://brookframework.org
The design is nice, but the text really needs some proofreading.
Attached is a patch for the main page/readme.
Don't know where the text for the other pages is.
Thanks.
----------------------------------------------------------------------
Leledumbo · 2012-12-15 14:31
Suggestion for the website (not the framework): split the
documentation menu into two (or more) submenu, namely tutorial and api
reference. Commonly when people click "documentation", they're
expecting a "how to" or "tutorial" instead of "api reference". It
seems you'll need to open the "how to" part as a wiki in order to
reduce the effort you'll need to spend.
----------------------------------------------------------------------
IndianaJones · 2012-12-15 14:34
well done @silvio, congratulations.
But I got a package install problem, here are the compile errors.
/home/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas(57,15) Error: There
is no method in an ancestor class to be overridden:
"TBrookCGIRequest.DeleteTempUploadedFiles;"
/home/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas(58,14) Error: There
is no method in an ancestor class to be overridden:
"TBrookCGIRequest.GetTempUploadFileName(const AnsiString,const
AnsiString,Int64):AnsiString;"
/home/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas(60,14) Error: There
is no method in an ancestor class to be overridden:
"TBrookCGIRequest.RequestUploadDir:AnsiString;"
/home/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas(62,15) Error: There
is no method in an ancestor class to be overridden:
"TBrookCGIRequest.HandleUnknownEncoding(const AnsiString,TStream);"
/home/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas(85,1) Fatal: There
were 4 errors compiling module, stopping
FPC 2.6.0-1
Lazarus SVN 1.1 - 39501
Linux Debian - Gnome 2.30.2
----------------------------------------------------------------------
mdbs99 · 2012-12-15 15:49
@Silvio, congratulations! Was a long way, no?
Quote from: Leledumbo on December 15, 2012, 06:20:46 amExploring
I hope it's something "different" from existing frameworks, including
mine (which is not ready enough to go public ). If it can fulfill my
requirements, I might migrate my existing web apps to it.
The Brook uses Greyhound so, you already know this part!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 21:08
Thank you Stefanos!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 21:12
Leledumbo,
I'd be flattered if you can test it.
In brook we have a router, fast and very helpful for RESTful
frameworks.
Please follow the project on Github, if you prefer, you can take a
fork and we apply the pull requests.
Thank you!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 21:15
Ask, feel free to make changes, they will be very welcome. Please,
inform all the changes here:
https://github.com/silvioprog/brookframework/issues
Thank you in advance for your support!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 21:20
BigChump,
Please, send all the changes to issues page, your help will be very
welcome!
Thank you very very very much for all the help guys!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 21:23
Thank you very much souza.fo!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:11
Quote1) Existe algum tipo de modelo de motor disponíveis?
Brook generates forms from database tables. However the HTML entered
manually is very little, the site Brook was done in 19 hours in
Notepad++.
Quote2) Is there a provision to use something more efficient than CGI
-- FastCGI or, even better, built-in web server?
Currently if you need high performance can use FastCGI.
I tried to maintain compatibility with Apache module, but at the time
I had no time to do this. but nothing prevents you from creating a
layer to support other types of servers.
With FastGGI I managed to make 2900 requests per second. I used the HP
tool for test it.
In short, you can use Brook yes Ask!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:17
BigChimp, I could not apply your patch, please see the error here:
http://imagebin.org/239497
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:24
You can help us with that? If so, we will build more pages in the
site. I will give all the support in the construction of the pages.
Again, feel free to send contributions.
Thank you again guy!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:27
IndianaJones (nice nickname ),
So, you need the Free Pascal 2.6.1 or higher.
These methods have been applied from a patch that I sent to the FCL-
Web.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:29
Yes guy, Brook is a partner of Greyhound!
Thanks for your effort to make this possible.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-15 22:52
Guys, I will be traveling on vacation these days. But I will try to
read email everyday. Please send all changes, patches and
contribuitions to here:
https://github.com/silvioprog/brookframework/issues
Thank you all again!
----------------------------------------------------------------------
IndianaJones · 2012-12-16 00:28
Thanks @silvio for the explanation, but custfcgi.pp is missing in the
/usr/local/lib/fpc/2.7.1/units/i386-darwin/fcl-web directory.
Regards.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-16 01:05
Guys, this is the repository of Brook site sources:
https://github.com/silvioprog/brook-site
You can make a fork and change it directly. Changed these codes, it's
only to apply to the site.
Thank you!
----------------------------------------------------------------------
Silvio Clécio · 2012-12-16 01:10
IndianaJones, strange. :/
Please see this:
http://imagebin.org/239509
----------------------------------------------------------------------
Silvio Clécio · 2012-12-16 01:44
QuoteAttached is a patch for the main page/readme.
Patch applied like a charm now! Please see:
https://github.com/silvioprog/brookframework/commit/b08f7a43b97457508a
0890081669ff021e9cdc26
Thank you very much BigChimp!
----------------------------------------------------------------------
IndianaJones · 2012-12-16 04:48
@silvio, the image was taken from windows, I had tested in Mac OS
environment. So my mistake i should specify that info.
Regards.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-16 04:57
Hello IndianaJones,
This is my fcl-web folder:
http://www.sendspace.com/file/po365p
Do not know if it will work, but, copy these files to your fcl-web
folder and try to compile them again (please backup your original fcl-
web folder before).
----------------------------------------------------------------------
IndianaJones · 2012-12-16 07:41
Thanks @silvio for the zip file but I compiled it from the fpc svn,
and everything is just fine under Mac environment.
I had just declared the missing file so that there would be added to
the next svn fpc trunk.
Regards.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-16 13:04
IndianaJones, so, the Brook compiled fine on your MAC? I'm curious.
----------------------------------------------------------------------
snorkel · 2012-12-17 16:15
I have not looked at this yet, but does it support automatic sessions
and the ability
to redirect to a session expired page before any dispatching is done
if the session has expired?
I currently use python and the http://www.cherrypy.org/ framework,
which can do all of that.
I really am interested in using FPC/Lazarus to rewrite my cherrypy
app. Only reason I went to cherrypy in the first place years ago was
because stupid borland abandoned Kylix, now that I am moving all my
desktop dev to Lazarus, not reason not to switch back to a pascal
based solution.
----------------------------------------------------------------------
Silvio Clécio · 2012-12-17 19:56
snorkel, yes, Brook supports it!
You can see it here:
https://github.com/silvioprog/brookframework/blob/master/demos/others/
chat/src/auth.pas
and the online demo here:
http://brookframework.org/demos/others/chat/cgi1.fbf
So, use session with Brook is very very easy.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-01 20:05
Hello guys,
Please see a nice post about Brook framework here:
http://pascalgeek.blogspot.com.br/2012/12/brook-framework-new-web-
application.html
Thank you and happy new year!
----------------------------------------------------------------------
belajarpascal · 2013-01-13 11:20
im newbie on lazarus ide. im interesting to try brook. i have fresh
installed lazarus svn win32. i install to brookex.lpk. compile process
is done but brook not installed yet. can anyone help me? thanks
----------------------------------------------------------------------
Silvio Clécio · 2013-01-13 12:25
Hello belajarpascal, welcome to the FPC-Lazarus!
Brook don't have components installed in IDE. Brook installs some
wizards for easy code creating.
Please see the get started page:
http://brookframework.org/get-started.html
Good luck!
Silvio Clécio.
----------------------------------------------------------------------
belajarpascal · 2013-01-13 22:25
silvioprog: i mean that the wizard not installed yet. i try to follow
'get started' steps but i cant find 2 new entries wizard like the
screenshot on that page. if i miss something? if i have to install
fpweb/fclweb on my fresh lazarus? thank to your help.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-14 02:11
I don't know what is happening. Try installing a current copy of
Lazarus and Free Pascal in a virtual machine. If everything works
there, it will be easier for you to find out what is happening in your
environment.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-14 02:13
belajarpascal, what your environment? (operating system, Lazarus and
Free Pascal version etc.)
----------------------------------------------------------------------
belajarpascal · 2013-01-14 05:05
-win xp home edition
-lazarus 1.1
-fpc 2.7.1
i just found message in the ide like this : makefile:29: *** You need
the GNU utils package to use this Makefile. Stop. do you know is it
the problem?
----------------------------------------------------------------------
belajarpascal · 2013-01-14 05:58
im searching on the google, and the problem solved. i already have
brook on my lazarus. thanks.
----------------------------------------------------------------------
kodok.buncit · 2013-01-14 07:34
hi silvio, is brookframework support for database session ?
----------------------------------------------------------------------
Silvio Clécio · 2013-01-14 09:41
Hello belajarpascal,
Please download Lazarus from here:
http://michael-ep3.physik.uni-halle.de/Lazarus/snapshots/Lazarus-1.1-
39837-fpc-2.7.1-20130113-win32.exe
(All downloads here: http://michael-ep3.physik.uni-
halle.de/Lazarus/snapshots/)
----------------------------------------------------------------------
Silvio Clécio · 2013-01-14 09:42
Hello kodok.buncit,
Yes. You can do this easily with a TBrookDBAction.
Thank you!
----------------------------------------------------------------------
Leledumbo · 2013-01-14 14:49
Quotehi silvio, is brookframework support for database session ?You
can also checkout the chat demo which demonstrates this
----------------------------------------------------------------------
kodok.buncit · 2013-01-15 01:45
i mean session that are using database for storage not traditional
file on the server..
chat demo using database session?can i see the code where the session
interact with database to store/retrive value?
i think it must be something like TDbBrookSession.
i also have checkout https://github.com/silvioprog/brookframework/blob
/master/core/brooksession.pas
and yup its just use file on the server to store session. someone will
correct me if im wrong.
sorry for my bad english
----------------------------------------------------------------------
belajarpascal · 2013-01-16 02:29
QuoteHello belajarpascal,
Please download Lazarus from here:
http://michael-ep3.physik.uni-halle.de/Lazarus/snapshots/Lazarus-1.1-
39837-fpc-2.7.1-20130113-win32.exe
(All downloads here: http://michael-ep3.physik.uni-
halle.de/Lazarus/snapshots/)silvioprog :
I just to know there's have installer like that. it more easier then
compile and build lazarus manually. thanks for the link. thanks to
all.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-23 18:51
Hello friends,
I'm thinking of implementing the following feature in Brook (a pseudo
code):
Code: [Select]type
TFoo = class(TObject)
published
procedure Validate;
property Any: string read GetAny;
(...)
end;
(...)
procedure TMyDBAction.Post;
var
Foo: TFoo;
begin
Foo := TFoo.Create;
try
Foo.Validade;
Table.Insert(Foo).Apply;
finally
Foo.Free;
end;
end;
Nice idea?
----------------------------------------------------------------------
jmpessoa · 2013-01-23 20:09
Hi Silvio,
There is a plan, in the medium term, to support apache dso?
Thank you!
----------------------------------------------------------------------
Silvio Clécio · 2013-01-23 20:44
I almost implemented it, but there is a coupling in fpapache unit that
prevented me from doing so.
Would need to make a change in fpapache, then would be born the unit
"BrookFCLApacheModuleBroker".
----------------------------------------------------------------------
jmpessoa · 2013-01-23 20:51
what great news!! Congratulations for the great work!
Parabens!
Abraços
----------------------------------------------------------------------
ttomas · 2013-01-24 11:24
Hi, Silvio
Thanks for your good work.
DWScript is already ported to Lazarus (integrated in CodeTyphon) and
have very fast development.
It will be very nice to be integrated in Brookframework.
Revision r1462 also have Delphi2JavaScript generator, now closed
source.
"]>Blocked/]http://delphitools.info/2013/01/23/introducing-
d]"]>Blocked/
----------------------------------------------------------------------
Leledumbo · 2013-01-24 17:04
QuoteIt will be very nice to be integrated in Brookframework.
FreePascal port is still experimental according to the latest author
post regarding its status, which is why you can find it in CodeTyphon
(which packs a lot of things, regardless their stability). Anyway, I'm
still unclear about the system. How will the script(s) be executed? If
the coupling is low enough, integration with brook might need nothing
at all, e.g. you can directly use in brook to produce client output.
----------------------------------------------------------------------
ttomas · 2013-01-24 21:50
Quote from: Leledumbo on January 24, 2013, 06:04:38 pmHow will the
script(s) be executed? If the coupling is low enough, integration with
brook might need nothing at all, e.g. you can directly use in brook to
produce client output.
When you have system in production it is nice future to have
possibility to change something in place without need to recompile
project. In MVC design, View part is most changeable part and having
powerful and fast interpreter is nice future. Even in C# .Net MVC
.cshtml files is not compiled in final dll and you can change them in
run time without recompile all project.
My idea was to have core brook project with native main modules, but
some part like reporting module to be easy changeable at run-time.
DWScript can be integrated in html file like this
Code: [Select]
Request Info
Request Info
Name
Value
<%
procedure WriteValue(name, value : String);
begin
Print('
');
Print(name);
Print('
');
if value="" then
Print(' ')
else Print(value);
PrintLn('
or
Code: [Select]
SQLite DB test
<%
var db := new DataBase('SQLite', ['%www%\.db\test.sql3']);
db.BeginTransaction;
db.Exec('create table if not exists ip_log (dt datetime, ip text, ua
text)');
// add to table
db.Exec('insert into ip_log values (?, ?, ?)', [Now,
WebRequest.RemoteIP, WebRequest.UserAgent]);
// keep only last 24 hours
db.Exec('delete from ip_log where dt', [Now-1]);
const SqlQuery = #"
select * from ip_log
order by rowid desc
limit 10";
%>
Last 10 IP that queried this page
<%=SqlQuery%>
Request time
Request IP
User Agent
<%
var ds := db.Query(SqlQuery);
// using different methods below for each for illustration purposes
while not ds.Eof do begin
%>
<%=db.Query("select count(*) from ip_log").AsInteger(0)%> requests
in the last 24 hours
<%
db.Commit;
%>
This concept can be very powerful if we have full access to all
brook brokers, database, objects in script.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-26 21:36
Hello ttomas, thanks for your answer,
I didn't know d]"]>Blocked, seems an interesting project.
So, it's safe to use SQL directly in HTML? :/
----------------------------------------------------------------------
Leledumbo · 2013-01-27 06:06
QuoteDWScript can be integrated in html file like thisIt looks like
plain PHP (no framework) to me :/
Especially for a production system, it will cause headache when a bug
appears, because the logic is scattered over different layers.
QuoteSo, it's safe to use SQL directly in HTML? :/No, it's never so,
and should never be done. I like the "view" strictness where it's
totally limited to template tag, probably with some parameters but
that's it. No logic or even more complex part should be in the view.
This will limit runtime modification significantly but it is better
structurally.
----------------------------------------------------------------------
ttomas · 2013-01-27 16:08
Quote from: Leledumbo on January 27, 2013, 07:06:02 amIt looks like
plain PHP (no framework) to me :/This is just demo from DWScript.
Define word framework! PHP, ASP, ColdFusion, there is a lot of
frameworks for this languages.
QuoteEspecially for a production system, it will cause headache when a
bug appears, because the logic is scattered over different
layers.Binary production system will cause more headache when a bug
appears.
QuoteSo, it's safe to use SQL directly in HTML? :/
No, it's never so, and should never be done.SQL is never used in HTML
This is script files, stored on server, look like HTML, but end user
never see code in it.
After interpretation we have plain HTML result send to user.
Don't tell me that PHP is not safe to use SQL.
QuoteNo logic or even more complex part should be in the view.Good old
scool
But not today with HTML5 and JavaScript, JQuery, Mobile etc. All this
is view part and this client framework/libraries have a lot of logic
in it.
Binary or Interpreted worlds? Both have some advantages and problems
and having possibility to chose and mix them look like winner
combination for me.
----------------------------------------------------------------------
Leledumbo · 2013-01-27 16:53
QuoteDefine word framework! PHP, ASP, ColdFusion, there is a lot of
frameworks for this languages.A set of libraries where you can
integrate your application in it, following given rules (might be
convention or configuration).
QuoteBinary production system will cause more headache when a bug
appears.Just open the source, you know the layer where the bug is
(can't be in the view), fix, recompile, done. No headache.
QuoteThis is script files, stored on server, look like HTML, but end
user never see code in it.
After interpretation we have plain HTML result send to user.
Don't tell me that PHP is not safe to use SQL.Yes, I know about it and
I've been in projects with such structure (err... I'd rather call it
no structure at all). The script mixes data, logic and output, and
that's the problem. In PHP it's not suggested as well (if you ask
quite experienced ones). By scattering the same thing over different
layers, you are taking the risk of opening security hole on those
layers, instead of just one. Even in most PHP framework, the
convention for view is only to have echo, simple if, and loop (which
is still not good enough though better than none). This is because
they mostly implement MVA instead of the original MVC, so view
receives output in the form of data structure instead of plain string.
QuoteBut not today with HTML5 and JavaScript, JQuery, Mobile etc. All
this is view part and this client framework/libraries have a lot of
logic in it.Client logic (ajax login, client side form fields
checking) is OK in view, but no server logic (querying database,
design report is server logic) allowed.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-27 22:08
My back-ends only generates JSON. I write HTML with ZenCoding (the
Brook's site it was written in ZenCoding in four hours) and Bootstrap.
I don't create HTML on the back-end, even using PHP. I use templates,
and JTemplate for the replacement of @vars.
In short, I have 3 layers, which are:
------------ ------- -------------
|Back-end|<-->|Ajax|<-->|Front-end|
------------ ------- -------------
Back-end - written with Brook, serving data via RESTful and JSON;
Ajax - Any HTTP requester, like jQuery, Synapse, FPHTTPClient etc.;
Front-end - LCL forms or HTML views;
A small sample is: http://silvioprog.com.br/ideia (it uses Bootstrap
and jQuery)
But I know friends who use business rules in several places.
Brook gives support for any data format, JSON, HTML, XML etc. If you
prefer to create business rules in HTML, Brook also gives you that
support, making replacement tags.
----------------------------------------------------------------------
Silvio Clécio · 2013-01-27 22:15
HTMLReport dinamically "replaces" your SQL to HTML:
http://code.google.com/p/htmlreporter
It's a nice job. It would be interesting a Free Pascal version of this
project.
----------------------------------------------------------------------
Silvio Clécio · 2013-02-05 18:19
Hello again friends,
ttomas, a nice alternative for DWScript is the PascalScript, and it is
compatible with Lazarus:
https://github.com/remobjects/pascalscript
Pascal server page uses PascalScript:
http://en.wikipedia.org/wiki/Pascal_server_page
Feel free to implement it (a new broker?) in Brook.
----------------------------------------------------------------------
Fred vS · 2013-02-05 18:24
Opa Silvio, tudo bem ?
Here a link maybe interesting for your Brooks framework :
http://www.live555.com/
Im busy to translate the c header if it interest you ...
----------------------------------------------------------------------
snorkel · 2013-02-08 20:15
Having a issue installing in Lazarus 1.0.6 on ArchLinux 64bit get the
following errors when the package compiles:
(is there some dependency I missed or other issue with 64bit?)
/home/snorkel/LazComponents/brookframework-
master/brokers/brookfclcgibroker.pas(57,15) Error: There is no method
in an ancestor class to be overridden:
"TBrookCGIRequest.DeleteTempUploadedFiles;"
/home/snorkel/LazComponents/brookframework-
master/brokers/brookfclcgibroker.pas(58,14) Error: There is no method
in an ancestor class to be overridden:
"TBrookCGIRequest.GetTempUploadFileName(const AnsiString,const
AnsiString,Int64):AnsiString;"
/home/snorkel/LazComponents/brookframework-
master/brokers/brookfclcgibroker.pas(60,14) Error: There is no method
in an ancestor class to be overridden:
"TBrookCGIRequest.RequestUploadDir:AnsiString;"
/home/snorkel/LazComponents/brookframework-
master/brokers/brookfclcgibroker.pas(62,15) Error: There is no method
in an ancestor class to be overridden:
"TBrookCGIRequest.HandleUnknownEncoding(const AnsiString,TStream);"
/home/snorkel/LazComponents/brookframework-
master/brokers/brookfclcgibroker.pas(85,1) Fatal: There were 4 errors
compiling module, stopping
----------------------------------------------------------------------
Leledumbo · 2013-02-09 13:23
QuoteHaving a issue installing in Lazarus 1.0.6 on ArchLinux 64bit get
the following errors when the package compiles:
(is there some dependency I missed or other issue with 64bit?)You need
recent FPC 2.6.1
----------------------------------------------------------------------
Leledumbo · 2013-02-09 13:26
By the way, silvio. Is there any reason for brook to only handle 404
and 500 http status? We still have a plenty to handle for errors such
as 403...
----------------------------------------------------------------------
snorkel · 2013-02-11 18:52
Quote from: Leledumbo on February 09, 2013, 02:23:26 pmQuoteHaving a
issue installing in Lazarus 1.0.6 on ArchLinux 64bit get the following
errors when the package compiles:
(is there some dependency I missed or other issue with 64bit?)You need
recent FPC 2.6.1
ah nuts, I must have missed that requirement somewhere.
----------------------------------------------------------------------
skobov · 2013-02-14 14:42
Hello Silvio,
How to change the default (80) tpc/ip port of Brookframework's
embedded server application ?
Thanks
----------------------------------------------------------------------
Silvio Clécio · 2013-02-14 15:24
It's easy:
Code: [Select]uses
BrookFCLHTTPAppBroker, CustHTTPApp, BrookApplication ...;
implementation
initialization
(BrookApp.Instance as TCustomHTTPApplication).Port := 1024;
----------------------------------------------------------------------
Silvio Clécio · 2013-02-18 01:14
Worked?
----------------------------------------------------------------------
skobov · 2013-02-18 06:15
Yes! Work great! Thank You
----------------------------------------------------------------------
Silvio Clécio · 2013-02-19 11:22
Quote from: Leledumbo on February 09, 2013, 02:26:25 pmBy the way,
silvio. Is there any reason for brook to only handle 404 and 500 http
status? We still have a plenty to handle for errors such as 403...
Are the common statuses. But the programmer can map the exception
event to handle other errors (403 etc).
----------------------------------------------------------------------
Silvio Clécio · 2013-02-27 01:42
Hello again friends,
In a not too distant future, there are great chances of Brook having a
"BrookServerPages".
----------------------------------------------------------------------
itmitica · 2013-03-07 19:39
Looks promising. One small suggestion.
Running the wizard for a new Brook project, on a larger DPI, it
results in some elements in the bottom of the TPanel being hidden.
Since the form in not resizable, it leads to some guessing game on
what the bottom fields are about and the values being entered.
--
Mitică
----------------------------------------------------------------------
Silvio Clécio · 2013-03-07 19:43
Hello Mitică,
Can you send a print screen with the problem? If yes, please send to:
https://github.com/silvioprog/brookframework/issues
Thank you very much!
----------------------------------------------------------------------
itmitica · 2013-03-07 19:52
Issue #18
...and thank you!
--
Mitică
----------------------------------------------------------------------
Silvio Clécio · 2013-03-07 19:55
Thank you again!
----------------------------------------------------------------------
BigChimp · 2013-03-10 11:01
FYI:
In the development version of my fpcup Lazarus/fpc
downloader/installer/updater, I added git repositories for
tiopf frameworklazpackager (addin to create Debian .deb packages)Brook
Frameworkljgridutils (JSON saving/loading from grid)Greyhound ORM
The tiopf one is a bit weird as you need to switch branches to do
anything useful. Haven't implemented support for that yet.
The repos are not enabled by default; you can either edit fpcup.ini or
run e.g. fpcup --only=lazpackager
Comments/suggestions welcome as always,
More info about fpcup:
http://lazarus.freepascal.org/index.php/topic,15919.0.html
https://bitbucket.org/reiniero/fpcup
thanks,
BigChimp
----------------------------------------------------------------------
Silvio Clécio · 2013-03-11 13:46
Thank you very much for adding Brook.
I'll test fpcup soon. Sounds a very interesting project.
----------------------------------------------------------------------
mdbs99 · 2013-03-11 17:50
Quote from: BigChimp on March 10, 2013, 12:01:23 pmFYI:
In the development version of my fpcup Lazarus/fpc
downloader/installer/updater, I added git repositories for
tiopf frameworklazpackager (addin to create Debian .deb packages)Brook
Frameworkljgridutils (JSON saving/loading from grid)Greyhound ORM[...]
Thanks for adding the Greyhound.
Please, see the sources again because I moved the package to another
directory today!
Best regards.
----------------------------------------------------------------------
BigChimp · 2013-03-12 07:03
Thanks Marcos, but where did you move it?
https://github.com/mdbs99/Greyhound.git seems to be up with latest
update about 11 hours ago.
Which URL should I use instead?
Suggestion: disable previous repo.
----------------------------------------------------------------------
mdbs99 · 2013-03-12 12:16
No!
I moved only the package from src/ to packages/
----------------------------------------------------------------------
Fred vS · 2013-03-26 11:47
Opa Silvio.
Has Brook a forum editor-designer ?
----------------------------------------------------------------------
Silvio Clécio · 2013-03-31 22:26
Pretty soon yes.
https://github.com/silvioprog/brookframework/issues/29
----------------------------------------------------------------------
jwdietrich · 2013-04-01 17:14
There is a recent discussion about a possible re-implementation of the
Lazarus website at
http://www.lazarus.freepascal.org/index.php/topic,20426. You might
want to join there as Brook could be useful resource for these
efforts.
----------------------------------------------------------------------
Silvio Clécio · 2013-04-01 17:29
Done. Thank you very much friend!
----------------------------------------------------------------------
Nebula · 2013-04-05 11:31
Just a comment and suggestion from someone quite new to web apps and
frameworks...
I looked at http://brookframework.org/get-started.html and was put off
by the /cgi-bin/ url, as - at that point - my basic understanding of
these things had led me to believe that crusty old CGI was a primitive
thing that reloaded every time a request was made
After an hour or so of research into why basic CGI is obsolete, etc, I
eventually came back to the Brook website and then found that you do,
after all, use the more modern techniques of a persistant process
(i.e. FastCGI as in
http://forum.lazarus.freepascal.org/index.php/topic,13312.0.html ) and
more acceptable URLs with 'routing', etc.
Make of that what you will. Perhaps it might be worth noting on the
get-started page that Brook does use up to date methods... "but here's
a very basic old cgi example...". Just to avoid confusion from newbs
like me!
Cheers, Good luck.
----------------------------------------------------------------------
Leledumbo · 2013-04-05 16:53
Just tried embedded webserver + daemon combo, SUPERB! In production,
it could run as a daemon without cluttering taskbar. In development,
it can easily be debugged from IDE. All just with a single ifdef to
determine whether to use the daemon broker or not.
----------------------------------------------------------------------
Silvio Clécio · 2013-04-05 18:03
Yes, CGI is old, but its safe and used even today by sites like
PayPal, HostMonster, HP, RedHat etc., please see some links:
https://www.paypal.com/cgi-bin/webscr?cmd=_login-submit
https://my.hostmonster.com/cgi-bin/cplogin
With FastCGI, I perform 2800 requests per second. Using PHP I perform
only 2200. FastCGI is fast, and IMHO speed and security is more
important than modernity.
----------------------------------------------------------------------
snorkel · 2013-04-19 14:48
Does brook have a way to handle sessions?
I am currently using python and CherryPy and it has the ability to
create a before dispatch event where you can
check if the session is expired or if the user has logged off and then
redirect them to a session expired page.
I didn't see a demo on the brook web page about how to handle storing
session data between requests.
Also is this thread where I should be asking questions about the Brook
Framework?
Thanks,
Snorkel
----------------------------------------------------------------------
snorkel · 2013-04-19 15:39
Been trying the embedded http server and I keep getting
a exception: Missing http protocol version in request
----------------------------------------------------------------------
snorkel · 2013-04-19 16:26
Was looking at the session demo.
Session support looks good, however how do I create a global session
that would apply to all actions?
Should I create it in the initialization and destroy it in the
finalization?
Also how can I create a global dobeforerequest that would apply to all
actions? I want to check before any request is processed to see
if the session has expired.
----------------------------------------------------------------------
Leledumbo · 2013-04-20 04:52
QuoteBeen trying the embedded http server and I keep getting
a exception: Missing http protocol version in requestJust ignore, the
exception is expected and already handled.
QuoteAlso how can I create a global dobeforerequest that would apply
to all actions? I want to check before any request is processed to
see if the session has expired.If you use quite recent Brook, create a
top level TBrookAction descendant (no need to register this one) and
override DoBeforeRequest method. Descend all of your actions from
this. If you use an old one, override the DoRequest method instead, do
what you want then call the inherited DoRequest.
----------------------------------------------------------------------
snorkel · 2013-04-22 16:06
Quote from: Leledumbo on April 20, 2013, 06:52:59 amQuoteBeen trying
the embedded http server and I keep getting
a exception: Missing http protocol version in requestJust ignore, the
exception is expected and already handled.
QuoteAlso how can I create a global dobeforerequest that would apply
to all actions? I want to check before any request is processed to
see if the session has expired.If you use quite recent Brook, create a
top level TBrookAction descendant (no need to register this one) and
override DoBeforeRequest method. Descend all of your actions from
this. If you use an old one, override the DoRequest method instead, do
what you want then call the inherited DoRequest.
Thanks,
That makes sense, I am using a snapshot from github, what about the
session, would I create that in the unregisterd action as well?
Also in the embedded web server it keeps dying with a unhandled
exception and it dies in:
Code: [Select]procedure TBrookApplication.Run;
begin
FApp.Run;
end;
Exception is: Missing http protocol version in request
It just dies after I go to localhost and hit refresh a couple of
times.
----------------------------------------------------------------------
Leledumbo · 2013-04-23 06:50
QuoteThat makes sense, I am using a snapshot from github, what about
the session, would I create that in the unregisterd action as well?I
guess so...
QuoteAlso in the embedded web server it keeps dying with a unhandled
exception and it dies in:Weird, I also use 2.6.2 at office and the
exception does happen but my app never dies... could it be because I
built everything from source? I have no idea. Maybe you could attach
your project so I can test.
----------------------------------------------------------------------
snorkel · 2013-04-23 14:57
Quote from: Leledumbo on April 23, 2013, 08:50:13 amQuoteThat makes
sense, I am using a snapshot from github, what about the session,
would I create that in the unregisterd action as well?I guess so...
QuoteAlso in the embedded web server it keeps dying with a unhandled
exception and it dies in:Weird, I also use 2.6.2 at office and the
exception does happen but my app never dies... could it be because I
built everything from source? I have no idea. Maybe you could attach
your project so I can test.
I got the session stuff working great, I created a base
TbrookSessionAction with the onbeforerequest and I create the session
in that classes constructor then when I need a action to have session
support I just derive my action from that and start the session in the
onbeforerequest. Thanks for the tip on that.
I saw on the brook git hub site that there is a bug in the fpc http
server. Going to try with a trunk build and see if it goes away.
----------------------------------------------------------------------
snorkel · 2013-04-24 04:06
Been playing around with the Brook Framework and so far it's great
:-)
I currently have a web server app in CherryPy and brook is actually
pretty similar, looking at dumping cherrypy and using brook instead.
----------------------------------------------------------------------
Silvio Clécio · 2013-05-01 17:14
Very nice!
----------------------------------------------------------------------
iru · 2013-06-01 07:58
I have Linux Mint-15, Laz 1.0.8, FPC 2.6.2 and Brook.
Tried to install Brookex.lpr into Lazarus.
Crashed with the following error:
../ideintf/frmbrooktable2htmlform.pas(29,19) Fatal: Can not find unit
ListFilterEdit used by frmBrookTable2HTMLForm.
Any suggestions appreciated, Ian.
----------------------------------------------------------------------
Silvio Clécio · 2013-06-01 15:23
Install the LazControls package:
lazarus\components\lazcontrols\lazcontrols.lpk
On Linux these packages comes disabled by default.
----------------------------------------------------------------------
iru · 2013-06-02 00:07
Thanks for the response.
LazControls appear to be installed, they appear on the palete and when
checked via package>open loaded package>lazcontrols is flagged as
installed. Cannot be removed because it is required by the IDE.
If I create a single form project I can add "ListFilterEdit" from the
palete, compiles clean and runs OK. ListFilterEdit appears in the
"uses" statetment.
It would appear that the compile invoked by the install BrookEX uses
different paths to the compile of a simple form.
What version of Lazarus has Brook been tested against? I will have a
look at going back to 1.0.6.
Ian
----------------------------------------------------------------------
iru · 2013-06-02 01:38
Silvio,
I turned on the compiler>verbose>show all flag and then attempted to
load the Brookex package.
Lots of messages showing that "ListFilt.pas" could not be found in any
directories under /usr/share/fpc/2.6.2. Nowhere.
So let me try and re-install LazControl. Switched IDE to SU mode,
turned on the "verbose" flag and watched it go.
The LazControl package install process crashed with the following:
Searching file /usr/lib/fpc/2.6.2/LISTFILT.PAS... not found
Can't find unit ListFilterEdit used by frmBrookTable2HTMLForm
Searching file
/home/iru/SW/Brook/ideintf/frmbrooktable2htmlform.pas... found
Searching file /home/iru/SW/Brook/ideintf/brookprojectintf.pas...
found
Searching file /home/iru/SW/Brook/ideintf/frmbrooknewproject.pas...
found
Why is the LazControl package install process looking at files in the
Brook directories. Something must have been left in the IDE
environmrnt by a previous failed Brook package install.
Ian
----------------------------------------------------------------------
iru · 2013-06-02 07:49
This just gets worse.....
Deleted, fpc and laz, searched for and found that /usr/share/lazarus
and a hidden .lazarus directory existed. Deleted them.
Re-installed fpc and laz, could compile a simple form. Attempted to
instal the LazControls package. Failed on the same error, in the Brook
frmBrookTable2HTMLForm file.
As this is all in a virtual machine I deleted the VM and then made a
clone of the base linux VM (no applictions or tools installed).
Installed fpc, fpc source and laz.
Invoked Laz as "SU", could compile and run a basic form.
Installed LazControl with no errors, all OK.
Tried to install the Brook package. Failed with the original
error!!!!!!!!!!!!!!!!
unit frmBrookTable2HTMLForm;
BrookDataBase, BrookTable, BrookSQLdbBroker, BrookDBUtils,
BrookConsts, Forms,
Classes, SysUtils, Dialogs, StdCtrls, ExtCtrls, CheckLst, Buttons,
Controls,
XMLPropStorage, ListFilterEdit, SQLdb, DB, StrUtils;
Cant find ListFilterEdit........... Ian
----------------------------------------------------------------------
Giu · 2013-06-02 08:04
I don't remember wich one, but I had errors too trying with brook and
1.0.8
I tried with 1.1 and all problems gone. Try with a snapshot or svn
build to test if you still having problems
----------------------------------------------------------------------
Leledumbo · 2013-06-02 10:24
I use Brook with 1.0.8 at office, obviously something is wrong. Check
whether brookrt.lpk (or brookex.lpk?) has dependency on lazcontrols in
project inspector.
----------------------------------------------------------------------
Silvio Clécio · 2013-06-02 16:44
It works fine for me on Mint and openSUSE, please see:
1. http://imagebin.org/259965
2. http://imagebin.org/259966
3. http://imagebin.org/259967
Do not run Lazarus as SU, it will only bring more problems.
Just:
0. Create a new VM on your VirtualBox;
1. Download and install Linux Mint (or other):
http://torrents.linuxmint.com/torrents/linuxmint-14.1-mate-
dvd-64bit.iso.torrent ;
2. $ wget -c http://silvioprog.com.br/download/install_fpc_lazarus_git
_version.tar.gz ;
3. $ tar -vzxf install_fpc_lazarus_svn_version.tar.gz ;
4. $ ./install_fpc_lazarus_svn_version.sh (be patient, the
installation may take a few minutes.);
5. Open and rebuild Lazarus installing this packages:
http://imagebin.org/259969 ;
6. Download a Brook snapshot:
https://github.com/silvioprog/brookframework/archive/master.zip;
7. Open and install: brookex.lpk ;
That's all.
----------------------------------------------------------------------
iru · 2013-06-03 03:39
Thank you for the detailed response.
Built a new VM with Mint 14.1 and all updates.
I noted a mixup between GIT and SVN in steps 2-3-4. Fixed that.
Invoked /install_fpc_lazarus_svn_version.sh.
Away it went for a long time but then crashed with the following:
Compiling fpcsrcscan.pas
Compiling progresswnd.pas
Compiling basebuildmanager.pas
lazbuild.lpr(1622,1) Error: resource compiler "fpcres" not found,
switching to external mode
lazbuild.lpr(1622,1) Warning: "crti.o" not found, this will probably
cause a linking failure
lazbuild.lpr(1622,1) Warning: "crtn.o" not found, this will probably
cause a linking failure
lazbuild.lpr(1622,1) Fatal: There were 1 errors compiling module,
stopping
Fatal: Compilation aborted
Ian.
----------------------------------------------------------------------
Silvio Clécio · 2013-06-03 05:43
Hm... strange.
I'll fix the script, create a new VM and try it again.
Please wait, I return with the result. If is bug it will fixed.
----------------------------------------------------------------------
Silvio Clécio · 2013-06-03 23:59
Friend, I'm sorry for the inconvenience. I noticed that FPC folks
changed some paths of FPC executables. I fixed it in my script and now
I'm working to update it in my site.
Now I'm testing it in a new VM with Linux Mint. Tonight I release the
new script. Please wait just a little longer...
----------------------------------------------------------------------
iru · 2013-06-04 00:25
Silvio,
Take your time.
Thanks for your efforts, Ian
----------------------------------------------------------------------
Silvio Clécio · 2013-06-04 01:09
Finally, done.
Please try all again:
1. Create a new VM and install Linux Mint ;
2. $ wget -c http://silvioprog.com.br/download/install_fpc_lazarus_git
_version.tar.gz ;
3. $ tar -vzxf install_fpc_lazarus_git_version.tar.gz ;
4. $ ./install_fpc_lazarus_git_version.sh ;
5. Open and install: brookex.lpk ;
It working like a charm now: http://imagebin.org/260157
----------------------------------------------------------------------
iru · 2013-06-04 12:41
Silvio,
It is certainly working like a charm.
Followed the instructions, started things off, went and watched the
Japan versus Australia football on the TV.
All finished, Lazarus rebuilt and there is NEW>Brook.
Thank you for your efforts, well done.
Ian
----------------------------------------------------------------------
a.atalla · 2013-06-19 07:39
i think the project need more documentation :
complete tutorial on how to create
simple blogsimple poll ... etc
----------------------------------------------------------------------
hallenberger · 2013-08-03 09:21
Hello!
With Lazarus 1.1 fpc 2.6.1 on Win XP brookframework compiles, but with
Debian 64 and Lazarus 1.1, fpc 2.6.3 x86_64-linux-gtk 2 I get an error
if I want install brookex:
/home/thomas/development/fpc/packages/fcl-stl/src/gvector.pp(50,42)
Error: Generics without specialization cannot be used as a type for a
variable
What am I doing wrong?
----------------------------------------------------------------------
marcov · 2013-08-03 09:33
Quote from: hallenberger on August 03, 2013, 11:21:56
am/home/thomas/development/fpc/packages/fcl-stl/src/gvector.pp(50,42)
Error: Generics without specialization cannot be used as a type for a
variable
Seems your FPC sources are in the unit path, and not the browsing
path. Only CompiledUnits should be in the units path.
----------------------------------------------------------------------
hallenberger · 2013-08-03 10:00
Quote from: marcov on August 03, 2013, 11:33:24 amQuote from:
hallenberger on August 03, 2013, 11:21:56
am/home/thomas/development/fpc/packages/fcl-stl/src/gvector.pp(50,42)
Error: Generics without specialization cannot be used as a type for a
variable
Seems your FPC sources are in the unit path, and not the browsing
path. Only CompiledUnits should be in the units path.
Thank you for your answer, but I did not understand. I see no
differences between my lazarus installations: windows and debian.
----------------------------------------------------------------------
nummer8 · 2013-08-05 10:41
Hi,
I started with brook framework and I am happily surprised!
Great work.
While testing I ran into a challenge.
I want to connect a program to a mysql database.
On connecting I receive an error :unkown connectortype?
Connecting to sqlite is no problem. That works.
I work on a windows Win 7 machine
Lazarus (CodeTyphon 4.4) 32 bits version
Wamp2.2 32 bits version
Mysql 5.5.24 32 bits version
For testing purposes I created a stand alone webserver application
instead of a cgi application.
( I used the code from demos/db/database/d1 to start with)
Changing the drivername to mysql, libmysql gave me the same error.
Below are a few lines from the Brokers unit.
=============================================
uses
BrookFCLHTTPAppBroker, BrookUtils, BrookApplication, BrookSQLdbBroker,
SQLite3Conn, pqconnection, Mysql55Conn;
implementation
initialization
BrookSettings.Configuration := 'library=sqldb;driver=mysql55;databas
e=test;user=root;password=;host=127.0.0.1;';
============================================
I also created a standard application with sqldb connector to check if
I could connect to the database.
That works fine.
Any thoughts?
I hope I described everything clear enough.
If not let me know.
Thanks in advance.
Jos
----------------------------------------------------------------------
nummer8 · 2013-08-09 10:37
Problem solved.
Created a normal application and dropped an sqlconnector from sqldb on
it.
Used the exact name from Connectortype to identifiy the right
connector type.
(including white spaces)
Mysql 5.5
That worked.
Jos
----------------------------------------------------------------------
Silvio Clécio · 2013-08-10 14:58
Hello,
I'm planning to create the BSP -- Brook Server Pages (please see:
https://github.com/silvioprog/brookframework/issues/51).
BSP is similar to JSP, ASP etc., however will use Object Pascal.
Tale with the help of those who are interested by this feature.
----------------------------------------------------------------------
IndianaJones · 2013-08-12 06:31
Hi silvio,
I havent compiled the brook framework in Mac OS X (10.6.. it complains
in the brookrt package. Here are the log. Thanks.
Hint: Start of reading config file /etc/fpc.cfg
Hint: End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.6.2 [2013/02/03] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling brookrt.pas
Compiling /Users/indiana/lazarus-
libs/brookframework/brokers/brookfclcgibroker.pas
Compiling /Users/indiana/lazarus-
libs/brookframework/core/brookaction.pas
Compiling /Users/indiana/lazarus-
libs/brookframework/core/brookhttputils.pas
Compiling /Users/indianAn unhandled exception occurred at $0005D463 :
EInOutError : Invalid file handle
$0005D463
$00088550
$001742F2
$00181041
$00167130
$00175534
$0017F434
$001803C7
$00167130
$00175534
$0017F434
$001803C7
$00167130
$00175534
$0017a/lazarus-libs/brookframework/core/brookhttpclient.pas
Assembling (pipe) /Users/indiana/lazarus-
libs/brookframework/packages/lib/i386-darwin/brookhttpclient.s
Fatal: Compilation aborted
----------------------------------------------------------------------
snorkel · 2013-08-12 17:18
Quote from: silvioprog on August 10, 2013, 04:58:29 pmHello,
I'm planning to create the BSP -- Brook Server Pages (please see:
https://github.com/silvioprog/brookframework/issues/51).
BSP is similar to JSP, ASP etc., however will use Object Pascal.
Tale with the help of those who are interested by this feature.
Sounds interesting, are you going to use pascal script?
Is this going to be templates with the ability to embed pascal script?
----------------------------------------------------------------------
Silvio Clécio · 2013-08-14 16:08
Hello a.atalla,
You can make it and send to we via issues. (y)
----------------------------------------------------------------------
Silvio Clécio · 2013-08-14 16:10
@IndianaJones,
Declare the unit "cthreads" in uses clause of your lpr.
I don't have Mac, so don't know what could be.
----------------------------------------------------------------------
Silvio Clécio · 2013-08-14 16:14
@snorkel,
Exactly.
We'll create it via brokets, so probably will support InstantFPC,
DWScript, PascalScript etc.
----------------------------------------------------------------------
IndianaJones · 2013-08-16 12:12
I have compiled brook framework on OSX now. The problem is related
with the authorization.
Execute startlazarus with sudo is the tip.
Thanks.
----------------------------------------------------------------------
Silvio Clécio · 2013-08-18 17:22
Friend, thank you for informing us that the Brook runs on Mac OS X.
This is good news, and I'll show it to some friends who use OS X. (y)
----------------------------------------------------------------------
woodengineer · 2013-09-01 17:54
First of, thanks silvioprog. This framework rocks!!
I could use some help on how to embed brook webserver into a Lazarus
Forms application.
Downloaded the git version and looked at the examples, but could only
find a console app.
A little sample app or some pointers would be greatly appreciated
Thanks!!
----------------------------------------------------------------------
Silvio Clécio · 2013-09-02 16:25
Thank you @woodengineer!
Oh yes. First implement it:
Code: [Select]unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Forms, StdCtrls, BrookApplication, BrookFCLHTTPAppBroker,
BrookAction;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
{ TMyAction }
TMyAction = class(TBrookAction)
public
procedure Get; override;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
function InitHttp({%H-}P: Pointer): PtrInt;
begin
Result := 0;
BrookApp.Run;
end;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
BeginThread(@InitHttp);
end;
{ TMyAction }
procedure TMyAction.Get;
begin
Write('Hello!');
end;
initialization
TMyAction.Register('*');
end.
(or download it here: http://www.sendspace.com/file/d6pk3m)
After, call "http://localhost" in your browser.
Good luck!
----------------------------------------------------------------------
woodengineer · 2013-09-03 13:19
Thanks for the reply silvioprog.
The example worked like a charm
I will be trying brook on the Raspberrypi, but have to update the
compiler first.
Also, in your code
Code: [Select]function InitHttp({%H-}P: Pointer): PtrInt;
what is the {%H-} for? I tried to google this convention, but came up
empty.
Alex
----------------------------------------------------------------------
Silvio Clécio · 2013-09-03 13:30
Very good @woodengineer!
Please see about %H- here: http://wiki.freepascal.org/IDE_directives
----------------------------------------------------------------------
Silvio Clécio · 2013-09-03 13:32
I sent two compiled demos (Windows, Linux) showing the future BSP:
https://github.com/silvioprog/brookframework/issues/51
----------------------------------------------------------------------
Giu · 2013-09-03 21:30
Quote from: silvioprog on September 03, 2013, 03:32:57 pmI sent two
compiled demos (Windows, Linux) showing the future BSP:
https://github.com/silvioprog/brookframework/issues/51
Hey Silvio. There are some public apps developed under brook to see?
It's possible (maintanenance, scale) big projects under it?
Regards.
----------------------------------------------------------------------
woodengineer · 2013-09-04 15:30
Hello again,
I am trying to figure out how to load java script from a separate file
e.g.
Code: [Select]
if I embed the java code into my html it works fine, but if I use the
above syntax the java code does not get executed. I am using an
embedded server.
I tried to see this work at "\demos\simple\static", but this example
has a compile error.
Thanks for all your work!!
Alex
----------------------------------------------------------------------
Leledumbo · 2013-09-04 15:41
QuoteI tried to see this work at "\demos\simple\static", but this
example has a compile error. If you're not using trunk (fpc < 2.7.1),
the fix is still in the working branch I guess. Please ask silvio to
merge it to the master branch.
----------------------------------------------------------------------
Silvio Clécio · 2013-09-05 18:18
@Giu,
Hm... I don't know who is using Brook all over the world, because I
never thought to control it. But it would be interesting Brook's site
to have an area showing the featured users.
As I said in other comments on this topic, I'm making a ERP with
Brook, and so far has given much everything right.
There are people using Brook here in Brazil, see:
https://www.youtube.com/results?search_query=brookframework&oq=brookfr
amework&gs_l=youtube.1.0.35i39j0i10.1499.2599.0.4738.9.8.0.0.0.0.795.3
507.0j1j2j0j1j3j1.8.0...0.0...1ac.1.11.youtube.zXe3iGgycZk
Would be an interesting idea to create a form on the Brook's site,
asking users to submit their featured users. (y)
----------------------------------------------------------------------
Silvio Clécio · 2013-09-05 18:24
@woodengineer, @Leledumbo: all changes merged to the master branch
now!
----------------------------------------------------------------------
Giu · 2013-09-05 21:01
Quote from: silvioprog on September 05, 2013, 08:18:36 pm@Giu,
Hm... I don't know who is using Brook all over the world, because I
never thought to control it. But it would be interesting Brook's site
to have an area showing the featured users.
As I said in other comments on this topic, I'm making a ERP with
Brook, and so far has given much everything right.
There are people using Brook here in Brazil, see:
https://www.youtube.com/results?search_query=brookframework&oq=brookfr
amework&gs_l=youtube.1.0.35i39j0i10.1499.2599.0.4738.9.8.0.0.0.0.795.3
507.0j1j2j0j1j3j1.8.0...0.0...1ac.1.11.youtube.zXe3iGgycZk
Would be an interesting idea to create a form on the Brook's site,
asking users to submit their featured users. (y)
Thanks Silvio.
I will try to get time to do something in the weekend with brook and
angularjs or dojo.
I'm interested to see how to get different panes (divs) on a page,
each one updating independent without refreshing page.
----------------------------------------------------------------------
woodengineer · 2013-09-06 01:35
Thanks Leledumbo, that did the trick
Cheers
Alex
----------------------------------------------------------------------
Silvio Clécio · 2013-09-06 02:46
Quote from: Giu on September 05, 2013, 11:01:40 pm... I'm interested
to see how to get different panes (divs) on a page, each one updating
independent without refreshing page.
Use Brook and ajax with jQuery (http://api.jquery.com/jQuery.ajax).
----------------------------------------------------------------------
Giu · 2013-09-06 07:47
Has your one cgi for all petitions or just one? Wich size?
Has screenshots to see how this ERP looks?
----------------------------------------------------------------------
woodengineer · 2013-09-06 13:52
Hello,
I am very new to Web applications.
is there documentation were I can read up on how this all actually
works. I am looking thru these great examples and I can them to work,
but I am missing the "big picture".
E.g., I do not understand what happens (or I have to do), when a page
requests information gets to the server? I create and register the
TbrookAction's but don't really understand how it all works.
Can someone point me in the right direction on what to read up on?
Thanks!
----------------------------------------------------------------------
Leledumbo · 2013-09-06 16:12
Quoteis there documentation were I can read up on how this all
actually worksI'm afraid not, currently the code itself is the (API)
documentation (also accessible from docs.brookframework.org) and the
demos are tutorials. Somebody's got to write a proper documentation to
give that "big picture".
QuoteE.g., I do not understand what happens (or I have to do), when a
page requests information gets to the server? I create and register
the TbrookAction's but don't really understand how it all worksServer
dispatches the requestFind the matching registered TBrookAction for
the requestExecute the action's method depending on the request type
(GET, POST, etc)What you have to do is... err... serve the request
with appropriate response
QuoteCan someone point me in the right direction on what to read up
on?Comments in the source code
----------------------------------------------------------------------
woodengineer · 2013-09-06 17:15
Thanks for the reply Leledumbo
will try to model thru.
Silvio, you mentioned "all changes merged to the master branch now!"
The download and the Git repo seem unchanged.
Can you elaborate?
Thanks!
Alex
----------------------------------------------------------------------
BigChimp · 2013-09-06 18:09
If you look at the git repo, you see there is a "master" branch and a
"working" branch.
Presumably changes got promoted from the working to the master
branch...
----------------------------------------------------------------------
tom.tom · 2013-09-07 13:48
Hi Silvio,
First of all - good job with your framework!
Recently I started ewaluating diffierent options for my current small
and quick web app project. The candidates were: our own Delphi
WebBroker based framework, pure Delphi web services, pure Lazarus fcl-
web and your framework I recently came across. Since this is going to
be small backend app for my customer, using mostly HTML and JS
(jQuery, jQueryUI and Knockout), the application itself is just
supposed to do the routing, DB access and communicate with frontend
using JSON. I was going to use fcl-web, but your FW seems to have
already all I need what I'd have to code on top of fcl-web.
Yesterday I moved my sample startup app from fcl-web FCGI to Brook.
The model I'm using is the remote FCGI and Apache which means the the
FCGI EXE is running separately and Apache call it per request.
First thing I noticed is strange thing about the way Brook handles
errors - either something simple like unhandled route or some internal
problems like SQL erorr. I see in your TBrookFCGIHandler two main
TWebHandler methods overriden: HandleRequest and ShowRequestException.
The later is prepared to handle errors in a Brook way, but it seems
like HandleRequest is missing the surrounding try-except and calling
ShowRequestException in case Route method fails. The lack of try-
except causes the whole app shutting down on any error. If you look
into original TWebHandler.HandleRequest the whole logic in there is
wrapped with try-except and the ShowRequestException is called in case
of any exception during request handling.
The ShowRequestException is actually called nowhere in the whole Brook
framework code.
Am I missing something?
Thanks for your advice,
Tomasz
----------------------------------------------------------------------
Silvio Clécio · 2013-09-09 16:37
Quote from: Giu on September 06, 2013, 09:47:39 amHas your one cgi for
all petitions or just one? Wich size?
I don't know if I got it right. The Brook uses FCL, then it supports
all platforms supported by the FCL.
QuoteHas screenshots to see how this ERP looks?
Not yet. But it will be a project much like ContaAzul
(https://contaazul.com/).
----------------------------------------------------------------------
Silvio Clécio · 2013-09-09 16:39
Quote from: woodengineer on September 06, 2013, 07:15:54 pmSilvio, you
mentioned "all changes merged to the master branch now!"
The download and the Git repo seem unchanged.
Can you elaborate?
I'll update the documentation in working branch now
(https://github.com/silvioprog/brookframework/tree/working) ....
----------------------------------------------------------------------
Silvio Clécio · 2013-09-09 16:48
Hello Tomasz,
Thank for the comments.
So, you can open a issue showing the problem here:
https://github.com/silvioprog/brookframework/issues
Please send a small sample or a screenshot showing the problem.
----------------------------------------------------------------------
tom.tom · 2013-09-09 22:03
Silvo,
I have just realized that I downloaded the 2012 version using the
big green button on your site and was using it. Have just downloaded
the current trunk and I see you already did what I was talking about -
wrapped the content of HandleRequest with try...except so the error
handling works ok.
Before I realized I had the old version I did some investigation and
the real reason the error handling was not working for FCGI but it was
working for CGI was that in the TCustomFCGIApplication the
ShowException procedure is not overridden as it is in the
TCustomCGIApplication. I even created a patch to TBrookFCGIApplication
that overrides that method in a similar way as TCustomCGIApplication
does but you already solved it on a little higher level.
Nevertheless it's interesting why it'snot done in
TCustomFCGIApplication...
Thanks for your work,
Tomasz
----------------------------------------------------------------------
jamhitz · 2013-09-10 16:39
Quote from: Leledumbo on September 06, 2013, 06:12:59 pmI'm afraid
not, currently the code itself is the (API) documentation (also
accessible from docs.brookframework.org) and the demos are tutorials.
Somebody's got to write a proper documentation to give that "big
picture".
I have done two introductory tutorials on a) fpJSON and b)Brook. Only
the first few pages are done, but I was hoping to post these somewhere
so that you guys can tell me if I am headed in the right direction
before I get so invested. The fpJSON one could probably go to the
wiki.
They are VERY raw, but I plan on a major improvement. Both are
attached. Please tell me what you think.
----------------------------------------------------------------------
woodengineer · 2013-09-10 18:00
Hello jamhitz,
just looked at the 2 examples and they look really good. Quite a few
things make already way more sense to me now. Please keep writing as
this kind of tutorial-documentation has a huge value for everybody
just getting started. I have been programming in Pascal/VB for several
years but the mechanics of Web programming is quite different from a
desktop app.
I think the format and structure looks good
Thanks again !!!
Alex
----------------------------------------------------------------------
Silvio Clécio · 2013-09-12 12:09
Hello jamhitz,
Keep writing, is getting very good.
You can post this job on social network and blogs. In the future,
Brook will have a blog, and you can post there too if you prefer.
----------------------------------------------------------------------
Silvio Clécio · 2013-09-12 12:10
Hello tom.tom,
Please send your patch to:
https://github.com/silvioprog/brookframework/issues.
Thanks!
----------------------------------------------------------------------
Giu · 2013-09-19 20:44
Quote from: silvioprog on September 09, 2013, 06:37:16 pmQuote from:
Giu on September 06, 2013, 09:47:39 amHas your one cgi for all
petitions or just one? Wich size?
I don't know if I got it right. The Brook uses FCL, then it supports
all platforms supported by the FCL.
Sorry, dont explained correctly. What I mean is, if all the
application is in just once cgi, and of wich size.
Regards.
----------------------------------------------------------------------
Silvio Clécio · 2013-10-05 15:01
This will depend on what platform you are generating the CGI, but
usually in my projects (Linux) the size is no more than 2MB, and I use
embedded server.
----------------------------------------------------------------------
Leledumbo · 2013-10-05 15:06
QuoteThis will depend on what platform you are generating the CGI, but
usually in my projects (Linux) the size is no more than 2MB, and I use
embedded server.It's just a couple of hundred KBs here *perhaps
because my web apps don't use database, just pure calculation and
string manipulation
----------------------------------------------------------------------
Silvio Clécio · 2013-10-06 00:20
Very good @Leledumbo!
----------------------------------------------------------------------
hinst · 2013-10-27 21:04
Hello. I hope you don't mind if I ask a question in this thread.
I am developing an application which should work like this: there are
two executables and one shared library. The first executable works
like cgi "script", the second runs to prevent shared library from
unloading. The library should do all work. Therefore the cgi "script"
(because it is actually not a script, but executable compiled by fpc)
should redirect input to the library by invoking exported functions.
So I can't use BrookApplication unit "directly" as the demo
applications suggest. Instead I have to pass http request and cookies
and related things to library and then write response returned by
library like
WriteLN(ProcessRequest(request, cookies));
I know that my approach to web development might seem pretty perverted
at first glance, but actually it's justified. I can't just use CGI
because my server should stay running for hours and I can't use
FastCGI because of unnecessary complications it brings; for example:
what if Apache kills my process or launches another instance of it?
What if I want my application to stay running even when Apache is not
running etc etc etc
So please please please tell me if you know how to make this work.
Again, briefly; what I want is to redirect http request and cookies to
Brook framework using exported function from shared library; the
library should be responsible for everything while the cgi "script"
should redirect input and output
// or perhaps I should just go for "embedded http server" mode
----------------------------------------------------------------------
taazz · 2013-10-27 22:08
Your design is flawed DLL/SO are not designed to used that way. You
need to redesign our solution.
----------------------------------------------------------------------
Silvio Clécio · 2013-12-14 11:28
I agree with taazz. Really, it seems a little confused model. :/
----------------------------------------------------------------------
truetom · 2014-01-06 01:48
Hello!
In the new version ,Brook not supported zeos?
In then old version , I can find BrookZeosBroker.pas, but in the new
version ,I not see it .
Thanks and best regards!
----------------------------------------------------------------------
Silvio Clécio · 2014-01-06 02:36
Hello man,
Hm... Brook continues to support third-party solutions, although they
do not come more embedded in the main package of the project.
So, what do you think about I add the following information in the
README file (in markdown format)?:
Code: [Select]## THIRD PARTY
The Brook supports third party solutions and, for these, there is a
broker file implementing your features. You can download the package
containing all files [here](https://dl.dropboxusercontent.com/u/135304
375/brookframework/third-party.zip).
If English is good, I can apply it now.
Thank you! (y)
----------------------------------------------------------------------
truetom · 2014-01-06 08:19
Hello silvioprog!
Thank you for your reply!
----------------------------------------------------------------------
Giu · 2014-01-06 21:52
Hi all,
There are some documentation about how to deploy?
I compiled blog demo, and copied cgi1.bf and home, newpost 404 and 500
html files to cgi-bin folder of xampp, and I get a 500(*) error trying
to access http://localhost/cgi-bin/cgi1.bf
500 error from IE, not 500 html file.
Regards.
----------------------------------------------------------------------
Leledumbo · 2014-01-07 09:27
QuoteThere are some documentation about how to deploy?For (F)CGI, it
depends on the web server. So you should consult your web server
instead. For embedded webserver, just run it as normal program. For
daemon, just follow this.
----------------------------------------------------------------------
Silvio Clécio · 2014-01-09 13:55
So, I avoid using packages like XAMMP / WAMP, they handle the in
Apache settings. I stumbled upon a XAMMP that not returning the
PATH_INFO variable.
Try to use a standard copy of Apache (e.g.: http://archive.apache.org/
dist/httpd/binaries/win32/httpd-2.2.22-win32-x86-openssl-0.9.8t.msi),
or follow the Leledumbo's hint, to use your own server.
----------------------------------------------------------------------
Silvio Clécio · 2014-01-27 19:19
Book's site now has a new look and new domain:
http://silvioprog.github.io/brookframework. And due to some spam
attacks, the demos are now running under HTTPS.
----------------------------------------------------------------------
bee · 2014-01-28 03:53
Quote from: silvioprog on January 27, 2014, 08:19:45 pmBook's site now
has a new look and new domain:
http://silvioprog.github.io/brookframework. And due to some spam
attacks, the demos are now running under HTTPS.
Silvio, do you have any plan to implement Pascal scripting like
DelphiWebScript (DWS) into Brook?
----------------------------------------------------------------------
Silvio Clécio · 2014-01-29 00:14
I and Gilson Nunes (https://github.com/gilsonnr) tried some drafts
with Pascal Script, worked fine, but a memory leak
(https://github.com/remobjects/pascalscript/issues/61) in Pascal
Script stopped our work.
I tried DWS too, but:
https://code.google.com/p/dwscript/issues/detail?id=428
So, I'll dedicate some time to try InstantFPC, although it requiring
Free Pascal installed on the server, it would not be a problem,
because the most important in moment is make a code that works.
Python requires 38MB of executables distributed together the
programmer application. Ruby, PHP etc. requires your libs too, so with
the Free Pascal would be no different.
Sorry for my englysh plz.
----------------------------------------------------------------------
taazz · 2014-01-29 01:02
have you tried any of the following?
http://sourceforge.net/projects/blaise/?source=directory
http://sourceforge.net/projects/scriptengine2/
I have recently found out about them too so I don't have any idea what
so ever how suitable they might be and it seems that they do not
implement pascal but something more liberal.
----------------------------------------------------------------------
bee · 2014-01-29 06:39
@silvio:
So, FPC doesn't yet support full unicode in the RTL? I can't blame the
DWS guy if that's the case. Then how do you support unicode in Brook?
Pascal Script does work with FPC, albeit the memory leak, but the
features are far behind DWS. The ability to create class from script,
for example.
Then, do you dare to create your own powerful crossplatform pascal
scripting engine?
----------------------------------------------------------------------
Leledumbo · 2014-01-29 15:10
@taazz:
I've looked a glance at ScriptEngine II a couple of times ago. It's
good. Very good for a Pascal scripting solution, I think it supports
all newer Delphi (XE and up) constructs. The only downsides are the
IDE is Delphi only (porting to Lazarus will require a bit amount of
work due to JEDI VCL dependencies) and the documentation is in German
only. The platform seems to be limited to x86 though, but someone with
German reading ability should be able to confirm that.
----------------------------------------------------------------------
taazz · 2014-01-29 23:03
Quote from: Leledumbo on January 29, 2014, 04:10:46 pm@taazz:
I've looked a glance at ScriptEngine II a couple of times ago. It's
good. Very good for a Pascal scripting solution, I think it supports
all newer Delphi (XE and up) constructs.
That sounds interesting, it just moved on the top of scripting list.
Quote from: Leledumbo on January 29, 2014, 04:10:46 pmThe only
downsides are the IDE is Delphi only (porting to Lazarus will require
a bit amount of work due to JEDI VCL dependencies)
Well I'm guessing the IDE you are talking about has nothing to do with
the engine it self as long as I don't use the IDE in my applications
(or if I right a new one) I can still use the engine right?
Quote from: Leledumbo on January 29, 2014, 04:10:46 pmand the
documentation is in German only.
That's bad and indifferent news at the same time it is bad because a
scripting language needs documentation to be used in its full and
indifferent because who RTFM's in the programming world?
Quote from: Leledumbo on January 29, 2014, 04:10:46 pmThe platform
seems to be limited to x86 though, but someone with German reading
ability should be able to confirm that.
You mean that the enginee can only be in a x86 executable and it will
not work if I compile it for arm or x64 or that it only produces x86
intermediate code that can be executed from any target CPU?
If the first it just moved way way down on my scripting list (last
position actually and probably will fall off eventually) I'm not going
to use something that needs special attention to compile on different
CPUs from the start, I don't have the time or the will to work on yet
an other component set my self.
----------------------------------------------------------------------
Leledumbo · 2014-01-30 15:58
QuoteWell I'm guessing the IDE you are talking about has nothing to do
with the engine it self as long as I don't use the IDE in my
applications (or if I right a new one) I can still use the engine
right?No, the engine itself is fully compatible with FPC. It's just
the IDE is a very good tool to test the scripts as well. Both
compilation and interpretation works FAST, though I haven't tested
with big programs yet. After all, if it's a scripting engine, it
shouldn't execute big code.
QuoteYou mean that the enginee can only be in a x86 executable and it
will not work if I compile it for arm or x64 or that it only produces
x86 intermediate code that can be executed from any target CPU?
If the first it just moved way way down on my scripting list (last
position actually and probably will fall off eventually) I'm not going
to use something that needs special attention to compile on different
CPUs from the start, I don't have the time or the will to work on yet
an other component set my self.I don't know, I see something x86 in
the documentation and it looks like so. As I said, someone with German
reading ability should confirm that. And that someone is not me
----------------------------------------------------------------------
Silvio Clécio · 2014-02-01 04:44
@guys, sorry for delay, Lazarus forum doesn't notify me of new replies
in this topic.
@taazz, hm... I don't know this projects, seems good, but, they are
compatible with Free Pascal and Linux?
Thx
----------------------------------------------------------------------
Silvio Clécio · 2014-02-01 04:50
@bee, Brook uses the same unicode of FPC. But if we analyze well,
unicode isn't a problem in Brook, because all the texts trafficked
from the side (client->server) to the other side (server->client) are
converted and deconverted to URI, automatically.
----------------------------------------------------------------------
Silvio Clécio · 2014-02-01 05:42
taazz, I converted and tested the demo "SEII (v.
0.6.1.0)\samples\Simple Test" to Lazarus and it worked like a cham on
Windows (XP and 8, and my environment is "Lazarus 1.0.14 r43446 FPC
2.6.2 i386-win32-win32/win64")!
I'll test it in Linux soon... (I'm returning from my vacation )
----------------------------------------------------------------------
Silvio Clécio · 2014-02-01 06:02
Sorry, I forgot the picture: http://imagebin.org/290230
----------------------------------------------------------------------
taazz · 2014-02-01 06:04
I'm glad that at least there is a new toy that we can play with, if it
works for 64bit applications as well as 32bit then I'm going to
rewrite the IDE leledumbo talks about in lazarus as a thank you to you
guys. In any case I really hope that it will not require to much
trouble to make work for every CPU target supported by fpc at least
x86, x64 and arm should be great.
----------------------------------------------------------------------
Silvio Clécio · 2014-02-01 06:11
I'm hope that it work fine in Linux too. Even that doesn't work, I'll
check what I can be made to it work.
----------------------------------------------------------------------
taazz · 2014-02-02 00:09
I tried it today on laz1.2rc2 and it failed to compile, it keeps
whining that it can't decide which overload method to call its on the
utf8decode/encode call and the code completion is a complete mess it
recognizes static as a keyword and goes in to denial, so I can't even
start looking which are the overloaded functions that makes it chock
so I'm really pissed at this point.
CODE COMPLETION IS NOT A PARSER IT DOES NOT HAVE TO BE EXACT AND STOP
PARSING THE UNIVERSE SO I CAN GET A MEANINGFUL ANSWER OUT OF MY IDE.
naaa that doesn't fill any better, I'm of to break something. see you
all later.
EDIT:
OK now that I've done some physical labor I fill a bit better and took
a second dive to the suit. I managed to make it compile after I placed
the & character on the static field name and after I found out that
there is no utf8encode/decode that accepts widechars only widestrings
and that was a problem for fpc I managed to compile the simple sample
and finally got a meaningful answer from the suit.
YES!! Take THAT! Hah, neee nene neeee neeee and all the 6 year old
behavioral patterns you can think of with a small victory chicken
dance around my chair at the end.
Whaaat?? Its 2 o'clock in the morning here if anyone is up at this
time I assure you is not looking in to my window.
In any case time to start working on that IDE see you all around, in
an other thread though this is way of topic here.
----------------------------------------------------------------------
Giu · 2014-02-04 17:34
Quote from: Leledumbo on January 07, 2014, 10:27:14 amQuoteThere are
some documentation about how to deploy?For (F)CGI, it depends on the
web server. So you should consult your web server instead. For
embedded webserver, just run it as normal program. For daemon, just
follow this.
Some kind of guide?
Clean Apache 2.2 installation with same results.
On IE got "HTTP 500 Error"
On Apache Error.log
Code: [Select][Tue Feb 04 17:24:37 2014] [error] [client 127.0.0.1]
script not found or unable to stat: D:/DevAux/Apache2.2/cgi-bin/cg1.bf
On access.log
Code: [Select]127.0.0.1 - - [04/Feb/2014:17:24:50 +0100] "GET /cgi-
bin/cgi1.bf HTTP/1.1" 500 249
----------------------------------------------------------------------
Leledumbo · 2014-02-05 04:48
QuoteSome kind of guide?
Clean Apache 2.2 installation with same results.
On IE got "HTTP 500 Error"Don't know, I'm not a fan of Apache. I
choose embedded webserver instead (since I also want the embedded
webserver to improve).
But maybe you can try something. A CGI program is no different from
console program. So you can verify whether your program works or not
simply by executing in a console / terminal. You should see something
like:
Quote$ ./hello
X-Powered-By: Brook framework and FCL-Web.
Status: 500 Internal Server Error
Content-Length: 184
Content-Type: text/html; charset=utf-8
Internal server error
500 -
Internal server error
Error: No
REQUEST_METHOD passed from server.
Now try again with
required environment variable:
Quoteleledumbo@LeleBuntu:/media/Shared/testprograms/testbrook$
REQUEST_METHOD=GET ./hello
X-Powered-By: Brook framework and FCL-Web.
Status: 200 OK
Content-Length: 6
Content-Type: text/html; charset=utf-8
HelloExample used attached.
----------------------------------------------------------------------
Giu · 2014-02-05 08:34
Hi leledumbo. One step further
I added exe extension to cgi application, and execute it from command
line. And now, seems like I see the real problem:
QuoteD:\DevAux\Apache2.2\cgi-bin\blog>cgi1.exe
X-Powered-By: Brook framework and FCL-Web.
Status: 500 Internal Server Error
Content-Length: 249
Content-Type: text/html; charset=utf-8
Internal server error
500 -
Internal server error
Error:
TBrookConfigurator: The config file was not found:
"C:\repository\git\br
ookframework\demos\db\db.cfg"
I copied this file from src folder, and tried again with same results.
On blog demo, this file is defined in Brokers.pas as this:
Code: [Select] BrookSettings.Configuration := 'db.cfg';
I can't fin any reference to the folder mentioned in error.
Meanwhile I can't solve this, there are some guide using embebbed
webserver?
----------------------------------------------------------------------
Leledumbo · 2014-02-05 09:37
QuoteI copied this file from src folder, and tried again with same
results.Edit it according to your db configuration. I have no idea
what's the "current directory" if apache is the one who's going to
execute your CGI, so you better give full path to the database
configuration file.
QuoteMeanwhile I can't solve this, there are some guide using embebbed
webserver? Just change BrookFCLCGIBroker to BrookFCLHTTPAppBroker and
set BrookSettings.Port according to your needs, then run the exe as if
it's a normal program. You can then access your web app from the
browser.
----------------------------------------------------------------------
Giu · 2014-02-05 21:43
Thanks leledumbo, with embebbed server seems to work.
There aren't any log embbebed server offers to know whats happening?
Regards
----------------------------------------------------------------------
Leledumbo · 2014-02-06 16:24
QuoteThere aren't any log embbebed server offers to know whats
happening?Not to my knowledge, you might want to ask Michael for that.
----------------------------------------------------------------------
Silvio Clécio · 2014-02-06 18:17
I'm using both, embedded server on Windows in a small app (as
service), and FastCGI in a HTTPS API, running on Linux.
----------------------------------------------------------------------
mangakissa · 2014-02-18 08:22
Do I need to install on my FreeBSD server running the Brook
application?
I tested my CGI with shellscript en perl and works fine, but running a
bf script give me this error
Code: [Select][Tue Feb 11 14:23:33 2014] [error] [client 192.168.2.31]
(8)Exec format error: exec of '/var/www/cgi-bin/cgi1.bf' failed
[Tue Feb 11 14:23:33 2014] [error] [client 192.168.2.31] Premature end
of script
----------------------------------------------------------------------
Leledumbo · 2014-02-19 01:25
QuoteDo I need to install on my FreeBSD server running the Brook
application?
I tested my CGI with shellscript en perl and works fine, but running a
bf script give me this errorTry running in a terminal, a simple:
Code: [Select]$ REQUEST_METHOD=GET ./yourappshould work, at least you
should get non-error output.
----------------------------------------------------------------------
Giu · 2014-02-24 15:35
Quote from: Leledumbo on February 19, 2014, 02:25:28 amQuoteDo I need
to install on my FreeBSD server running the Brook application?
I tested my CGI with shellscript en perl and works fine, but running a
bf script give me this errorTry running in a terminal, a simple:
Code: [Select]$ REQUEST_METHOD=GET ./yourappshould work, at least you
should get non-error output.
Some idea where the hell DLL should be placed? I tried on system32 and
SysWow64...on cgi-bin folder too...same error always....
Code: [Select]C:\Dev\xampp\cgi-bin>blog.exe
X-Powered-By: Brook framework and FCL-Web.
Status: 500 Internal Server Error
Content-Length: 389
Content-Type: text/html; charset=utf-8
Internal server
error
500 -
Internal server error
Can not load SQLite client library
"sqlite3.dll". Check your installation.
----------------------------------------------------------------------
Leledumbo · 2014-02-24 16:02
QuoteSome idea where the hell DLL should be placed? I tried on
system32 and SysWow64...on cgi-bin folder too...same error
always....Somewhere your exe can access. I don't know how web server
executes your cgi, I think it depends on the web server as well.
Normally, anywhere in PATH should be fine.
----------------------------------------------------------------------
Giu · 2014-02-24 16:39
Quote from: Leledumbo on February 24, 2014, 05:02:06 pmQuoteSome idea
where the hell DLL should be placed? I tried on system32 and
SysWow64...on cgi-bin folder too...same error always....Somewhere your
exe can access. I don't know how web server executes your cgi, I think
it depends on the web server as well. Normally, anywhere in PATH
should be fine.
This is what I thought,but not
----------------------------------------------------------------------
Giu · 2014-02-25 16:29
Nothing
I tried as embebed server and CGI. With sqlite3.dll on system32, on
sysWow64, on the same folder of exe (when embebbed), on apache/bin
folder......
Maybe I did something bad in my previous life, and karma is punishing
me, because it's the 3rd time I try to start with brook in last
months, and after some days, at the end I abandon tired
----------------------------------------------------------------------
BigChimp · 2014-02-25 16:32
Mmm. You could try running sysinternals process monitor to see where
the executable is looking for dlls...
----------------------------------------------------------------------
Giu · 2014-02-25 17:06
Quote from: BigChimp on February 25, 2014, 05:32:50 pmMmm. You could
try running sysinternals process monitor to see where the executable
is looking for dlls...
Good idea, but it suppose it should found it.
Code: [Select]"17:53:27,9445377","blog.exe","16148","QueryBasicInforma
tionFile","D:\DevAux\LazComp\brook\demos\db\blog\sqlite3.dll","SUCCESS
","CreationTime: 24/02/2014 16:31:42, LastAccessTime: 25/02/2014
13:40:48, LastWriteTime: 03/02/2014 21:06:00, ChangeTime: 01/01/1601
1:00:00, FileAttributes: A"
----------------------------------------------------------------------
BigChimp · 2014-02-25 17:41
So the next question is: do the bitness of the sqlite dll and the cgi
exe match? Does that same dll work with regular sqldb Lazarus
applications?
----------------------------------------------------------------------
Giu · 2014-02-25 17:42
Quote from: BigChimp on February 25, 2014, 06:41:34 pmSo the next
question is: do the bitness of the sqlite dll and the cgi exe match?
Does that same dll work with regular sqldb Lazarus applications?
It's suppose Brook uses sqldb for database connections...I mean...I
suppose yes.
----------------------------------------------------------------------
Silvio Clécio · 2014-02-25 18:11
@Giu,
I believe you are doing something wrong in your project. Your CGI was
compiled for Win 32 or 64? Your DLL is for Win 32 or 64? Your
webserver runs in Win 32 or 64? I ask because you said that copied the
DLL to the "system32" and "sysWow64" folders .
I see a way to you know where the problem lies: create a simple
project (like a Program, and without Brook), and try to connect to a
SQLite database. I'm sure this problem is not related to Brook!
Another tip: use the latest version of Brook, 3.0. Brook 2.6.4 no more
implements persistence, but offers features for a programmer to use
any persistence library, like SQLdb, Zeos, dOPF
(https://github.com/silvioprog/dopf), JCore
(https://github.com/jcmoraisjr/jcore) etc.
In current version, Brook provides an object for each request, see a
diff:
form.html:
Code: [Select]
Person
Brook 2.6.4:
Code: [Select]unit Unit1;
{$mode objfpc}{$H+}
interface
uses
BrookAction;
type
TMyAction = class(TBrookAction)
public
procedure Post; override;
end;
implementation
procedure TMyAction.Post;
begin
// where's validation?
Write('ID: %d, Name: %s', [Fields['id'].AsInt64,
Fields['name'].AsString]); // where's reuse?
// where's persistence?
end;
initialization
TMyAction.Register('/person');
end.
Brook 3.0:
Code: [Select]unit person;
{$mode objfpc}{$H+}
interface
uses
SysUtils;
type
EPerson = class(Exception);
{ TPerson }
TPerson = class
private
FId: Int64;
FName: string;
public
procedure Validate;
procedure Save;
published
property Id: Int64 read FId write FId;
property Name: string read FName write FName;
end;
implementation
{ TPerson }
procedure TPerson.Validate;
begin
if Trim(FName) = '' then
raise EPerson.Create('Name must not be empty.');
end;
procedure TPerson.Save;
begin
// implement your persistence here, using any framework like dpof:
https://github.com/silvioprog/dopf
end;
end.
Code: [Select]unit Unit1;
{$mode objfpc}{$H+}
interface
uses
BrookAction, person;
type
TMyAction = class(specialize TBrookEntityAction)
public
procedure Post; override;
end;
implementation
procedure TMyAction.Post;
begin
Entity.Validate; // Yes, my own validation!
Write('ID: %d, Name: %s', [Entity.Id, Entity.Name]); // Yes, I'm
reusing my object!
Entity.Save; // I love it, my persistence using OPF (like
https://github.com/jcmoraisjr/jcore or
https://github.com/silvioprog/dopf) or DAO!
end;
initialization
TMyAction.Register('/person');
end.
ps1: Please see this topic: http://lists.lazarus.freepascal.org/piperm
ail/lazarus/2014-February/085964.html
ps2: Join to the Lazarus mailing list too, most of the guys of this
forum is registered there:
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
----------------------------------------------------------------------
BigChimp · 2014-02-25 18:45
Quote from: Giu on February 25, 2014, 06:42:35 pmQuote from: BigChimp
on February 25, 2014, 06:41:34 pmSo the next question is: do the
bitness of the sqlite dll and the cgi exe match? Does that same dll
work with regular sqldb Lazarus applications?
It's suppose Brook uses sqldb for database connections...I mean...I
suppose yes.
"Suppose"? That doesn't really help. Brook db connections obviously
don't work for you. Checking if a regular Lazarus database application
(even the FPC bug report application
http://wiki.lazarus.freepascal.org/Database_bug_reporting#FreePascal)
works with the sqlite dll you use will confirm if the problem lies
with your Brook installation or with your sqlite dll....
Also you haven't answered the question about bitness...
(These questions are BTW exactly the ones Silvio is asking as well)
----------------------------------------------------------------------
Giu · 2014-02-25 18:56
Didn't understood what bitness means sorry, and yes, this could be the
root of the problem, because with an standard project, problem is the
same. I'm reinstalling Laz but 32b to see
----------------------------------------------------------------------
Silvio Clécio · 2014-02-26 04:17
Nice. Please post your new tests. This problem does not seem to be
difficult to solve. Is not karma hehe...
----------------------------------------------------------------------
Leledumbo · 2014-02-26 05:05
QuoteDidn't understood what bitness means sorry32-bit, 64-bit and so
on. The bitness between your executable and dll must match, since it
also defines the ABI (a little humanic way to read it: it defines how
your exe should call functions residing in the dll).
----------------------------------------------------------------------
Giu · 2014-02-26 08:50
Quote from: silvioprog on February 26, 2014, 05:17:13 amNice. Please
post your new tests. This problem does not seem to be difficult to
solve. Is not karma hehe...
I'm sure was sqlite3.dll bitness. I'm trying now with brook from
github.
Quote32-bit, 64-bit and so on. The bitness between your executable and
dll must match, since it also defines the ABI (a little humanic way to
read it: it defines how your exe should call functions residing in the
dll).
I understand. Was my english fault
----------------------------------------------------------------------
CCRDude · 2014-04-29 11:07
Noticed Brook this morning and got interested by its features
Played around with the version that's part of CodeTyphon 4.70, but
that was too old, so I downloaded the latest and installed that.
Both versions needed one change (applied in two locations) in
BrookRouter.pas to be able to identify actions:
Code: [Select] if MatchPattern(PRoute^.Pattern,
ARequest.PathInfo, VRedirect,
VNames, VValues) then
if MatchPattern(PRoute^.Pattern, ARequest.URI, VRedirect,
VNames, VValues) then
When debugging, ARequest.Pathinfo always was set '127.0.0.1' (or
'localhost') when browsing http://localhost/info - comparing 127.0.0.1
e.g. to /info obviously fails. Passing ARquest.URI instead, it gets
compared correctly. Difficult to debug deeper to the TRequest being
outside of the Brook code, within the FCL I think.
That's Lazarus as Typhon IDE 4.7, using FPC 2.7.1, svn-rev 43727, with
the Brook download from an hour ago.
My second issue that I wasn't able to fix yet is that Files is empty:
Code: [Select] { TSubmitAction }
TSubmitAction = class(TBrookAction)
public
procedure Post; override;
end;
implementation
{ TSubmitAction }
procedure TSubmitAction.Post;
var
cID: Int64;
fUploaded: TBrookUploadedFile;
begin
Write('');
Write('');
Write('submission');
Write('');
Write('');
try
cID := StrToInt64Def(Self.Params.Values['id'], 0);
if Self.Files.Count = 0 then begin
Write('
');
end;
Write('back');
except
on E: Exception do begin
Write('[-] error handling is work in progress');
end;
end;
Write('');
Write('');
end;
I do upload the file using form output of another action
Code: [Select]{ TInfoAction }
procedure TInfoAction.Get;
begin
Write('');
Write('');
Write('info');
Write('');
Write('');
Write('');
Write('');
Write('');
end; Both registered this way:
Code: [Select]initialization
TSubmitAction.Register('/submit', rmPost);
TInfoAction.Register('/info?id', rmGet, True);
end.
I always get Files.Count = 0. What am I doing wrong?
----------------------------------------------------------------------
CCRDude · 2014-05-05 17:04
Giving myself an answer: input needed to have name="something" set in
HTML to have httpdefs from FCL recognize the submitted file.
----------------------------------------------------------------------
Leledumbo · 2014-05-05 23:14
QuoteGiving myself an answer: input needed to have name="something"
set in HTML to have httpdefs from FCL recognize the submitted
file.This is a bug I submitted years ago, some browsers don't send
unnamed fields, some send with empty names. FCL automatically assigns
a unique name, but the field will be unaccessible, just to avoid a
crash (which was the bug).
----------------------------------------------------------------------
cryptkeeper · 2014-05-10 13:22
Hello guys
I just installed Brook framework from git repository. I tried install
additional packages (brokers) for greyhond and zeosdb, but it seems,
that some units are missing: BrookDatabase, BrookDBAction, BrookTable,
BrookQuery and others needed for database support.
It's because are some big changes in Brook framework core or is
something wrong with git repository?
regards
----------------------------------------------------------------------
Silvio Clécio · 2014-05-13 23:21
Brook 3.0 was released now:
http://forum.lazarus.freepascal.org/index.php/topic,24563.0.html. \o/
----------------------------------------------------------------------
aradeonas · 2014-05-26 16:19
Hi
I check Brook demos but with db demos I get HTTP method not allowed
for the requested resource.
i found http://lists.lazarus.freepascal.org/pipermail/lazarus/2014-
February/086014.html but it does not help.
Idea?
thanks
----------------------------------------------------------------------
Silvio Clécio · 2014-05-28 21:48
Chose the POST method in your REST client.
----------------------------------------------------------------------
Silvio Clécio · 2014-06-01 14:16
Guys, now the Brook framework project has a community where users can
post your doubts, take a look here:
https://plus.google.com/u/0/communities/101133820055678331036
Welcome!