CodeIgniter4 join table alias

Here is an example of joint tables using alias.

 

Auto Refresh Grid Data In ExtJs7.x

Using Ext.TaskManager we can refresh a grid in certain interval.

Here is an example:

In this example, the grid is refreshed each minute.

End!

ExtJs Grid load data via POST method

In ExtJs7.x, a grid load data uses GET method by default. However sometimes we want to load a grid using a POST method, then we need to adjust the proxy config.

Here is an example:

The key is actionMethods.

Now the grid could load data by sending POST method, but the parameters are sent via params like form fields. With config paramsAsJson, the request parameters can be sent as json data.

The full config is: Continue reading

Remove ExtJs7.x MenuItem empty icon space

Menu items with no icon still have the space allocated on the left of the button. If you wish to remove that space so the menu item text has no left padding, it can be done as follows.

In Application.scss add CSS class hide-menu-icon :

Continue reading

Getting Items From ExtJs7.x Toolbar

The code below shows an example of getting items from a toolbar:

The code here gives a brief demonstration of how to change the backgroud color of buttons in a toolbar by iterating over the toolbar’s items . Continue reading

Writing XML Document to InputStream using dom4j

When tring to upload a XML file to AWS S3, I found that it’s not allowed to create a tmp file in server local, so I had to transfer the file as InputStream at first and upload it later.

This is the code of transfering the XML Document instance to InputStream and Byte array:

As dom4j is been used to generate the XML, some classes from which (e.g. Document, XMLWriter) can be found in the code.

Uploading files to AWS S3 By Java SpringBoot

This is a demo of uploading files to AWS S3 using Java SpringBoot.

First, we need to add the dependency of AWS S3:

Then add these configs in application.yml:

The accessKey, secretKey and bucket is nesscessary which can be found in aws’ admin dashboard. Continue reading

Reading files from SpringBoot resources folder

Reading files from a SpringBoot jar is something a little complex.

I had tried to read a file from springboot resources folder using java.io.File. This is the code:

And I got the FileNotFoundException :

Since there is no path like file:/data/www/htdocs/my-app/lib/my-app.jar!/BOOT-INF/class existed in my computer, I got the exception. Continue reading

Package all files in Java resources’ subdirectories

Maybe mvn clean package is one of the easiest operation in java programing. Howerver, I recently encountered a problem of packaging, which took up some of my time.

This was the initial package config in maven pom:

And this is the path of the file I wanted to package and read:

Executing the package command (mvn clean package) and opening the jar with compression software (e.g. WinRAR), the file was expected to locate at BOOT-INFO/class/template. However I could not find it. Though all files in resources folder directly existed, the others in subdirectories was not there. Continue reading

Markdown – Embedding Code Snippets In Code Snippet

When tried to show how to insert code snippets in markdown, I found that I didn’t know how to insert code sinppets in code snippet.

Helped by Google, I finally got the solution.

We can embed code snippets into Markdown text by:

  1. intending 4 or more spaces, or a tab as code block
  2. using triple backticks plus a syntax language code delimiter at the beginning and triple backticks at the end of code block

Interactive use of the two ways can help us write a demo of inserting code in markdown. Continue reading