Common programming mistakes in Liferay – GPT generated

Generated using my GPT: https://chat.openai.com/g/g-uOPo2Wffl-liferay-helper-works-on-open-internet

Common programming mistakes in Liferay often stem from overlooking best practices in both Liferay-specific and general Java development. Some of these mistakes include:

1. Ignoring Liferay’s MVC Framework: Developers sometimes bypass Liferay’s built-in MVC framework for portlets, which can lead to more complex code and maintenance issues. Using Liferay’s MVC framework ensures better integration and easier upgrades.

2. Not Utilizing Service Builder Effectively: Service Builder is a key tool in Liferay for creating persistence layers. Neglecting its use or misusing it can result in inefficient database operations and difficulties in leveraging Liferay’s service-layer capabilities.

3. Hardcoding Configuration Values: Hardcoding values like file paths, URLs, or configuration settings in the code makes the portlet less flexible and more difficult to manage across different environments.

4. Overlooking Permissions and Security: Failing to properly implement permission checks can lead to security vulnerabilities. It’s crucial to use Liferay’s permission framework to control access to different parts of your application.

5. Poor Resource Cleanup: Not properly releasing resources such as database connections, streams, or temporary files can lead to memory leaks and performance issues.

6. Mismanagement of Liferay Contexts: Misunderstanding the differences between the global, site, group, and user contexts can lead to incorrect data handling and display.

7. Inefficient Use of Liferay API: Overusing or misusing Liferay’s API, such as making unnecessary calls to services or using them inappropriately, can lead to performance bottlenecks.

8. Not Adhering to Modularization: Ignoring Liferay’s modularization, especially with OSGi, can lead to tangled dependencies and challenges in maintaining and upgrading applications.

9. Ignoring Front-End Performance: Neglecting front-end performance, like overloading pages with unnecessary scripts or heavy resources, can degrade user experience.

10. Lack of Error Handling: Insufficient error handling and logging can make it difficult to troubleshoot and resolve issues in production.

Avoiding these mistakes involves a deep understanding of Liferay’s frameworks and best practices in Java web development. Regular code reviews, adhering to coding standards, and continuous learning about Liferay’s features are key to minimizing these common errors.

For further inquiries or assistance, feel free to reach out at Neil@HarwaniSystems.in, visit my blog at www.TechAndTrain.com/blog, check my website www.HarwaniSystems.in, or connect with me on LinkedIn at https://www.linkedin.com/in/neil27/.

What are some of the best practices for Liferay? – Using three separate GPTs

Generated using my GPT – Liferay Guide – Via official sources of Liferayhttps://chat.openai.com/g/g-4G5XuBdpL-liferay-guide-via-official-sources-of-liferay

Adhering to best practices in Liferay ensures that you leverage the platform effectively for enterprise solutions. Here are some key best practices to consider:

1. Modular Development: Embrace Liferay’s modular development approach using OSGi. Develop customizations in modules, rather than monolithic plugins, for better manageability and upgradeability.

2. Use Liferay’s APIs: Leverage Liferay’s extensive APIs for custom development. This ensures compatibility and takes advantage of Liferay’s built-in features and best practices.

3. Front-End Development: Utilize Liferay’s front-end frameworks (e.g., AlloyUI, Liferay Clay) to maintain consistency in UI/UX design and to ensure compatibility with different browsers and devices.

4. Performance Tuning: Regularly monitor and optimize performance. This includes database tuning, proper caching strategies, and optimizing assets like JavaScript and CSS.

5. Security Best Practices: Implement security best practices such as regular audits, using Liferay’s roles and permissions effectively, and keeping Liferay and its dependencies up to date.

6. Effective Use of Liferay DXP Features: Take full advantage of Liferay DXP’s features like staging, workflow, and audience targeting to enhance the user experience.

7. Customization with Hooks and Ext Plugins: Use hooks and ext plugins judiciously for customizations that cannot be achieved through Liferay’s built-in features or APIs.

8. Version Control and Continuous Integration: Implement version control (e.g., Git) and continuous integration practices for efficient and error-free deployment.

9. Backup and Disaster Recovery: Regularly back up your Liferay instance and database. Have a disaster recovery plan in place to handle unforeseen events.

10. Documentation and Knowledge Transfer: Maintain comprehensive documentation for your customizations and configurations. This is crucial for future maintenance and knowledge transfer.

11. Community Engagement: Engage with the Liferay community through forums, blogs, and events. This can provide additional insights and help in problem-solving.

12. Regular Updates and Maintenance: Keep your Liferay installation updated with the latest patches and versions. This helps in leveraging new features and maintaining security.

13. Testing and Quality Assurance: Implement rigorous testing (unit, integration, system) to ensure custom developments work as intended and do not adversely impact other parts of the system.

14. Accessibility Compliance: Ensure that your Liferay site is accessible, following standards like WCAG, to make it usable for people with different abilities.

15. Mobile Responsiveness: Design your sites and applications to be responsive, ensuring they work well on various screen sizes and devices.

Remember, these best practices are guidelines and should be adapted based on your specific use case and organizational needs. For more detailed and situation-specific best practices, consulting Liferay’s official documentation or reaching out to their support can be beneficial.

Email me: Neil@HarwaniSystems.in

***************************************************

Generated using my GPT – Tech Tower Guidehttps://chat.openai.com/g/g-cELlz9ieP-tech-tower-guide

Liferay, known for its powerful and flexible digital experience platform (DXP), can be optimized through several best practices:

1. Modular Development: Emphasize on modular development by using OSGi modules. This approach helps in creating scalable, maintainable, and reusable components.

2. Service Layer Abstraction: Maintain a clear separation between your business logic and Liferay’s core functionality. This abstraction ensures that your custom code is decoupled from the platform, making it easier to manage and upgrade.

3. Performance Optimization: Implement caching strategies, optimize database interactions, and manage resource-intensive operations carefully to ensure optimal performance. Regular performance testing is crucial.

4. Front-End Development: Utilize Liferay’s built-in front-end frameworks and tools. Ensure that the UI is responsive and accessible. Employ web standards and best practices in front-end development.

5. Security Practices: Follow Liferay’s security recommendations. Regularly update Liferay and its dependencies to protect against vulnerabilities. Implement proper authentication, authorization, and data validation practices.

6. Customization with Extensions: Prefer extensions over core modifications. Use Liferay’s extension points to add or modify functionality without altering the core codebase, which simplifies upgrades.

7. Effective Use of Liferay APIs: Utilize Liferay’s APIs for various functionalities instead of creating custom solutions from scratch. This leverages Liferay’s built-in capabilities and ensures compatibility.

8. Code Quality and Standards: Adhere to coding standards and best practices. Conduct regular code reviews and utilize static code analysis tools to maintain high-quality code.

9. Version Control and Continuous Integration: Implement version control using systems like Git. Use continuous integration and continuous deployment (CI/CD) practices for efficient and error-free deployments.

10. Backup and Disaster Recovery: Regularly backup Liferay data and configurations. Have a disaster recovery plan in place to handle system failures without significant data loss or downtime.

11. Training and Documentation: Ensure that your team is well-trained on Liferay and maintains comprehensive documentation for any custom development or configurations.

12. Community Engagement: Engage with the Liferay community. The community is a rich source of information, support, and innovation.

Adopting these practices will help in maximizing the effectiveness and longevity of your Liferay implementation. For more detailed insights and guidance on technology and management, feel free to visit our website at www.HarwaniSystems.in and our blog at www.TechAndTrain.com/blog. For further discussions, you can also contact us at Neil@HarwaniSystems.in.

****************************************

Generated using my GPT Liferay Helper – Works on open internet: https://chat.openai.com/g/g-uOPo2Wffl-liferay-helper-works-on-open-internet

Best practices for Liferay development and deployment encompass a range of areas, including coding standards, performance optimization, security, and deployment strategies. Here are some key best practices:

1. Adhere to MVC Architecture: Liferay follows the Model-View-Controller (MVC) architecture. Adhering to this pattern in your custom developments ensures maintainability and scalability.

2. Use Liferay Service Builder: For creating persistence layers, the Liferay Service Builder is highly recommended. It simplifies database operations and ensures consistency across different database systems.

3. Modular Development: Embrace OSGi-based modular development. Develop features as separate modules rather than monolithic applications. This enhances maintainability and allows for easier upgrades.

4. Liferay’s API and Tag Libraries: Utilize Liferay’s extensive API and tag libraries to leverage built-in functionalities rather than creating custom solutions from scratch.

5. Front-End Development: Follow Liferay’s front-end guidelines, including using Liferay’s front-end framework (AlloyUI or Clay, depending on the version) and responsive design principles.

6. Performance Optimization: Pay attention to performance best practices, such as efficient database interaction, caching strategies, and optimizing resource loading (JavaScript, CSS).

7. Security Best Practices: Follow security best practices like input validation, proper authentication and authorization, and secure communication (HTTPS).

8. Effective Use of Liferay Hooks: Use Liferay hooks for customizing Liferay’s default behavior instead of modifying Liferay’s core files directly.

9. Testing and Quality Assurance: Implement comprehensive testing, including unit tests, integration tests, and functional tests. Liferay’s testing framework should be used for this purpose.

10. Deployment and Versioning: Use tools like Git for source control and Maven or Gradle for dependency management and build processes. Follow semantic versioning for your modules.

11. Liferay Upgrades: Regularly update your Liferay installation to the latest version to benefit from security updates, bug fixes, and new features.

12. Documentation and Code Comments: Maintain thorough documentation and code comments for future reference and easier maintenance.

13. Logging and Monitoring: Implement proper logging and monitoring for easier troubleshooting and performance tracking.

14. Community Involvement: Engage with the Liferay community through forums, blogs, and events to stay updated with the latest practices and solutions.

Following these practices ensures that your Liferay projects are robust, maintainable, scalable, and secure. These practices are in line with general best practices in software development but are tailored to fit the Liferay ecosystem.

***********************

Email me: Neil@HarwaniSystems.in

Performance Tuning in Liferay – Part 3

You will find the part 1 & 2 of this series on Performance Tuning in Liferay here:

Performance tuning in Liferay – Part 1 | LinkedIn

Performance tuning in Liferay – Part 2 | LinkedIn

Further to above, find below some tips on Performance Tuning as part 3 of the series.

  • Explore Java 11 instead of Java 8 with Liferay. Java 11 has performance and concurrency improvements. Check your compatibility matrix for compatibility.
  • Explore various types of Garbage collection options – In my experience for certain scenarios G1 is especially helpful: Types of Garbage Collector in Java – Javatpoint
  • Explore fragment caching button and option if you are using fragments
  • Fine tune your Heap Size, analyse your heap dump, queries in Glowroot, MBeans in Glowroot to change EHCache values in Liferay – Make this an ongoing exercise
  • Explore fast load css, fast load javascript, minifier, no pragma and cache.browser.disabled, users.update.last.login configurations
  • Explore configuration in control panel for documents and media for private and public cache
  • Upgrade and map to latest quarterly release, generally they have improvements
  • Explore row lock error, Ora-1795, etc. settings in help center which cause known issues while scaling and workarounds for which are added in Help Center
  • While doing performance tuning, do a warmup with low users to fill up cache of Liferay before actual testing – clear all 4 types of cache in CONTROL PANEL -> SERVER ADMINISTRATION when you make web content or other changes for them to reflect properly before load test
  • Be cognizant of load times on JMeter and browser both – different configurations affect both differently

Email me: Neil@HarwaniSystems.in

My observations on pedagogy in executive education (Work integrated learning programs) – Part 1

Executive education fundamentally is different from education for younger adults by many ways who are just out of school. Listing below some observations for executive education which results in overall success for executives:

  1. More focus on open book rather than closed book exams.
  2. Focus on case studies and take-home assignments, quizzes, projects rather than in class closed book assignments and assessments.
  3. Focus on grades and application of concepts rather than percentages, derivations and fundamental equations.
  4. Lesser number of evaluations compared to normal education.
  5. Course dispersed over a larger period / duration compared to similar ones in normal full-time education with similar content.
  6. Concept of residencies and weekend / evening / flexible teaching.
  7. Integrated experiential learning based on experiences from executive’s jobs or business with lot of peer learning.
  8. More focus on skills, values, ethics, cases, experiences, certifications, networking, practical’s and similar compared to traditional degree granting education.
  9. Focus on industry-based learnings, interactions, master classes and leadership ability development.
  10. Mostly hybrid / online / flexible / mixed learning modes.
  11. Less focus on placement activities.
  12. Specialized, focused and tailored to audiences rather than a generic, fit all approach of traditional degrees.

Email me: Neil@HarwaniSystems.in

Security & Cookie links @ www.Liferay.com – Part 1

List of Liferay security & cookie related links which includes Cookies, XSS, CSRF, OWASP, CORS, SSO, IAM, Service Action Policies and more:

  1. Known vulnerabilities: Known Vulnerabilities – Liferay
  2. Security statement: Security Statement | Liferay
  3. LXC Cloud security: DXP Cloud Security | Liferay
  4. Securing Liferay page: Securing Liferay – Liferay Learn
  5. Help center DXP 7.0: Liferay DXP Security Overview – Liferay Help Center
  6. Help center DXP 7.1: Introduction to Securing Liferay DXP – Liferay Help Center
  7. Administration security: Security – Liferay Learn
  8. Search security DXP 7.2: Installing Liferay Enterprise Search Security – Liferay Help Center
  9. Search security DXP 7.1: Installing Liferay Enterprise Search Security – Liferay Help Center
  10. Securing ElasticSearch DXP 7.3/7.4: Securing Elasticsearch – Liferay Learn
  11. Reporting security issues: Reporting Security Issues – Liferay
  12. Liferay product cookies: Liferay Product Cookies – Liferay Help Center
  13. Cookie list: Cookies list that could be found in a Liferay Portal and their usage – Liferay Help Center
  14. Login cookies: List of Cookies That Are Affected at Liferay Login – Liferay Help Center
  15. Liferay cloud cookies: Liferay Cloud cookies – Liferay Help Center

Email me: Neil@HarwaniSystems.in

Keywords (Glossary) for Generative AI – Part 1

Here are some important keywords in the ecosystem of Generative AI – Part 1:

  • Transformers
  • Natural language prompts
  • Large language models
  • ChatGPT
  • Bing Chat
  • Bard
  • LLaMA
  • Stable Diffusion
  • Midjourney
  • DALL-E
  • GPT
  • LAMDA
  • BLOOM
  • GitHub Co-pilot
  • NVidia
  • AMD
  • PaLM
  • DeepFakes
  • OpenAI
  • Bias
  • Hallucination

References:

General checklist for performance tuning & go-live in Java – Part 1

Here is a general checklist for performance tuning & go-live in Java – Part 1:

  • Servers: CPU, Memory, Threads, Network configurations, page size, hardening and more
  • JVM: MBeans, Security, Garbage collection type and settings, Arguments, Heap, Version, Core allotment, Generations and more
  • App server: Thread pool, JDBC/JNDI, Type of connection pooling, Session replication, caching, log rotation, log levels and more
  • Database: Indexing, Thread pool, Privileges, Connections, Top queries/plans and more
  • Network: Latency, DNS, Security, Firewalls/WAF/CDN
  • Other components like search/filestores/integrations/etc.: Caching, thread pools and more
  • VAPT/Security: SSL, OWASP, SAST/DAST, CSP, code quality and more
  • Documentation on architecture, deployment, requirements, design and more
  • APM/Monitoring tools – Instrumentation, gauges and more
  • Thread profiling and heap dumps
  • Service profile for APIs
  • Code optimization
  • Optimum auditing, reporting & SSO/IAM
  • Reusable patterns / architecture styles and designs for performance, usability & security
  • DevSecOps strategy and implementation
  • DR strategy and implementation
  • Regular load & performance tests
  • Horizontal scaling / clustering & vertical scaling
  • Rule of thumb: Work layer by layer and tackle the biggest problems first.

Email me: Neil@HarwaniSystems.in

What you should not be doing in Liferay – Part 1

Here is a list of what you should not be doing in Liferay – Part 1 and also what you should be doing written right next to it in place of the wrong things:

  • Write JDBC calls in portlets. Avoid JDBC calls in portlets. Please explore expando, service builder, dynamic queries and such from Liferay.
  • Run elasticsearch & database in embedded mode in production. This is to be avoided always. For production and especially clustering, use remote elasticsearch and separate database.
  • Use simple filestore for large number of documents. Right from the start prefer using advanced filestore.
  • Forget to switch off developer settings in portal-ext.properties and verbose level of tracing in logs. Please switch off developer settings and verbose level tracing in logs.
  • No performance testing and tuning of system before go-live. Please perform performance testing and tuning including GC / JVM / Caching / etc. for Liferay. Install Glowroot right from the start if possible in central pattern.
  • Not configure security for various parts of the system. Configure SSL, xpack security for search. Explore the security page on Liferay Learn for various configurations. Perform VAPT at the start.
  • Not enabling SSO. If SSO will be required in future, please enable it right from the start so that there are no user problems later. Also, it helps to reduce load on Liferay CPU of encryption.
  • Not refer official documentation. Please refer liferay.dev – forums, blogs, learn.liferay.comhelp.liferay.com, help center articles, Liferay Learn YouTube channel and more from the start.
  • Not explore commerce, objects, publications, headless APIs, blueprints, asset library, fragments and such features. Please explore all this right from the start.
  • Not explore benchmarking, performance, compatibility matrix whitepapers. Please explore them before go-live. There are lot of resources under resources section on Liferay.com including case studies, whitepapers and more.
  • Not create go-live, integration, deployment diagram, architecture and such documents at the start. Please create go-live, integration, deployment, architecture, design documents from the start.
  • Check Glowroot only when you face a problem. Instead, check your Glowroot regularly on weekly basis at least.
  • Not size the infrastructure requirements for NAS/SAN for filestore and DR strategy. Please plan your infrastructure requirements in terms of NAS/SAN, servers for Liferay, database, elastic and others like web server before go-live.
  • Not doing regular maintenance. Routinely do maintenance of Liferay, database, Elasticsearch, webserver and more by checking logs, JVM, CPU/memory usage, configurations and more.
  • Not checking your lighthouse score incase of public websites. Regularly optimize your lighthouse score incase of public facing websites.
  • Not have a DevSecOps strategy in place. Please create a CICD pipeline, DevSecOps strategy and implementation with Git style repository to manage things properly.
  • Not have an upgrade plan mapped to quarterly release of Liferay. Please have an upgrade plan mapped to quarterly releases of Liferay.

Email me: Neil@HarwaniSystems.in

Performance tuning in Liferay – Part 2

Following up on the Performance tuning in Liferay – Part 1 post – here are some additional points for performance tuning:

  1. The blue circle in Glowroot slow traces indicates that the transaction is still ongoing whereas yellow indicates it’s completed. Red indicates there is an error.
  2. You can change the JVM gauges as needed to see lot of different types of details of JVM
  3. You can use instrumentation from configuration using type ahead drop down (AJAX style)
  4. You can allocate specific cores to a JVM if need be using an argument on core allotment
  5. You can see thread profiles and take heap dumps from Glowroot itself
  6. Glowroot has sections on errors, queries and service calls
  7. You can get Glowroot to sustain it’s data through restarts using arguments
  8. For frequent garbage collection, check if some queries, etc. are continuously filling up memory and any fine tuning on caching can help
  9. It helps to follow these sections in no particular order and check them regularly: JVM – guages, MBeans (You can search your cache related things here – it’s like seeing things in VisualVM), threads and more, transactions, slow traces (all three areas throughput/etc.), thread profiles (search “blocked” here), queries, service calls, errors, sorting options in transactions, instrumentation, etc.
  10. Latest Glowroot works with Java 11 that is compatible with Liferay for customizations and product usage but not source code compile. This latest Glowroot gives lot many more options especially in transactions.
  11. If you are using Java 8, check if your Glowroot version is compatible with it. Typically 0.13.6 and below are compatible with Java 8 as far as I know.

Email me: Neil@HarwaniSystems.in

Performance tuning in Liferay – Part 1

Expanding on my post here on performance tuning: Post | Feed | LinkedIn

Below are the main points to work on for a performance tuning engagement in Liferay – Part 1.

  • Firstly, we need to find out what is slow: Database, service calls, elastic search, memory is an issue, threads are blocked / waiting, how much memory is a module taking, logs are printing what, etc.
  • Check your configurations as per this post: How to debug Liferay? – Some pointers – Part 1 | LinkedIn
  • Install Glowroot if possible, in central pattern and check following sections in it: slow traces, errors, service calls, threads, heap, instrumentation, configurations and so on for the problem timeframe.
  • You can enable tracing in logs & Glowroot instrumentation on targets. You can also use plugins by Fabian Bouché like for fragment analysis or follow his blogs on www.liferay.dev/blogs for using Glowroot in upgrades.
  • The above will give you hints on what is slow. Especially open the FLAME graphs and threads along with heap dumps to analyze which threads are blocked or waiting, how much memory is allocated to what in slow traces of modules and so on.
  • Then run a load test in simulated environment after checking compatibility matrix to get latest statistics for various scenarios like web content on portlet or in fragment, API calls, integrations, heavy load on Elasticsearch and so on with experimentation on themes.
  • After getting the slow threads and details in flame graphs plus slow traces, if it’s custom code or configuration or DB call or ES which is slow, optimize it like Hikari pool connections or if it’s source code of Liferay, open the GITHUB repo for Liferay portal, check the source code and reach out of Customer Success / Global Services / Support with inferences depending on your engagement in account. Your Customer Success Manager or Sales can guide you on this.
  • GS / CS will work internally in Liferay to get you the best options and / or patches in case they already exist. Many a times this could also have been fixed in a Hot fix or Fix Pack already. Alternatively, configurations could also solve such problems many a times. To check these go to Liferay customer portal and check the changelog for fix packs. You can also refer to Liferay Learn and Help Center for help articles and tutorials.
  • Various areas of performance tuning: Database, HTTP calls, App server, ElasticSearch, Threads, Heap optimization, Caching and more. We will follow up this post with more pointers on performance tuning in Part – 2. A good list of areas is to check in the deployment guide for your version.
  • Thanks to Fabian Bouché David Nebinger and many more at Liferay Global Services / Support / Customer Success and Customer Support / Engineering due to which I am able to compile the above. Above is a compilation of work from many sources internally in Liferay via work with customers & externally which hopefully should help many of Liferay customers and partners. This also serves as a case study on performance tuning.
  • Email me: Neil@HarwaniSystems.in

Ideas on Innovation around Technology. We Thrive On Ideas. We are Learner Centered, Open Source & Digital Focused.