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


Re: [Lazarus] getlazarus.org search request

2019-08-11 Thread Anthony Walter via lazarus
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.

Here is how a template is formatted:



Search Results: {Phrase}



{SearchItems}



And a template file for the search item:


{Bolden}
{Kind}
{Description}

If you want something specific with regards to layout, just send me a
custom template and possibly a css file to make it look however you want.

Since I have written this web library myself, its very easy to modify and
extend. I might add the ability for anyone to send their own templates and
browse or select from templates directly on every page, but that extension
is not likely to happen in the next few days.

If anyone is interested let me know and I'd produce a short instructional
video on how the my web library makes developing web pages easy. The only
hard part is writing html and css, which for plain stuff isn't hard at all
really. But html and css are design work, so you get out of html and css
work is whatever kind of design, taste, and effort you put into it.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] getlazarus.org search request

2019-08-11 Thread Ryan Joseph via lazarus


> On Aug 11, 2019, at 1:51 PM, Anthony Walter via lazarus 
>  wrote:
> 
> Currently there is no custom formatting applied as this is meant to be an 
> AJAX request to create populate suggestions. As this is an API like RESTful 
> function is this good enough for you or do want a "pretty" result format?
> 

Making a pretty formatted option would be nice also actually. It’s already 
basically there but a few line breaks would make it more useable. :)

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-11 Thread Ryan Joseph via lazarus


> On Aug 11, 2019, at 1:51 PM, Anthony Walter via lazarus 
>  wrote:
> 
> Ryan,
> 
> I was going to modify my project to allow for RESTful queries, when I 
> realized it already does this. The url and format are as follows:
> 
> https://docs.getlazarus.org/?method=codesearch=TStringList

Excellent, thanks for your foresight :). Could it be adapted so that there’s an 
option to show the page of the top result? For example in the query above a 
list of links is displayed but it would be better if the top result 
(https://docs.getlazarus.org/#rtl+classes+tstringlist) was loaded 
automatically. The fact that “TStringList” shows the correct page as the best 
result means this will work for 99% of the use cases I have in mind.

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-11 Thread Anthony Walter via lazarus
Ryan,

I was going to modify my project to allow for RESTful queries, when I
realized it already does this. The url and format are as follows:

https://docs.getlazarus.org/?method=codesearch=TStringList

Alternate request for xml format:

https://docs.getlazarus.org/?method=codesearch=xml=TStringList

Currently there is no custom formatting applied as this is meant to be an
AJAX request to create populate suggestions. As this is an API like RESTful
function is this good enough for you or do want a "pretty" result format?

Here are the templates, which I could easy swap out based on another
request parameter:

Page uses this template as an html fragment:

{SearchItems}

Results collection uses this template:


{Bolden}
{Kind}
{Description}

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


Re: [Lazarus] getlazarus.org search request

2019-08-09 Thread Anthony Walter via lazarus
Ryan, that is a good idea and I can absolutely add a search page that pulls
a string from RESTful query string and returns a friendly hyperlinked
summary of the most useful results. Also, I don't know if you know this,
but you can edit Lazarus settings to open up https://docs.getlazarus.org to
the appropriate page when you press F1 on any identifier in the code editor.

Tools -> Options -> Help -> Help Options
  set StartPage / BaseURL = https://docs.getlazarus.org/
  set RTLUnits / BaseURL = https://docs.getlazarus.org/rtl/
  set FCLUnits / BaseURL = https://docs.getlazarus.org/fcl/
  set LCLUnits / BaseURL = https://docs.getlazarus.org/lcl/
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] getlazarus.org search request

2019-08-08 Thread Ryan Joseph via lazarus
getlazarus.org has a really excellent search feature but I’d like to make a 
request (I think the owner posts here which is why I’m asking). Could an 
additional API be added so that we could use 3rd party editors with it?

In particular what I’d like to do is being able to send a HTTP request with the 
currently selected word and have it pull up the best result. I understand this 
doesn’t work with words like “Create” but it works well for types names. For 
example if:

http://docs.getlazarus.org/search.php?TStringList

Regards,
Ryan Joseph

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