Essential Command Line Skills for Web Designers

If you’ve ever followed a web design or development tutorial, you might have seen instructions asking you to use commands like npm install or git clone. These instructions are for the Command Line Interface (CLI), a tool we use to instruct the computer to carry out specific actions, typically by entering commands in Terminal or Command Prompt.

For web designers, using Terminal or Command Prompt might not seem the easiest, especially if you’re more accustomed to graphical interfaces. However, command line tools such as Yeoman, Bower, and Google Web Starter Kit rely on command line inputs.

If the thought of typing commands seems daunting, this article will introduce you to a few simple command lines to get you started and make you more comfortable with using them.

Read Also: 
Essential Shell Commands Every Blogger Should Know

Before We Begin…

Let’s discuss Terminal and Command Prompt first. These applications grant you access to the operating system’s heart. It’s crucial to understand that once you make a change here, it cannot be undone. Therefore, any actions taken in these environments must be approached with care – only proceed if you’re confident in what you’re doing.

Another key point is the inability to use the mouse within Terminal or Command Prompt. This means you can’t search or select text using the mouse. All interactions are through the keyboard, making keyboard shortcuts invaluable.

For Windows users, it’s important to note that some commands might not be available. In such cases, I recommend using tools like Cygwin, UnxUtils, or Windows Services for UNIX Version 3.5 to bring UNIX utilities to Windows. Now, get ready to dive in with enthusiasm.

Changing Directories

Navigating through directories is a common task. Both Terminal and Command Prompt utilize the cd command for changing your current directory to a specified destination. For example, to move to a folder named foo, you would type:

cd foo

The current directory is displayed before the blinking cursor, as shown below.

Example of cd command in Terminal

To dive into a sub-directory of foo, you can do it in one step:

cd foo/sub-folder

If you need to go back to the previous directory or move up one level from your current directory, simply type:

cd ..

Read Also: 
How to Use the CD Command in Linux

Creating a New Folder

The mkdir command is handy when you need to create a new directory. To make a directory named foo, you would use the following command:

mkdir foo

Creating multiple directories simultaneously is also straightforward. The next command will create three directories named foo, hello, and world in one go:

mkdir foo hello world

This mkdir command works in both Terminal and Command Prompt.

Read Also: 
How to List Files and Folders in Linux

Creating a New File

To create an empty file, the touch command is what you need. For instance, to create a file named filename.html, you would type:

touch filename.html

If you want to create several files at once, just list them all in the command like so:

touch file.html style.css

Read Also: 
How to Use the ‘touch’ Command in Linux

Moving Files

To move a file to a specific folder, use the mv command. For instance, to move style.css into a folder named /css, the command is:

mv style.css /css

The mv command can also be used to rename files and folders. To rename index.html to about.html, you would use:

mv index.html about.html

Read Also: 
How to Use mv in Linux

Copying Files

To copy a file, the cp command (or copy on Windows) is used. For example, copying index.html and naming the duplicate as about.html can be done with:

cp index.html about.html

Remember, on Windows platforms, you should use the copy command.

Read Also: 
How to Copy Files and Folders in Linux

Listing Directory Contents

One of my most frequently used commands is the List Directory command, also known as ls. This command allows you to view all the contents within a directory.

Example of ls command output

By specifying a folder name before the ls command, you can list the contents of that particular folder, as shown below:

Listing contents of a specific folder with ls command

To get more details about the contents, such as creation date, permissions, and owners, use ls -l or ll.

Detailed listing with ls -l command

Note that the ls command works in UNIX shells, meaning it’s suitable for Ubuntu and OS X but not for Windows. For Windows, you’ll need to use the dir command instead.

Using dir command in Windows

Read Also: 
How to List Files and Folders in Linux

Opening Files

To open files or folders in their default applications, use the open command. For example, to open the Desktop folder in Finder:

open ~/Desktop

To open a .txt file in TextEdit (the default plain text editor in OS X), you would use:

open readme.txt

Windows users should opt for the edit command for a similar effect. To open a text file in the default editor, the command is:

edit readme.txt

Read Also: 
How to Use the ‘open’ Command in Linux

Creating Symbolic Links

Symbolic links, or Symlinks, function like shortcut folders, yet the system recognizes them as actual folders. A favorite use case of mine for Symlinks is to sync folders from /Dropbox to my /Sites directory, where I store all my web development projects.

Here’s how you specify the command:

ln -s /source /destination

To link your /Dropbox to the /Sites folder, execute:

ln -s ~/Dropbox/project ~/Sites/project

For Windows, the equivalent command is mklink /d.

Read Also: 
How to Use the ‘ln’ Command in Linux

Using the Nano Editor

If you need to set up a new VirtualHost with a new domain name, you’ll likely need to edit the hosts file that maps domain names to IP addresses. The fastest way to do this is by using the following command:

sudo nano /etc/hosts

Sublime Text Command Line Interface

Sublime Text includes a command line interface (CLI), subl, allowing operation through Terminal and Command Prompt. Initially, the Terminal won’t recognize the subl command.

To integrate Sublime Text CLI, execute this command:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

With this setup, you can open files directly, such as style.css, using:

subl style.css

Adding --add to your command opens files or folders in the existing Sublime Text window:

subl --add foo

For additional options, subl --help will guide you.

Read Also: 
12 Best Sublime Text Tips and Tricks

Mastering these command lines and starting with the basics will reveal that commands can be more efficient than graphical interfaces for certain tasks. Hopefully, this guide helps you begin your journey.

Further Reading: Command Line Mastery

Explore more through these posts, which teach you various tasks using command lines:

The post Essential Command Line Skills for Web Designers appeared first on Hongkiat.

A Comprehensive Guide on Date Formatting for Global Websites

Mastering date formats is essential for websites with a global audience. Different regions prefer distinct date formats, and aligning with these preferences is key to user engagement and international success. This guide dives into the effective use of JavaScript’s Internationalization API, as defined by ECMA, for customizing date displays in various languages and cultural norms. Learn how to handle different date formats, currencies, and time zones with ease.

Our focus: leveraging the Internationalization API for seamless and efficient date formatting across different languages and regions.

Display Date and Time: How to Do It Right

.no-js #ref-block-post-23989 .ref-block__thumbnail { background-image: url(“https://assets.hongkiat.com/uploads/thumbs/250×160/time-date-web.jpg”); }

Display Date and Time: How to Do It Right

We come across them dates and time… well, every day. When it comes to the Web, you can… Read more

Determining the User’s Locale

To display the date in the user’s preferred local format, it’s important to first identify their locale. The most straightforward method is to allow users to choose their language and regional preferences on your webpage.

If direct user selection isn’t viable, other approaches include interpreting the Accept-Language header from user requests or utilizing the navigator.language (for Chrome and Firefox) or navigator.browserLanguage (for Internet Explorer) properties in JavaScript.

However, it’s important to note that these methods may not always accurately reflect the user’s browser UI language preference.

 var language_tag = window.navigator.browserLanguage || window.navigator.language || "en";
 // returns language tags like 'en-GB'
 

Verifying Internationalization API Support

To determine if a browser supports the Internationalization API, we can check for the presence of the global Intl object.

 if(window.hasOwnProperty("Intl") && typeof Intl === "object"){
 // The Internationalization API is available for use
 } 

Exploring the Intl Object

The Intl object in JavaScript serves as a gateway to the Internationalization API. It contains three constructor properties: Collator for string comparison, NumberFormat for number formatting, and DateTimeFormat for date and time formatting. Our focus will be on DateTimeFormat, which is instrumental in adapting date and time presentation to different languages.

Capabilities of the DateTimeFormat Object

The DateTimeFormat constructor in JavaScript takes two optional arguments:

  • locales – This can be a string or an array of strings indicating language tags, such as “de” for German or “en-GB” for English as used in the United Kingdom. In the absence of a specific language tag, the default locale of the runtime environment is used.
  • options – An object whose properties allow customization of the date formatter. It includes properties such as:
PropertyDescriptionPossible values
dayDay of the month“2-digit”, “numeric”
eraEra in which the date falls, e.g., AD or BC“narrow”, “short”, “long”
formatMatcherAlgorithm used for format matching“basic”, “best fit” [Default]
hourHour of the day“2-digit”, “numeric”
hour12Whether to use 12-hour format (true) or 24-hour format (false)true, false
localeMatcherAlgorithm used for matching locales“lookup”, “best fit” [Default]
minuteMinute of the hour“2-digit”, “numeric”
monthMonth of the year“2-digit”, “numeric”, “narrow”, “short”, “long”
secondSecond of the minute“2-digit”, “numeric”
timeZoneTime zone to use for formatting“UTC”, default to the runtime’s time zone
timeZoneNameName of the time zone“short”, “long”
weekdayDay of the week“narrow”, “short”, “long”
yearYear“2-digit”, “numeric”

Example:

 var formatter = new Intl.DateTimeFormat('en-GB');
 // Returns a formatter for UK English date format
 var options = {weekday: 'short'};
 var formatter = new Intl.DateTimeFormat('en-GB', options);
 // Returns a formatter for UK English date format with weekday

Utilizing the format Function

The DateTimeFormat object includes a property accessor named format. This function is designed to format a Date object according to the specified locales and options within the DateTimeFormat instance.

It accepts either a Date object or undefined as an optional argument, returning a formatted date string.

Note: If no argument is provided, or if it’s undefined, the function defaults to formatting the current date using Date.now().

Here’s how it works:

 new Intl.DateTimeFormat().format()
 // Returns the current date in the format specific to the runtime's locale

Let’s explore some simple date formatting examples:

See the Pen ZGbLdL by Preethi (@rpsthecoder) on CodePen.

Now, let’s see how changing the language affects the output:

See the Pen gpambJ by Preethi (@rpsthecoder) on CodePen.

Next, let’s delve into the versatility of the formatting options:

See the Pen QbjpvK by Preethi (@rpsthecoder) on CodePen.

Using the toLocaleDateString Method

As an alternative to the formatter approach, you can use Date.prototype.toLocaleDateString for similar functionality. This method also utilizes the locales and options arguments. While it’s similar to using the DateTimeFormat object, the latter is recommended for applications handling a large number of dates.

 var mydate = new Date('2015/04/22');
 var options = {
   weekday: "short", 
   year: "numeric", 
   month: "long", 
   day: "numeric"
 };

 console.log(mydate.toLocaleDateString('en-GB', options));
 // Outputs "Wed, 22 April 2015"

Checking Supported locales

To determine which locales are supported, the DateTimeFormat object’s supportedLocalesOf method can be used. This method returns an array of all supported locales or an empty array if none are supported. For example, to test, we can include a fictitious locale “blah” among the locales being checked.

 console.log(Intl.DateTimeFormat.supportedLocalesOf(["zh", "blah", "fa-pes"]));
 // Outputs Array [ "zh", "fa-pes" ]

References

The post A Comprehensive Guide on Date Formatting for Global Websites appeared first on Hongkiat.

Creating a Next.js Dashboard for SQL Data Visualization

Creating dashboards for visualizing SQL data has been a relevant demand for a long time. In contrast, technologies for building web apps change quite frequently, so developers meet this unchangeable demand differently every year.

In this article, I’ve decided to share my latest professional experience developing a web app for visualizing data from a database.

Choosing technologies

One of the requirements I had was to use MySQL. However, I could freely choose the rest of my toolkit, including a framework.

React has always been popular among web developers for building rich user interfaces. I’ve also had a great experience using React in my previous projects and decided to refresh my skills with it.

But React is not actually a framework anymore. Reading through the React documentation, I’ve found out that from now on, projects should be created using one of the following React-based frameworks:

According to the React team, using a framework from the start ensures that the features used by most web applications are built-in, such as routing, HTML generation, data fetching, etc.

In this way, when your project reaches the point when such features are needed, you do not need to look for additional libraries and configure them for your project. Instead, all features are already available for you, making development much smoother. You can see more details on the React website.

This left me with one question…

Which framework should I use?

As with everything in this world, there is no universal React framework that suits every need.

I’ve decided to stop on Next.js for my project, and here is why:

The framework is chosen, but it’s not enough. We also need tools for connecting to MySQL and visualizing its data.

Choosing data visualization tools

You should carefully consider which third-party tools to use in your project since there are so many options and not every one of them might suit your needs. For me, the perfect choices were Flexmonster and Recharts.

Both of these tools are flexible, powerful, and easy to use.

  • Flexmonster is primarily a pivot table and allows working with different datasets, such as MySQL. It can also be integrated with various frameworks, including Next.js! Flexmonster’s documentation even provides a dedicated tutorial for integrating this tool with Next.js. Flexmonster is a paid tool, but it offers a 30-day trial, which was more than enough for me to get acquainted with the product and determine if it suits my use cases.
  • Recharts is a charting library with a wide selection of built-in charts and customization options. The library pairs especially well with Next.js applications since it uses React’s component-based architecture. Recharts is a free tool released under the MIT license, which is worth considering.

My deciding factor was the easy setup of Flexmonster, Recharts, and their communication. While Flexmonster connects to the MySQL dataset, processes its data, and visualizes the data in the pivot table, Recharts can use the processed data to visualize it in charts.

If you are wondering whether these tools fit your project, check out the best tools for data visualization in React article. It covers in great detail the different options on the market, their pros and cons, as well as their use cases.

Now that the preparations are complete let’s create the actual app!

Create a Next.js project

First, a basic Next.js app must be created with the following command:

npx create-next-app next-sql --ts --app && cd next-sql

Notice the --ts and --app arguments. They enable TypeScript and the new App Router feature, which this tutorial assumes in further instructions.

You will also be given prompts to enable other features, such as ESLint or Tailwind CSS. For simplicity, answer No. But if you know what you’re doing and these features are necessary for your project – feel free to enable them.

Also, it’s best to remove unnecessary data from the newly created project. For the purposes of this tutorial, we won’t need the public/ folder so you may delete it. If you think you might need this folder for other reasons, feel free to leave it where it is.

In addition, change the app/page.tsx file, so it has the following contents:

"use client"
import styles from './page.module.css'

export default function Home() {
  return (
    <main className={styles.main}>
    </main>
  );
}

It’s important that the page is marked as a Client Component because we will add features that can be used only when the page is rendered on the client side.

Finally, the unnecessary styles should be deleted from the app/page.module.css file so it has the following content:

.main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 6rem;
  min-height: 100vh;
}

Embed data visualization tools

Next, we need to add Flexmonster and Recharts to our newly created project. Let’s start with Flexmonster.

Embedding Flexmonster

First, install the Flexmonster CLI:

npm install -g flexmonster-cli

Next, download the Flexmonster wrapper for React:

flexmonster add react-flexmonster

Now let’s add Flexmonster to our page:

  1. Import Flexmonster styles into the app/global.css file in your project:
    @import "flexmonster/flexmonster.css";
  2. Create the PivotWrapper Client Component (e.g., app/PivotWrapper.tsx) that will wrap FlexmonsterReact.Pivot:
      "use client"
      import * as React from "react";
      import * as FlexmonsterReact from "react-flexmonster";
      import Flexmonster from "flexmonster";
    
      type PivotProps = Flexmonster.Params & {
        pivotRef?: React.ForwardedRef<FlexmonsterReact.Pivot>;
      };
    
      const PivotWrapper: React.FC<PivotProps> = ({ pivotRef, ...params }) => {
        return (
          <FlexmonsterReact.Pivot
            {...params}
            ref={pivotRef}
          />
        );
      };
    
      export default PivotWrapper;
    
  3. Import the PivotWrapper into your Next.js page (e.g., app/page.tsx) as a dynamic component without SSR:
      import dynamic from "next/dynamic";
    
      const PivotWrapper = dynamic(() => import("@/app/PivotWrapper"), {
        ssr: false,
        loading: () => <p>Loading Flexmonster...</p>
      });
    

    The SSR is disabled because Flexmonster uses the window object, so it cannot be rendered on a server.

  4. In the same page file, create an additional component for ref forwarding (e.g., ForwardRefPivot):
      import * as React from "react";
      import { Pivot } from "react-flexmonster";
    
      const ForwardRefPivot = React.forwardRef<Pivot, Flexmonster.Params>(
        (props, ref?: React.ForwardedRef<Pivot>) => <PivotWrapper {...props} pivotRef={ref}/>
      );
    
  5. Inside the page component (e.g., Home), create an empty ref object (e.g., pivotRef):
      export default function Home() {
        const pivotRef: React.RefObject<Pivot> = React.useRef<Pivot>(null);
      }
    
  6. Then insert the ForwardRefPivot component from step 4 and pass the ref object as its prop:
      export default function Home() {
        const pivotRef: React.RefObject<Pivot> = React.useRef<Pivot>(null);
    
        return (
          <main className={styles.main}>
            <ForwardRefPivot
              ref={pivotRef}
              toolbar={true}
            />
          </main>
        );
      }
    

Now Flexmonster is ready to be used. Let’s move to Recharts.

Embedding Recharts

Start by installing Recharts with the following command:

npm install recharts

Then, import the LineChart component with its child components and insert them after the pivot table:

import { LineChart, Line, CartesianGrid, YAxis, XAxis } from "recharts";

export default function Home() {
  const pivotRef: React.RefObject<Pivot> = React.useRef<Pivot>(null);

  return (
    <main className={styles.main}>
      <ForwardRefPivot
        ref={pivotRef}
        toolbar={true}
      />

      <LineChart width={1000} height={300}>
        <Line type="monotone" stroke="#8884d8" />
        <CartesianGrid stroke="#ccc" />
        <XAxis />
        <YAxis />
      </LineChart>
    </main>
  );
}

Technically, we’ve added Recharts to our page, but we need to fill it with data. Let’s first create interfaces that will describe data for Recharts:

interface RechartsDataObject { [key: string]: any; }
interface RechartsData {
  data: RechartsDataObject[];
  xName: string;
  lineName: string;
}

Then, we need to create a variable that will hold the Recharts data. But remember, our data will come from Flexmonster, which can change at runtime. So we need some way of tracking changes to this data. That’s where React states come in handy. Add the following code to your page component:

export default function Home() {
  // Flexmonster instance ref
  const pivotRef: React.RefObject<Pivot> = React.useRef<Pivot>(null);
  // Recharts data
  const [chartsData, setChartsData] = React.useState<RechartsData>({ data: [], xName: "", lineName: "" });

  // Subscribe on Recharts data changes
  React.useEffect(() => {
    console.log("Charts data changed!");
  }, [chartsData]);
  // The rest of the code
}

Now, the data for Recharts will be stored in the chartsData variable, and thanks to the useState and useEffects React Hooks, we will know when it’s changed.

Lastly, we need to tell Recharts to use chartsData as its source of data by adding the following props:

<LineChart width={1000} height={300} data={chartsData.data}>
  <Line dataKey={chartsData.lineName} type="monotone" stroke="#8884d8" />
  <CartesianGrid stroke="#ccc" />
  <XAxis dataKey={chartsData.xName} />
  <YAxis />
</LineChart>

In the next section, let’s fill the chartsData with the data from Flexmonster so our pivot table and charts are synced.

Connecting Flexmonster and Recharts

In the app/page.tsx file, let’s create a function that transforms the data from Flexmonster so it can be accepted by Recharts:

import { GetDataValueObject } from "flexmonster";

function prepareDataFunction(rawData: Flexmonster.GetDataValueObject): RechartsData | null {
  // If there is no data, return null
  if (!rawData.data.length)
    return null;
  
  // Initialize chartsData object
  const chartsData: RechartsData = {
    data: [],
    xName: rawData.meta["r0Name" as keyof typeof rawData.meta],
    lineName: rawData.meta["v0Name" as keyof typeof rawData.meta]
  };
  
  // Transform Flexmonster data so it can be processed by Recharts
  // The first rawData element is skipped because it contains a grand total value, not needed for our charts
  for (let i = 1, dataObj, chartDataObj: RechartsDataObject; i < rawData.data.length; i++) {
    dataObj = rawData.data[i];
    chartDataObj = {};
    chartDataObj[chartsData.xName] = dataObj["r0" as keyof typeof dataObj];
    chartDataObj[chartsData.lineName] = dataObj["v0" as keyof typeof dataObj];
    chartsData.data.push(chartDataObj);
  }
  
  return chartsData;
}

To keep the tutorial simple, prepareFunction returns only data for the first row and measure. If you want to display data for another field or measure, move this field or measure to the first position using the Field List in Flexmonster.

Watch this video to see how it works:

Now, let’s add a function for chart drawing in the page component itself (e.g., Home). The function will call the previously created prepareFunction and update the chartsData state to trigger re-rendering:

export default function Home() {
  // Flexmonster instance ref
  const pivotRef: React.RefObject<Pivot> = React.useRef<Pivot>(null);
  
  // Recharts data
  const [chartsData, setChartsData] = React.useState<RechartsData>({ data: [], xName: "", lineName: "" });
  
  // Subscribe on Recharts data changes
  React.useEffect(() => {
    console.log("Charts data changed!");
  }, [chartsData]);
  
  // Function for chart drawing
  const drawChart = (rawData: GetDataValueObject) => {
    const chartsData = prepareDataFunction(rawData);
    if (chartsData) {
      setChartsData(chartsData);
    }
  }
  
  // The rest of the code
}

All that’s left is to tell Flexmonster to use this function when its data is changed. Add the following props to the ForwardRefPivot component:

<ForwardRefPivot
  ref={pivotRef}
  toolbar={true}
  // Connecting Flexmonster and Recharts
  reportcomplete={() => {
    pivotRef.current?.flexmonster.off("reportcomplete");
    pivotRef.current?.flexmonster.getData({}, drawChart, drawChart);
  }}
  licenseKey="XXXX-XXXX-XXXX-XXXX-XXXX"
/>

Here, we’ve subscribed to the reportcomplete event to know when Flexmonster is ready to provide data. When the event is triggered, we immediately unsubscribe from it and use the getData method to tell Flexmonster where to pass the data and what to do when it’s updated. In our case, we can use the drawChart function for both purposes.

Also, notice the licenseKey prop. It must contain a special trial key that will allow us to connect to Recharts. You can get such a key by contacting the Flexmonster team. Once you have the key, paste it in place of XXXX-XXXX-XXXX-XXXX-XXXX.

Flexmonster and Recharts are now connected, but they are still empty! Let’s fix it by connecting to a database!

Connecting to MySQL

Since Recharts gets data from Flexmonster, only the latter should be connected to the database. Fortunately, Flexmonster provides a ready-to-use solution – Flexmonster Data Server. This is a server application, so all aggregations are performed on the server side, which saves the browser’s resources and results in faster data visualization. This fits perfectly into the Next.js philosophy of putting heavy work on the server (see the SSG and SSR features).

We can install the Data Server using the previously installed Flexmonster CLI:

flexmonster add fds -r

Once the command is finished – Flexmonster Admin Panel will open. This is a tool for configuring the Data Server and its connections, also called indexes. Let’s configure one for our MySQL database.

  1. Open the Indexes tab and click Add New Index:
  2. Add New Index Screen
  3. Under the Name and Type fields, enter the connection’s name (e.g., next-sql) and select the Database type:
  4. Index Configuration Fields
  5. The Database type should be set to MySQL by default. Enter the Connection string and the Query for your database under the respective fields. For this tutorial, I have hosted a sample database on the freedb.tech service. Feel free to use this connection string and query:

    Connection string:

    Server=sql.freedb.tech;Port=3306;Uid=freedb_dkflbvbh;pwd=NpkyU?jYv!2Zn&B;Database=freedb_next_fm

    Query:

    SELECT CONCAT(first_name,' ',last_name) AS full_name,salary,TIMESTAMPDIFF(YEAR, birthday, CURDATE()) AS age FROM users

    The Refresh time indicates how often the data should be refreshed (0 means the data is not refreshed).

    When all the configurations are set, hit Create to establish the connection to the database:

  6. Database Connection Setup

Now, all that’s left is to visualize the data.

Visualize the data in the pivot table and charts

To visualize data prepared by the Data Server, we need to create a Flexmonster report.

A report is used to predefine configurations for Flexmonster Pivot. Our interest lies in the data source configuration for SQL databases.

We will represent our report as an object (e.g., report) that contains the following data:

const report = {
  dataSource: {
    type: "api",
    url: "http://localhost:9500",
    index: "next-sql"
  }
};

Let’s cover what each property stands for:

  • dataSource contains data source configurations for the pivot table component.

    For simplicity, I’ve specified only the required properties to visualize our data. There are many more options described in Flexmonster docs.

  • dataSource.type specifies the type of the data source.

    In our case, it must be set to “api“.

  • dataSource.url contains the Data Server’s URL where the client will send requests for data.

    Since the client and the server run on the same machine, we can use the localhost address. The port is set to 9500 because the Data Server uses it by default. You can run the Data Server on another port.

  • dataSource.index identifies the dataset created in the Data Server.

    We’ve named it “next-sql” in the Connecting to MySQL part of this tutorial, so let’s specify it here.

Now, let’s pass the previously created report as a ForwardRefPivot prop:

<ForwardRefPivot
  ref={pivotRef}
  toolbar={true}
  //Setting report
  report={report}
  //Connecting Flexmonster and Recharts
  reportcomplete={() => {
    pivotRef.current?.flexmonster.off("reportcomplete");
    pivotRef.current?.flexmonster.getData({}, drawChart, drawChart);
  }}
  licenseKey="XXXX-XXXX-XXXX-XXXX-XXXX"
/>

Conclusion

Hooray, our Next.js data visualization app is ready and can be started with this command:

npm run build && npm start

You can also get this tutorial project on GitHub. Feel free to use it as a starting point when developing your NEXT app (pun intended)!

The post Creating a Next.js Dashboard for SQL Data Visualization appeared first on Hongkiat.

How to Remove Unnecessary jQuery Modules

jQuery is undoubtedly the most popular JavaScript library. Almost every website on the planet uses it. Due to its widespread use, jQuery includes functionalities to cover every possible scenario.

However, when working on a simple website, we might only use a few of these functions. It would be more efficient to run only the necessary functions and exclude the unused ones. We can exclude certain jQuery modules that aren’t needed for our project. Let’s explore how to do this.

Getting Started

First, we need to install essential tools for the task. These tools include Git, Grunt, and Node.js. If you’re using macOS, the most straightforward method to install these tools is through the macOS package manager, Homebrew.

Installing Homebrew

Open your Terminal and execute the following command to install Homebrew. With Homebrew, installing the other tools becomes simpler.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Installing Git

Once Homebrew is installed, execute the command below to install Git.

brew install git
Installing Node.js

Use the following command to install Node.js:

brew install node
Installing Grunt

Finally, install Grunt by running the command below:

npm install -g grunt-cli

For Windows users, there’s a comparable package manager named Chocolatey. You can use it to install the aforementioned packages in a similar manner.

Building jQuery

At present, jQuery allows the exclusion of the following modules:

ModuleCommandDescription
Ajax-ajaxThis refers to the jQuery AJAX API, which includes jQuery.ajax(), jQuery.get(), and the .load() function.
CSS-cssThis pertains to functions from the jQuery CSS Category, including .addClass(), .css(), and .hasClass().
Deprecated-deprecatedThis refers to the deprecated modules or functions.
Event Alias-event-aliasThis pertains to event functions such as .click(), .focus(), and .hover().
Dimensions-dimensionsThis relates to the functions for setting CSS dimensions, including .height(), .innerHeight(), and .innerWidth().
Effects-effectsThis refers to functions that apply animation effects, such as .slideToggle(), .animate(), and .fadeIn().
Offset-offsetThis pertains to functions that retrieve coordinates and position, including .offset() and .position().

Before customizing jQuery, we need to clone it from the GitHub repository. Execute the following command in the Terminal:

git clone git://github.com/jquery/jquery.git

A new folder named jquery will be created in your user directory. Navigate to this directory with the command:

cd jquery

Next, install the Node dependency modules required for our project:

npm install

Then, build jQuery by simply executing the Grunt command:

grunt

If successful, the following report will be displayed:

grunt report

As indicated in the report, our jQuery is stored in the dist/ folder. At this stage, our jQuery includes all functionalities, resulting in a size of 265kb. The minified version is 83kb.

jquery report

Module Removal

If you wish to remove the Effects module from jQuery, execute the following command:

grunt custom:-effects

Upon checking the file size again, you’ll notice it has reduced to 246kb.

jQuery custom build

To exclude multiple modules, list each module separated by a comma, like so:

grunt custom:-effects,-ajax,-deprecated

Excluding multiple modules will further reduce the jQuery file size. In this instance, it’s been reduced to just 207kb.

Concluding Thoughts

jQuery facilitates easy DOM manipulation, but its size, exceeding 200kb, might impact your website’s performance. By removing unnecessary jQuery modules, your script will undoubtedly run more efficiently and faster. We hope this tip proves beneficial for your upcoming projects.

The post How to Remove Unnecessary jQuery Modules appeared first on Hongkiat.

30 Basic Git Commands You Should Know

When it comes to software development, version control is essential. It allows you to track your code changes, revert to previous stages, and collaborate with your team on a project. One of the most popular version control systems is Git. Whether you’re a beginner just starting out or an experienced developer looking to streamline your workflow, understanding Git commands is a skill that will undoubtedly pay off.

basic git commands

In this post, we will delve into 30 basic Git commands that every developer should know. These commands will help you initialize a repository, make commits, create and switch branches, and much more. By mastering these commands, you’ll be well on your way to becoming a more efficient and effective developer.

10 Useful Github Features to Know

10 Useful Github Features to Know

Github is now the place where programmers and designers work together. They collaborate, contribute, and fix bugs. It… Read more

1. git init:

This command is used to initialize a new Git repository. It creates a new .git subdirectory in your current working directory. This will also create a new branch named master.

Example:

git init

This will initialize a Git repository in your current directory.

2. git clone:

This command is used to clone a repository. It creates a copy of a remote repository on your local machine.

Example:

git clone https://github.com/username/repository.git

This will clone the repository at the given URL to your local machine.

3. git add:

This command adds a file to the staging area in preparation for a commit.

Example:

git add filename

This will add the file named “filename” to the staging area.

4. git commit:

This command is used to save your changes to the local repository. It takes a snapshot of the changes you’ve staged using git add.

Example:

git commit -m "Commit message"

This will commit your changes with a message describing what you changed.

5. git status:

This command shows the status of changes as untracked, modified, or staged.

Example:

git status

This will display the status of your working directory.

6. git pull:

This command fetches changes from a remote repository and merges them into your current branch.

Example:

git pull origin master 

This will pull changes from the master branch of the origin remote repository.

7. git push:

This command sends your committed changes to a remote repository.

Example:

git push origin master 

This will push your committed changes to the master branch of the origin remote repository.

8. git branch:

This command lists all of the branches in your repository.

Example:

git branch

This will list all of the branches in your repository.

9. git checkout:

This command is used to switch between branches in a Git repository.

Example:

git checkout branch-name

This will switch to the branch named “branch-name”.

10. git merge:

This command merges the changes from one branch into another.

Example:

git merge branch-name
11. git diff:

This command shows the file differences which are not yet staged.

Example:

git diff 

This will show unstaged differences since the last commit.

12. git reset:

This command unstages the file, but it preserves the file contents.

Example:

git reset filename 

This will unstage the file named “filename“.

13. git rm:

This command deletes the file from your working directory and stages the deletion.

Example:

git rm filename

This will delete the file named “filename” and stage the deletion.

14. git log:

This command shows a listing of commits on a branch including the corresponding details.

Example:

git log 

This will display an ordered list of the recent commits.

15. git show:

This command shows the metadata and content changes of the specified commit.

Example:

git show

This will display the metadata and content changes of the latest commit.

16. git tag:

This command is used to give tags to the specified commit.

Example:

git tag v1.0

This will tag the latest commit with “v1.0”.

17. git fetch:

This command fetches all the objects from the remote repository that are not present in the local one.

Example:

git fetch origin

This will fetch all objects from the origin remote that don’t exist in your current repository.

18. git rebase:

This command is used to apply the changes made on the current branch ahead of another branch.

Example:

git rebase master

This will apply any changes made on the current branch ahead of the master branch.

19. git revert:

This command creates a new commit that undoes the changes made in a previous commit.

Example:

git revert HEAD

This will create a new commit that undoes the changes made in the last commit.

20. git stash:

This command temporarily saves changes that you don’t want to commit immediately. You can apply the changes later.

Example:

git stash 

This will temporarily save all modified tracked files.

21. git stash pop:

This command restores the most recently stashed changes.

Example:

git stash pop

This will apply the most recently stashed changes and remove them from the stash list.

22. git stash list:

This command lists all stashed changesets.

Example:

git stash list 

This will display all stashed changesets.

23. git stash drop:

This command discards the most recently stashed changeset.

Example:

git stash drop

This will discard the most recently stashed changeset.

24. git cherry-pick:

This command applies the changes introduced by some existing commits.

Example:

git cherry-pick commitID 

This will apply the changes introduced by the commit with the given ID.

25. git bisect:

This command uses a binary search algorithm to find which commit in your project’s history introduced a bug.

Example:

git bisect start
git bisect bad
git bisect good commitID

This will start the bisecting process, mark the current commit as bad, and mark the commit with the given ID as good.

26 git blame:

This command shows what revision and author last modified each line of a file.

Example:

git blame filename 

This will show what revision and author last modified each line of “filename”.

27. git clean:

This command removes untracked files from your working directory.

Example:

git clean -n 

This will show what will be removed without actually doing it. Replace -n with -f to actually remove the files.

28 git reflog:

This command shows a list of all references to commits in the local repository.

Example:

git reflog 

This will display all references to commits in your local repository.

29. git grep:

This command lets you search through your repository.

Example:

git grep "hello" 

This will search the repository for any occurrences of “hello”.

30. gitk:

This command launches the Git repository browser.

Example:

gitk

This will launch the Git repository browser.

Conclusion

In conclusion, Git is a powerful tool that can greatly enhance your productivity and efficiency as a developer. The 30 basic Git commands we’ve discussed in this post are just the tip of the iceberg. There are many more commands and options available in Git, and we encourage you to explore them further.

Remember, practice makes perfect. The more you use these commands, the more comfortable you’ll become with them. So, don’t be afraid to dive in and start using Git in your projects. It may seem daunting at first, but with time and practice, you’ll find that it’s an invaluable tool in your development toolkit.

The post 30 Basic Git Commands You Should Know appeared first on Hongkiat.

10 Common CSS Mistakes Developers Often Make

CSS is a powerful tool that brings our websites to life. It’s the magic behind the beautiful, interactive, and responsive designs that captivate users. However, like any tool, it’s not immune to misuse or misunderstanding. Even the most seasoned developers can fall into common CSS pitfalls that can turn a dream website into a nightmare of bugs and inconsistencies.

CSS coding

In this blog post, we’ll shine a light on the ten common CSS mistakes developers make; whether you’re a beginner just dipping your toes into the CSS pool, or an experienced developer looking to brush up on best practices, this post is for you.

By understanding and avoiding these common CSS mistakes, you can write cleaner, more efficient code, ensure your websites look and function as intended across all browsers and devices, and ultimately provide a better user experience.

1. Not Using a Reset CSS

Different browsers have different default styles for elements. For example, the default margin and padding for the <body> element might be different in Chrome and Firefox. This can lead to inconsistencies in how your website looks across different browsers.

Example:

Let’s say you have a simple HTML file:

<!DOCTYPE html>
<html>
<head>
    <title>Test Page</title>
</head>
<body>
    <h1>Hello, world!</h1>
</body>

And you have some CSS:

body {
    margin: 0;
    padding: 0;
}

h1 {
    margin: 0;
    padding: 0;
}

Even with this CSS, the <h1> might still have some margin in some browsers, because they have a default style for <h1> that includes a margin.

Fix:

To fix this issue, you can use a reset CSS. A reset CSS is a set of styles that you apply at the beginning of your CSS file to reset the default styles of elements. Here’s a simple reset CSS:

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

This CSS resets the margin and padding of all elements to 0, and sets their box-sizing to border-box. This can help eliminate inconsistencies between browsers.

However, this is a very simple reset and might not cover all elements and styles. There are more comprehensive reset CSS files available, like the Meyer’s reset, which you can find online and use in your projects.

Using a reset CSS can make your website look very plain, because it removes all default styles. After applying a reset, you’ll need to style all elements yourself. But this gives you complete control over the look of your website.

2. Not Using Shorthand Properties

CSS has shorthand properties that allow you to set multiple related styles at once. If you’re not using them, your CSS can become unnecessarily long and harder to maintain.

Example:

Let’s say you have the following CSS:

.box {
    margin-top: 10px;
    margin-right: 20px;
    margin-bottom: 10px;
    margin-left: 20px;
}

This CSS applies margin to all four sides of elements with the class “box“. But it’s quite verbose.

Fix:

You can use the shorthand margin property to set all four margins at once:

.box {
    margin: 10px 20px;
}

This does the same thing as the previous CSS. The first value is the top and bottom margin, and the second value is the right and left margin.

Here’s another example with the background property. Instead of this:

.box {
    background-color: #000;
    background-image: url('image.jpg');
    background-repeat: no-repeat;
    background-position: center;
}

You can write this:

.box {
    background: #000 url('image.jpg') no-repeat center;
}

Shorthand properties can make your CSS much shorter and easier to read and maintain. They can also help ensure consistency in your styles.

However, be aware that when you use a shorthand property, any unspecified sub-properties are set to their initial values. For example, if you use the background shorthand property and don’t specify a background size, the background size is set to its default value of “auto“.

3. Using Inline Styles

Inline styles are CSS declarations that are applied directly within your HTML elements. While they might seem convenient for quick styling, they can lead to several issues:

Maintenance Difficulty: If you have a large HTML file with many elements using inline styles, it can become very difficult to maintain and update your styles.

Specificity Issues: Inline styles have a very high specificity. This means that they will override any styles declared in your external or internal CSS, making it difficult to override them when needed.

Reusability: Inline styles are not reusable. If you want to apply the same styles to multiple elements, you would have to repeat the inline styles for each element.

Example:

Here’s an example of an inline style:

<h1 style="color: blue; font-size: 2em;">Hello, world!</h1>
Fix:

Instead of using inline styles, it’s better to use external or internal CSS. Here’s how you can do the same thing with internal CSS:

<head>
    <style>
        .blue-heading {
            color: blue;
            font-size: 2em;
        }
    </style>
</head>
<body>
    <h1 class="blue-heading">Hello, world!</h1>
</body>

And here’s how you can do it with external CSS. First, create a CSS file (let’s call it “styles.css”):

.blue-heading {
    color: blue;
    font-size: 2em;
}

Then, link it in your HTML file:

<head>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <h1 class="blue-heading">Hello, world!</h1>
</body>

Using external or internal CSS makes your styles easier to maintain and update, allows you to reuse styles, and avoids specificity issues. It’s a best practice to avoid using inline styles whenever possible.

4. Not Using Vendor Prefixes

Vendor prefixes are a way for browser makers to add new CSS features before they become part of the official CSS specifications. Not using them can lead to some CSS properties not being recognized by some browsers, causing inconsistencies in your design.

Example:

Let’s say you want to use the box-shadow property, which is a relatively new addition to CSS:

.box {
    box-shadow: 10px 10px 5px #888888;
}

This CSS will work in most modern browsers, but older versions of some browsers might not recognize the box-shadow property.

Fix:

To ensure that your CSS works in as many browsers as possible, you can use vendor prefixes. Here’s how you can add a box shadow with vendor prefixes:

.box {
    -webkit-box-shadow: 10px 10px 5px #888888; /* Safari and Chrome */
    -moz-box-shadow: 10px 10px 5px #888888; /* Firefox */
    box-shadow: 10px 10px 5px #888888; /* non-prefixed, works in most modern browsers */
}

This CSS will apply a box shadow in Safari, Chrome, Firefox, and most other modern browsers.

However, keep in mind that vendor prefixes should be used as a last resort. The use of vendor prefixes can lead to bloated and hard-to-maintain code. It’s better to write standard CSS and let tools like Autoprefixer add the vendor prefixes for you.

Also, note that as CSS evolves and browsers update, the need for vendor prefixes decreases. Many properties that once required vendor prefixes now are universally supported without them. Always check the current browser compatibility for a CSS feature before deciding to use vendor prefixes.

5. Using Too Specific Selectors

In CSS, specificity determines which CSS rule is applied by the browsers. If your selectors are too specific, it can make your CSS hard to override and maintain. It can also lead to unnecessary complexity in your CSS.

Example:

Let’s say you have the following CSS:

body div#container ul.nav li a {
    color: blue;
}

This selector is very specific. It selects an <a> element that is a descendant of an <li> element, which is a descendant of a <ul> with a class of “nav”, which is a descendant of a <div> with an ID of “container”, which is a descendant of the <body>.

Fix:

It’s better to use classes and keep your selectors as simple as possible. Here’s how you can simplify the previous selector:

.nav a {
    color: blue;
}

This selector does the same thing as the previous one, but it’s much simpler. It selects any <a> element that is a descendant of an element with a class of “nav”.

Simplifying your selectors makes your CSS easier to read and maintain. It also reduces the likelihood of specificity conflicts, where more specific selectors override less specific ones.

However, be aware that simplifying your selectors can also increase the likelihood of naming conflicts, where two elements have the same class name but should have different styles. To avoid this, you can use methodologies like BEM (Block, Element, Modifier) to name your classes in a way that reduces the likelihood of conflicts.

6. Not Organizing Your CSS

If your CSS is not organized, it can be hard to find and change styles. This can lead to difficulties in maintaining your code, especially when working with large stylesheets or in a team environment.

Example:

Let’s say you have a CSS file with hundreds of lines of code, and the styles are all mixed up:

h1 {
    color: blue;
}

.footer {
    background: black;
}

h2 {
    color: green;
}

.header {
    background: white;
}

In this example, the styles for different sections of the website are scattered throughout the CSS file. This can make it hard to find the styles for a specific section when you need to update them.

Fix:

A good practice is to organize your CSS in a logical way. Here’s how you can organize the previous CSS:

/* Header */
.header {
    background: white;
}

h1 {
    color: blue;
}

h2 {
    color: green;
}

/* Footer */
.footer {
    background: black;
}

In this example, the styles are grouped by the section of the website they apply to. This makes it easier to find and update the styles for a specific section.

There are many ways to organize your CSS, and the best method depends on the specifics of your project. Some developers prefer to organize their CSS by component, others prefer to organize it by page, and others prefer to organize it by type of style (typography, layout, color, etc.).

In addition to organizing your CSS within each file, it’s also a good idea to organize your CSS files themselves. For large projects, it can be helpful to split your CSS into multiple files (for example, one for typography, one for layout, one for colors, etc.) and then import them all into a main stylesheet using @import statements. This can make your CSS easier to manage and maintain.

7. Not Using CSS Variables

CSS variables, also known as custom properties, allow you to store specific values for reuse throughout your CSS. If you’re not using them, you might find yourself repeating the same values over and over, which can make your CSS harder to maintain and update.

Example:

Let’s say you have a specific shade of blue that you use frequently in your CSS:

.header {
    background-color: #007BFF;
}

.button {
    background-color: #007BFF;
}

.link {
    color: #007BFF;
}

In this example, the same color value is repeated three times. If you decide to change this color, you would have to find and update every instance of it in your CSS.

Fix:

You can use a CSS variable to store this color value:

:root {
    --main-color: #007BFF;
}

.header {
    background-color: var(--main-color);
}

.button {
    background-color: var(--main-color);
}

.link {
    color: var(--main-color);
}

In this example, the color value is stored in a variable called --main-color, and this variable is used wherever the color is needed. If you decide to change this color, you only need to update the variable, and the change will be applied everywhere the variable is used.

CSS variables can make your CSS easier to maintain and update. They can also help ensure consistency in your styles. However, be aware that CSS variables are not supported in some older browsers, so if you need to support this browser, you might need to provide a fallback or use a preprocessor like Sass or Less, which have their own systems for variables.

8. Not Considering Accessibility

Accessibility in web design means making your website usable for all people, regardless of their abilities or disabilities. This includes people with visual, auditory, cognitive, and motor impairments. If you’re not considering accessibility in your CSS, you might be excluding a significant portion of your audience.

Example:

Let’s say you have a website with light gray text on a white background:

body {
    color: #999;
    background-color: #fff;
}

This might look stylish, but it’s hard to read for people with low vision or color vision deficiencies.

Fix:

To make your website more accessible, you can use high contrast colors for your text and background:

body {
    color: #333;
    background-color: #fff;
}

This is much easier to read, even for people with vision impairments.

In addition to color contrast, there are many other aspects of accessibility to consider in your CSS. Here are a few examples:

  • Use relative units like em and rem for font sizes, so users can adjust the text size if needed.
  • Avoid using CSS to hide content that should be accessible to screen readers. For example, use visibility: hidden or opacity: 0 instead of display: none.
  • Use media queries to make your design responsive, so it’s usable on all screen sizes.
  • Use ARIA roles and properties when necessary to provide additional information to assistive technologies.

Remember, accessibility is not just a nice-to-have feature, it’s a requirement for good web design. Making your website accessible can improve its usability for all users, not just those with disabilities.

9. Not Testing on Multiple Browsers

Your website can look and behave differently on different browsers due to differences in how they interpret and render CSS. If you’re not testing your website on all major browsers, you might be unaware of these differences, leading to a poor user experience for some of your visitors.

Example:

Let’s say you’ve used the CSS grid layout in your website design:

.container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

While CSS Grid is supported in all modern browsers, it may not be fully supported or may behave differently in older versions of some browsers.

Fix:

To ensure your website looks and works correctly on all major browsers, you should test it on each one. This includes Chrome, Firefox, Safari, and Edge. There are also tools available that can help you with cross-browser testing, such as BrowserStack and BitBar.

If you find that a certain CSS feature is not supported or behaves differently in a certain browser, you can use feature queries (@supports rule) to provide a fallback:

.container {
    display: flex;
}

@supports (display: grid) {
    .container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
}

In this example, the container will use the flex layout by default. If the browser supports CSS Grid (as determined by the @supports rule), it will use the grid layout instead.

The goal of cross-browser testing is not to make your website look exactly the same on all browsers, but to ensure a consistent and usable experience for all users.

10. Not Using Responsive Design

With the variety of devices and screen sizes today, it’s important to make your website responsive. This means that the layout and design of your website should adapt to the screen size of the device it’s being viewed on. If you’re not using responsive design, your website might be hard to use on some devices, particularly mobile devices.

Example:

Let’s say you have a website with a fixed width:

.container {
    width: 1200px;
}

This website will look fine on screens that are 1200px wide or larger, but on smaller screens, it will cause horizontal scrolling, which is generally considered a poor user experience.

Fix:

To make your website responsive, you can use media queries to apply different styles for different screen sizes. Here’s how you can make the previous example responsive:

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

In this example, the container will take up 100% of the screen width on smaller screens, and it will be centered with a maximum width of 1200px on larger screens.

You can also use media queries to apply completely different styles for different screen sizes. For example:

.container {
    width: 100%;
}

@media (min-width: 768px) {
    .container {
        width: 750px;
        margin: 0 auto;
    }
}

@media (min-width: 1200px) {
    .container {
        width: 1170px;
        margin: 0 auto;
    }
}

In this example, the container will be full width on screens smaller than 768px, 750px wide on screens between 768px and 1199px, and 1170px wide on screens that are 1200px or larger.

Using responsive design can make your website more user-friendly and accessible to a wider audience. It’s a crucial aspect of modern web design.

The post 10 Common CSS Mistakes Developers Often Make appeared first on Hongkiat.

Understand Units in CSS: A Comprehensive Guide

CSS (Cascading Style Sheets) is a crucial component of modern web design. It’s the language that gives your website its look and feel. But to truly master CSS, you need to understand the units it uses to measure things like length, angle, time, and resolution.

CSS units

In this guide, we take a look into each type of CSS unit, providing an explanations and practical examples to help you grasp their usage. We’ll cover everything from absolute and relative length units like px, em, rem, and viewport units like vw, vh, to more specialized units like degrees deg for rotation, seconds s and milliseconds ms for animation durations, and even dots per inch dpi for resolution.

By understanding these CSS units, you’ll gain more control over your layouts, leading to more precise, responsive, and visually appealing designs.

1. Absolute Lengths

px (Pixels)

This is the most commonly used unit in web design. A pixel represents a single point on a computer screen.

Example: font-size: 16px; sets the font size to 16 pixels.

cm (Centimeters)

This unit is not commonly used in web design because screen sizes and resolutions vary greatly between devices. However, it can be useful for print media.

Example: width: 10cm; sets the width of an element to 10 centimeters.

mm (Millimeters)

Similar to centimeters, millimeters are not commonly used in web design but can be useful for print media.

Example: width: 100mm; sets the width of an element to 100 millimeters.

in (Inches)

This unit is also more useful for print media than web design.

Example: width: 4in; sets the width of an element to 4 inches.

pt (Points)

Points are traditionally used in print media (1 point is equal to 1/72 of an inch). In CSS, points are useful for creating styles that can be printed with precision.

Example: font-size: 12pt; sets the font size to 12 points.

pc (Picas)

A pica is equal to 12 points. It’s another unit that’s more commonly used in print than in web design.

Example: font-size: 1pc; sets the font size to 12 points.

Absolute length in CSS:

Here’s an example of how these units might be used in a CSS rule:

div {
    width: 300px;
    height: 20cm;
    padding: 5mm;
    border: 1in solid black;
    font-size: 14pt;
    margin: 1pc;
}

Code explanation:

The div element would have a width of 300 pixels, a height of 20 centimeters, padding of 5 millimeters, a border that’s 1 inch wide, a font size of 14 points, and a margin of 1 pica.

However, keep in mind that these units may render differently on different screens and devices due to varying pixel densities and screen sizes.

2. Relative Lengths

em

This unit is relative to the font-size of the element.

Example: If an element has a font-size of 16px, then 1em = 16px for that element. If you set margin: 2em;, the margin will be twice the current font size.

rem

This unit is relative to the font-size of the root element (usually the <html> element). If the root element has a font-size of 20px, then 1rem = 20px for any element on the page.

Example: font-size: 1.5rem; will set the font size to 1.5 times the font size of the root element.

ex

This unit is relative to the x-height of the current font (roughly the height of lowercase letters). It’s not commonly used.

ch

This unit is equal to the width of the “0” (zero) of the current font.

Example: width: 20ch; will make an element 20 “0” characters wide.

vw (Viewport Width)

This unit is equal to 1% of the width of the viewport.

Example: width: 50vw; will make an element 50% as wide as the viewport.

vh (Viewport Height)

This unit is equal to 1% of the height of the viewport.

Example: height: 70vh; will make an element 70% as tall as the viewport.

vmin

This unit is equal to 1% of the smaller dimension (width or height) of the viewport.

Example: font-size: 4vmin; will set the font size to 4% of the viewport’s smaller dimension.

vmax

This unit is equal to 1% of the larger dimension (width or height) of the viewport.

Example: font-size: 4vmax; will set the font size to 4% of the viewport’s larger dimension.

%

This unit is relative to the parent element.

Example: If you set width: 50%;, the element will take up half the width of its parent element.

Relative length in CSS:

Here’s an example of how these units might be used in a CSS rule:

div {
    font-size: 2em;
    padding: 1.5rem;
    width: 75vw;
    height: 50vh;
    margin: 5vmin;
    line-height: 200%;
}

Explaination:

The div element would have a font size twice that of its parent, padding 1.5 times the root font size, width 75% of the viewport width, height 50% of the viewport height, and a margin of 5% of the viewport’s smaller dimension. The line height is 200% of the current font size.

3. Time Units

s (Seconds)

This unit represents a time duration in seconds. It’s commonly used with animation and transition properties.

Example: animation-duration: 2s; would make an animation last for 2 seconds.

ms (Milliseconds)

This unit represents a time duration in milliseconds, where 1000 milliseconds equals 1 second. It’s also used with animation and transition properties.

Example: transition-duration: 500ms; would make a transition last for 500 milliseconds, or half a second.

Time units in CSS #1:

Here’s an example of how these units might be used in a CSS rule:

div {
    transition: background-color 0.5s ease-in-out;
    animation: move 2s infinite;
}

@keyframes move {
    0% { transform: translateX(0); }
    100% { transform: translateX(100px); }
}

Code explanation:

The div element would have a transition that changes the background color over 0.5 seconds, and an animation that moves the element from its current position to 100 pixels to the right over 2 seconds. The animation repeats indefinitely due to the infinite keyword.

Time units in CSS #2:

Another example could be a delay in transition or animation:

div {
    transition: all 2s ease 1s; /* transition will start after 1 second delay */
    animation: spin 4s linear 0.5s infinite; /* animation will start after 0.5 second delay */
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

Code explanation:

The div element has a transition that starts after a delay of 1 second and an animation that starts after a delay of 0.5 seconds. The animation makes the div spin indefinitely.

4. Resolution Units

Resolution units in CSS are used to specify the pixel density of output devices. They are primarily used in media queries to serve different styles to devices with different pixel densities.

dpi (Dots Per Inch)

This unit represents the number of pixels per inch.

Example: A a media query like @media (min-resolution: 300dpi) {...} would apply the styles in the curly braces only to devices with a pixel density of at least 300 dots per inch.

dpcm (Dots Per Centimeter)

This unit represents the number of pixels per centimeter. It’s similar to dpi, but uses centimeters instead of inches.

Example: @media (min-resolution: 118dpcm) {...} would apply the styles to devices with a pixel density of at least 118 dots per centimeter.

dppx (Dots Per px Unit)

This unit represents the number of dots per CSS pixel unit. A CSS pixel might correspond to multiple physical pixels on a high-density display.

Example: @media (min-resolution: 2dppx) {...} would apply the styles to devices with a pixel density of at least 2 dots per CSS pixel unit.

Resolution Units in CSS:

Here’s an example of how these units might be used in a CSS rule:

@media (min-resolution: 2dppx) {
    body {
        background-image: url("high-res-background.png");
    }
}

@media (max-resolution: 1.5dppx) {
    body {
        background-image: url("low-res-background.png");
    }
}

Code explanation:

Devices with a pixel density of 2 dots per CSS pixel unit or higher would use the high-resolution background image, while devices with a pixel density of 1.5 dots per CSS pixel unit or lower would use the low-resolution background image.

5. Angle Units

Angle units in CSS are used to specify rotation and direction. They are often used with properties like transform and gradient.

deg (Degrees)

This unit represents an angle in degrees.

Example:

transform: rotate(45deg); would rotate an element 45 degrees clockwise.

grad (Gradians)

This unit represents an angle in gradians, where 100 gradians equals a right angle.

Example:

transform: rotate(100grad); would rotate an element 90 degrees clockwise.

rad (Radians)

This unit represents an angle in radians, where 2π radians equals a full circle.

Example:

transform: rotate(3.14159rad); would rotate an element 180 degrees.

turn

This unit represents a full circle.

Example:

transform: rotate(0.5turn); would rotate an element 180 degrees.

Angle Units in CSS:

an example of how these units might be used in a CSS rule:

div {
    transform: rotate(45deg);
}

div:hover {
    transform: rotate(0.5turn);
}

Code explanation:

The div element would be rotated 45 degrees by default. When you hover over the div, it would rotate 180 degrees (0.5 of a full turn).

Bonus: Flex

fr (Fractional Unit)

This unit is used with CSS Grid Layout and represents a fraction of the available space in the grid container. If you have a grid with two columns defined as 1fr 2fr, the first column will take up one third of the available space, and the second column will take up two thirds.

Example:

.grid-container {
  display: grid;
  grid-template-columns: 1fr 2fr;
}

The total available space is divided into 3 equal parts (1fr + 2fr = 3fr), the first column takes up 1/3 of the space, and the second column takes up 2/3 of the space.

The post Understand Units in CSS: A Comprehensive Guide appeared first on Hongkiat.

10 Basic Python Tips Developers Should Know

Python is one of the most popular programming languages in the world today due to its simplicity and readability. Whether you’re a seasoned developer or a beginner, mastering Python can open up countless opportunities in fields like web development, data science, AI, and more. In this post, we’ll explore 10 Basic Python Tips Developers Should Know. These tips are designed to help you write more efficient and cleaner code, and to leverage Python’s powerful features to the fullest.

The beauty of Python lies in its simplicity and the breadth of its applications. However, to truly tap into its potential, it’s essential to go beyond the basics. This is where our handy tips come in. From list comprehensions and generators to the use of zip, map, and filter functions, these tips will help you navigate Python’s unique features and idioms.

1. List Comprehensions

List comprehensions provide a concise way to create lists based on existing lists. For example, if you want to create a list of squares from another list, you can do:

numbers = [1, 2, 3, 4, 5]
squares = [n**2 for n in numbers]
print(squares)  # Output: [1, 4, 9, 16, 25]
2. Generators

Generators are a simple and powerful tool for creating iterators. They are written like regular functions but use the yield statement whenever they want to return data. Each time next() is called on it, the generator resumes where it left off.

def fibonacci():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

fib = fibonacci()
for i in range(10):
    print(next(fib))  # Output: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
3. The with statement

The with statement simplifies exception handling by encapsulating common preparation and cleanup tasks in so-called context managers. This is particularly useful when working with file I/O.

with open('file.txt', 'r') as file:
    print(file.read())

This code automatically closes the file after it is no longer needed.

4. Lambda Functions

These are small anonymous functions that can be created with the lambda keyword. They are useful when you need a small function for a short period of time, and you don’t want to define it using def.

multiply = lambda x, y: x * y
print(multiply(5, 4))  # Output: 20
5. The enumerate function

This is a built-in function of Python. It allows us to loop over something and have an automatic counter. It’s more pythonic and avoids the need of defining and incrementing a variable yourself.

my_list = ['apple', 'banana', 'grapes', 'pear']
for counter, value in enumerate(my_list):
    print(counter, value)

Output:

0 apple
1 banana
2 grapes
3 pear
6. Dictionary Comprehensions

Similar to list comprehensions, dictionary comprehensions provide a concise way to create dictionaries.

numbers = [1, 2, 3, 4, 5]
squares = {n: n**2 for n in numbers}
print(squares)  # Output: {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
7. The zip function

The zip function is used to combine two or more lists into a list of tuples.

names = ['Alice', 'Bob', 'Charlie']
ages = [25, 30, 35]
combined = list(zip(names, ages))
print(combined)  # Output: [('Alice', 25), ('Bob', 30), ('Charlie', 35)]
8. The map and filter functions

These functions allow you to process and filter data in a list without using a loop.

numbers = [1, 2, 3, 4, 5]
squares = list(map(lambda x: x**2, numbers))  # Output: [1, 4, 9, 16, 25]
evens = list(filter(lambda x: x % 2 == 0, numbers))  # Output: [2, 4]
9. The args and kwargs syntax

This syntax in function signatures is used to allow for variable numbers of arguments. args is used to send a non-keyworded variable length argument list to the function, while kwargs is used to send a keyworded variable length of arguments to the function.

def my_function(*args, **kwargs):
    for arg in args:
        print(arg)
    for key, value in kwargs.items():
        print(f"{key} = {value}")

my_function(1, 2, 3, name='Alice', age=25)
10. The __name__ attribute

This attribute is a special built-in variable in Python, which represents the name of the current module. It can be used to check whether the current script is being run on its own or being imported somewhere else by combining it with if __name__ == "__main__".

def main():
    print("Hello World!")

if __name__ == "__main__":
    main()

In this case, main() will only be called if this script is run directly (not imported).

The post 10 Basic Python Tips Developers Should Know appeared first on Hongkiat.

10 JavaScript Frameworks You Should Know

Looking to up your JavaScript skills and create dynamic, responsive web apps? If so, you might want to brush up yourself (or at least get familiarized) with some of the top JavaScript frameworks available today. These frameworks provide a wide range of tools and libraries that can help you streamline your development process and create high-quality code.

In this article, we will take a closer look at ten popular JavaScript frameworks you should know, from Angular to React and Vue.js and so on… So, whether you’re a seasoned JavaScript developer or just starting, read on to discover the best JavaScript frameworks to add to your toolkit.

1. Ember.js

Ember.js

Ember.js is a JavaScript framework used to develop scalable single-page web applications. It was initially known as the SproutCore 2.0 framework and comes with a Glimmer renderer that can render DOM elements.

The Ember.js command-line interface allows for in-browser tests, automatic component reloads, quick rebuilds, and more. There are many popular companies that use this framework, including Netflix, LinkedIn, Microsoft, and Apple.

PROS

  • It comes with a strong data layer that works well with Java.
  • It supports the URL, and you also get user-friendly documentation and an API.
  • Ideal for long-term thinkers since it provides stability without stagnation.
  • It has a quick boot time that aids server-side rendering, allowing search engines, curl, and other scrapers to access your project.
  • It offers an object model that represents the underlying data and makes key-value observation easier.

CONS

  • Lacks component reuse functionality at the controller level.
  • Bloated object model implementation due to its large size, and when debugged, it calls the stack.
  • Not suitable for small projects.
  • It may have outdated content. While working with Ember.js, you may come across a lot of outdated content that isn’t working anymore.

2. AngularJS

AngularJS

Angular is an MVC framework. It has a two-way data binding between models and views. This data binding allows both sides to be automatically updated whenever the data changes. This will enable you to create reusable presentation components that simplify the interaction between the back-end and the front-end.

Angular has NativeScript for native apps while developing Ionic for mashups. It allows you to add conditions, loops, and local variables directly inside the template, tracking, processing, and displaying changes from the user using data binding.

Moreover, Angular makes dynamic rendering easy with its JSON-based processing and rendering capabilities. Any developer with experience in basic front-end technologies like HTML5 and JavaScript can learn AngularJS easily.

Originally, Angular was designed to be modular, testable, and maintainable. Thus, it is suitable to become an excellent basis for the development of the interface.

Large organizations like PayPal, Freelancer, LinkedIn, Lego, Hopscotch, and a few others use their AngularJS interfaces.

PROS

  • Excellent MVC. Most frameworks require that developers split their app into multiple MVC components. After that, the programmer must develop code to reassemble them. However, AngularJS strings it together automatically. It saves you time and decreases the app’s time-to-market.
  • Intuitive. Because it uses HTML as a declarative language, AngularJS is more user-friendly. It’s also less brittle when it comes to reorganizing.
  • Injection of dependencies. This feature aids developers in better developing, testing, and understanding apps. For example, using the DI feature, you won’t have to seek dependencies or create them yourself; instead, they’ll automatically be created and provided to you.

CONS

  • Learning is difficult. One of the main reasons why most new developers need help from AngularJS Job assistance is that it is difficult for beginners.
  • Support for JavaScript is required to use AngularJS, and if JavaScript support is disabled on your device, you may have a big problem. When you have a large number of related users, the situation may deteriorate and when there is a large number of associated users, the problem can get worse.
  • Not recommended for those who are new to MVC. Developers who have never worked with AngularJS before may be unfamiliar with the MVC templates (Model View Controller). It indicates that the project will take a long time to complete. As a result, reaching the project’s deadline becomes difficult.

3. React

React

React is an open-source JavaScript library for building user interfaces. It allows you to create interface components for mobile and PC software. This framework is worth using if you are building a SPA, cross-platform application, or small business application.

The main purpose of the React framework is to split the user interface into a set of components to simplify the development process. The ability to use this framework for native development is one of its main advantages, among other things worth mentioning a large community, rich ecosystem, maximum SEO support, and reusable components.

PROS

  • Quick rendering. The use of composed methods to reduce the number of DOM operations aids in the optimization and acceleration of the updating process.
  • Easier to create dynamic apps. Data binding in React creates the conditions for developing dynamic apps.
  • JSX makes the code of components and blocks readable. It shows how components are connected or combined.
  • Update procedure that has been improved and accelerated.

CONS

  • Rapidly changing environment. React environment is changing at a rapid pace and some developers are finding it hard to keep up with.
  • Documentation is lacking. This issue can be traced back to the constant release of new tools. Several members of the community think that React technologies are changing and accelerating at such a rapid pace that there isn’t enough time to produce comprehensive documentation. To solve this, developers create their custom documentation for specific tools used in current projects.
  • JSX. To work with HTML and JavaScript, React has introduced JSX. It allows you to combine HTML and JavaScript, but it has certain new attributes and syntaxes that make it harder to deal with when you’re new to React. Developing with JSX is made more difficult by the lack of comprehensive documentation.

4. Vue.js

Vue.js

Vue.js is a lightweight progressive JS framework that incorporates many of its concepts from ReactJS and AngularJS. It has a template style similar to Angular and has component-based props similar to ReactJS. Vue provides an easy and fast fix for apps, UI, and interactive web development.

The most important advantage of Vue is that the component dependencies are automatically tracked during its rendering. This way, the system knows which component needs to be re-rendered when the state changes. This prevents additional work required for optimization and allows the developer to focus more on building the application.

PROS

  • The approach is easy. Vue.JS is simple to integrate into an existing web project. Even if you are unfamiliar with JSX, ES2015, or the Build System, you can get started working with it fast and easily. As a result, switching to this framework is simple and beneficial in a fast-paced development environment.
  • Detailed documentation. The documentation for Vue.JS is so extensive that anyone with a basic understanding of JavaScript and HTML can quickly create a Web page or application.
  • MVVM Architecture. Vue.JS has an MVVM (Model-View-View-Model) architecture, making two-way communication possible. HTML Blocks are easier to work with this MVVM Architecture.

CONS

  • Resources are limited. While the ecosystem is fairly large, and all of the necessary tools are available to begin creating with Vue, it is still not as large as React or Angular.
  • Large-scale projects face a lack of backing. Vue.js is a relatively new framework. The scale of its community and development team is still incomparable to that of older Angular. It also does not receive financial help from huge corporations.
  • Flexibility. Vue.js offers a lot of alternatives and flexibility within the framework. However, if you’re working on a larger project with many developers, then excessive flexibility may cause complications, leading to additional errors and inconsistencies in the code.

5. Svelte

Svelte

Svelte is an open-source JavaScript framework written in Typescript. It converts the project to JavaScript at build time, not runtime. As a result, application development with Svelte is generally faster compared to other JavaScript frameworks. Companies like Codustry and Kontist use Svelte for their projects.

PROS

  • Uses less boilerplate code to get the same functionality as other frameworks.
  • Converts code into Vanilla JS. You can convert your code into compact, framework-less Vanilla JS, ensuring that your app loads quickly.
  • Uses scoped styling without the usage of CSS-in-JS.
  • Adds reactivity to JS. No more complex state management libraries as Svelte adds reactivity to JavaScript itself.

CONS

  • Not much community support. It has very little community support making it difficult for developers to find a UI kit.
  • No cross-platform applications. So, you’ll either have to totally rewrite your mobile app in React Native or utilize hardcoded NativeScript and finish it manually.
  • No substantial backing by tech giants. Google has supported Vue.js and Angular, while Facebook has supported React. Svelte, however, is currently without any substantial backing mainly because it’s a very new framework, and may receive support in the future.

6. Backbone.js

Backbone.js

Backbone.js is a lightweight JS framework based on the Model View Presenter (MVP) architecture. It has a RESTful JSON interface and helps you build client-side web applications.

Backbone gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.

PROS

  • Makes it easier to create one-page apps and front-ends using JavaScript functions.
  • Well-structured apps. Backbone.js allows the developers to create well-structured and well-organized client-side web or mobile apps.
  • Offers many building elements for creating client-side web apps including models, views, events, routers, and collections.

CONS

  • Regenerate the entire tech pack after error fixing. Even if one error is still within the same parameters as the previously created tech pack, you have to regenerate the entire tech pack once the error is fixed.
  • Offers a bad workaround by asking us to the fit and revision section for TP notes. The Compare Samples section is inoperable and difficult to view.
  • Requires extra plugins. Due to the fact that Backbone is lightweight, you have to add missing functionality with different plugins.

7. Next.js

Next.js

Next.js lets you develop Jamstack and server-side applications. It supports CSS and styled JSX. Plus, it allows you to import JavaScript modules and React components.

Using Next.js it is possible to export a completely static site from within the application. Companies like Netflix, Github, and Avocode use this framework.

PROS

  • Split code. It breaks the code automatically to make the page load faster.
  • Security. Because there is no direct link to the database, dependencies, user data, or other private information, the static site is absolutely secure.
  • Faster load page time. Because JS websites are static, they load quickly. It can also optimize pages automatically when needed.

CONS

  • Not a backend framework. As a result, backend logic, such as a database or an accounts server, should be kept in a separate server application.
  • All data must be loadable from both the client and the server.
  • Not ideal for a small project. Next.js is a powerful tool, but it might be overkill for developing a small project.

8. Aurelia

Aurelia

Released in June 2019, Aurelia is a relatively new Javascript framework. Today it is one of the most advanced and developer-friendly front-end frameworks. It is also called the “Next Generation UI Framework”.

One of the principles of Aurelia is “Convention over Configuration”. This principle aims to reduce the number of required configurations without sacrificing flexibility.

PROS

  • Easy to extend. One may add or remove any of the framework tools, as well as any additional tools that aren’t part of Aurelia’s framework.
  • Unobtrusive style. Aurelia’s standards-based style makes development a pleasure and saves a significant amount of time.
  • Aimed towards web standards and will constantly stay up to date with new concepts.

CONS

  • A small development community and the number of developers who use it is limited.
  • Two-way data binding which is often considered an anti-pattern.
  • Not supported by big corporations. Aurelia has no big success stories so far.

9. Node.js

Node.js

Node.js is one of the most downloaded, open-source, cross-platform frameworks for executing JavaScript outside of the browser. It is used to build internal services or APIs and develop server and network applications.

PROS

  • Single-threaded model.
  • Manage asynchronous I/O through an event-driven architecture.
  • Properties similar to Java can be used, such as multithreading or looping.

CONS

  • Unstable API. The API of Node.js updates regularly, and the updates are often incompatible with previous versions.
  • Not Suitable for Heavy-Computing Apps. Node.js can handle far more complex applications than Ruby, but it is unsuitable for long-running computations. Heavy computations might cause incoming requests to be blocked, resulting in a loss in performance.
  • Immaturity of Tools. Although the core of Node.js is stable, many packages in the npm registry are still of bad quality or lack proper documentation.

10. Meteor

Meteor

Meteor is a full-stack framework that helps you build a modern, highly scalable web and mobile application in one JavaScript.

It allows for rapid prototyping and cross-platform code creation. With Meteor, applications for any device can be developed with less coding and using only one language (JavaScript). Companies such as Mazda, Honeywell, and Qualcomm use Meteor.

PROS

  • Smart Packages are available. One of the most significant advantages of Meteor.js is that it allows you to create users through a relatively simplified accounts system. The system simplifies the procedure considerably.
  • Develop Using Only One Language. Meteor.js simplifies development by combining the frontend, backend, and database into a single language – JavaScript.
  • Web Development in real-time. It is a development framework with the unique capability of real-time development. When changes have been made to the data, the data in the templates are automatically updated.

CONS

  • Tough learning curve. Meteor requires basic understanding of programming and its own functionality. Although the Meteor Docs are sufficient for this purpose, several less-experienced developers may need additional help.
  • Resource intensive. The very heavy apps may require a lot of CPU, RAM, and time to construct a separate app for production.
  • No native support for MSSQL / MySQL or any other DB than MongoDB.

The post 10 JavaScript Frameworks You Should Know appeared first on Hongkiat.

15 Podcast Channels for Web Developers

Listening to podcasts is a great way to stay up-to-date in web development. Podcasts provide a convenient way for you to learn and get information since you don’t need to sit down at your desk for that.

Here, we’ve put together some of the best podcasts for developers, covering various topics such as software development, frontend development, JavaScript, CSS, and more. Whether you’re a seasoned developer or just starting out, I’m pretty sure you will find a podcast that fits your needs. So grab your headphones and get ready to learn!

1. Inside Marketing Design

Inside Marketing Design

Inside Marketing Design is a podcast that can help you learn more about a different side of design in tech. The show is focused on marketing and brand design, which is not as much mentioned or discussed as product and UI/UX design.

Each episode features an interview with marketing design experts from large tech companies such as Zendesk, Stripe, Zapier, Shopify, etc. You’ll hear about how they design things like landing pages, brand illustrations, and campaigns.

By listening to these interviews, you’ll get a better understanding of how design teams work, how they tackle projects, and what challenges they face.

Listen in:

YouTube
Spotify
Apple Podcasts

2. Boagworld

Boagworld

Paul Boag is a well-respected name in the web design industry. He is an author who has released several bestselling books and is a founder of the UK-based design agency, Headscape.

His podcast, Boagworld, has been on air since 2011 with more than 100 episodes on website building and digital strategy, making it one of the longest-running podcast channels in the industry. You can subscribe to Boagworld through RSS or iTunes.

Listen in:

Spotify

3. ShopTalk Show

ShopTalk Show

ShopTalk Show is one of the most popular web design podcasts hosted by Chris Coyier of CSS-Tricks and Dave of Paravel; ShopTalk invites web design and programming experts to share their ideas and experiences.

They currently have more than 100 episodes already and counting, and podcast releases are weekly.

Listen in:

YouTube

4. Beyond Coding

Beyond Coding

Beyond Coding is a weekly podcast covering various software development and engineering topics. But as the name implies, it goes beyond just coding.

It also includes discussions on leadership, communication, self-improvement, and happiness. The show is hosted in a friendly and informal format, with host Patrick Akil and his guests having relaxed conversations about their experiences and perspectives. There’s a new episode every Wednesday.

Listen in:

YouTube
Apple Podcasts

5. Syntax FM

Syntax FM

A podcast hosted by two experienced web developers, Scott Tolinski and Wes Bos, and they cover a wide range of topics related to frontend development, back-end development, and design.

They’ll provide you with practical advice, tips, and insights to help you improve your skills and stay up-to-date with the latest trends and best practices in the industry. It’s one of the most popular podcasts in the web community for its in-depth conversations and insightful commentary.

Listen in:

Spotify
Apple Podcasts

6. CodePen Radio

CodePen Radio

A podcast from codepen.io, a popular online code editor for frontend developers and designers. The podcast focuses on web development, design, and the intersection of code and creativity.

The show is hosted by Chris Coyier and Marie Mosley, and they explore a variety of topics related to the web, including design patterns, CSS, JavaScript, and more. It is a great resource for front-end developers and designers looking to stay up-to-date with their field’s latest trends and best practices.

Listen in:

Apple Podcasts

7. CodeNewbie Podcast

odeNewbie Podcast

A podcast for people who are new to coding or who are thinking about starting a career in technology. The show is hosted by Saron Yitbarek and features conversations with developers and tech professionals from various backgrounds.

It covers a wide range of topics from coding and the technology as well as how to get started with programming, tips for staying motivated, and stories about the ups and downs of learning to code.

The podcast is part of the CodeNewbie community, which is dedicated to helping people learn to code and find their place in the tech industry.

Listen in:

Spotify
Apple Podcasts

8. Frontend Happy Hour

Frontend Happy Hour

Hosted by a group of experienced web developers from well-respected names in the tech industry, such as Netflix, Twitch, Atlassian, Evernote, and LinkedIn. It features discussions on various topics related to frontend development, including the latest trends, best practices, and latest shiny tools.

It’s great podcast for frontend developers who want to stay up-to-date with the latest trends and best practices in their field, as well as for those who are looking for inspiration and advice on how to grow and succeed as a frontend developer.

Spotify
Apple Podcasts

9. Web Rush

Web Rush

A weekly podcast for web developers hosted by John Papa, Ward Bell, Craig Shoemaker, and Dan Wahlin. It covers various topics, from JavaScript to general web development. The show aims to provide practical insights and discussions about the challenges faced by developers today.

Each episode features expert guests who share their experience and knowledge. It is a great resource for learning development in the fields, whether you’re a beginner or an experienced web developer.

Apple Podcasts

10. JavaScript Jabber

JavaScript Jabber

Another weekly podcast covering a wide range of topics related to JavaScript, web development, and the web platform. It aims to provide insights, tips, and advice to help developers improve their skills and stay up-to-date.

A great resource for anyone interested in web development, especially those working with JavaScript, and is accessible to developers of all levels, from beginners to experts.

Apple Podcasts

11. Views on Vue

Views on Vue

A podcast about Vue.js, featuring conversations with developers and experts who are working with Vue.js. Each episode covers various topics around Vue.js, such as the best practices, emerging trends, and some real-world projects using Vue.js.

A perfect podcast for any developer looking to learn more about Vue.js or who is already using it in their work.

Spotify
Apple Podcasts

12. DeveloperTea

DeveloperTea

A podcast for web and software developers hosted by Jonathan Cutrell. This podcast is designed to be a quick and easy way for developers to stay informed about to things related to web development.

Each episode is around 10-15 minutes long and covers a variety of topics, from technical skills and tools as well as non-technical areas for developers. It is a great podcast for developers at all levels or anyone interested in web and software development.

Listen in:

Apple Podcasts

13. Podrocket

Podrocket

A weekly podcast that focuses on front-end web development. It is hosted by LogRocket co-founder Ben Edelstein and the LogRocket engineering team, along with other experienced developers.

The show provides in-depth knowledge and insights on libraries, frameworks, and current industry issues related in web development.

Listen in:

Spotify
Apple Podcasts

14. The Changelog

The Changelog

A weekly podcast that covers topics related to open-source, software development, and technology in general. Hosted by Adam Stacoviak and Jerod Santo. The show features interviews with developers, engineers, and other experts in the software development industry.

The podcast covers many topics, including new and emerging technologies, tips, and the future of open-source software. If you’re into open-source, it’s a great resource for anyone interested in staying up-to-date with the latest developments in the open-source field.

Listen in:

Spotify
Apple Podcasts

15. The CSS Podcast

The CSS Podcast

A podcast covering all things CSS. It is hosted by Una Kravets and Adam Argyle, discussing a wide range of topics related to CSS, including the latest CSS features, design and development tips, tricks, and more.

They also interview experts in the field to provide insights and perspectives on the current state of CSS and its future direction. Stay tuned to this podcast if you want to learn more about CSS and keep up-to-date with the latest advancements in this field.

Listen in:

YouTube
Spotify
Apple Podcasts

The post 15 Podcast Channels for Web Developers appeared first on Hongkiat.