Home Blog Page 44

How to migrate mongodb database from one server to another server

0
How to Migrate MongoDB Database from one server to another

Hi Guys, Welcome to Proto Coders Point. In this tutorial will learn How to migrate mongodb database to another server- export mongo data to another server instance.

So basically we are going to copy MongoDB Databases to a New Server, or you can say it as export mongodb data to new server.

Suppose you have data in GB’s and want to move the data to latest server, so Instead of taking backup (dump files of mongodb) in your local computer, then copying it again to new aws server. it will consume lots of internet and time is wasted a lot. So here is the solution, simple transfer mongodb files from server 1 to server 2 then use mongorestore command to restore the data to new server database.

Let’s Get Started

Video Tutorial

Export Mongodb from one server to another

I have 2 servers instance created on AMAZON WEB SERVICES (just for this tutorial).

  • server 1
  • server 2
aws server instance ec2

On both the server mongodb is been installed, learn how to installed mongodb on AWS ubuntu server.

In SERVER 1, I have data in mongodb that I want to transfer directly to server 2.

mongodb compass

Follow the below Steps

In Server 1 : Take mongodb backup & send to server 2

So In Server 1, We need to take backup of our mongodb database using mongodump cmd & then create zip/tar file of dump folder & transfer the tar/zip file to server 2.

Follow below Steps

Mongodump – Database backup

Step 1: move to path where you want to take mongodb dump backup files Eg: /var/www/

cd /var/www

Step 2: Mongodump – MongoDb Export Database

mongodump --uri="mongodb://username:password@<ipaddress>:27017/DatabaseName

My DB don’t have any authentication security, this tutorial is just to learn how to migrate database to server, learn How to secure mongodb authorization for remotely access Here.

Eg: without authentication

sudo mongodump --uri="mongodb://18.117.182.26:27017/mydb" 

Eg: With DB auth security

sudo mongodump --uri="mongodb://username:password@18.117.182.26:27017/mydb" 

Successfully created database backup dump


#image of dump file created for database backup

Step 3: Create tar.gz file of dump file

Being into the same directory where we have created mongodump backup, create tar.gz of dump folder.

** Create tar **
tar -czvf dump.tar.gz dump

Sending file server to server

To transfer files from one server to another server, we need below details of server 2.

  1. username of server 2
  2. ip address of server 2
  3. .pem file of server 2 (aws/google cloud provides you).

Here .pem file is very important, it helps use in communicating to server system.

Step 1: Keep .pem file to server 1

I have copied .pem file under /var/www folder

Step 2: Change permission of .pem file to read only

chmod -R 400 filename.pem

Step 3: Finally transfer file to server 2

scp -i mykey.pem somefile.txt <UserName>@<IP ADDRESS>:/

Eg:

Below Screenshot is of server 2 file, as you can see file is been transfer successfully to server 2.

file transfer to server 2

In Server 2 – Mongodb data restoring

Check directory path to /var/www

On server 2 under /var/www you will see a tar/zip file that been transferred from server 1 to server 2, we need to extract it & then import the mongodb data in server 2 database i.e. mongodb restore.

Step 1: Extract tar.gz

sudo tar -xzvf dump.tar.gz

Step 2: Mongodb import database – mongorestore

sudo mongorestore --username rootUser --password abc123 --db mydb dump/mydb/

Here

username & password are auth key of my database.

mydb is name of database.

dump/mydb/ is path of mongodb files.

Learn Angular – Build first web app using angular

0
learn angular
learn angular

Hi Guys, Welcome to Proto Coders Point. This tutorial will be on How to start learning Angular to build web projects.

What is Angular

Angular is a client side scripting language helps in creating single page applications. So you might be wondering what exactly is Single Page Applications.

Single Page Applications (SPA) – In this application only a single page is created and this page keeps changing based on the user inputs. In Angular SPA a web page takes input from user and dynamically re-build the current website page with the new data requested by the user from web server, here the web page is loaded entire when new data is requested.

Requirement to build Web Application using Angular

In order to run a simple angular project, Firstly we need to install nodejs, Download nodejs.

For the angular project to run we need npm (Node Package Module) to be installed in our system, NPM also helps us in installing angular packages.This comes along nodejs installation.

What is npm

Npm stands for Node Package Module. As we all know the browser is not capable of understanding other languages. So Angular is a modern framework that is built entirely in TypeScript, so Npm helps us in converting the typescript to javascript.

Once nodejs is installed we can check using below cmd in Terminal.

node –version

npm –version

Install angular cli using cmd prompt

Once nodejs is installed, we will move ahead in installing the angular cli using command prompt.

npm install –g @angular/cli 

The above command will download angular cli, Here -g, means angular cli will get installed globally.

Angular Cli – helps us in creating an angular ready made boilerplate project.

once angular cli we can check using ng –version.

check angular version
check angular version

Nodejs & Angular is successfully installed in our system.

Installing IDE & Plugin Extension

Next step will be installing the IDE that is Visual Studio code, Download Visual Studio Code.

Once IDE is installed, we will be installing two angular extension in Visual Studio code.

In the visual studio code go to extensions and search there with below extensions and install.

  1. Angular Essentials.
  2. Material Icon.
angular essentials
angular essentials
angular essentials
Material icon theme

Create angular project

After following all the above steps, we are done with the installation and now we can create an angular boilerplate project:

Open the cmd & run as administrator.

Navigate to the path where we want to create the new angular project and we run the command as below.

     ng new <folder-name>

If it prompts message as shown below, do YES and enter

creating first angular project
creating first angular project

Further it asks you what type of stylesheet you want in your project you can select anyone from them, I have preferred the CSS stylesheet and then  press enter .

angular stylesheet selection
angular stylesheet selection

Now it will install all the required packages for the angular project nake sure you are connected to internet. Below is the screenshot attached.

Now you can go to particular path and check there will be a folder automatically created with all the packages needed for angular project.

How to run angular project

Next we need to open project in visual studio code and open a terminal and run the below command

ng serve

ngserve – ng serve command is used to run the angular project. Once we run this we will get the message as shown in screenshot that means it is successful.

how to run anguale project ng serve

As you can see above, our first angular project is been serving at port no 4200.

Now go to the browser and search for localhost:4200 and we can see there the boilerplate template created by angular cli been displayed.

getting started with angular

Recommended Article

Different between react and angular

Flutter vs React native

7 best tools for react development

How to use bootstrap in React

How to create custom hooks in react

Android Wireless Debugging ADB over WiFi – Run App Wirelessly

0
ADB over wifi - run android project wirelessly
ADB over wifi - run android project wirelessly

Hi Guys, Welcome to Proto Coders Point. In this tutorial will learn How to run a app on your Android device without USB, ADB over WiFi: What You Need to Know, so basically will debug android project & run on physical device wirelessly through WiFi.

So with latest release of android studio i.e. bumblebee 2021.1.1, There is a new feature been added, ADB over WiFi, have a ability to run/debug native android or flutter project wirelessly using WiFi, so there is not need of USB debugging to connect mobile to laptop for debugging/run android project.

ADB over WiFi – Android Wireless debugging

Mandatory requirement to run app on mobile wirelessly – ADB over wifi

  1. Android Studio Bumblebee – 2021.1.1 or above version.
  2. Physical Mobile device should have android 11 or +.
  3. PC/Laptop & phone should be connected to same wifi network.

Let’s get started

Android studio bumble bee – Wireless debugging over wifi

Video Tutorial

Let’s connect physical device through WiFi to run android project wirelessly on phone.

1. Update IDE to Bumblebee

The first step is to check if your android studio IDE is 2021.1.1 i.e bumblebee, if not then update it.

IDE Menubar -> Help -> check for updates...

A stable version of bumblebee

Studio update to Bumblebee
Studio update to Bumblebee

You can read the list of new feature added in android studio bumblebee, one of them is ADB over Wi-Fi.

Preparing IDE for update

Restart IDE ater upgrade

android studio bumblebee 2021.1.1

2. Enable Wireless debugging on android 11

Note: Only available on Android 11 & above.

In your android phone, first of all:

Enable developer debugging option for that goto settings -> about -> build number (Tap on it 5 times to enable developer options).

Then Settings -> System -> Advanced -> developer option, Now you will see wireless debugging tap on toggle button to turn on/off, A pop will appear “Allow wireless debugging on this network”, Tap allow.

Enable Wireless Debugging
Enable Wireless Debugging
llow access for ADB over wifi
Allow access for ADB over wifi

3. Pair Device with QR code/pairing code

Now in Setting -> System -> Advanced -> developer option -> wireless debugging, being in that screen.

Types of wifi pairing
Types of wifi pairing

As you can see, there are 2 ways to pair new device to IDE for Wireless wifi debugging.

  1. Pair device with QR code: From mobile you need to scan a QR code that appear on android studio IDE to pair through WiFi.
  2. Pair device with pairing code. You will get 6 digit wifi pairing code, that you need to enter in IDE to get paired.

We are done with mobile side, let’s go to IDE.

4. Android Studio IDE – Pair using WiFi – device manager

In IDE -> Menubar -> Tools -> Device Manager.

Click on Physical -> Pair using WiFi.

device manager - Pair using wifi
device manager – Pair using wifi

Pair using QR code

Here you just need to scan the QR code from your physical android device and your device will get connected to IDE for wireless debugging.

QR code to pair wifi connection for wireless debug
Scan this QR code to pair wifi connection for wireless debug
Pair using QR Code – device connected

Pair using pairing code

As I said above, your mobile device will give you a pairing code, that you need to enter into IDE to getting connected to wireless debugging.

pair using pairing code
pair using pairing code
pair using pairing code
pair using pairing code

How to create .exe installation file of flutter windows Application

0
how to create .exe installer file of flutter windows application
how to create .exe installer file of flutter windows application

Hi Guys, Welcome to Proto Coders Point. In this Article will learn how to create .exe installation file of flutter windows application.

Now with Flutter 2.10 version & above is stable that support to build flutter windows application, therefore now you can easily build flutter apps for windows desktop just by using below command in flutter project terminal.

flutter build windows

When you run above build windows cmd, flutter will build windows application of your flutter project at location:-

<project>/..build/windows/runner/release/

There you have a Application file, clicking on exe file will run flutter windows application on windows OS.

This is how flutter build windows app release folder will look like:

This Application file will make use of data folder & .dll file to execute flutter app successfully.

But the question is …! How to distribute flutter windows app throughout the world or to our client ?. & suppost if main .dll file or data folder got deleted or went missing then your flutter app will not work. So we need to create installer, Let’s do it.

Create .exe installer file of flutter app

So to distribute your flutter windows app you need to build & create .exe installer file for your flutter app, so that your client can easily click on installer executable file & install flutter app on windows operating system. In this flutter article, will learn how to create exe file of flutter windows application.

Inno setup to create installer .exe file

Will make use of Inno Setup software to create .exe installed of flutter windows build.

Download Inno Setup

Below are the steps How to use Inno Setup for creating .exe file.

1. Install Inno setup & open it, It look like as below.

inno setup software

In the first step, select the second option i.e “create a new script file using the script wizard” & click on OK button as shown in above screenshot.


2. Fill out information about flutter application in inno setup.

In the next step you will be asked to fill basic information about your application.

App info window
Installation folder windows ( your flutter will get installed basically in C:// Program Data)

3. Application files

Here Select Flutter Windows application file, folders and exe selections

This step is very much important, Here you need to select release flutter build windows files and folder.

Refer above screenshot

  1. Select Application main executable file i.e .exe
  2. Add files: Select 2 files i.e .dll and .exe
  3. Add folder: Select data folder.

After selecting data folder, select the selected path of folder & click on Edit Button.

inno setup
inno setup

Here in destination subfolder, you need to set a folder name, In our case it “data”, so enter data in it as shown & hit OK button.

then next.


4. Application file association

inno setup windows

Here we need to select if our flutter windows application has any other type of file extension, In our case we don’t support any other extension for now, so uncheck, associate a file type to the main executable and hit next.


5. Windows Application shortcuts


6. Setup Install Mode

Here select Administration Install Mode (Instakk for all users).


7. Compiler Settings

Here in Inno setup compiler setting windows page you need to:

  1. Choose / Browse final output folder.
  2. Final output file name Eg: protoInstaller.
  3. [Optional] Setup icon Image file. Should be in .ico extension.
  4. [Optional] Set Password for your installer setup.

Then click on Next, Until finish.


8. Create new inno Script

Then you will be prompt, asking for creating new compile script. click “YES”.

9. Flutter app windows exe installer is created

Flutter exe installer

After successfully compilation completes, you will see a installer setup been created in your selected folder as you can see above.

Conclusion

Now, We have successfully created .exe installer of our flutter windows app.

So now you can easily distribute your flutter windows application through out the world just by sharing .exe installer setup we created in above steps. Your flutter app user can now simply click on the installer setup to install flutter application on windows OS.

[100% working Solution] cmdline-tools component is missing Flutter

0
CMD line-tools component is missing
CMD line-tools component is missing

Hi Guys, Welcome to Proto Coders Point.

So when you run flutter doctor you get warning saying:-

Android tool chain – cmdline-tools component is missing

Android license status unknown – run ‘flutter doctor –android-licenses’ to accept SDK license.

Solution – cmdline-tools component is missing

Android sdkmanager not found, update to latest android SDK and ensure that the cmdline-tools is installed to resolve this.

Step to solve Android SDK command line tool issue.

Make user you are connected to internet

  1. Start Android Studio.
  2. In Menu bar goto tools > sdk manager.
  3. goto to SDK tools tab.
  4. Tick/select Android SDK command line tools
  5. Click on Apply button then OK

Screenshot step by step reference

Start/Open Android Studio IDE

Open SDK Manager by going to Tools > SDK Manager

how to open sdk manager in android studio

A New windows will popup, go to SDK Tooks section, and tick Android SDK command- line tools

how to install android SDK command-line tools

Then Click on Apply button.

At this port, you will be prompt to accept SDK license & cmd line tools accept it and done, this will download & install cmd line tools.

downloading command line tool android studio

Now, after installing commandlinetool, Come to Terminal and enter

flutter doctor

This will check if all the required platform dependencies is completed or no.

flutter doctor check up

So as you can see in above screenshot all the software/dependencies like Visual Studio, Android Studio, Android tookchain is installed properly.

How to upgrade flutter SDK 2.10 & enable flutter windows desktop support

0
how to upgrade flutter to 2.11 for desktop support

Hi Guys, Welcome to Proto Coders Point. In this Flutter Article will learn how to upgrade flutter to 2.10 & enable flutter windows desktop support.

Video Tutorial to upgrade flutter SDK


Steps to Upgrade Flutter SDK version

First run command prompt at administration

1. flutter doctor:- Check if all the platform required dependencies is setup.

flutter doctor

flutter doctor

Here as you can see all the platform setup required is done, and showing No issue found!


2. flutter upgrade:- This will upgrade your flutter SDK version to latest version available i.e flutter 2.11.

flutter upgrade

flutter upgrade

We have successfully upgraded flutter SDK to 2.10.


Installing Visual Studio with Desktop development with C++

So as we are going to build windows app in flutter, we need visual studio with desktop development C++ package installed.

Therefore, open simple install visual studio installer and install it.

visual studio desktop development with C++

Enable windows desktop and create flutter platforms windows

Once you have successfully upgraded flutter 2.10 and install visual studio with desktop development.

Now, open any existing flutter project or create new and run below 2 commands to enable windows desktop support for your flutter app.

flutter config --enable-windows-desktop

flutter create --platform=windows,macos,linux .


Conclusion

Now, In this tutorial we have successfully upgraded flutter SDK to 2.10 and enabled desktop windows support.