Thursday, April 11, 2024

How to make php artisan to run on different port

When we want to run two servers on the same machine we may need to have two different ports.  We can change the default port for the Artisan development server by two ways.
        1. Changing the port number in env file.
        2. Through port argument to php artisan command.

1. .Env file change: 
        you can add the parameter SERVER_PORT to the .env file in the root directory of your project. Then, you can use the command php artisan serve to start the server with the new port. The default port is 8000, but serve will scan up to port 8009 for available ports

2. Passing argument to the command
        We can pass the --port argiment to php artisan serve command and run it to start the localhost server on the specified port
        php artisan serve --port:8080

       
Artisan Serve Improvements

In previous releases of Laravel, Artisan's serve command would serve your application on port  8000. If another serve command process was already listening on this port, an attempt to serve a second application via serve would fail. Beginning in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing you to serve multiple applications at once.

Monday, April 8, 2024

Various collaboration options with a company on research product development

Collaborating with a company on research and product development without significant financial impact on your organization can be achieved through various arrangements. Here are some options:

1. Joint Research Agreements (JRAs):
- JRAs allow companies to share resources, expertise, and risks in research projects.
- Both parties contribute resources such as personnel, equipment, and facilities.
- Costs and benefits are shared based on agreed-upon terms.

2. Grant Funding: - Seek grants from government agencies, non-profit organizations, or industry consortia to fund collaborative research. - Grants can cover project costs, including personnel salaries, equipment, and materials. - Many grants specifically support collaborative projects between academia and industry. 3. Sponsored Research: - Companies can sponsor research conducted by your organization. - The sponsor provides financial support for the research project without direct involvement in its execution. - Intellectual property rights are typically negotiated in sponsored research agreements. 4. In-kind Contributions: - Companies can contribute resources other than money, such as equipment, materials, or access to proprietary data or technology. - These contributions can significantly reduce the financial burden on your organization. 5. Technology Licensing: - If your organization has developed intellectual property relevant to the company's interests, consider licensing it to them. - The company can then take the lead in further development and commercialization, while your organization receives licensing fees or royalties. 6. Collaborative Grants: - Identify grant opportunities that specifically encourage collaboration between academia and industry. - Collaborate with the company to jointly apply for such grants, leveraging each other's expertise and resources. 7. Joint Development Agreements (JDAs): - JDAs outline the terms of collaboration between two parties to jointly develop a product or technology. - Costs and risks are shared, with each party contributing resources and expertise. 8. Crowdfunding: - Consider crowdfunding platforms to raise funds for specific research projects. - This approach allows you to engage the public and potentially attract funding without relying solely on your organization's finances. 9. Revenue Sharing Agreements: - If the collaborative project leads to commercialization and revenue generation, negotiate revenue-sharing agreements with the collaborating company.
When considering any collaboration, ensure that the terms are clearly defined in legally binding agreements to protect the interests of all parties involved. Consult with legal and financial advisors to navigate the complexities of collaborative arrangements effectively.


cvc-complex-type.2.4.a: Invalid content was found starting with element 'base-extension'. One of '{layoutlib}' is expected Error in Android


We were facing this issue many times when we download project from github. We are using new Android studio. 

Error was: cvc-complex-type.2.4.a: Invalid content was found starting with element 'base-extension'. One of '{layoutlib}' is expected. 

This is not the gradle issue. When we search this over internet, we get lot of answers as it's a gradle issue. But following all those solutions are in vain as this is not actually a gradle issue.

We solved this issue with some experiments. 

Android SDK configuration file ~/Library/Android/sdk/platforms/android-32/package.xml has an extra tag named base-extension compared to the same file of other API levels. Removing this tag solves the problem.
Delete downloaded Android API 32 SDK Platform from SDK Manager (Tools → SDK Manager) also solves the problem (you can redownload after deletion). Maybe the Android studio team noticed the problem, redownloading API 32 platform files, the base-extension tag disappeared from the API 32 package.xml








Sunday, April 7, 2024

Do's and Don't for a database maintenance

Here I have listed some do's and don'ts for a database project.

Do's for a Database Maintenance Project:

1. Regularly perform database backups to prevent data loss in case of system failures or disasters.
2. Monitor database performance metrics such as CPU usage, memory usage, and disk I/O to identify potential bottlenecks.
3. Implement database maintenance tasks such as index rebuilds, statistics updates, and data purging to optimize performance.
4. Conduct regular security audits to identify and mitigate vulnerabilities in the database system.
5. Document all changes made to the database structure or configuration to maintain an audit trail and facilitate troubleshooting.
6. Schedule regular downtime for maintenance activities and communicate it to stakeholders to minimize disruptions.
7. Keep database software and associated tools up to date with the latest patches and updates to ensure security and stability.
8. Test database backups and disaster recovery procedures regularly to verify their effectiveness.
9. Implement access controls and encryption mechanisms to protect sensitive data stored in the database.
10. Establish performance baselines and thresholds to proactively identify performance degradation and take corrective actions.

Don'ts for a Database Maintenance Project:

1. Don't neglect regular database maintenance tasks such as backups, index optimizations, and software updates.
2. Don't make changes to the database configuration or schema without proper testing and approval processes in place.
3. Don't ignore security vulnerabilities or delay applying security patches, as this exposes the database to potential security breaches.
4. Don't perform maintenance activities during peak usage hours without proper planning and coordination with stakeholders.
5. Don't rely solely on automated tools for database maintenance without human oversight, as they may not catch all potential issues.
6. Don't overlook performance tuning opportunities, as even small optimizations can have a significant impact on overall system performance.
7. Don't grant excessive permissions to users or applications, as this increases the risk of unauthorized access or data breaches.
8. Don't forget to document all maintenance activities and changes made to the database system for future reference and audit purposes.
9. Don't assume that backups are sufficient for disaster recovery without testing the restoration process regularly.
10. Don't overlook monitoring and alerting mechanisms to promptly identify and address any issues or anomalies in the database system.
 

Monday, March 11, 2024

RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

When I was trying to do a git clone, I got the below error:


The error was RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 0)
some bytes of body are still expected. Unexpected disconnect while reading sideband packet. Early EOF. 
I have gone through google to solve this issue. I found different solutions. Some of them even told it's due to network. You need to change the internet operator etc. But all in vain. The correct solution is , you need to increase the buffer size of http post with the below command

git config --global http.postBuffer 157286400
After this I was able to clone the repo properly.

Happy coding