how to upload multiple images using Longblob

if (count($_FILES) > 0) {

    if (is_uploaded_file($_FILES['userImage']['tmp_name'])) {

        $imgData = addslashes(file_get_contents($_FILES['userImage']['tmp_name']));
        $imageProperties = getimageSize($_FILES['userImage']['tmp_name']);

        $sql = "INSERT INTO trial (imageType ,imageData,uploaded_on, user_id,tax_payer_id)
                VALUES('{$imageProperties['mime']}', '{$imgData}',NOW(),'".$_SESSION['id']."','".$_GET['id']."')";
        $current_id =  mysqli_query($db, $sql) or die("<b>Error:</b> Problem on Image Insert<br/>" . mysqli_error($db));
        $current_id = mysqli_insert_id($db);

        if (isset($current_id)) {
           echo "Upload Succesfully";
        }else{
            echo "There is a problem";
        }
    }
}
?>  

    <form name="frmImage" enctype="multipart/form-data" action="" method="post"                         class="frmImageUpload">
        <label>Upload QrCode File:</label><br /> 
        <input type="file" class="inputFile" name="userImage" />
                <input type="hidden" name="imageID"  value="<?php if(!empty($_GET['id'])){ echo $_GET['id'];} ?>">
        <input type="submit" value="Submit" class="btnSubmit" />
    </form>

I'm trying to upload multiple images and I'm using longblob to store the images in database.

How to Install WordPress on a Separate Subdomain Site (No Multisite Required)

In this post, you will learn how to set up a WordPress site on its own separate subdomain without using Multisite.

Note: This article is intended for WPMU DEV members, as it utilizes features of WPMU DEV hosting. If you are not a member yet, consider joining with our no-risk free trial.

Suppose you run a web agency (e.g. https://webagency.site) and you would like to use your main website strictly for promotional or marketing purposes but you also want to run a completely separate WordPress installation on a subdomain under the same brand as your main site (i.e. using the same domain).

For example:

  • a Learning Management System (LMS) section at https://lms.webagency.site,
  • an eCommerce store (e.g. https://store.webagency.site),
  • run events and ticket sales on https://event.webagency.site,
  • or simply show your clients a pre-launched site you’re building as part of your white label service (e.g. https://client1.webagency.site).

To do this, you would normally have to set up a WordPress multisite installation, specify subdomains (instead of subdirectories) in your setup, and then add a new WordPress site to your Multisite network.

But, what if you want to set up and run a completely separate WordPress site on a subdomain without having to go through a Multisite environment?

As this article will show you, you can easily do this by creating an additional WPMU DEV hosted site.

In this tutorial, we’ll cover the following:

Benefits and Drawbacks of Installing WordPress on a Subdomain Without Multisite

Let’s start with the benefits of setting up and maintaining a single subdomain site using the method we’ll show you further below:

  • It’s easier than installing, setting up, and maintaining an entire Multisite installation. We will effectively use The Hub as if it were the network site on an multisite setup.
  • You can set up, develop and launch WordPress subdomain sites without affecting the original main site.
  • No need to change the main hosting package size, just create a new hosting package. Also, since the site will be hosted on a separate server account, you can modify your hosting (e.g. upgrade or downgrade your plan) without touching your main site’s hosting.
  • All plugins associated with your subdomain site (e.g. LMS, events, and/or WooCommerce, etc.) are kept separate from the main site causing less server strain.
  • If your main site is more static (i.e. only has company info pages) and your subdomain site needs to be dynamic (e.g. an ecommerce site), having both sites hosted on separate accounts allows you to keep your main site relatively more stable, especially with regards to plugin updates. This can also affect caching on the more static vs dynamic site (i.e. main site experiences longer/better caching).
  • There are less chances of experiencing plugin conflicts, as you’ll only install what you require on each site.
  • Can password-protect using HTTP Authentication only.
  • It’s highly unlikely that both sites would fail at the same time if there are any server issues.
  • You can run separate backups for each site.
  • Staging can be used on each server, making adjustments even easier.

Now that we have looked at the benefits, let’s examine some of the drawbacks of installing WordPress on a subdomain without using multisite:

  • Your theme changes won’t stay ‘in sync’ automatically as they would in a multisite installation. Updates will sync the theme version only. (Note: most themes allow manual import/exporting of settings. For example, sites built using Elementor allow the export of Site Kit, which can include the entire site’s theme settings).
  • You need to maintain two sites worth of plugins (however, this is easy with The Hub, as you can update multiple sites simultaneously and update these automatically using our Automate service.)
  • Multisite lets you keep all site settings in sync (again, with Hub Configs, this is really easy).
  • There may be some additional costs compared to setting up sites on a single multisite install (depending on what packages and components you require). For example, some themes and plugins may require two sets of licences.
  • You may not be able to share ‘live data’ across your sites (e.g. a WooCommerce cart cannot be displayed on a different site).

Now that we’ve looked at the benefits and drawbacks, let’s take you through how to set up a separate WordPress subdomain site without installing WordPress Multisite.

How to Install and Set Up a WordPress Subdomain Site Separately from Your Main Site

As stated in our documentation, the configuration shown below only works if both sites are hosted by WPMU DEV and you manage the DNS of the top-level domain in your Hub’s DNS Manager.

Let’s go through the steps.

First, add a new site in The Hub.

Note: Cloning your main site can be a great starting point when creating your subdomain site. So, for this tutorial, we’ll start by cloning our main site.

Hub - Clone site
Let’s add a new subdomain site by cloning our main site.

Unless you are creating a brand new site from scratch, select the website that you’d like to clone.

The Hub - Clone Website
Select your main site as your cloning source.

Next, select a hosting plan for your new site. After selecting a plan, you will then be asked to create a temporary URL for your new site. Click continue when done.

Hub - Create A Temporary URL
Enter a temporary URL for your subdomain site.

Select a server location for your new site and click the button. Your new site will be created in just a few minutes.

Hub - Clone site creation display.
You will new site will be created in minutes.

Now that you have created your site, let’s set up our subdomain.

In this example, we’ll set up a separate WordPress site under the subdomain store.webagency.site.

The key to making this work is to add an A record for the subdomain to the main site’s DNS record. This is fully explained in our documentation sections on using subdomains and how to use a subdomain as your primary domain.

Here is a summary of the steps:

First, go to The Hub, select the Hosting section of the site where you want to add your subdomain, click on Domains and copy the site’s IP address.

The Hub - Hosting - Domains
Select your subdomain site’s IP address.

Next, add a new DNS record in your main domain’s DNS section.

Enter the following information, then click the Add button:

  • Record type – Select ‘A’ Record.
  • Hostname – Enter only the subdomain name as you want it to appear in the URL. In this example, we’re creating a record with the hostname store on the domain webagency.site to create the URL store.webagency.site.
  • IPv4 Address – In this field, paste the A Record you copied from your previous step.
  • TTL – Enter a value here or leave the default.
Add a subdomain A record to your main site's DNS.
Add a subdomain A record to your main site’s DNS.

Return to the Domains tab of the site where you copied the IP address earlier, click the Add Domain button, enter the full URL of your subdomain (no http:// or https:// and do not check the Add www or Add DNS records options), then click Add Domain when done.

Add a domain
Add your subdomain as shown above, ignoring all other options.

Finally, after the DNS and SSL status are confirmed as working correctly, set your subdomain as your new site’s primary domain.

Set subdomain as primary.
Set your subdomain as primary.

That’s it! You can now manage your newly added WordPress subdomain site separately from your main site in The Hub.

The Hub - New Subdomain Site
Your new subdomain site.

Make sure to test your new site, check out our documentation section for a complete step-by-step walkthrough of using subdomains as shown above, and contact our expert support team if you need help or have any questions.

PS: You can also use the above method to migrate a multisite subsite to a single WordPress install and run the site on its own separate subdomain.

Gutenberg 12.0 Focuses on Cleanup and Minor Enhancements

Last week, contributors to the Gutenberg plugin wrapped up the version 12.0 release just ahead of the U.S. Thanksgiving holiday. Most work is being pushed toward the upcoming WordPress 5.9 release, which has been postponed to January 25. As a result, Gutenberg 12.0 has fewer bells and whistles and more bug fixes and maintenance. However, the latest update has a handful of enhancements.

The most notable features are an overhaul of block styles previews, grouped paragraph typography options, and block icons in the global styles sidebar. The site editor also has a new welcome guide, which should ship with WordPress 5.9 and introduce users to the new tool.

Theme authors can now opt-out of the core color palette and gradients. There is still a bug where this does not currently work for the site editor.

Block Styles Previews

WordPress editor focused on an image block.  In the sidebar, the mouse is hovering the "rounded" block style and its preview is shown in a popup.
Hovering a block style to see its preview.

For once in the last few years, the editor sidebar feels kind of clean and organized. When using a theme with multiple block styles, the style previews have been nothing short of an annoyance. The tab that held them took up a lot of space by presenting an entire demo of every option.

In the latest Gutenberg plugin release, the previews have been replaced with text-based buttons, emphasizing the style names. Users can still see what individual block styles look like by hovering over each one or focusing on it with a keyboard.

The downside to this new experience is that longer block-style names can sometimes get cut off. For example, the “Portfolio: Tilt Left” and “Polaroid: Tilt Right” options in my custom theme both read “Portfolio: Ti…” I will have to rethink their names, but that is a small price to pay for the cleaner interface.

Paragraph Drop Cap Control Moved

Paragraph highlighted in the WordPress editor. The typography panel now includes the drop cap option at the bottom.
Drop cap control now under Typography tab.

It seems this release has been one for fixing those irritating issues with the user experience. The option for adding a drop cap to the Paragraph block now rests alongside similar controls under the Typography block options tab.

Formerly, users had to find it under a separate Text Settings tab, which only held the drop cap option. I am sure I have mentioned this being a poor user experience on a few occasions as someone who often reaches for the control. I, for one, am a happy camper with this change.

Icons Shown in the Blocks List

WordPress site editor with the global styles panel opened to its blocks list.  The block names have their associated icons next to them.
Blocks now show their icons.

After the Gutenberg 11.7 release, one of my suggestions was to add icons to the global styles blocks list. Previously, it was a vertical scrollable area with dozens of block names, making it hard to find something specific to customize.

Whether Nik Tsekouras, who wrote the patch for this change, happened to read that Tavern post or saw the same issue with his own experience, I am grateful that he coded a solution. Finding a block is now much faster because I can just scan the list for a recognizable icon.

Themes Can Opt Into All Appearance Settings

For any theme author who has been working with theme.json, you know how unruly the file can get when enabling or disabling specific settings. A new flag allows themes to opt into support of all appearance-related options at once.

An example theme.json file would look like the following:

{
        'version': 2,
        'settings': {
                'appearanceTools': true
        }
}

Setting the appearanceTools flag to true enables support for all border, color, spacing, and typography options. This should cut back on unnecessary JSON code, especially for themers who are opting into almost everything. Theme authors can still disable specific features individually.

Depending on the theme author’s point of view, the potential up or downside to this new flag is that it will also enable support for other appearance-related features in the future. It would allow users to access new features before their themes officially support them. On the flip-side, theme authors may want more control or to run tests before enabling something new.

Hiring the Top Mobile App Developers: Do’s and Don’ts

We are all surrounded by technologies and advancements in today's fast-paced era, and mobile apps are one of them. In today's competitive market, all firms recognize that simply having a web presence is insufficient.

And that's why they're relying more on mobile apps these days. According to an app development statistic, mobile applications are predicted to generate over $935 billion in revenue by 2023.  

Working Together as Embedded Engineering Teams

What Is the Embedded Model?

Companies need specialists, and specialists often do their work with people outside their department. For example, all these specialties work with software engineers:

  • Designers
  • Product managers
  • Site reliability engineers (SREs)
  • Quality engineers (QA)
  • Application security engineers
  • Architects

Specialists often apply the most leverage when they work next to engineers. For example, an SRE might help a team improve its monitoring. They might help even more if they help the team to understand how to do monitoring themselves. A designer might work side by side with an engineering team. They design future features and collaborate on current features.

Adding a Custom Domain and SSL to AWS EC2

In our previous article, we Dockerized our Node.js server, pushed that container image to AWS ECR, and then launched an EC2 instance with that container running inside. With our network and security group configured, we could send HTTP requests to our EC2 instance (at port 80) and receive responses from our server.

For our next trick, let's set up a custom domain name and make our server accessible via HTTPS. Here are the steps we're going to take:

How to Use WebSockets with AWS Serverless

In this guide, we are going to see how we can use WebSockets using an AWS serverless framework with NodeJs. At the end of this guide, we will have an application where we can create a chat room and other users can join our room to chat with each other in a custom room. I made the procedure very simple to follow, and at the end of this post, you will also get a link to the Github repository for the code.

Project Setup

The first thing is to set up the project folder and install the required project dependencies by creating a new folder and running the below commands in the root of the project folder.

XPath: Axis Steps, Node Tests, Unabbreviated Syntax

A lot of literature presents XPath as though using it is rather like navigating a filesystem: the tags' identifiers are completely taken for granted, and shorthand like ., .., or // often is introduced early on. This article demonstrates exactly how to use XPath to the exclusion of shorthand: which is to say, solely by means of axis specifiers and node tests, and with the use of identifiers confined to predicates.

The XML we'll work on is simple on its face. As a former bookseller, I've made it personal:

A Beginner’s Guide to High-Performance Computing in Python

Ever since the Python programming language was born, its core philosophy has always been to maximize the readability and simplicity of code. In fact, the reach for readability and simplicity is so deep within Python's root that, if you type import this in a Python console, it will recite a little poem:

    Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. The complex is better than complicated. The flat is better than nested. Sparse is better than dense. Readability counts...

Simple is better than complex. Readability counts. No doubt, Python has indeed been quite successful at achieving these goals: it is by far the most friendly language to learn, and an average Python program is often 5 to 10 times shorter than equivalent C++ code. Unfortunately, there is a catch: Python's simplicity comes at the cost of reduced performance. In fact, it is almost never surprising for a Python program to be 10 to 100 times slower than its C++ counterpart. It thus appears that there is a perpetual trade-off between speed and simplicity, and no programming language shall ever possess both.

But, don't you worry, all hope is not lost.

Taichi: Best of Both Worlds

The Taichi Programming Language is an attempt to extend the Python programming language with constructs that enable general-purpose, high-performance computing. It is seamlessly embedded in Python, yet can summon every ounce of computing power in a machine -- the multi-core CPU, and more importantly, the GPU.

We'll show an example program written using taichi. The program uses the GPU to run a real-time physical simulation of a piece of cloth falling onto a sphere and simultaneously renders the result.

Writing a real-time GPU physics simulator is rarely an easy task, but the Taichi source code behind this program is surprisingly simple. The remainder of this article will walk you through the entire implementation, so you can get a taste of the functionalities that taichi provides, and just how powerful and friendly they are.

Before we begin, take a guess of how many lines of code this program consists of. You will find the answer at the end of the article.

Algorithmic Overview

Our program will model the piece of cloth as a mass-spring system. More specifically, we will represent the piece of cloth as an N by N grid of point-masses, where adjacent points are linked by springs. The following image, provided by Matthew Fisher, illustrates this structure:

The motion of this mass-spring system is affected by 4 factors:
  • Gravity
  • Internal forces of the springs
  • Damping
  • Collision with the red ball in the middle
For the simplicity of this blog, we ignore the self-collisions of the cloth. Our program begins at the time t = 0. Then, at each step of the simulation, it advances time by a small constant dt. The program estimates what happens to the system in this small period of time by evaluating the effect of each of the 4 factors above, and updates the position and velocity of each mass point at the end of the timestep. The updated positions of mass points are then used to update the image rendered on the screen.

Getting Started

Although Taichi is a programming language in its own right, it exists in the form of a Python package and can be installed by simply running pip install taichi.

To start using Taichi in a python program, import it under the alias ti:

import taichi as ti

The performance of a Taichi program is maximized if your machine has a CUDA-enabled Nvidia GPU. If this is the case, add the following line of code after the import: ti.init(arch=ti.cuda)

If you don't have a CUDA GPU, Taichi can still interact with your GPU via other graphics APIs, such as ti.metal, ti.vulkan, and ti.opengl. However, Taichi's support for these APIs is not as complete as its CUDA support, so, for now, use the CPU backend: ti.init(arch=ti.cpu)And don't worry, Taichi is blazing fast even if it only runs on the CPU. Having initialized Taichi, we can start declaring the data structures used to describe the mass-spring cloth. We add the following lines of code:

Python
 
 
    N = 128
    x = ti.Vector.field(3, float, (N, N)) 
    v = ti.Vector.field(3, float, (N, N))


Build Your IoT Application in a Day

IoT Application development is required today at all levels. But for people with very low coding knowledge, it is not easy to build/develop what is needed for them. With MQTTRoute, an IoT application framework with an inbuilt MQTT Broker, any early adopters or budding developers can develop, host and manage their application easily. This just leaves their development challenge for their IoT Server application. MQTT Broker comes with a default user interface, however, visualization needs to be built specific for each distinct vertical. We recently run an internal hackathon at Bevywise to build applications over our framework. Interestingly, we were able to build an IoT application in a day. The application built was an Industrial Furnace Monitoring. This blog portrays the hacks used to build the application.

IoT Application for Industrial Temperature Monitoring

Monitoring and control of the temperature of the furnaces is crucial with respect to its usage in the industries as it directly affects the quality of the product that is being created. We have created a simulated device using IoT Simulator similar to a monitoring edge device that pushes data to the MQTT Broker. The goals set for the application were:

Improving Your Communication Skills as a Developer

Communication with other people is an important part of a software developer’s career. As a software developer, you will often communicate with other developers on your team, non-technical people on your team, stakeholders, and users of your software.

Having good communication skills will help you work well with your team and others by communicating your messages effectively.

What Are the Five Steps of Ethical Hacking?

As technology continues to become more relevant for businesses worldwide, the importance of securing business-critical applications and their underlying tech stack continues to gain prominence. With the changing threat landscape, it is often impractical to identify vulnerabilities in real-time by simply leveraging automated tools. To help with this, ethical hacking has been steadily gaining popularity on account of its effectiveness in simulating real-world attacks and identifying gaps. 

This article explores what ethical hacking is, the five stages of the ethical hacking process and addresses commonly asked questions.

Integrating SCTL Into DistSQL’s RAL

In the previous article “An Introduction to DistSQL” written by Haoran Meng, the Apache ShardingSphere Committer shared the motivating reasons behind the design of DistSQL, explained its syntax system, and impressively showcased how you can use one SQL to create a sharding table.

Recently, the ShardingSphere community has redesigned the SCTL grammar and the execution engine, integrating SCTL into the DistSQL syntax system. Now RAL contains the old SCTL function, making ShardingSphere’s command language even more convenient for database management. Today, our community author would like to introduce the changes and elaborate on how you can use the new RAL command lines. We always pursue a better user experience, and the upgrade we developed this time is just another typical example.

What Is LoRa IoT?

There are many technical solutions for the endpoint Netcom transmission technology of the internet of things (IoT). The more famous technical solutions include NB-IoT, Lora, WiFi, Bluetooth, ZigBee, dustl, and sub GHz. 

Different communication technologies have different characteristics and have their own application scenarios. Among them, Lora and Nb-IoT are the most used and most concerned in the Internet of things application scenarios. Lora IoT technology can meet long-distance and low-power data transmission. This application scenario can not be fully met by other IoT communication technologies, which is also the original intention of Lora IoT technology. 

Authentication With Remote LDAP Server in Spring Web MVC

There are plenty of articles, videos, and courses about this topic, but nearly all of them use embedded LDAP as a source for user information. In this article, we will develop a Spring Boot project and integrate to remote LDAP through Spring Security. In addition, we will perform authentication (auth) and authorization (autz) operations over JWT (JSON Web Token) for the APIs we will open. 

In a business scenario, our application serves as a user portal service that authenticates and authorizes users against specific APIs with their LDAP authorities. First, let's talk about the terms we will use.

Using MQTT for IIOT Apps

Introduction to MQTT

MQTT is a communication protocol that has taken off in the IIoT community. It’s a lightweight, efficient protocol that works through a publisher/broker/subscriber model. It creates an easy way for field devices to communicate and retrieve data from a single location. In this tutorial, we’ll go over MQTT and dive into an example of how you can publish data using a groov EPIC PAC and retrieve the data using an MQTT client.

How MQTT Works

The Open Systems Interconnection (OSI) model is used to describe the way machines and applications communicate between themselves. The model was developed with the idea that a provider can utilize different protocols or software components at every layer without having to re-architect the entire structure. The MQTT protocol will come into play at Layer 7 of the model; on top of TCP/IP (Layer 4). The reason that this is important is that this keeps a lot of infrastructure in place while redefining how the packets are being sent between devices.

Developers That Embrace Security Add Personal, Organizational Value

While the relationship between software development and security hasn't always been harmonious, recent research suggests the two are becoming much more aligned. In one study, almost half of developers said they had prioritized learning or improving AppSec/secure programming since the pandemic began. In another study, 79 percent said the importance of secure code is increasing in prominence.

This long-awaited meeting of the minds is being driven in large part by astronomical increases in cyberattacks, which are happening on average every 39 seconds. Meanwhile, 60 percent of developers are releasing code two times faster than before. So, while developers are primarily motivated by creating great software, increasingly they are making efforts to ensure that development is complementary to security. The alternative — creating insecure code that puts attackers in the headlines — makes it imperative for developers to incorporate security wherever possible.