Tips Posts

How to display responsive image in different devices

Today we are going to see how we can image based on resolution. We have the most common issue of loading big images in small devices take time. So, the basic solution is to use the picture element to load a different image in different devices and resolutions.

The <picture> element will be for the art direction of responsive design.

The element contains two tags.

  • <source>
  • <img>

So, the browser will look for the first <source> element where the media query matches the current width, and then it will display the image. The <picture> element is required as the last child of the <picture> element.

Let me show you an example of how to display a different image in different widths.

Here is a Code example,

<picture>
    <source media="(min-width:900px)" srcset="infyom_logo_lg.jpg">
    <source media="(min-width:700px)" srcset="infyom_logo_md.jpg">
    <source media="(min-width:500px)" srcset="infyom_logo_sm.jpg">
    <img src="infyom_logo_xl.jpg" alt="Flowers" style="width:auto;">
</picture>
June 18, 20211 minuteShailesh LadumorShailesh Ladumor
How to Setup Global Git Ignore in window

Lots of developers have a question: How do I create a global gitignore file? so, In this article, I show how to set up a global git ignore.

Reviewing pull requests, I often see contributors sneakily adding editor configuration to the repository’s .gitignore file.

If everyone would commit their environment-specific .gitignore rules, we’d have a long list to maintain! My repository doesn’t care about your editor configuration.

There’s a better solution to this: a personal, global .gitignore file for all your repositories. Here’s how you can set one up. create a .gitignore file for your global rules.

You can also see the following video tutorial as well.

You need to set up your global core.excludesfile configuration file to point to this global ignore file. So, let's start step by step

Step 1:

Create a file .gitignore on your profile C:\Users{username} for example C:\Users\Shailesh

Step 2:

Now you can set a .gitignore path with a three-way. we need to tell this to get this my global git to ignore file.

First Way: Using Windows git bash

Let's open Windows git bash and fire the following command,

git config --global core.excludesFile '~/.gitignore'

Second Way: Using Windows cmd

Let's open Windows cmd and fire the following command,

git config --global core.excludesFile "%USERPROFILE%\.gitignore"

Third Way: Using Windows PowerShell

Let's open Windows PowerShell and fire the following command,

git config --global core.excludesFile "$Env:USERPROFILE\.gitignore"

So, you can easily set the .gitignore global file.

March 06, 20212 minutesShailesh LadumorShailesh Ladumor
How to setup and enable https with SSL on wamp server virtual host

Recently, I've started working on one project where we need to set up a virtual host with HTTPS because I need to run that project with expose and Shopify in my local development machine. I've wamp 3.2.3 on my local machine.

I spent a lot of time setting it. so, I thought I should write one article and video for a step-by-step guide. So, I will show you in this article how to set up HTTPS for a local machine.

You can watch the following video tutorial or follow the article.

Step 1 - Install Wamp

Install wamp server if not installed in your local machine. you can download the latest version of the wamp server from here. wamp server is available in 32 bit and 64 bit. make sure you select the correct version of the wamp server based on your operating system (window)'s version.

Step 2 - Install OpenSSL

OpenSSL is an open-source command-line tool that is used to generate the SSL certificate and private key. OpenSSL is available in both versions 32 and 64 bit. download the latest version of OpenSSL from here.

2021-01-29-601401f28a12b

I hope you successfully installed OpenSSL on your machine. let's take the next step

Step 3 - Create a Private key

Open your terminal as an Administrator otherwise you will get a permission denied error. Also, you can provide permission to the OpenSSL directory and run the terminal in normal mode.

Now, let go to where we installed OpenSSL

cd C:\Program Files\OpenSSL-Win64\bin

Let's create a private key which is 2048 bits encryption. fire one by one the following two commands to create it.

openssl genrsa -aes256 -out private.key 2048

openssl rsa -in private.key -out private.key

2021-01-29-60140b3530e0b

Your private.key is successfully generated here C:\Program Files\OpenSSL-Win64\bin

Step 4 - Create an SSL Certificate

Let's create a certificate using the following command,

openssl req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500

You need to enter a detail that looks like

2021-01-29-60140cd318bd9

You can verify here

2021-01-29-60140d37b3a9f

Step 5 - Move both Private Key and a Certificate

Open a directory D:\wamp64\bin\apache\apache2.4.46\conf (Based on where your wamp is installed) and create a key directory.

Now, move both files to the key directory.

Step 6 - Configure Your httpd.conf File

Open your D:\wamp64\bin\apache\apache2.4.46\conf\httpd.conf (the drive should be where your wamp is installed) and un-comment the following 3 lines one by one.

LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

Step 7 Configure Your httpd-ssl.conf File

Open your D:\wamp64\bin\apache\apache2.4.46\conf\extra\httpd-ssl.conf (the drive should be where your wamp is installed) and change the following lines.

DocumentRoot "${INSTALL_DIR}/www"
ServerName localhost:443
ServerAdmin admin@example.com
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"

Make sure, these following all lines are set or not. if not, add it as well.

SSLSessionCache "shmcb:${SRVROOT}/logs/ssl_scache(512000)"
CustomLog "${SRVROOT}/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Step 8 Configure a Virtual Host

Hope you have created a virtual host. if not, create a virtual host using the virtual host manager which is provided by wamp.

Open an D:\wamp64\bin\apache\apache2.4.46\conf\extra\httpd-vhosts.conf and update your virtual host

Change the port :80 to :443

add the following lines into the VirtualHost.

SSLEngine on
SSLCertificateFile "${SRVROOT}/conf/key/certificate.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/key/private.key"

Now, the code of VirtualHost looks like,

Now, we are done. Let's restart a wamp server.

If you see a green WAMP icon everything should be right. If the icon is orange there is a problem with your syntax somewhere.

Open terminal and go to the D:\wamp64\bin\apache\apache2.4.46\bin and run httpd -t in the command prompt and if there are any syntax errors they will be listed.

if fine then open https://ladumor.test on the browser

January 30, 20213 minutesShailesh LadumorShailesh Ladumor
How to create custom validation rules in Laravel ?

While developing complex applications, sometimes we have to validate fields and data in a totally customized way, at that time you can use laravel's custom validations rules functionality.

In this tutorial, we are going to create our own custom validation rule to compare UUID. In our case, I have to check the UUID which is actually a binary string, whether it exists on DB or not.

Laravel doesn't provide any rule to compare that binary UUID string, so we will create our own validation rule.

So let's create our custom validation rule::

Generate Custom Validation Class

So here we have created a new class named UuidExists into App\Rules

namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Ramsey\Uuid\Uuid;
class UuidExists implements Rule
{

    protected $table;
    protected $column;

    public function __construct($table, $column)
    {
        $this->table = $table;
        $this->column = $column;
    }
    public function passes($attribute, $value)
    {
        $value = Uuid::fromString(strtolower($value))->getBytes();
        return \DB::table($this->table)->where($this->column, $value)->exists();
    }
    public function message()
    {
        return 'The validation error message.';
    }
}

Add Rule to AppServiceProvider

Add your rule to AppServiceProvider.php into boot() method. here I have to give the name uuid_exists to my custom rule. you can give your own name whatever you want.

\Validator::extend('uuid_exists', function ($attribute, $value, $parameters, $validator) {
    list($table, $column) = $parameters;
    return (new UuidExists($table, $column))->passes($attribute, $value);
});

How to use custom rules?

You can use your custom rule as follows. Here we have using the required and uuid_exists rule, where we are passing attributes and values to our custom rule, which will be used to passes($attribute, $value) function.

'tenant_id' => ['required', 'uuid_exists:tenant_id,uuid']

Keep connected to us for more interesting posts about Laravel.

January 21, 20211 minuteVishal RibdiyaVishal Ribdiya
Which Logo File Format to Use Part-2

GIF logo file formats are not as widely used as they once were. They have a very limited color spectrum (only 256 colors out of millions in JPG) so solid color logos are a good candidate for this format. A special feature of the GIF file is that it supports smooth animation. You can create frames with frame animations and file sizes will be negligible as long as you keep the color flat and smooth (from red to blue). GIF files are pixel-based and do not expand well.

logo

EPS and AI logo file formats are a sacred grail of file formats. They are made up of dots and lines, not pixels, allowing infinite scaling and expansion without losing quality. Many business owners and executives ignore these logo file formats because they cannot open them normally. Many common MS Office fee programs do not open the EPS logo file format. EPS files can also support pixels, which also makes this file format difficult. Software such as Adobe Illustrator, InDesign, or Photoshop can work with this file format and optimize and save almost any logo file format you need. Illustrator will allow resizing, color mode change, and more.

PDF logo file formats can also be difficult as PDF color mode can disguise spectra and resolution. Some common office fee software will open or import PDFs but one way to tell if the resolution is good is to zoom in very closely to the logo. If the edges stay crisp, you’re in business and a graphic designer who can use something in print and digital applications. If the edges become blurred or pixelated, you will be limited in the use and extension of this particular logo file format.

SVG files have become more common on websites and digital access and are considered the standard format for displaying vector graphics on the web. SVG logo file formats allow a resizable logo format that does not lose image quality as it is expanded or reduced. This is especially important with responsive web design where the logo file can be resized depending on the digital device the website is viewing. Another major advantage for the SVG logo file format is the relatively small file size - which allows a digital file to load on a website very quickly. Support is limited to SVG but website design is an important place for their use.

January 08, 20212 minutesKishan SavaliyaKishan Savaliya
How to Generate Sales Leads

Many successful small business owners are constantly looking to expand their customer base and grow their businesses. However, business growth can be a difficult and long-term process. One of the key elements of growing a business is constant access to a steady stream of sales leads. A lead is a person or business if you have a company that sells to other businesses that are interested in the products or services you sell.

Here are some tips for building a system that will help you identify sales leads in your small business, and - with the right focus and effort - turn them into customers.

1. Increase your engagement with your customers

Relationships are all about sales and talking to the people who reach out to you to do so. For example, when people reach you with questions about your product or company, instead of just mentioning them on your blog, you can ask them if they mind having a quick chat with you.

2. Constantly refresh your email lists

It is impossible to generate leads from an old email list that contains incorrect information or does not match the parameters of your target person. If you haven't cleaned up your email list for a while, you may still be cold-emailed people who are already your customers.

3. Use chatbots on your website

Customers want to do business with companies that respond promptly to questions. Although companies respond within 12 hours on average, research shows that consumers expect responses within 1 hour. You might think, "Well, but they know we're not working right now," or, "They'll surely understand that we're in another realm of time." While customers can understand and understand later, there are thousands of businesses offering services just like yours, so you don't want to take that opportunity.

4. Join and participate in social media groups

LinkedIn and Facebook are great places to connect with other professionals, share your skills, and find leads. Once you join a group, don't start by pitching members as this can cause people to separate. Instead, do the following to establish a relationship:

  • Start a conversation
  • Engage in other people's conversations
  • People appreciated their content and the events they were planning to organize

Once the group members recognize you, you can use the platform to generate interest in your products.

5. Use SEO to increase website traffic

High ranking your website in search results will increase your website traffic. To get a better rank, you must do search engine optimization on your website. Some of the basics of SEO include:

  • Keyword optimization on both landing pages and blog content
  • Constantly great content post
  • Link building

Again, it is important to point out that SEO and content creation can be technical and time-consuming.

6. Create a sales funnel

Once you know who you are targeting and decide how to reach them, you need to have a plan to collect contact information. The first part of the process involves funneling all prospects into a standard form or landing page that encourages them to share their contact information, usually in exchange for a free gift, coupon, sample, or any other value-added incentive.

7. Use an email newsletter to build relationships

Now that you’re in touch with prospects, it’s time to cultivate those relationships so you can take them from the lead stage through sales (and ultimately repeat sales). One of the best ways to keep in touch with your prospects is through an email newsletter.

January 05, 20213 minutesAnkit KalathiyaAnkit Kalathiya
How to add Shadow and Text on ImageView in Android

Basically, it works like a stack where each view is stacked on top of the other.

Create a drawable file for shadow view and assign the name image_shadow and add the below code in this file.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="10dp" />
    <gradient
    android:angle="270"
    android:centerX="300%"
    android:endColor="#99000000"
    android:startColor="#00000000"
    android:type="linear" />
    <size
    android:width="270dp"
    android:height="60dp" />
    <stroke
    android:width="1dp"
    android:color="#878787" />
</shape>

Now, open the XML file and add the below code into it, and set this drawable file as view background.

<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <androidx.appcompat.widget.AppCompatImageView
        android:id="@+id/imageView"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:scaleType="centerCrop"
        android:src="@drawable/shopping_image"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>
    <View android:id="@+id/view"
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:background="@drawable/image_shadow"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"/>
    <androidx.appcompat.widget.AppCompatTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:textColor="@android:color/white"
        android:text="Write your text here"
        android:textSize="25sp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toBottomOf="@+id/view"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.LinearLayoutCompat>

That's it. You should be ready to go.

December 31, 20201 minuteVivek BeladiyaVivek Beladiya
How to increase 10 X sales

Simply put, the rule of 10 X is taking any target you set for your company or sales team, and multiplying it by 10.

So if the goal is to increase revenue by 5% using the 10X rule, you will increase that goal to 50%.

What the 10X rule does is force you and your sales team to think in terms of LEVERAGE. Because all of a sudden, instead of focusing on the “real” goal, the goal is achieved through the roof.

Contact customer acquisition with a solid plan. Build a foundation by developing relationships with your target audience.

Achieve customers differently as you progress toward strategic goals. Here are four lessons to guide your team:

1. Create an engagement

It is highly unlikely that a first time visitor will stumble upon your website and automatically purchase your products. Potential customers should be fully engaged with your brand before making a purchase.

2. Be present on social media

If you are not present on social media, you are lost in a huge market that your competitors are already taking advantage of.

Having a social media presence should also not be expensive. Creating a business account on Facebook, Twitter, Instagram, and LinkedIn is free. Just join discussions and groups related to your industry. Provide helpful answers to questions and insights on various posts to make yourself known.

3. Keep your sales simple

Everyone is on sale, even if your job or business has no impact, Cardo told those in attendance. And many entrepreneurs and professionals overreact to it.

Sales is a game of touch. It’s about finding someone who can buy, who has the power to make decisions, and who is interested. Then you contact them with offer fur, talk price, and ask. It's not always easy, though it's really easy. The most successful salespeople focus on simplifying their sales process.

4. Put your problem customers

We have it all - the customers that we meet today or in the future take up more of our time for business.

5. All your customers are committed to staying in touch after purchasing from you

Keep an eye out for ways you can sell them extra items. Don’t keep your customers engaged to monopolize your time, but you can help them gain an understanding of strategy opportunities.

6. Host an event

Hosting an event is a great way to do this because it gives potential customers the opportunity to meet your brand on a more personal level. Depending on your product or service, you can either host a personal event where customers can meet you or host an online webinar where it still feels personal - just like you are in front of your audience.

December 26, 20202 minutesAnkit KalathiyaAnkit Kalathiya