From 66dba7c6e0f8388da3ba64a41f84520583569bf8 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 7 Jun 2024 00:34:49 +0200 Subject: [PATCH] improve md --- docs/recipes/startup-listeners-code.md | 8 ++++---- docs/recipes/static_scope.md | 16 ++++++++-------- docs/recipes/supercharge-your-website.md | 8 ++++---- docs/recipes/thread_task.md | 12 ++++++------ docs/recipes/thread_usage.md | 12 ++++++------ docs/recipes/xml_fast-easy.md | 4 +++- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/docs/recipes/startup-listeners-code.md b/docs/recipes/startup-listeners-code.md index e5c311e74..b8838b87a 100644 --- a/docs/recipes/startup-listeners-code.md +++ b/docs/recipes/startup-listeners-code.md @@ -20,14 +20,14 @@ ] } --> -## Startup Listeners Code ## +# Startup Listeners, server.cfc and web.cfc Lucee has two kinds of startup listeners. - **Server.cfc** which runs when the Lucee Server starts up. It exists only once per Lucee instance. - **Web.cfc** which can be used for each web context. -### Server.cfc ### +## Server.cfc Create a `Server.cfc` file in `lucee-server\context\context` directory. @@ -59,7 +59,7 @@ component{ - Start Lucee Server. - The server console or `out.log` should show the above systemOutput's which means it has run the `Server.cfc` -### Web.cfc ### +## Web.cfc Create a `Web.cfc` file in `webapps\ROOT\WEB-INF\lucee\context\` directory, or the context webroot. @@ -98,7 +98,7 @@ Here ``reload`` is used to reload the web context. We see the difference when se This is a simple way to stop the server context. It is never triggered because there is no event happening inside java. -### Footnotes ### +## Footnotes Here you can see above details in video diff --git a/docs/recipes/static_scope.md b/docs/recipes/static_scope.md index 1df130065..e9e68316d 100644 --- a/docs/recipes/static_scope.md +++ b/docs/recipes/static_scope.md @@ -18,7 +18,7 @@ ] } --> -## Static scope in components +# Static scope in components Static scope in components is needed to create an instance of cfc and call its method. It is used to avoid creating an instance each time you use the cfc. @@ -26,7 +26,7 @@ You can create an object in the Application init() function, and make it at appl We explain this methodology with a simple example below: -### Example: +## Example 1 ```luceescript // index.cfm @@ -61,7 +61,7 @@ cfc = new Example0(); cfc.hey(); ``` -### Example 1: +## Example 2 As our code gets more complicated, we need to make some additions to it. @@ -96,7 +96,7 @@ new Example1(); new Example1(); ``` -### Example 2: +## Example 3 1) Another example is using the static scope to store the result of a time-consuming operation that does not need to be recomputed every time. @@ -125,7 +125,7 @@ new Example2(); new Example2(); ``` -### Example 3: +## Example 4 1) The static scope can also be used for functions. In this example, we define a static function that is available to all instances. @@ -145,7 +145,7 @@ Component { dump(Example3::hello()); ``` -### Example 4: +## Example 5 1) The static scope can be used to count the number of instances created from a component. @@ -171,7 +171,7 @@ new Example4(); new Example4(); ``` -### Example 5: +## Example 6 1) We can also use the static scope to store constant data like HOST, PORT. @@ -207,7 +207,7 @@ dump(person.getLastName()); dump(Example5::splitFullName("Quintana Jesus")); ``` -### Footnotes +## Footnotes [Lucee 5 features reviewed: static](https://dev.lucee.org/t/lucee-5-features-reviewed-static/433) diff --git a/docs/recipes/supercharge-your-website.md b/docs/recipes/supercharge-your-website.md index 289ba3aa4..f8c5d2627 100644 --- a/docs/recipes/supercharge-your-website.md +++ b/docs/recipes/supercharge-your-website.md @@ -12,11 +12,11 @@ ] } --> -## Supercharge your website ## +# Supercharge your website This document explains how you can improve the performance of your website in a very short time with Lucee. -### Example: ### +## Example: ```luceescript // index.cfm @@ -25,7 +25,7 @@ writeDump(now()); Run the above index.cfm, and you get a timestamp. Whenever we call our file, Lucee checks once at every request if a file has changed or not (for files currently residing in the template cache). If a file has changed, Lucee recompiles it, and executes it. Checking the files at every request takes time. If you have a published server, and you know your server does not produce or change any files, you can simply avoid that check that happens all the time. -### Using Admin ### +## Using Admin * Go to _Admin -> Performance/ Caching -> Inspect Templates (CFM/CFC) -> Never_ @@ -37,7 +37,7 @@ Run the above index.cfm, and you get a timestamp. Whenever we call our file, Luc * Another option to clear the template cache is to use clear cache via the admin by clicking the button in _Admin -> Settings -> Performance/ Caching -> Page Pool Cache_. -### Footnotes ### +## Footnotes Here you can see these details on video also: diff --git a/docs/recipes/thread_task.md b/docs/recipes/thread_task.md index f88fafdc4..6c68ddb56 100644 --- a/docs/recipes/thread_task.md +++ b/docs/recipes/thread_task.md @@ -18,7 +18,7 @@ ] } --> -## Thread Task ## +# Thread Task This document explains about the thread tasks. It is useful to know the differences between regular threads and task threads. @@ -32,7 +32,7 @@ Regular Threads have the following characteristics: 3) **It fails when it fails**: There is no special exception handling so when the thread fails it fails unless you have Cftry, cfcatch inside the thread and you have exception handling there. -### Example 1: ### +## Example 1 In addition to daemon (regular) threads, Lucee also supports task threads. The main differences is that task threads execute completely independently of the request that is calling the thread. We log the thread and can re-execute it. @@ -50,7 +50,7 @@ Note that when you execute the example code, you will get no output. This is exp However, view the Lucee _Admin --> Services --> Tasks_ and see the name of the tasks and their `Type` is `daemon` and the status is `terminated`. -### Example 2: ### +## Example 2 Next we show a similar example using the task type: @@ -64,7 +64,7 @@ dump(getPageContext().getTasks().getTask("test")); This example shows the task type. This example is similar to the daemon thread. It waits 1 second before outputting the task details. The task type thread will continue to run independently. -### Example 3: ### +## Example 3 Task threads can be retried multiple times if they fail. This is different from daemon threads which fail permanently after an exception. Below example shows a task thread that retries multiple times. @@ -85,7 +85,7 @@ dump(getPageContext().getTasks().getTask("test")); This example creates a task thread named `test` that retries according to the defined intervals. Initially, the task thread throws an exception. The retry intervals are defined in the array with `tries` and `interval` attributes. -### Example 4: ### +## Example 4 Another example for getting the admin component and task is physically created on the system. @@ -115,7 +115,7 @@ admin.removeAllTask(); 3) `admin.removeTask()` and `admin.removeAllTask()` are used to remove tasks from the administrator. -### Footnotes ### +## Footnotes Here you can see the details in the video: [Thread Task](https://youtu.be/-SUbVWqJRME) \ No newline at end of file diff --git a/docs/recipes/thread_usage.md b/docs/recipes/thread_usage.md index 386a06df8..f5136da87 100644 --- a/docs/recipes/thread_usage.md +++ b/docs/recipes/thread_usage.md @@ -16,11 +16,11 @@ ] } --> -## Thread Scope +# Thread Scope This document explains how to use threads in Lucee. Threads are mainly used for executing code in parallel. -### Example 1 +## Example 1 The below example shows normal execution, waiting for all code to resolve. Here it takes 1000 milliseconds to complete the execution. @@ -54,7 +54,7 @@ Threads run independently of other threads or code in Lucee. Lucee does not the Threads are mainly used to retrieve data from the database, cfhttp, or webservice. Threads are used when it does not matter how much time it takes to execute. -### Example 2 +## Example 2 Here we see an example using multiple threads in Lucee. All threads run in parallel. @@ -86,7 +86,7 @@ dump("done in #getTickCount()-start#ms"); The above example shows five threads running in parallel. The thread action="join" line waits for all threads to finish. `cfthread` returns struct info of all thread statuses. -### Example 3 +## Example 3 Threads can also be used to perform long-running tasks asynchronously. @@ -138,7 +138,7 @@ dump("done"); ``` -### Example 4 +## Example 4 Lucee members often discuss how to extend functionality to make Lucee easier to use or adding other new functionality. @@ -185,7 +185,7 @@ for(i=0; i<10; i++; true) { Another planned enhancement is to extend parallel to the loop by simply adding `parallel=true`. It will execute the body of the loop in parallel. -### Footnotes +## Footnotes Here you can see the above details in a video: diff --git a/docs/recipes/xml_fast-easy.md b/docs/recipes/xml_fast-easy.md index 7bb79029d..e7cf71c09 100644 --- a/docs/recipes/xml_fast-easy.md +++ b/docs/recipes/xml_fast-easy.md @@ -18,6 +18,8 @@ ] } --> +# XML Fast And Easy, using SAX - Listener Functions + This document explains how to use XML parsing in Lucee. I have XML as shown below: @@ -423,7 +425,7 @@ The example above executes and returns a result array which contains only the ye You can modify the component as you like. Instead of storing the array, you can store the result in a database or mail, or whatever you like. -### Footnotes ### +## Footnotes You can see the details in this video: [Xml-Fast and Easy](https://www.youtube.com/watch?v=_AP6GpVk7TE) \ No newline at end of file