InfyOm Blog

latest-post

We often listen to the words "Eager Loading" & "Lazy Loading" in Laravel. but maybe some of how still don't know what that actually stands for.

What Lazy Loading means?

I worked with many projects that is developed by some other developers and the common problems in code I found us Lazy Loading queries everywhere.

To understand it more easily let's take one simple example.

Let's say There is Post model and Comments Model.

So basically post->hasMany('comments')

So let's say we are fetching 10 posts and now we want the comments of each post. what we will do is :

$post->comments()->get() (LAZY LOADING)

Lazy loading cause N+1 queries issues as every time we are fetching comments of each post and it will block the execution too for while as its queries from the DB.

What Eager Loading means?

Eager loading is very useful when we are working with large-scale projects. it saves lot's of execution time and even DB queries too :)

Let's take the above example to understand the Eager loading.

$posts = Post::with('comments')->get()

$post->comments (EAGER LOADING)

here when we retrieve the posts at that time we are fetching its comments too on the same query. so when we do $post->comments it will not again do query into DB or not even block execution as the comments are already there in model instance.

So this is how Eager loading saves your time and also prevents N+1 Query.

Hope that helps.

August 13, 20221 minuteuserVishal Ribdiya

Posts

How to Check the Visibility Keyboard in Android?

The keyboard is one of the basic components of any Android application. Typically, we use the keyboard to take input from the user. Soft keyboards are used in Android applications, and the Android system gives you with a keyboard to receive user input in any EditText or anything similar. Also, the keyboard will be invisible from the screen if the user has given input. So, in this blog, we will learn how to check if keyboard appears in Android app. How can I make this keyboard invisible or turn it off if it is visible?. So, let's get started.

Step 1 − Create a new project in Android Studio, Add the following code to activity_main.xml.

<?xml version = "1.0" encoding = "utf-8"?>
<android.support.constraint.ConstraintLayout
   xmlns:android = "http://schemas.android.com/apk/res/android"
   xmlns:app = "http://schemas.android.com/apk/res-auto"
   xmlns:tools = "http://schemas.android.com/tools"
   android:layout_width = "match_parent"
   android:layout_height = "match_parent"
   android:id = "@+id/main_layout"
   tools:context = ".MainActivity">
   <EditText
      android:id = "@+id/editext"
      android:layout_width = "match_parent"
      android:layout_height = "wrap_content">
   </EditText>
   <Button
      android:id = "@+id/button"
      android:layout_width = "wrap_content"
      android:layout_height = "wrap_content"
      android:text = "Click here to hide"
      app:layout_constraintBottom_toBottomOf = "parent"
      app:layout_constraintLeft_toLeftOf = "parent"
      app:layout_constraintRight_toRightOf = "parent"
      app:layout_constraintTop_toTopOf = "parent" />
</android.support.constraint.ConstraintLayout>

Step 3 − Add the following code to MainActivity.java

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
   ConstraintLayout constraintLayout;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Button button = findViewById(R.id.button);
      EditText editText=findViewById(R.id.editext);
      editText.requestFocus();
      constraintLayout=findViewById(R.id.main_layout);
      constraintLayout.getViewTreeObserver().addOnGlobalLayoutListener(new  ViewTreeObserver.OnGlobalLayoutListener() {
         @Override
         public void onGlobalLayout() {
            Rect r = new Rect();
            constraintLayout.getWindowVisibleDisplayFrame(r);
            int screenHeight = constraintLayout.getRootView().getHeight();
            int keypadHeight = screenHeight - r.bottom;
            if (keypadHeight > screenHeight * 0.15) {
               Toast.makeText(MainActivity.this,"Keyboard is showing",Toast.LENGTH_LONG).show();
            } else {
               Toast.makeText(MainActivity.this,"keyboard closed",Toast.LENGTH_LONG).show();
            }
         }
      });
      button.setOnClickListener(this);
   }

   @Override
   public void onClick(View v) {
      switch (v.getId()) {
         case R.id.button:
         hideSoftkeybard(v);
         break;
      }
   }

   private void hideSoftkeybard(View v) {
      InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
      inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
   }
}

Here, we are using hideSoftKeyboard to hide the keyboard if the keyboard is visible on clicking the button.

So, finally, run the application and see the output on your mobile device.

In this blog, we learned how to check if the keyboard is visible or not on the screen. Also, we have if the keyboard is visible then how to close it. That’s it for this blog.

March 01, 20222 minutesauthorVivek Beladiya
User Interface Design Tips: Checkbox vs Toggle Switch

In practically every form of mobile or desktop application, website, or interface, interactivity, or user input, is anticipated. While utilizing an interface, users enter personal information, modify application settings, and navigate through various menus. It is our obligation as designers to give users the appropriate controls to make these inputs easier and faster.

Toggle switches and checkboxes, two of the most ubiquitous controls, appear to achieve the same goal, and their use cases are frequently misinterpreted as a result. However, there are a few circumstances where one or the other should be used. This blog will discuss the differences between checkboxes and toggle switches, as well as when each should be used in your user interfaces.

How to Tell the Difference Between Checkbox and Toggle Switches

There are two possibilities for checkbox controls: chosen and not selected. When the user can choose from any of the alternatives listed, the checkbox should be used. The checkbox will normally require buttons such as "Submit, OK, Next, Apply" after the box has been checked.

A toggle switch, like a light switch, represents a physical switch and is a "either/or" control that allows users to turn things on or off. The impacts of switching a light switch are felt quickly, much like flipping a light switch. Toggle switches in the user interface have the same trait.

Switches can assist mobile users in a variety of ways. In comparison to checkboxes, switches have a larger touchpoint to engage with and can deliver greater haptic feedback.

A toggle switch requires two steps: selection and execution, whereas a checkbox requires only the selection of an option, and the execution/saving action is normally required later or at a different area.

A few use-cases are provided below to assist you in determining which control is best for your user interface.

When to Use a Toggle Switch

  • Without review or confirmation, an immediate response is required.
  • An on/off or show/hide operation is required for a setting.

darkmode_gif

When to Use Checkboxes

  • Before submitting any options, the user must confirm or evaluate them.
  • For modifications to take effect, the user must take additional actions.

checkbox-01

  • There are several possibilities accessible, and the user must choose one or more of them.

checkbox-02

  • There is only one yes/no option, or only one alternative may be picked, and the message is evident.

checkbox-03

  • You want to provide two alternatives for an on/off decision when the user is toggling separate features or behaviors.

checkbox-04

Focus on context rather than function when choosing between a switch and a checkbox. Consider if a setting should take effect right away. Ask yourself whether users need to check their settings before they apply them.

March 29, 20222 minutesauthorKishan Savaliya
GUI Testing brief note for Software Testers

What is GUI Testing?

GUI Testing is a type of testing in which an applications’ Graphical User Interface (GUI) is tested to make sure it is in line with the expectations. GUI testing involves checking the objects on the UI (User Interface), which are the objects that we can see on the screen. Anything the user sees in the system or application is a GUI. Let us consider that if you visit a website, then the homepage is the GUI (graphical user interface) of the site. The source code will not be visible as the user can see only the UI interface. Mainly the focus of GUI testing is on the design pattern, images, alignment, spellings and the overall look and feel of the UI.

Why do we need GUI testing?

To get the answer you need to think as a user, not as a tester. It is the User Interface of the Software/Application that is a deciding factor to know whether a user is going to use the Application further or not. The looks and designs of the Application/Software are what a typical user will first look at. Secondly, he checks how easy it will be for him to understand and navigate through the UI. If the Software/Application is more complex and not appealing or if the user is not comfortable with the Interface design, then he is not going to use that Application again. That’s the reason, GUI testing is a matter for concern and should be taken very seriously. Also, proper testing should be carried out in order to make sure that GUI is free from any issues.

How to create test cases and how to do GUI testing?

UI Testing mostly involves the checking the various elements on the screen for their look and feel, the test cases should be written in such a way that they validate the following points for each of the UI objects. Size, position, width, and height of the objects with reference to other objects on the screen, Error messages displayed on the screen, the color and font of the error message. Errors are normally in Red color. Readable and inconsistent across the application unless specified by the client. Checking the same screen in different resolution with the help of zooming in and zooming out like 640 x 480, 600×800, etc. Also if there is a requirement you may want to check it in a mobile browser as well. Font color, hyperlink color, error/warning message color, etc. Quality of the images on the screen, if applicable. Spellings, grammar, and punctuations. Scrollbars according to the size of the page if any. Checking disabled fields if any. Checking the size of the images.

Challenges in GUI Testing:

The list of GUI test cases can be very exhaustive and time-consuming and it requires a lot of manual effort and the quality of the testing would depend on the skills of the tester. Number of automation tools available is very limited GUI is usually unstable during the initial development phases, so GUI testing is postponed to the end of the testing cycle, which sometimes creates a time crunch.

March 09, 20223 minutesauthorNayan Patel
Common CSS Mistakes Should be Avoid

Using PX when it's not Needed

Bad

.class-name {
    padding: 10px 0px;
}

Good

.class-name {
    padding: 10px 0;
}

Not Using Shorthand Properties

Bad

.class-name {
    margin-top: 10px;
    margin-bottom: 10px;
    margin-left: 10px;
    margin-right: 10px;
}

Good

.class-name {
    margin: 10px;
}

Using Font Fallback

Bad

.class-name {
    font-family:Helvetica; 
}

Good

.class-name {
    font-family:Arial, Helvetica, sans-serif; 
}

Repeating the Same code

Bad

.class-name {
    margin: 10px;
    padding: 10px;
}

.other-class-name {
    margin: 10px;
    padding: 10px;
}

Good

.class-name, .other-class-name {
    margin: 10px;
    padding: 10px;
}

Over Qualifying Selectors

Bad

.navbar ul.menu li a {
   color: #000000
}

Good

.menu a {
    color: #000000
}

Using Color Names

Bad

.class-name {
    color: black
}

Good

.class-name  {
    color: #000000
}
March 15, 20221 minuteauthorPayal Pansuriya
How To Increase Sales Through Digital Marketing

Introduction

Digital marketing can increase sales if we choose the best strategies.

Being an influential and well-known brand in your audience is something that is essential and positive.

Be available to your customers

75% of consumers expect to find a solution to their problem within five minutes of facing it. If you do not provide a solution, there is a good chance that they will not return to your business.

The online world is 24/7, so when you're not actively available to your customers, it's important that you set up a live chat, even if it's a bot.

Excessive communication with your customers

Transparency is key in the digital world. Trust is especially important where face-to-face communication is limited.

Building trust and then delivering on your promises is the key to enhancing the customer experience and ensuring that your brand's reputation is as strong as it can be to ultimately boost sales.

Offers and Discounts

We place some offers or discounts for our business during the festive season etc.

Clicking on Digital Marketing Pay will display advertisements of your business on various social media sites through advertising techniques. This ad will reach all the social media users so your sales will increase.

Use social networks

Social networks are very helpful in maintaining the reputation of your brand.

People like to have a unique experience with your brand on different social media channels. You need to choose the right channels for your business.

Create videos for YouTube

YouTube is an online video platform with millions of users and viewers every day. You should use these leading platforms as they can help your business grow through video views alone.

Videos can be made by you, your team, or (for more professional videos), videographer or photographer. Make sure your content is relevant to your audience or create videos specifically related to your business.

March 15, 20222 minutesauthorAnkit Kalathiya
How to Connect Gatsby to WordPress

Gatsby is a blazing-fast website framework for React. It allows developers to build React-based websites within minutes.

WordPress

WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database. Features include a plugin architecture and a template system, referred to within WordPress as Themes.

Integrate Gatsby with WordPress

Install gatsby-source-wordpress package

npm install gatsby-source-wordpress

gatsby-config.js file

add the gatsby config file in the following code

 plugins: [
    ...
    {
        resolve: `gatsby-source-wordpress`,
        options: {
            // Specify the URL of the WordPress source
            baseUrl: `localhost:8888/wordpress`,
            protocol: `http`,
            // Indicates if a site is hosted on WordPress.com
            hostingWPCOM: false,
            // Specify which URL structures to fetch
            includedRoutes: [
              '**/posts',
              '**/tags',
              '**/categories'
            ]
        }
    }

Now connect your gatsby website and Wordpress.

Here is an example of the GraphQL API query

import React from "react"
import { graphql } from "gatsby"
import Layout from "../components/layout"
import SEO from "../components/seo"

export default ({ data }) => {
  return (
      {data.allWordpressPost.edges.map(({ node }) => (
        <div>
          <p>{node.title}</p>
        </div>
      ))}
  )
}
export const pageQuery = graphql`
  query {
    allWordpressPost(sort: { fields: [date] }) {
      edges {
        node {
          title
          excerpt
        }
      }
    }
  }

Hope this helps.

February 28, 20221 minuteauthorVatsal Sakariya
How to convert a Lead into a Client

Most of your leads through your conversion funnel will not automatically convert into sales. He will often need extra help to make the conversion.

Talk about value first

Focus on bringing value to your customers' lives. People dislike it who only care about getting sales from it. focus on addressing your customers' needs.

Work as a mentor with great expertise in your field. If you are the center of contact for potential customers, they will also trust your decision and solutions to their problems.

Identify their problem

You need to identify the problem that is causing the lead. Whenever you ask a question, take a different approach, because it starts a conversation. This is a great way to open up a conversation and raise questions or concerns that might arise.

Make it a conversation

It is clear that your potential will be more responsive if you encourage two-way communication. You can definitely find out how your product or service works for them.

Ask for sales

Just asking for a sale is nothing new or innovative, but it is a crucial part of the conversion process. That sounds like common sense, yet a surprising number of people don't.

Ask your prospects if they are ready to get started and see how many say "yes". They would not have gone so far had it not been for their initial interest in becoming a customer. If you do not ask for sales, you will have competition.

Follow-up

Keep your leads in purchase mode by following up via email or phone calls. This is a great way to quickly convert them into customers before a long time passes. All leads you generate should be contacted immediately and followed up in a few days.

You want to make sure they are as successful as possible with the product and that all their questions are answered.

March 07, 20222 minutesauthorAnkit Kalathiya
The Difference Between UX and UI Design

UX and UI designs are similar and are often used interchangeably. In fact, these two words have completely different meanings and relay different activities. These two businesses have essentially been around for years, but only recently have been involved in the technology industry, which has been renamed to encourage UI and UX designers.

These two components are essential when it comes to digital products, but the roles are very different. They refer to various aspects of both product development as well as the actual design process. Although UX means "user experience" and UI means "user interface", both jobs cover much more than they seem, which makes learning UX and UI more important at the same time.

User Experience Design (UX)

Originally defined by a cognitive scientist named Don Norman, the term "user experience" was defined before the 21st century. He described UX as "all aspects of the end-user interaction with the company, its services, and its products".

UX can be applied to anything in life that creates an experience. Whether it's a website, a mobile app, a theme park, or a tea party. UX doesn't have to be related to anything in the world of graphic design. User experience is the user's interactions and user "experience" with a product or service.

When it comes to digital products or services, UX is concerned with how a web page, mobile application, or software perceives the user. This may include simplifying the website checkout process or simplifying the application for general use.

uxdesign

You could say that a UX design job requires marketing, design, and project management skills. It is a complex role. Regardless of whether it is being applied to a car, shoe, or website, UX Designer's main goal is to create a simple and pleasant user experience. The product needs to communicate the owner’s goals, while also meeting the needs of the user.

User Interface Design (UI)

UX and user interface (UI) are often compared or grouped in the same job description. These two modes are very different, leaving the UI to be misinterpreted.

Often when looking at job descriptions for UI offerings, you will see a closer description of graphic design. Although UI positions sometimes deal with parts of branding or even frontend development, they do not indicate the original position.

User interface design is a digital term. This is mainly where it differs from UX. A UI is simply an interaction between a user and a digital product or service. This may include a touchpad that allows you to select your coffee from an automatic coffee machine or from your computer screen. It also deals with applications and websites that look and feel how the user interacts with the product.

uidesign

The main purpose of the UI is that the designer will use design tools that enable better communication between the designer and the developer. This in turn will facilitate implementation with developers.

The user interface is an incredibly important element that allows the user to trust the brand. The UI designer is also responsible for relaying the message of the product as well as its research and content into a compelling display or experience.

UX vs. UI

The comparison of UX and UI is almost like apple and orange. If you take the human brain with the right hand representing creativity (usually left-handed individuals), this would be the UI design. If the left side of the brain represents the analysis (usually right-handed individuals), then the left side UX.

ui_ux

UI design is creative, fuzzy, beautiful, and presentable. UX design is, alternatively, the optimization, organization, and structure of the data to be implemented. Without one or the other, the project cannot be completed. To complete the product, you may not lack UX or UI. Despite this, they have completely different roles with different functions.

In general, a UX designer will need to fully map the entire user's journey to solve a specific problem in a product. Much of the UX Designer's job is to understand the user's problems and how to solve them. UX designers work by researching to understand the users they are targeting and what their needs will be.

Alternatively, UI designers consider all aspects of the visual elements. Everything from the first screen to the last screen. The UI designer will make sure the colors are readable. This may include ensuring that a partially blind 65-year-old feels comfortable using the same screen as a normal 13-year-old.

February 25, 20224 minutesauthorKishan Savaliya