All posts by meta_prasad

https://res.cloudinary.com/metasyssoftware/images/w_624,h_379/f_auto,q_auto/v1656401265/Custom-record-privileges-1/Custom-record-privileges-1.png?_i=AA

Editing & Restricting record access privileges – FileMaker

We will illustrate a case study to demonstrate how to restrict users with limited access from editing a record once it is created.

The Requirement

The client that manages their business processes via a set of FileMaker files, has different access levels for different users based on their specific assigned roles. The client has a demand to restrict access for specific users, to lock a record immediately after they create it. Once the record is committed and accepted, it cannot be modified. Here is an approach that explains how this was achieved for designated users.

The Process

FileMaker has built-in security feature to manage uncompromised access. To assign access to users with only create access and no modification access, a new privilege set is created under ‘Create Record Privileges’, with ‘View’ and ‘Create’ set to ‘yes’, and ‘Edit’ and ‘Delete’ set to blank as shown in the image. Field Access privileges is set as per requirement, in this instance, ‘Field Access’ is set to ‘all’.

Custom record privileges

In ‘Edit Privilege Set’, ‘Layouts’ level privilege is set to ‘All modifiable’, while ‘Value Lists’ are set to ‘All view only’ and Scripts set to ‘All executable only’. The ‘Available menu commands:’ is set to ‘All’.

Edit Privilege set

By following this approach, users with Limited access can create records and edit records that are created during the current active user session. Any other records created in earlier sessions, users do not have access to edit.

However, the catch is that this approach makes new records created during the active user sessions editable, which was not the specified requirement.

To be in par with client expectations, security settings were tweaked, restricting access to edit new records immediately after creation. The limited value under the Edit option was selected, with a condition so that only users with a specific privilege set can edit the records, in line with the client requirement.

New record

However, we discovered that this setting can vary as per the client requirements, and this approach may not always work. Consider a scenario where a user mistakenly commits a record. In this case, they won’t be able to edit the record again. Here is a probable solution.

The Global Fields

Global fields can be used to collect data temporarily through a separate Form. Data is saved using a script that is executed through a button. A confirmation can be obtained to save data along with a warning, indicating a record that cannot be edited once it is created. This way, users can decide when to save data.

FileMaker security settings, along with the Global fields give the expected results. For more information, feel free to contact our FileMaker experts.

https://res.cloudinary.com/metasyssoftware/images/w_624,h_416/f_auto,q_auto/v1656401319/pexels-cottonbro-5483149-1/pexels-cottonbro-5483149-1.jpg?_i=AA

Implementing Active Directory in a .NET application with Multiple Roles

The need for a directory of users arises when various devices are used on the same network. It is crucial to locate the directory on one central source, known as Active Directory. It helps validate and authenticate multiple users accessing all resources on the domain with a single sign-on.

In this blog, we will demonstrate how to implement Active Directory in a .NET application.

Login

What is Active Directory?

Active Directory is a database adapted by Microsoft to manage multiple devices on a single network. It also can be defined as a set of services that connect users with network resources they need to accomplish projects. In order to obtain access to devices, the network users require it to be validated.

Let us consider a C# .NET application to validate the users using Active Directory on the login page, before implementing Active Directory, we use ASP.NET membership to validate a user on the Login page. The code should look similar to the code below.

Code

Now, to create our own function to validate the user through Active Directory, we use the code below.

Code

VerifyUserAD accepts three parameters, namely, Username, Password and ReturnMsg. ReturnMsg returns the error message if the validation of the user fails against the Active Directory. Refer to the code below.

Code

Once the user is validated, the function VertifyUserAD returns an ‘authenticated’ message, based on which the user can take the following relevant actions.

To entirely bypass the ASP .NET membership, use the Active Directory to validate the user. For an existing application, users can maintain and access a copy of Users in the database, meaning there is no need to modify the whole application end-to-end.

Role-based implementation

For role-based implementation, we use the DirectorySearcher class to fetch the property ‘memberOf’ for that user in Active Directory, as shown in the code below.

Code

This enables users to find the list of Groups in which the user is assigned using the SearchResult.

Search result

Use the command below to install Directory Services using the package manager console.

Install-Package System.DirectoryServices

Hope this blog will help you in the implementation of Active Directory in Dot Net application. For more information on .Net services, please visit https://www.metasyssoftware.com/dot-net

https://res.cloudinary.com/metasyssoftware/images/w_624,h_416/f_auto,q_auto/v1656401331/pexels-thisisengineering-3861972/pexels-thisisengineering-3861972.jpg?_i=AA

How Custom Software Will Help You In Running Your Business In This Global Crisis?

2020 saw a seismic shift of the workforce from offices to peoples homes. Most businesses found they did not have the right software, systems and processes to handle day to day operations and functions anymore. It highlighted the need to focus not just on collaboration, communication and productivity. It became imperative for employers to make the health and safety of their dispersed workforce a top priority.

The global crisis hit businesses of all industries all across the globe. Companies realized that investing in custom software development can be beneficial as one-size-fits-all software was no longer efficient and adequate to meet the growing and challenging needs of the business.

Let us dive deeper into the topic of custom software development and understand how it helps businesses to achieve team collaboration, performance, safety, and scalability.

What Is Custom Software Development?

Custom software development is the process of designing and developing a software product to meet the specific requirements of a business. These software solutions include features, function, performance parameters, and security features to meet the organization-specific requirements and precisely address the firms’ customer needs.

Traditionally, banking transaction applications were typically off the shelf products or platforms. However, client interaction pre-Covid was based on face to face contact and physically signed documents. Banks that are digitizing these processes are doing it with custom solutions from the ground up so that it meets their internal processes, manages their risks and fulfils customers needs. Banks that have quickly innovated in this space are well placed to be leaders in the post-Covid world.

How is Custom Software effective amid this Global crisis?

Entrepreneurs find custom software effective in addressing new challenges in business. Below we outline the ways bespoke software could be an essential tool and an effective strategy for a business.

Cost-Effective

Custom software is your very own asset. You don’t need to pay for licensing, upgrades, user fees, etc. Companies get the flexibility to build a personalized app within their budget when they go for custom software. As revenues grow they can extend the functionality of the app. Cost-effectiveness has become a critical aspect now as Covid has hit revenues and profits. This makes custom software development an effective strategy today.

Automate Business Processes

When Covid hit the world, businesses’ had to enable work from home almost overnight. Work from home, however, brought challenges to meet productivity requirements. A custom-made software in this situation helps automate several day-to-day operations and business needs and keeps everyone involved, connected. Not to mention, tailor-made software is built with unique features which are necessary for your specific business. A product on the other hand will offer you several features, not all of which may be relevant to your business.

App Integration

Integration with other third-party applications is key to business success in today’s time. Mobile apps as an extension to your website or enabling digital payment processing on your company systems are just a few examples of app integration. Custom software allows you to develop and integrate new software or apps easily into your existing business processes. Companies that are looking to tweak their business processes during this covid crisis can find it helpful. One can handle complex business requirements through app integration in custom software.

Scalable

The current crisis has affected the demand and supply equations of different products and services. So scalability of business has become essential, and it can be achieved seamlessly with a bespoke software development company. Custom software can be used to improve scalability in business operations to move faster and eliminate inefficient processes and practices. With growth comes complexity in executing business operations, and custom software are designed to handle this.

Flexibility

The product owner has complete control over the interface design, the user experience, the custom features and functionalities. This can help companies differentiate themselves from their competitors and sustain growth.

Software Maintenance

Some custom software development companies offer a dedicated support team for the maintenance of the application. The experienced and skilled professionals render regular maintenance and in-depth support to your apps. Personalized support like this means that security vulnerabilities and technical challenges will be taken care of promptly. Custom App development companies offer flexible packages on a pay as you go basis.

Streamline Methodologies and Processes

When the global crisis hit businesses, one of the biggest challenges was to streamline methodologies and processes. Companies that operated from multiple locations and branches faced many problems. Custom apps help in streamlining processes within an organization and improving team collaboration. Bespoke software can be designed to have all business data in one centralized location and distribute it from there. Cross-functional teams sitting across multiple locations can easily access this data through custom software and make informed business decisions.

Finally…

Most companies find off-the-shelf solutions appropriate for some specific conditions. If you are looking to improve operations within your company during this pandemic or thereafter, then custom software solutions might be your best choice.

https://res.cloudinary.com/metasyssoftware/images/w_624,h_305/f_auto,q_auto/v1656401338/React-Context/React-Context.png?_i=AA

Effective use of Context in a React Application

The prerequisite to comprehend this article is a fair knowledge of Hooks. Hooks is a new addition in React 16.8 that let you use state and other React features without writing a class.

In a React application, we can pass data from parent component to child components using the prop. However, this is limited to certain type of properties such as Theme, locale preference, etc., which need to be used at global level in the application. With React Context, we can use the data or props without explicitly passing them as props to the component.

Context has three main elements. We need to understand these elements to utilize Context to the fullest.

  1. Context ObjectThe Context object is designed to share data globally in the application.
  2. Context ProviderThe Context object comes with a provider that can be used to consume Context data in the React component.
  3. Context Consumer The Context Consumer is wrapped inside the Context provider, and it is used to get access to the Context data.

In this article, let us see how to create a Theme Context using typescript step by step.

1.Create Theme Context Object. Export ThemeContext and set the Context default value to ‘undefined’.

Theme context object

2.Create the Theme object by using two Themes, for instance, here we are going to use ‘dark’ and ‘light’.

Create Theme Object

3.Create Theme Context provider.

Theme Context Provider

4.We created the Theme Context Provider by setting the Default Theme and function to change the Theme.

5.Subscribe Theme Context by wrapping the component with Context provider.

SubscribeThemeContext

6.Use or set the Context data as shown in the screenshot below.

Context data React

The concept of Context is simple yet effective. In this article, we covered how to use Context in the React Application with Theme Context example using TypeScript.

Should you have any queries, please contact MetaSys Software React experts, who have abundant experience in engineering applications using latest dev-tools such as React-Redux, React Hooks, React Router, React Bootstrap, etc.

You can reach out to us with any coding queries too! We would be happy to help!

Happy Coding!

https://res.cloudinary.com/metasyssoftware/images/w_624,h_372/f_auto,q_auto/v1656401352/Wordpress-security/Wordpress-security.png?_i=AA

Tips to Prevent WordPress Website Hack

WordPress is a well-known open-source PHP based CMS (Content Management System) platform used for writing blogs and developing websites. Easy accessibility of WordPress leads to a variety of threats and malware attacks. WordPress security is the highest priority for any organization that has a website. In addition, Google’s rule on blacklisting all websites with malware and threats, is yet another reason to consider WordPress security cardinal.

Reasons that lead to WordPress Website Hacking

There are umpteen reasons how and why a WordPress website is hacked. Here the top of the charts list.

  1. WordPress Update: WordPress is highly maintained and updated regularly and these updates need to be implemented on the WordPress website instantly. By ignoring WordPress website updates, one allows threats to harm your website. WordPress ensures that every latest updated version involves improvements and security updates, which addresses existing threats, and when a website is not adhering to these updates, the organization is exposing the website to threats, malware, and hacking.
  2. Default Admin Login: Even kids these days understand that the default URL for an admin panel login page is probably the most used link, for instance, com/wp-admin. This predictability makes it easy for attackers to hack/phish the website. Hackers and attackers usually try various combinations of username and password for hacking a program; setting an obvious or easy to hack username and password will aid bots crack the credentials and access the admin panel with ease, allowing the attackers to go ahead with their malicious activities.
  3. Common WordPress Folders: WordPress has common folders across all websites, such as Plugins folder, Themes Folder, Uploads folder, etc. The website owner can add a different folder, and so can hackers. They can enter malicious code in it.
  4. Insecure HTTP Server: A WordPress site can be hosted on an insecure HTTP server, which gives way to hackers to steal credit card information by intercepting the connection.
  5. Inactive Users: Users, especially Administrators, have access to modify content, and every User with a weak Username and Password is a threat to the website. When it is necessary to retain users, it is advised to change the role of the User from Administrator to Subscriber to avoid weak links.

Measures to ensure WordPress Website Security

  1. Keep it up to date: Keep your WordPress, plugins and themes up to date with their respective latest versions. Every new version of WordPress brings new features along with bug fixes and security fixes. Avoid unnecessary plugins and themes to reduce the vulnerability of the website. Always download plugins and themes only from trusted sources. Reading about the plugins, checking the reviews and number of downloads will help make the decision. Also, ensure that these plugins and themes sources provide regular updates, meaning even if there are bugs, the source should ensure an update or a fix.
  2. Security Firewall Plugin: Install a security firewall plugin to scan your website regularly. The firewall plugin allows periodic scanning of the website, malware removal, and track any update on the website such as login details, documents trail, suspicious login attempts, etc.
  3. Customize Admin URL: Change admin login default URL /wp-admin to your custom URL using the updated plugin and limit the wrong login attempts, to reduce the exposure to unauthorized users.
  4. Rename WordPress Database Prefix: While setting up a website, the default prefix used for the database is ‘wp_’, and most admins ignore changing the default settings, making it easier for hackers. Spammers and hackers run codes that mass attack ‘wp_’ files. Rename the default WordPress database prefix, rename WordPress tables, and User Meta tables. Always remember to backup WordPress files before making any changes.
  5. Avoid Common Usernames: Admin, wp-admin, etc., are truly common usernames that do not hold any strength against hackers. Using these usernames for the primary administrator user account makes the website vulnerable and easy to hack. Always have complex usernames and never have a username that appears anywhere on the website; for instance, you should not have an author name as is as a username.
  6. Strong Password: Using a strong password is given. However, users do not pay great attention to work-related passwords as much they need to. As a brand guideline, encourage all users to use unique username and passwords. Every password should be at least eight characters and should include all of the following.
    1. One uppercase
    2. One lowercase letter
    3. One number
    4. One special character
    5. No spaces
  7. Timely Backup: Be prepared for any adversity that the future holds, and make regular backups of all files and databases of WordPress website. Even in drastic conditions where an administrator is locked out, the backups can come handy.
  8. Disable PHP Execution: Block the PHP execution to untrusted folders manually by using the .htaccess file or plugin. Folders such as uploads, themes, plugins by default have read and write access, ensure these rights are allocated based on user roles.
  9. SSL Certificates: Secure WordPress website through Secure Sockets Layer (SSL) to avoid any data leaks. Run your website HTTPS server to protect the data from getting stolen.
  10. User Rights: There are five different default users in WordPress. Each role has its own significance. Understand the user roles and assign access rights for each user role. Always remove access to any abandoned users. If an employee leaves an organization, the respective User should be either removed or transferred based on the requirement. Any unused or dormant user can be a weak link for hackers to enter.

Ensuring these measures are implemented effectively will close doors to any hackers or spammers or anyone phishing.

WordPress is an Open Source CMS which is free, but it does have some paid plugins. To secure the WordPress website, we need to take some actions on a regular basis. Always keep security and firewall plugins active to avoid all vulnerabilities. The best way is to keep a regular tab on your website and have a monthly or a fortnightly maintenance calendar to avoid missing out on any checks and maintain a secured website.
MetaSys has hands-on experience for more than two decades in providing custom software solutions. If you are looking for a WordPress expert to help you with WordPress website development or WordPress Security integration, you are at the right place. Get in touch with us and we will solve all your tech challenges.

Happy Coding!

https://res.cloudinary.com/metasyssoftware/images/w_624,h_324/f_auto,q_auto/v1656401394/Monolith-and-Microservices/Monolith-and-Microservices.jpg?_i=AA

What, Why, and How of Microservices?

What are Microservices?

Historically applications were Monolithic applications where the architecture was a unified and closely coupled integrated unit. Microservices, on the contrary, are smaller independent unified business modules. Each module in Microservices performs its own unique business functionality, at times with dedicated databases.

Monolith and Microservices

As shown in the above image, the architecture of Microservices consists of independent smaller units, which are interconnected and managed with the help of API Gateway.

Why opt for Microservices instead of Monolithic Applications?

A Monolithic application is a big container with a collection of different smaller independent parts combined and coupled tightly together, which creates varied inseparable disadvantages.

Here are a few disadvantages of Monolithic services.

• Inflexible – Monolithic applications cannot be built using different technologies.
• Unreliable – One bug or issue in the application may result in the shutdown of the entire system.
• Not Scalable – The tightly coupled nature of a Monolithic application does not scale easily, as workloads cannot be easily distributed across multiple nodes or hardware.
• Hinders continuous deployment – Continuous delivery and deployment in short cycles of time is difficult due to the monolithic nature of the application
• Longer development timelines – The development of Monolithic applications requires lengthy timelines since every feature demands rebuilding of the entire application.
• Complex applications –Incorporating changes in complex monolithic applications become expensive and a maintenance nightmare.

As mentioned earlier, a microservices application is a collection of small independent services designed for different business purposes. In Microservices, each individual service is self-contained. Communication with each self-contained unit is managed by an API Gateway. There are various API Gateways available, and the client can communicate with different business functions of Microservices via the API Gateway.

Features of Microservices

• Decoupled Components – Decoupled services in Microservices architecture enables the entire application to be built, modified, and scaled up quickly with ease.
• Componentization –As each service is an independent component, they can be easily individually replaced and upgraded.

• Undivided business capability –Each Microservice is effortless and focuses on a single business capability

• Autonomy – Developers and teams can work with minimal dependencies, thus increasing development speed and turnaround time.
• Continuous delivery – Allows frequent releases of features by systematic automation of application creation, testing, and approval.
• Responsibility – Microservices treat applications as products and not projects, ensuring the responsibility is in-built.
• Decentralized governance – With no fixed or standardized tool or any technology patterns, developers have the freedom to choose tools based on the requirements to accomplish the job within stipulated timelines.
• Agility – New features can be added easily and quickly developed. A Microservices architecture supports agile development.

Advantages of Microservices

• Independent development – all services are independent of their business purposes and usage.
• Independent deployment –The architecture of Microservices allows services to be individually deployed.
• Isolation of fault – the system continues to function even if one service or a part of the application ceases to work.
• Mixed technologies stack – it is not mandatory to use only one of the platforms for development. We can use multiple platforms and built Microservices architecture as per the need of the application.
• Individual scaling – scale different individual components and deploy them individually without affecting other components.

Best Practices to Design Microservices

• Separate data store for each Microservices
• Maintain the level of code maturity
• Separate build for each Microservice
• Deploy services into containers
• Treat server as stateless

Disadvantages of Microservices

• Huge number of services makes application management tough to track
• The developer will require to solve issues pertaining to Network latency and load balancing

How to create Microservices and API Gateway interface?

Note: This is for those who are familiar with ASP.Net project concepts.

In this demo, we’ll cover the following points,

1. Create two Microservices
2. Create an API Gateway
3. For creating the demo project VS2019 or VS Code, .Net Core 3.1 SDK needs to be installed on the machine

Steps to Create a Microservices Demo Project

Step 1
• Create two .Net Core web API template project for different purposes
• First, UserService project for user data purpose
• Second, ProductService project for product data purpose
• Create UserController in UserService project and ProductController in ProductService
• Add simple action into the controller that returns the string for testing purpose
• If required, connect API project with the database

Simplemicroservice

Step 2 – Test the above web API project with the help of postman individually

1.) Product Service Output

Product service output

2.) User Service Output

User service output

 

Step 3 – Create .net core web empty template project for API Gateway with the desired name. In this instance, we chose ‘APIGateway’

Step 4 – Include the dependency of ocelot API Gateway from NuGet package manager

Ocelot

Step 5 –
• Create a JSON file to configure API Gateway for web API and assign a name. In this instance, it is ‘ocelot.json’
• Include the following code text to the JSON file for configuring the API Gateway. In this demo project, API Gateway is used for routing purpose. API Gateway serves different purposes such as:
o Routing
o Caching
o Logging
o Authentication
o Authorization
o Load balancing
o Service Discovery

Ocelot.JSON

Note: In the above image, detail of ocelot.JSON are in the comments

Some details of ocelot.JSON are considered while configuring API Gateway from the ocelot package.

• The request forwarded to URL set byDownstreamPathTemplate, DownstreamHostAndPorts and DownstreamScheme
• Ocelot will use the UpstreamPathTemplate URL to identify where the DownstreamPathTemplate request is to be used.
• Ocelot uses UpstreamHttpMethod to make a difference between multiple requests with the same URLs but with different HTTP verbs. We can set a specific list of HTTP Methods or set a blank to allow any of them.

Step 6 – Configure the JSON file for application configuration as shown below in Program.cs file

Program.cs file

Step 7 – Set Ocelot middleware ASP.Net project as shown below in Startup.cs file

Startup.cs file

Step 8 – Run the application to test the working condition of API Gateway. Before running, make sure all projects are marked as startup projects. To handle request from the API Gateway application UserService and ProductService must be running.

Note: If you are testing project through VS2019, the following steps will help you mark all projects as the startup project.

Step 9 – Right-click on the main solution and click on the property, alter the settings as shown below

Simplemicroservice image 2
Step 10 – Below screen shows the final output. When you run the project, all three startup projects will be running, at times, on different ports. We need to check if Customer and User service received a call from the API Gateway project, as shown below.

API Gateway project

 

Hope this article has helped you understand the know-how of Microservices. If you have any questions, please feel free to drop them in our comments section. Happy to Help!
Happy Coding!

https://res.cloudinary.com/metasyssoftware/images/w_624,h_343/f_auto,q_auto/v1656401279/Contacts-2/Contacts-2.png?_i=AA

Guide to Avoid Navigation Rework in FileMaker

Did you ever encounter the turmoil of adding a new module on all layouts post creation of standard menu navigation?

Well, we all know how bothersome that could be! Here we are with an easy solution, read along…

Undoubtedly, navigation is an integral part of every application. It plays a pivotal role when a user requires navigating to different modules and sections.

Static navigation is rigid, which demands rework of all modules even when a single module is to be updated/added. Planning an end-to-end navigation prior to application development is the perfect solution. However, practically it is impossible to predict all modules and create a navigation way ahead of time. The second-best solution is to setup a smart extensive set of menu items for the future.

Let’s take a look at two elaborate approaches to implement a sidebar navigation!

Approach 1: Using Fixed Left Navigation

Contacts

 In this approach, a button bar is added on the left-hand side of the layout in advance. Each button has calculations referring to dynamic variables as button labels, with a common script to define every button action. By default, this navigation bar is visible on all layouts.

The downside to this approach, it can work for Form views, but not for List views. Additionally, the demand for more real estate in the layout of the application is another drawback that leads us to Approach 2.

Approach 2: Hamburger Menu Using Popover

Hamburger menu with popover

 

In this approach, a Hamburger menu icon is placed in the header of the layout. Clicking this will expand/collapse the popover. The popover has a button bar and it’s implementation is similar to Approach 1, with the only difference of buttons placed on the Popover. This approach works well for Form view, List view, and Table view.

Contact list

Let us take a look at the Application Implementation Steps in detail.

 Step 1 – Opening Script

Create an Opening script or a Startup script to set global variable values that are used as calculation to define labels for each button segment in a Button bar.

For any new module navigation, set the global variable to the same.

Opening Script

 

Contacts 2

 

Step 2 – Specify Active button

The Sidebar_Values variable defined in the Opening script will store the list of table names, i.e. main navigation module table names. It is then used to define the active button bar segment of selected module as below.

Specify Active Button

 

Step 3 – Main Navigation Script:

Create another script which is the main script used for navigation between modules. This script is attached to every segment of button bar, with a script parameter defined for the module to navigate.

If the user is currently on the Details view, then the application redirects to Details view of the destination module. Similarly, If the user is in List view, the application redirects to the List view of destination module.

Each layout has set icons to help navigate to Details view or List view specifically. For instance, if the user is in Details view, clicking relevant icon will help navigate to List view and vice versa.

Main Navigation Script

 

This script checks if the user is on Details or List view and sets it to a variable. Append this variable to script parameter to get the layout where the user wants to navigate .

Step 4 – Naming convention:

Each layout requires a specific naming convention . In this case, it is <<tablename>> _<<Viewtype>>.

Here the ViewType can be DetailsView, ListView or TableView. Let’s take a look at some of these examples.

  1. Contact details layout will be ‘Contacts_DetailsView’
  2. Contact list layout will be ‘Contacts_ListView’
  3. Contact table view layout will be ‘Contacts_TableView’

By following the Approach 2, adding a new module is matter of few simple steps and the application is as good as new.

Hope you find this article insightful. Feel free to leave a comment or post any challenges that you may have.

Our FileMaker development experience includes handling complex project management systems, e-commerce shopping sites, cruise booking systems and more.

https://res.cloudinary.com/metasyssoftware/images/f_auto,q_auto/v1656401451/Package-JSON-1/Package-JSON-1.png?_i=AA

How to Create a React Native NPM Package?

NPM is a Package Manager for Node JS. It was first created in 2009 as an open-source project to help JavaScript developers to easily share their code in the form of packages. NPM allows you to install the various public packages for the project. NPM has over 8,00,000 packages with public access.

My intention behind writing this blog is to help React-native developers create their own package. If any developer wants to share his own package on the NPM registry, then he needs to make it public. This allows developers to contribute to the NPM ecosystem. Steps to create and publish a react-native NPM package are as follows:

There are 3 phases to create and publish a package.

1. Creating the NPM package.
2. Testing the NPM package on the react-native app.
3. Publishing on the NPM website.

1. Creating the NPM package:

First create a folder where package information like package.json, .babelrc, webpack.config.js, etc will be stored. We will introduce these files soon.

Now navigate into that folder directory using terminal and run command – npm init

You will be prompted for the package name, version, main, keyword, etc. You can skip questions (by pressing enter) (it is easy to modify later). At this point, a package.json file will be created.

Now, open the package.json file in your IDE (code editor) and install all the dependencies as below using – npm install dependency-name.

Below is an example of package.json file.

Package JSON

Note: “main” should be the same as above.

Now create a file .babelrc and add the following lines. Babel is a compiler to convert JavaScript code into ES5 JavaScript.

React Native image

Let’s create a file named webpack.config.js and add the lines below.
Remember, webpack is the builder. It compresses code into ‘build’ that can be deployed in the React-Native app. Make sure “entry” is either ./src/index.js or ./index.js depending upon your file structure.

webpack

Now, create a folder src, add the index.js file and add your component.

src image

Whenever you make any change to your package, you have to create the build again using command – npm run build. After that, you must re-install it in the react-native app.

Once you configure the above steps, your folder structure should look as follows

React test library

2. Testing the package on React-Native app:

To test or use your package, you will need a React-Native app. Create a React-Native app by executing the run command npm create-react-app “your app name” and open it in your IDE.

You can install your package in two ways

1. Upload it on the NPM website and then install it using npm i “package name”.
2. Locally install it through a relative path of NPM package to react-native app npm i ../react-test-library

React Native

Note: We will try to avoid the first option because whenever there is any change in your NPM package, you have to re-publish it on the NPM website and re-install it on your project.

So we will test it locally first and then upload it on the NPM website.

To check your package, you have to install it through the relative path as shown in the above example and import your component from your package.

src/App.js

src

To see the result of the installed package, run the command in your react-native app – npm start.

npm package

Now, let’s see the final step.

3. Publishing on the NPM website:

For publishing any package, you should have an account on the NPM website (if not you can create one). While uploading the same package, the package version should be unique each time.

Steps to upload your package –

1. Using the terminal, navigate to your package directory.
2. Run command – npm login. Enter a username, password, and email id.
3. Run command – npm publish.

Once your package has been published, you can check it on the NPM website.

React test library

At last, you are able to create your own library. In case of any queries feel free to share your feedback in the comments section below.

Happy Coding…

https://res.cloudinary.com/metasyssoftware/images/f_auto,q_auto/v1656401491/New-project-1/New-project-1.png?_i=AA

How to use a Database project in .NET Visual Studio?

Introduction

The Database plays a vital role in any web or windows application development. The Database project can be used to maintain the repository of the schema changes.

Why do we need a Database project?

While developing any application, the developer has to work on many database tasks such as creating tables, triggers, stored procedures, functions, etc. It is difficult to manage the scripts at the time of deployment. Also, it is tedious to review the changes made by the developer during development. The database project in Visual studio addresses these issues.

How to create a database project?

  1. Create a new project in visual studio. Select the SQL Server Database Project, as shown below.

New project

2. Right-click on the project and select Import🡪Database

Importing database

3. After this, you get one popup as follows. Click on ‘Select Connection…’ option to import the database.

Import database

4. You will receive another popup to select the connection properties of your database. After entering the credentials (and authenticating successfully), you will get the dropdown filled with a list of databases on  the SQL server. Select the database for which you are creating the project.

Connection properties

5. Once you click on ‘Connect’, you will notice all the tables, procedures, functions, etc. which will get imported.

Import database summary

6. Check solution explorer for your database related artefacts.

Solution explorer

7. Now compare your project schema with the database schema after performing modifications to the database. Right-click on the solution and select Schema compare, as shown below.

Database demo

As you can see in the above image, there are two sections Source and Target.

Source: If you have made any changes in the database and you want to compare those on the target, then select the database name. If however, you have made changes in the database project that you want to compare with the database, then select your project path.

Target: It will always be with the source which will be compared. If you want, you can swap Source and Target. Once selected, click on ‘Compare’ to compare Source and Target schemas.

8. For example, I have added the Enquiry table in the database; Clicking on Compare allows you to see a list of modifications.

Database demo 8

The Action column in the above image is displayed if the changes are new or if there are any updates or deletions in the schema.

When you check the box and click on ‘Update’, all the changes will be applied to Target.

9. Now if you have made any changes in the database project and you want to execute those on the Production UAT database, then execute it in the same way as shown above.

10. In order to create the scripts for the changes, then compare the Database project with the Target Database. Then click on ‘Generate Scripts’.

Merits and Demerits of Database Project:

Merits:

  1. DDL (Data Definition Language) is readily available for all the objects.
  2. Deployment scripts can be easily generated.
  3. A database project also includes designers for working with these files.
  4. Version control can be done for the database through a series of check-in and check-outs for various operations performed on scripts and schema changes.
  5. Reviewing database changes is easier and allows  Dot Net developers to be more effective in terms of making changes and reviewing previous modifications done by team members.

Demerits:

  1. Schema designing is not available.
  2. References to external database sources cannot be created in the database project.
  3. The Visual studio database project only supports the SQL Server.