Posts
Why you should learn Adobe Illustrator?Design
Why you should learn Adobe Illustrator?Design
One of my tasks today was to create a banner and I thought to myself which software should I choose Adobe Photoshop or Illustrator and yes it is obvious that I have chosen Adobe Illustrator and later I decided to write you an article saying that you need Adobe Illustrator To convince you about why you should learn. You are a graphic designer or web developer.
The Big Muscles to Adobe Illustrator
You may think that learning Adobe Illustrator in 2021 is pointless since most of the work can be done on Adobe Photoshop, and with the release of Adobe XD there can be all layouts and planning. What does it mean after all? Well here are some of the things Adobe Illustrator does best but first
What is Adobe Illustrator?
Adobe Illustrator is a software developed and published by Adobe Inc. since 1987. At first, it was only available for Mac but in later years it was also available for Windows. It is used to create vector scalable graphics.
What is Vector Graphic you ask?
There are two types of 2D graphic vector and raster.
Raster Graphics
Raster graphics are made up of a grid of pixels, each of which can have a different color. The main drawback of this is that it can only be made smaller (the size can be reduced) but if you try to increase the pixels the image will become blurred. Ex: Digital photographs, icons, etc.
Adobe Photoshop is a raster graphic software used for editing these types of images.
Vector Graphic
Vector graphics are made in a simple way that can create shapes, letters, or any other line objects. They follow mathematical formulas that provide information about these lines, such as colors, and what shapes to form. This type of graphics can be measured infinitely and it will never lose design.
Now since that’s out of the way let’s get back to our main topic
Best for designing Logo
It is always better to design the locator in vector format so that you can resize any color as you like. Customers always zoom in, check out the detailed view of the logo, the vector graphic is easy to customize.
Exported to SVG
One of the best things about Adobe Illustrator is that it can be exported directly in the form of SVG so you don't have to worry about the best resolutions for websites.
Web Designing
Adobe Illustrator is really the best way to create wireframes (the basic structure of a website or application) and lay it out and has many built-in features to do so.
Create your custom font, cartoons, and artworks
Ever seen stylish-looking text or artwork on Instagram or any social media platform and wonder if I want to create something like that, but don’t know how? Here's your
answer: Learn Adobe Illustrator and you will be able to do it with practice.
How to make the font
- Sketching: Sketch the letters by hand.
- Tracing: Use the scanner to get that image into the system and open that image in Illustrator. Now trace the letters with the pen tool.
- Reorganizing: Accurate, readability and Corning images you are looking at are refined and organized.
- Saving: Save the glyph and export it using additional plug-ins.
- Using: Put that new brand into your new design for good use.
Patterns with just a few repeats
Illustrator is the ACR of creating peters with repeat options. You repeat, reflect, and ask for spas between objects and your pattern is ready.
The Infographic
Infographics are a very popular way to illustrate a topic with shapes, budgets, some data, and text. Creating charts in Adobe Illustrator is easy, just need to enter and complete some values. Infographics can be easily designed in Illustrator. This infographic is also saved in EPS format which is best for printing.
Easy to Learn
Trying to learn Adobe Photoshop, your first week will be literally the hardest learning of all those shortcuts while learning Adobe Illustrator is fairly easy. No need to create new layers every time, in Adobe Illustrator you just do your work because you like that the whole screen is your work area (inside or outside the artwork).
In other words, what I'm trying to say is that Adobe Illustrator is software that can be used in most scenarios and gives you the freedom to express your creativity without having to wonder how color can fill in the blanks.
Room Database in android javaAndroid Development
Room Database in android javaAndroid Development
Hi everyone, in this post, we will discuss Room Database in android java.
Below are all steps covered in this blog
- How to use the Room database
- How to add Room Database in android studio
- Insert,Update,Delete record
- How to pass query in Database
What is a Room?
-
The Room strong library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
-
Normally Room databases are fast created and have good performance like reading, updating and deleting records. Room Database makes everything easy and fast
- Room Database more detail open this link: https://developer.android.com/training/data-storage/room/
Components of Room Here room have main 3 components
Entity:
- Instead of creating the SQLite table, we will create the Entity. An entity is nothing but a model class annotated with @Entity. The variables of this class are our columns, and the class is our table.
Database:
- It is an abstract class where we define all our entities.
DAO:
- Stands for Data Access Objects. It is an interface that defines all the operations that we need to perform in our database.
Demo App Create
- First, we create a new project in android studio.
- Name of my project "Room DataBase"
Adding Dependencies
- Add needed dependencies for the room database.
- Android studio in this file add dependencies "build.gradle".
- See the below image and add the latest version room database replace here "$room_version" add original version
First, we will create DAO class:
- This DAO class-main work intermediary between the user and database. All performed operations are defined here.
- Below create StudentDao class
@Dao
public interface StudentDao {
@Query("SELECT * FROM Student")
List<Student> getAll();
@Insert
void insert(Student student);
@Update
void updateTask(Student student);
@Delete
void deleteTask(Student student);
}
Nowhere explain all components of StudentDao Class
- Compulsory add class upper "@Dao" keyword
- Three methods create insert, update, delete
- Most important thing here is "@Query"
What is a Query?
- Using query to get database existing record.
- @Query("SELECT * FROM Student") this query gets all student records.
- But the user wants to get only the standard "5" student record and only get how to pass a query?
@Query("SELECT * FROM STUDENT where std = :std")
List<Student> dataCheck(String std);
- Here "std" id table field name
- Call this method "data check(String std)" pass a string in "5" and database in getting only 5 stander student record
- So this concept use the query parameter
Second steps create student model class
@Entity(tableName = "student")
public class Student implements Serializable {
@PrimaryKey(autoGenerate = true)
private int id;
@ColumnInfo(name = "std")
private int std;
@ColumnInfo(name = "name")
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getStd() {
return std;
}
public void setStd(int std) {
this.std = std;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
- PrimaryKey: auto increment values
- tableName : user wants to set the table name
- ColumnInfo: give the table in columns name
Third steps Create Database class:
@Database(entities = {Student.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
public abstract Student studentDao();
}
- User wants to add multiple tables how can add like that:
@Database(entities = {Student.class,Abc.class,Xyz.class}, version = 1) public abstract class AppDatabase extends RoomDatabase { public abstract Student studentDao(); }
- To create a new model class like Abc.class and Xyz.class etc same method.
Fourth step inserts, update and delete records create separate method:
- But implements upper all method in understanding asynctask
- You, not knowing whats is asynctask first open this link and check it: https://developer.android.com/reference/android/os/AsyncTask
- how we will create a common class method insert,update, delete
public class InsertUpdateDeletRecord {
private String DB_NAME = "db_task";
private Student Student;
public studentRepository(Context context) {
Student = Room.databaseBuilder(context, Student.class, DB_NAME).build();
}
public void insertTask(String std,String name) {
insertTask(std, name);
}
public void insertTask(String std,String name) {
Student student = new Student();
student.setstd(std);
student.setname(name);
insertTask(student);
}
public void insertTask(final Student student) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
Student.daoAccess().insertTask(student);
return null;
}
}.execute();
}
public void updateTask(final Student student) {
student.setModifiedAt(AppUtils.getCurrentDateTime());
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
Student.daoAccess().updateTask(student);
return null;
}
}.execute();
}
public void deleteTask(final int id) {
final LiveData<student> task = getTask(id);
if(task != null) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
Student.daoAccess().deleteTask(task.getValue());
return null;
}
}.execute();
}
}
public void deleteTask(final student student) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... voids) {
Student.daoAccess().deleteTask(student);
return null;
}
}.execute();
}
}
Sample Implementation of basic CRUD operations using ROOM
Insert:
InsertUpdateDeletRecord
insertUpdateDeletRecord = new
InsertUpdateDeletRecord(getApplicationContext( ));
String std = "5";
String name = Android";
insertUpdateDeletRecord.insertTask(title,
description);
Update:
InsertUpdateDeletRecord
insertUpdateDeletRecord = new
InsertUpdateDeletRecord(getApplicationContext( ));
Student student =
insertUpdateDeletRecord.getTask(2);
student.setName("Java");
student.setStd("6");
insertUpdateDeletRecord.updateTask(student);
Update:
InsertUpdateDeletRecord
insertUpdateDeletRecord = new
InsertUpdateDeletRecord(getApplicationContext());
insertUpdateDeletRecord.deleteTask(3);
How to test reCAPTCHA form - prepare yourself for bots !Testing
How to test reCAPTCHA form - prepare yourself for bots !Testing
Nowadays, people are hacking secure data systems, so will See the security testing criteria for reCAPTCHA forms.
reCAPTCHA is a technology that assesses the probability that the entity that uses your web code (page, app, portal, etc.) is a human and not a bot (or the other way around). Grabbing information of behavior (of a user or a bot) encapsulates it in the token that gets sent to your server. On your server, the token is being sent again to Google for returning the assessment on how probable it is that the token was generated by a human. Part of the response returned from Google to your server:
Let's See the points how to Test 🛠️
First, we validate from the frontend
On any reCAPTCHA from removing that div from inspect element and then trying to save, there must be valid and records should not store on the backend as shown in the image.
Remove this div then save the form there should be a validation message for reCAPTCHA verification and the form should not be saved, if the form is submitted then the data were stored in the data table which was False to the system.
Now Let's see how we validate from the postman
First, add testing form URL on browser and apply Post method and on body add all fields which are added in form lets see on the image.
Now add on the header at Key column CSRF token, X-Requested, cookie and add its perspective value as shown in the image.
CSRF token and XSRF-TOKEN will store in the cookie which will get from the front page from inspect element.
Now, click on send request and validate the status should be false as shown in the image
If the status changes to true, then the data stored in a table & will create a problem, and the reCAPTCHA form will validate false.
Hence, reCAPTCHA form Test, Hope this helps.
Fix 404 while reloading Gatsby Website for dynamic client-only routeGatsby
Fix 404 while reloading Gatsby Website for dynamic client-only routeGatsby
Last week, we run into a problem for one of the large Gatsby + ReactJS + Laravel projects in hosting which is hosted with Apache Webserver on Amazon AWS EC2. The problem we were facing was, for some reason, when we reload the Gatsby website, it was giving a 404 error page.
If you open a home page and then a normal visit then the website will fully function, but if you reload the page then it gives an error. And we found it happens when we are using Dynamic routing of React Route in Gatsby as per show in Gatsby documentation here.
Also, what we found, if we test the website build with gatsby serve
then it works fine. But while using Apache, it behaves differently and we found that this problem has been faced by lots of people over the internet.
So what we came up with is, we used gatsby serve
with an apache proxy. Here is how we did it,
Step 1 - Setup Project
As a first step, clone the project on the server and run a command, gatsby build
to create a gatsby build.
Step 2 - Setup PM2 for Gatsby Serve
The next step that we need to do is run gatsby serve
. But as you know, we can not run this command directly via console, because as you exit from the console, the command will be terminated.
So we will be using pm2 package, a NodeJS utility that is used to run nodejs apps.
For that, we will need to install pm2 globally. Run the following command to install it,
npm install pm2 -g
You can find other installation ways here if you need.
Once the installation has been done, let's run the gatsby serve command via pm2. For that run the following command from the gatsby project folder,
pm2 start gatsby --name my-web-app -- serve
where my-web-app
you can replace with the name of your app.
Once, it's running, try to test it, if it's working correctly by opening the URL http://your-ip-address:9000/. Make sure, port 9000 is opened on your server for traffic.
Step 3 - Configure Apache
Once, gatsby serve
is working and tested. The next step is to configure apache to proxy all port 80 traffic to port 9000.
For that, edit your apache conf file (or virtual host conf file), and add the following lines (or configure it to something like the following),
<VirtualHost *:80>
ServerName my-web-app.infyom.com
ServerAdmin webmaster@infyom.com
ProxyRequests On
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
ErrorLog ${APACHE_LOG_DIR}/my-web-app.infyom.com.error.log
CustomLog ${APACHE_LOG_DIR}/my-web-app.log combined
......
# any other options below as per your need
......
</VirtualHost>
The next step you need to do is restart your apache server by,
sudo service apache2 restart
And then you can just open the URL https://my-web-app.infyom.com and it should work fine.
Bonus
New Deployment
Whenever you deploy a new code, you again need to run gatsby build
and then pm2 restart my-web-app
. Then only it will take new changes.
Troubleshooting
Sometimes, we found that we need to restart apache as well after the new deployment. so if you run into any trouble, then make sure to restart apache as well and it should solve the problem.
I hope it may help you to resolve your 404 problem.
How to generate User Device API using Laravel One SignalLaravel
How to generate User Device API using Laravel One SignalLaravel
Generally, we are using a Laravel One Signal package for push notification. if you are planning to use one signal in the mobile application then this package right for you.
Recently, I add a new feature UserDevice. let me explain why I added support for user Device APIs.
We need to create an API to register a device because One Signal sends a push notification using os player id. so, we need to store os_player_id in the backend from the mobile application. So, need to create an API for it.
Now. you can save your time using this package. you can Generate APIs using one artisan command,
php artisan one-signal.userDevice:publish
This command generates the following files,
- UserDeviceAPIController
- UserDeviceAPIRepository
- UserDevice (model)
- Migration So, everything is ready in minutes and delivered an API on the spot.
Also, do not forget to add the following routes to the api.php file.
use App\Http\Controllers\API\UserDeviceAPIController;
Route::post('user-device/register', [UserDeviceAPIController::class, 'registerDevice']);
Route::get('user-device/{playerId}/update-status', [UserDeviceAPIController::class, 'updateNotificationStatus'])
How to generate pre-signed URL from s3 bucket ?Laravel
How to generate pre-signed URL from s3 bucket ?Laravel
People nowadays are becoming more intelligent, so better to protect our application's content/data from those who are calling themself hackers.
One of the best examples is the data URLs from AWS buckets. it's not a good idea to store sensitive data into a public AWS Bucket, as the URL is accessible by the people.
Of Course, you can store profile avatars and others data to the public bucket's that not contains any confidential information. so that's fine.
But when it's about confidential information like PAN CARD Details, AADHAR Card Details, Bank Informations we Must Recommend using AWS Protected Bucket.
In this tutorial, we are going to show that how we can prevent that kind of case, Or how we can integrate AWS Protected Bucket in our Laravel Application.
The following code will help you to generate a pre-signed AWS URL that will prevent our data, that URL is non-guessable and it will expire within some minutes/hours specified by us.
So let's start with some code :
$s3 = \Storage::disk(config('filesystems.s3_protected_disk'));
$client = $s3->getDriver()->getAdapter()->getClient();
$expiry = "+1 minutes";
$command = $client->getCommand('GetObject', [
'Bucket' => \Config::get('filesystems.disks. s3_protected_disk.bucket'),
'Key' => 'Path to your file',
]);
$request = $client->createPresignedRequest($command, $expiry);
return (string) $request->getUrl();
So here we have created an s3 instance and it's stored on the $s3 variable, we have specified the expiry time as 1 minute so the given URL for data will be expired within a minute.
Also, we have to specify the bucket name and path to our protected file to generate AWS pre-signed URL.
It will return the pre-signed URL and its looks like as the following URL.
https://pre-signed.s3.au-west-2.amazonaws.com/image.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=xxxxxxxx%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210210T171315Z&X-Amz-Expires=60&X-Amz-Signature=xxxxxxxx&X-Amz-SignedHeaders=host
Hope this helps.
How to display responsive image in different devicesLaravel
How to display responsive image in different devicesLaravel
Today we are going to see how we can image based on resolution. We have the most common issue of loading big images in small devices take time. So, the basic solution is to use the picture element to load a different image in different devices and resolutions.
The <picture>
element will be for the art direction of responsive design.
The element contains two tags.
<source>
<img>
So, the browser will look for the first <source>
element where the media query matches the current width, and then it will display the image. The <picture>
element is required as the last child of the <picture>
element.
Let me show you an example of how to display a different image in different widths.
Here is a Code example,
<picture>
<source media="(min-width:900px)" srcset="infyom_logo_lg.jpg">
<source media="(min-width:700px)" srcset="infyom_logo_md.jpg">
<source media="(min-width:500px)" srcset="infyom_logo_sm.jpg">
<img src="infyom_logo_xl.jpg" alt="Flowers" style="width:auto;">
</picture>
How to setup passwordless Login In LaravelLaravel
How to setup passwordless Login In LaravelLaravel
Basically, we set up email/username and password login in all our projects. but, sometimes we need to implement s passwordless login in the laravel application,
First of all, what is passwordless login? passwordless login is an authentication method that allows the user to log in without entering a password.
In this article, I show you how to set up passwordless login laravel step by step.
Step 1:
one great laravel package Laravel Passwordless Login provides the ability to log in without a password.
This package provides a temporary signed URL link that logs in a user, What it does not provide is a way of actually sending the link to the route to the user. This is because I don't want to make any assumptions about how you communicate with your users.
Step 2:
Open the terminal and go to the project directory and fire the following command to install
composer require grosv/laravel-passwordless-login
Step 3:
Configure the following variables in your env file
LPL_USER_MODEL=App\User
LPL_REMEMBER_LOGIN=false
LPL_LOGIN_ROUTE=/magic-login
LPL_LOGIN_ROUTE_NAME=magic-login
LPL_LOGIN_ROUTE_EXPIRES=30
LPL_REDIRECT_ON_LOGIN=/
LPL_USER_GUARD=web
LPL_USE_ONCE=false
LPL_INVALID_SIGNATURE_MESSAGE="Expired or Invalid Link"
Step 4:
Create one function in your login controller. it looks like
use App\User;
use Grosv\LaravelPasswordlessLogin\LoginUrl;
function sendLoginLink(\Request $request)
{
$user = User::where('email','=', $request->get('email))->first();
$generator = new LoginUrl($user);
$url = $generator->generate();
//OR Use a Facade
$url = PasswordlessLogin::forUser($user)->generate();
$data['url'] = $generator->generate();
$data['user'] = $user;
Mail::to($user->email)->send(new UserLoginMail($data));
return back();
}
Step 5:
Set following route in your web.php
Route::post('/user/login', [LoginController::class, 'sendLoginLink'])->name('userLogin');
Step 6:
Create one mailable. you can refer to a doc if not familiar. Also, fire the following command to create a mailable
php artisan make:mail UserLoginMail
Step 7: Create an Email UI as per your requirement.