Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Marco van de Voort via lazarus


Op 2019-08-12 om 11:13 schreef Anthony Walter via lazarus:
Yes, in C#. Personally I find ASP.NET  or Core easier 
to use than a CGI executable


Well, something like ISAPI dlls are inbetween those for a long,long time.


--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Ryan Joseph via lazarus


> On Aug 11, 2019, at 9:05 PM, Anthony Walter via lazarus 
>  wrote:
> 
> Ryan,
> 
> My sites are built on my custom web class library that optionally uses 
> templates to generate content. Templates are simple fill in the blank page 
> type text files which use reflection to pull properties of a objects into the 
> template.
> 

Thanks. I had a better idea. Would it be possible to make a split view where 
the search results are in a side bar and the main view shows the first result 
automatically? 99% of the time when I search for TStringList I want the class 
definition page (and clicking to get to it would be an extra step even) but 
having a side bar with additional results would make it complete.

Regards,
Ryan Joseph

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Marcos Douglas B. Santos via lazarus
On Mon, Aug 12, 2019 at 6:36 AM Michael Van Canneyt via lazarus
 wrote:
>
> [...] FPC+Lazarus effectively covers all scenarios :-)

No doubt about that for sure.

Marcos Douglas
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
In C# to define a property you write:

visibility typename propname { [visibility] get; [visibility] set; }
-or-
public int Age { get; set; }

This means you have a read write property that does nothing special. You
could also write ...

private int age;
public int Age { get { return age; } set { if (value > -1) age = value; } }

To use private a backing with code invoked to set or get. And finally you
can also write:

public int Age { get; private set; }
-or-
public int Age { get; private set; }
-or-
public int Age { get; protected set; }

To limit access to either a setter or getter of a property.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Graeme Geldenhuys via lazarus
On 12/08/2019 9:33 am, Anthony Walter via lazarus wrote:
> public IEnumerable SearchItems { get; set; }


I don't know C# at all, but am curious regarding this. What does that
"get" and "set" do?  It that a shorthand syntax for implementing getters
and setters of a field variable?


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Michael Van Canneyt via lazarus



On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote:


I use FPC for a lot of web stuff, but generally not for servers. In this
project I am using an FPC program to create the database and download
updates using my TClientSocket class.

For long running stuff, which I may typically host on an Amazon cloud
server with Linux, I'll generally either use something from a package (apt
or docker) or write a custom service in C# hosted in Kestrel or Apache.

Don't worry though, I spend most of my time writing desktop apps, and for
that nothing beats FPC + Lazarus ;)


Well, I use FPC mostly for web, so almost exactly the opposite of what you
do.

If we put our experiences together, it leads me to the conclusion that 
FPC+Lazarus effectively covers all scenarios :-)


That said, there is of course always room for improvement, 
so as I said before I'm open for suggestions to make things easier.


Michael

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
I use FPC for a lot of web stuff, but generally not for servers. In this
project I am using an FPC program to create the database and download
updates using my TClientSocket class.

For long running stuff, which I may typically host on an Amazon cloud
server with Linux, I'll generally either use something from a package (apt
or docker) or write a custom service in C# hosted in Kestrel or Apache.

Don't worry though, I spend most of my time writing desktop apps, and for
that nothing beats FPC + Lazarus ;)
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Michael Van Canneyt via lazarus



On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote:


Yes, in C#. Personally I find ASP.NET or Core easier to use than a CGI
executable.


I assumed you wrote your classes for FPC.

If you use the Microsoft stack, then my remarks are of no importance.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
Yes, in C#. Personally I find ASP.NET or Core easier to use than a CGI
executable. Also the ability to dynamically compose anonymous objects,
write linq expressions, and use reflection can be quite powerful.

The object formatting system is C#, where everything is an object and
custom formatters can be easily added, allow for the same formatting
strings in both compiled code and external template files.

As is right now, the only time consuming or potentially difficult part is
writing html / css. As I mentioned html / css can be a time sink depending
on how much design, taste, and effort you want to put into the actual page
spit out in the end.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Michael Van Canneyt via lazarus



Ah, but this is C# ?

I don't think you need more code in FPC to do the same.
But if there are proposals to reduce the amount of code in FPC even more, I'm 
open for suggestions.

Michael.

On Mon, 12 Aug 2019, Anthony Walter via lazarus wrote:


Michael,

Here is an example of how easy it is.

   public class CodeSearch : TemplateHandler
   {
   private static readonly string searchSql =
"search.sql".LoadResourceText();

   protected override void Run(Templates templates, StringBuilder
output)
   {
   SearchItems = DataCommand
   .Prepare(searchSql)
   .Add("@phrase", Read("phrase"))
   .Compose();
   templates[Read("format") + "SearchItem"].FormatObject(this,
output);
   }

   public IEnumerable SearchItems { get; set; }
   }

So given the url,
https://docs.getlazarus.org/?method=codesearch=xml=TStringList in
steps:

1) The library automatically finds the CodeSearch class without any code to
write
2) It runs the template handler automatically
3) In run we execute some SQL to search for a phrase and compose the
results as a collection of anonymous objects
4) The we select the template we want and format the CodeSearch object and
its available properties, in this case our search result "SearchItems".

The FormatObject method is a template engine that uses reflection to lookup
properties with mustache braces. It has the ability to query subproperties
and use all available format specifiers. Collection properties (IEnumerable
) are expanded by a detail template that can read through reflection the
properties of the anonymous objects in the collection by name and template
them as well.

Here are some template examples. Note you can access sub properties using
object.suprop.susubprop syntax as well as custom formatting in the template
(i.e. Price:C2 or Page.Modified:y-mm-dd).

{Title} or {Page.Title} // Welcome to our
website
Price is {Amount:C2} // Price is $15.75
Page modified on {Page.Modified:y-mm-dd} // Page modified on
2019-07-10
{SeachItems} // Expands our template


--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Anthony Walter via lazarus
Michael,

Here is an example of how easy it is.

public class CodeSearch : TemplateHandler
{
private static readonly string searchSql =
"search.sql".LoadResourceText();

protected override void Run(Templates templates, StringBuilder
output)
{
SearchItems = DataCommand
.Prepare(searchSql)
.Add("@phrase", Read("phrase"))
.Compose();
templates[Read("format") + "SearchItem"].FormatObject(this,
output);
}

public IEnumerable SearchItems { get; set; }
}

So given the url,
https://docs.getlazarus.org/?method=codesearch=xml=TStringList in
steps:

1) The library automatically finds the CodeSearch class without any code to
write
2) It runs the template handler automatically
3) In run we execute some SQL to search for a phrase and compose the
results as a collection of anonymous objects
4) The we select the template we want and format the CodeSearch object and
its available properties, in this case our search result "SearchItems".

The FormatObject method is a template engine that uses reflection to lookup
properties with mustache braces. It has the ability to query subproperties
and use all available format specifiers. Collection properties (IEnumerable
) are expanded by a detail template that can read through reflection the
properties of the anonymous objects in the collection by name and template
them as well.

Here are some template examples. Note you can access sub properties using
object.suprop.susubprop syntax as well as custom formatting in the template
(i.e. Price:C2 or Page.Modified:y-mm-dd).

{Title} or {Page.Title} // Welcome to our
website
Price is {Amount:C2} // Price is $15.75
Page modified on {Page.Modified:y-mm-dd} // Page modified on
2019-07-10
{SeachItems} // Expands our template
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-12 Thread Michael Van Canneyt via lazarus



On Sun, 11 Aug 2019, Anthony Walter via lazarus wrote:


Ryan,

My sites are built on my custom web class library that optionally uses
templates to generate content. Templates are simple fill in the blank page
type text files which use reflection to pull properties of a objects into
the template.


I'm a bit surprised you still write custom things for this.
All this is available by default in the FPC web classes. 
Templating is as old as the web, after all.


Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus