Saturday, 10 July 2021

Flutter | Display Text And Images From API



NOTE : The API used for this tutorial is https://unpossiblepog.com/flutter-json/data.php

Step 1 : Download project’s ZIP file from following link. Extract it.

https://unpossiblepog.com/projects/FLUTTER+JSON/Display-Text-And-Images-From-JSON-REST-API

------------------------

Step 2 : Open “pubspec.yaml” file, the option will automatically appear in ANDROID STUDIO to download library, mostly the link’s label will be “Pub get”. Click on it to download library.

------------------------

Step 3 : Run the project, click on “REDIRECT” button which will show new page with API’s data inside it.

------------------------

Step 4 (Optional) : On “Unpossible.dart” file, line number 63 & 64 represent TITLES ad IMAGES respectively. Use any one of them to switch between TITLES and IMAGES.

===================

QUICKSTART to Display DATA and IMAGES from JSON API To Flutter App.

-------------------------------


Instructions:-

https://unpossiblepog.blogspot.com/2021/07/flutter-display-text-and-images-from-api.html


Download Project:-

https://unpossiblepog.com/projects/FLUTTER+JSON/Display-Text-And-Images-From-JSON-REST-API


Subscribe my Channel:- 

http://www.youtube.com/user/SanketRooney?sub_confirmation=1 


Facebook Page:- 

https://www.facebook.com/UnpossibleNS 


Twitter Account:- 

https://twitter.com/UnpossiblePOG 


Blog:- 

https://unpossiblepog.blogspot.com/ 


Website:- 

https://unpossiblepog.com/ 


Gaming Instagram:- (@unpossiblepoggaming)

https://www.instagram.com/unpossiblepoggaming/

-------------------------------

This tutorial will help you to quickly extract data from JSON file and display text or images on flutter application.

Let’s get started.

This blog contains steps that we have to follow.

There is an API link given at the top. We will be using this data which contains texts and image links.

From 1st step, download the project by clicking on the link. Click on “HERE” button to download the project.

Go to the place where it is downloaded and extract it.

Now, open the studio where you run the flutter app.

Go to the place where you extracted that file.

You will see the ICON with name as “api_quickstart”.

In studio, open the “pubspec.yaml” file. You will see the “PUB GET” link somewhere on the studio. Click on it to download important libraries which will help to extract data from API.

Let’s run the project.

Click on “REDIRECT” button, you will see titles.

If you want to see the images, open the “Unpossible.dart” file inside LIB folder.

Comment line number 63 and remove the comment from line number 64.

Let’s run it again.

So that is it, thanks for watching. Like share and subscribe.


Monday, 5 July 2021

Upload Files From Local Machine To CPANEL | Bad Config Value For receive.denycurrentbranch Solution | Git & GIT VERSION CONTROL




Upload files from Local Computer to CPANEL’s file manager using git version control.
-------------------------------
SSH Key generation command:-
ssh-keygen -t rsa -b 4096 -C "your_email_id"

BASHRC File code:-
export PATH=/usr/local/cpanel/3rdparty/lib/path-bin:$PATH

Subscribe my Channel:- 
http://www.youtube.com/user/SanketRooney?sub_confirmation=1 

Facebook Page:- 
https://www.facebook.com/UnpossibleNS 

Twitter Account:- 
https://twitter.com/UnpossiblePOG 

Blog:- 
https://unpossiblepog.blogspot.com/ 

Website:- 
https://unpossiblepog.com/ 

Gaming Instagram:- (@unpossiblepoggaming)
https://www.instagram.com/unpossiblepoggaming/
-------------------------------
Hello guys, in this video we shall upload files from LOCAL COMPUTER to domain’s CPANEL using git and git version control.
There are 2 requirements to complete this task.
1st, , make sure that you have SSH access is enabled on your domain. In my case as I purchased it from godaddy, so there is a setting for it.
Also I do have CPANEL access of it. Make sure that it has git version control enabled.
2nd requirement is have GIT installed on your computer. 
Now in command prompt, notice that this is the default location, which is C drive, USERS folder and then the username.
Copy the command that is provided in the description of the video, paste it in command prompt.
Type your email address inside double quote.
It will create a public-private keys.
Do no add any text, leave them empty by pressing ENTER button of your keyboard.
Now go to this location.
There will be a “.ssh” folder, if there is not, it will be hidden. Go to settings and make it visible.
Now go inside ssh folder, and there you will see the file with an extension as “.pub” which means the public key.
Open it in text editor like notepad or anything.
Copy it and go to CPANEL of your domain, go to SSH ACCESS option, click on “IMPORT KEY”, give any random name.
Leave private key and passphrase empty. 
In PUBLIC KEY TEXTAREA, paste that public key.
Click on IMPORT.
Now authorize that newly added key.
Let’s go to CPANEL dashboard, click on GIT VERSION CONTROL.
Click on create, uncheck the “CLONE REPOSITORY” option.
I shall add file name which will automatically create a new folder in cpanel.
Now, go back to the listing, click on MANAGE button in front of newly created repository, and copy the CLONE URL.
Now, on your computer, choose any location, create a folder there.
Open that folder in GIT BASH.
Type command “git clone”, then paste the path, and then give any random name to it. I gave it a name as “testing”.
If it asks question, type YES.
Of course our repository is empty so ignore the warning.
Let’s create idex.html file there, open it in text-editor.
Type something inside it.
Let’s add that in change list.
My mistake, you have to go inside that testing folder so use the CD command to enter inside it.
Now, we are inside testing folder.
Let’s run commands to upload those files.
Now, before pushing files to CPANEL, check the available branches.
We have one available known as “refs/heads/master”.
Lets push file inside it.
There is one error called “bad config value for ‘receive.denycurrentbranch’ in ./config”.
To solve that, go to FILE MANAGER of cpanel, go to settings and make sure that “show hidden files” is checked. Save settings.
Search file “.bashrc”. Let’s edit that page.
On top of file, paste the following code that I provided in the description.
Save it.
Now, let’s run that command again.
Let’s check if changes are reflected.
As you can see, there is an index.html file and it has the text that we typed.
Let’s make more changes. Save them.
And, those changes are reflected.
So that is it, thanks for watching. Like share and subscribe.

Saturday, 26 June 2021

New Instagram Account For Gaming | Unpossible POG





 Instagram (@unpossiblepoggaming) : https://www.instagram.com/unpog.gaming/

When I upload videos on my youtube channel, I always post it on this blog. But this blog's main focus is to provide more information on programming tutorials which comes in the category of EDUCATION. But the gaming is different, it is mostly an ENTERTAINMENT. So instead of promoting gaming videos on blog, I decided to open an instagram account where gaming videos are more suited.

Sunday, 13 June 2021

Digital Animation With HTML And Javascript




-------------------------------
Code :-

<html>
  <head>
    <link href="http://fonts.cdnfonts.com/css/led-digital-7" rel="stylesheet">
    <style>
      div {
        font-family: 'LED Digital 7', sans-serif;
        font-size: 48px;
        text-shadow: 4px 4px 4px #aaa;
      }
    </style>
  </head>
  <body>
    <div id="appear"></div>
  </body>
  <script type="text/javascript">
    var string="UNPOSSIBLE-POG";
    var final_string=""; 
    for(let i=1;i<=(string.length)*4;i++)
    {
       
      setTimeout(function deplay_this(){ 
        var to_display="";
        if(i%4==3){
          to_display=final_string+"8";
        }
        if(i%4==2){
          to_display=final_string+"0";
        }
        if(i%4==1){
          to_display=final_string+"1";
        }
        if(i%4==0){
          final_string=final_string+string[(i/4)-1];
          to_display=final_string;
        }
        document.getElementById("appear").innerHTML=to_display; 

      }, i*100);
      
    }
  </script>
</html>

-------------------------------

Subscribe my Channel:- http://www.youtube.com/user/SanketRooney?sub_confirmation=1


Facebook Page:- https://www.facebook.com/UnpossibleNS


Twitter Account:- https://twitter.com/UnpossiblePOG


Blog :- https://unpossiblepog.blogspot.in/


Wednesday, 26 May 2021

Flutter Add & Edit Page To Insert & Update Data Inside SQFLITE Database Table






NOTE : You can download a whole project from  https://unpossiblepog.com/projects/dart+flutter+sqflite/Flutter-Basic-SQFLITE-Database-Project-Create-Insert-Update-Delete


1. In main.dart file, need to add new column called action, which will contain an EDIT button for each entry. For that, replace the “getDynamicTable” function with following code.


Table getDynamicTable() {

List<TableRow> rows = [];

rows.add(TableRow(children: [

Text("Id"),

Text("Name "),

Text("Address "),

Text("Actions"),

]));

if(employeeFinalList!=null)

{

for (int i = 0; i < this.employeeFinalList.length; ++i) {

rows.add(TableRow(children: [

Text(""+employeeFinalList[i]['id'].toString()),

Text("" + employeeFinalList[i]['name'].toString()),

Text("" + employeeFinalList[i]['address'].toString()),

new RaisedButton(

child: new Text('EDIT'),

onPressed: () {

Navigator.push(

context,

MaterialPageRoute(builder: (context) => insertPage(id:int.parse(employeeFinalList[i]['id']))),

);

},

)

]));

}

}

return Table(

border:TableBorder.all(width: 2.0,color: Colors.black),

columnWidths: {

0: FixedColumnWidth(100.0),

0: FixedColumnWidth(100.0),

1: FlexColumnWidth(),

},

children: rows,

);

}

-------------------------------

2. Create a new dart file at the place where the main.dart file is present. Give it a name as “addEditPage.dart” and paste the following code inside it.


import 'package:flutter/material.dart';

import 'dart:async';

import 'package:<your_project_folder_name>/database_connector.dart';

import 'package:sqflite/sqflite.dart';

import 'main.dart';

class insertPage extends StatelessWidget {

int id;

String name;

String address;

int fetchData=0;

// This widget is the root of your application.

insertPage({this.id});

var txt_1 = TextEditingController();

var txt_2 = TextEditingController();

@override

Widget build(BuildContext context) {

//print(""+id.toString());

if(id!=0)

{

DBConDisplaySpecificId(id);

}

TextStyle textStyle = Theme.of(context).textTheme.title;

return Scaffold(

appBar: AppBar(

title: Text("Second Route"),

),

body: Padding(

padding: EdgeInsets.only(top: 15.0, left: 10.0, right: 10.0),

child: ListView(

children: <Widget>[

Padding(

padding: EdgeInsets.only(top: 15.0, bottom: 15.0),

child: TextField(

controller: txt_1,

style: textStyle,

onChanged: (value) {

debugPrint('Something changed in Name Text Field');

},

decoration: InputDecoration(

labelText: 'Name',

labelStyle: textStyle,

border: OutlineInputBorder(

borderRadius: BorderRadius.circular(5.0)

)

),

),

),

Padding(

padding: EdgeInsets.only(top: 15.0, bottom: 15.0),

child: TextField(

controller: txt_2,

style: textStyle,

onChanged: (value) {

debugPrint('Something changed in Address Text Field');

},

decoration: InputDecoration(

labelText: 'Address',

labelStyle: textStyle,

border: OutlineInputBorder(

borderRadius: BorderRadius.circular(5.0)

)

),

),

),

Padding(

padding: EdgeInsets.only(top: 15.0, bottom: 15.0),

child: Row(

children: <Widget>[

Expanded(

child: RaisedButton(

color: Theme.of(context).primaryColorDark,

textColor: Theme.of(context).primaryColorLight,

child: Text(

'Save',

textScaleFactor: 1.5,

),

onPressed: () {

debugPrint("Save button clicked");

getValuesFromTextbox();

Navigator.push(

context,

MaterialPageRoute(builder: (context) => MyApp()),

);

},

),

),

Container(width: 5.0,),

],

),

)

]

)

),

);

}

void getValuesFromTextbox()

{

DatabaseConnect con = DatabaseConnect();

final Future<int> dbFuture = con.insertUpdateDynamic(id,txt_1.text,txt_2.text);

}

void DBConDisplaySpecificId(id){

DatabaseConnect con = DatabaseConnect();

List<Map<String, dynamic>> list=[];

final Future<Database> dbFuture = con.initializeDatabase();

dbFuture.then((database) {

Future<List<Map<String, dynamic>>> noteListFuture = con.getSpecificEmployee(id);

noteListFuture.then((emp_data) {

for(var i=0;i<emp_data.length;i++)

{

Map m=emp_data[i];

m.forEach((k,v) =>

{

//print('${k}: ${v}'),

if('${k}'=="name")

{

txt_1.text='${v}',

},

if('${k}'=="address")

{

txt_2.text='${v}',

}

}

);

}

print(emp_data);

});

});

}

}

-------------------------------

3. Then import that file by pasting the following code in “main.dart” file.


import 'addEditPage.dart';

-------------------------------

4. In floating button, onPressed event, add the following code.


() {

Navigator.push(

context,

MaterialPageRoute(builder: (context) => insertPage(id: id)),

);

},

-------------------------------

5. Add new integer variable in the first line of "Widget build" function.


int id=0;

-------------------------------

6. In database_connector.dart file, add the following code inside “DatabaseConnect” class.


Future<int> insertUpdateDynamic(int id,String name,String address) async {

Database db = await this.database;

var result=0;

if(id==0)

{

result = await db.rawInsert("INSERT INTO employee(name,address) VALUES('"+name+"','"+address+"')");

}

else

{

await db.rawUpdate("UPDATE employee set name='"+name+"', address='"+address+"' where id='"+id.toString()+"'");

result=id;

}

return result;

}

Future<List<Map<String, dynamic>>> getSpecificEmployee(int id) async {

    Database db = await this.database;

    var result = await db.rawQuery('SELECT * FROM employee where id='+id.toString()+' order by id ASC');

    return result;

}

-------------------------------
END
-------------------------------

Subscribe my Channel:- http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:- https://www.facebook.com/UnpossibleNS

Twitter Account:- https://twitter.com/UnpossiblePOG

Blog :- https://unpossiblepog.blogspot.in/

-------------------------------

In last part, we displayed database in table format. In this video, we are going create add & edit page from where we can insert or update data.

We already have table structure ready, we shall add new column for edit button.

And we already have add button floating at the bottom of simulator screen.

I created a blog which contains code and instructions.

We just have to copy-paste it.

From 1st point, copy the code and replace the getDynamicTable function.

It will help to add new EDIT column.

For 2nd point, create a new dart file in LIB folder.

Paste the whole code in it.

Make sure to add correct project name, in my case it is “steps”

3rd point says that you have to import newly created file.

From 4th point, onpressed function of floating button, add the given code.

In 5th point, create a new int variable called ID with default value as 0.

From last point, copy the code, go to database_connector.dart file and paste the code inside the class.

Now let’s run the project.

Peter Parker came twice, so I am going to edit the entry.

Let’s add new entry by clicking on floating button.

So that is it, thanks for watching. Like share and subscribe.



Wednesday, 5 May 2021

Flutter | Navigate To New Page


 


You can download the project from


https://unpossiblepog.com/codes/DART+FLUTTER/Flutter-Redirect-To-Another-Page


1.
To add a button (on click of which we have to open new page), remove Center() function and following code.

Column(children: <Widget>[

])

--------------------

2. Then to copy-paste the following code to add a manual button inside box bracket of Column function.


new RaisedButton(
child: new Text('Add Data'),
onPressed: () {

Navigator.push(
context,
MaterialPageRoute(builder: (context) => insertPage()),
);

},
)

--------------------
3. Observe that the function “insertPage” will be highlighted as an error. We have to call create a new dart page which will have “insertPage” as a class name.


So create a new dart file, give it any random name.

Then copy-paste the following code in that newly created file.


import 'package:flutter/material.dart';


class insertPage extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {

TextStyle textStyle = Theme.of(context).textTheme.title;
return Scaffold(
appBar: AppBar(
title: Text("Second Route"),
),
body: Padding(
padding: EdgeInsets.only(top: 15.0, left: 10.0, right: 10.0),
child: ListView(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 15.0, bottom: 15.0),
child: TextField(
//controller: titleController,
style: textStyle,
onChanged: (value) {
debugPrint('Something changed in Title Text Field');
//updateTitle();
},
decoration: InputDecoration(
labelText: 'Title',
labelStyle: textStyle,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0)
)
),
),
),
Padding(

padding: EdgeInsets.only(top: 15.0, bottom: 15.0),
child: Row(
children: <Widget>[
Expanded(
child: RaisedButton(
color: Theme.of(context).primaryColorDark,
textColor: Theme.of(context).primaryColorLight,
child: Text(
'Save',
textScaleFactor: 1.5,
),
onPressed: () {
debugPrint("Save button clicked");
//_save(context);
//_showAlertDialog("ok","ok",context);
},
),
),

Container(width: 5.0,),

],
),

)
]
)
),
);

}
}

--------------------

4. After that, we have to call that new file in our main file so copy-paste the following code at the top of main.dart page in import section.


import 'insertPage.dart';


--------------------

DIALOGS:

Subscribe my Channel:-
http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
https://www.facebook.com/UnpossibleNS

Twitter Account:-
https://twitter.com/UnpossiblePOG

Hey guys, in this video I shall add a button which will redirect to new page in flutter application.

I have created a new basic project. By default, it has a button which displays click count.

I provided a blog link which contains instructions and codes.

For first instruction, copy the code. In Flutter project, remove the default Center function if you have it.

Paste the code.

Then from second instruction, copy the code, and paste it inside Column function.

You can add 2 buttons, but make sure to add comma between them.

Anyway, currently I will be adding only one button.

As you can see, when I try to save it, it gives me an error.

It is because we currently don’t have insertPage() function.

Change button text if you want to.

Then, from the 3rd instruction, copy the whole code.

In Android Studio, create a new dart file in LIB folder.

Paste the code in it.

Now, we he have to import that newly created dart file inside our main.dart.

Go to the top, import the page. Make sure to give same name as you gave it to a newly created dart file, in my case it is newPage.dart.

Now, let’s check it on simulator.

When I click on a button, it will open a new page.

To go back, there is a back button automatically added.

So that is it, thanks for watching. Like share and subscribe.




Thursday, 22 April 2021

HTACCESS + PHP | Forcefully Add Ending Slash (/) In URL On Rewrite Rule

 


You can download the whole folder from:
https://unpossiblepog.com/codes/PHP+HTACCESS/HTACCESS-Forcefully-Add-Slash-At-The-End-Of-URL

.htaccess
RewriteEngine on

RewriteRule ^([^\.]+)/$ $1.php [NC,L]

ErrorDocument 404 http://%{HTTP_HOST}/<project-folder>/error.php?ref=%{HTTP_HOST}%{REQUEST_URI}

-----------------------------------------
error.php

<?php

if(isset($_GET['ref'])) {

$path_name=$_GET['ref'];

$file_name_array=explode("?", $path_name);

//echo $this_path."<br/>";

//echo $file_name_array[0]."<br/>";

if(isset($_SERVER['HTTPS'])){$http_https = "https://";}else{$http_https = "http://";}

$file_name=$http_https.$file_name_array[0];

header("location: ".$file_name."/");

  //echo $file_name."<br/>";

}

?>

-----------------------------------------
index.php

<h1>This is INDEX file.
</h1>
-----------------------------------------

about.php

<h1>This is About page.</h1>
-----------------------------------------
hello.php

<h1>This is hello page.</h1>

=======================


Subscribe my Channel:- http://www.youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:- https://www.facebook.com/UnpossibleNS

Twitter Account:- https://twitter.com/UnpossiblePOG

Blog :- https://unpossiblepog.blogspot.in/

-------------------------------

Hey guys, we shall create a code to force browser to add slash at the end of URL using HTACCESS and PHP.


Make sure to use INCOGNITO mode while implementing this because sometimes the HTACCESS code remains in a cookies which won’t help to run the updated code of HTACCESS.


Currently in folder, we have some PHP files, each file contains some text.


And we have the REWRITE RULE in HTACCESS file which will allow you to run the file without using the “.php” extension. And the rule contains an ending slash in first parameter.

So if you enter the URL without extension and end with slash, it will run that page.

But if you remove the ending slash, it will give you a 404 error. The best solution is to forcefully add ending slash in URL using the code.

So in HTACCESS, write the following code, code link is given in the description.

Notice that this file is inside the “tutorial” folder which is inside HTDOCS folder of xampp.

You have to add the URL accordingly.

So I have already created an error.php page which will forcefully add slash. Code is given in the description.

Our strategy is to send the current URL as a request parameter when error occurs.

And as you can see, it redirects and ends with slash.

So that is it, thanks for watching. Like share and subscribe.