Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,315
» Latest member: Zer
» Forum threads: 96
» Forum posts: 104

Full Statistics

Online Users
There are currently 25 online users.
» 2 Member(s) | 23 Guest(s)
MarkHairl, RSlutt

Latest Threads
Ravishankar Chavare
How to set up or install ...

Forum: Python
Last Post: Ravishankar Chavare
04-07-2018, 10:03 AM
» Replies: 0
» Views: 866
Ravishankar Chavare
Welcome to Python

Forum: Python
Last Post: Ravishankar Chavare
04-07-2018, 07:55 AM
» Replies: 0
» Views: 257
Ravishankar Chavare
Generate 4 digit otp

Forum: Php
Last Post: Ravishankar Chavare
03-11-2018, 09:53 AM
» Replies: 0
» Views: 1,054
Ravishankar Chavare
Paytm 200rs Cashback on 2...

Forum: Suggestions for sale
Last Post: Ravishankar Chavare
03-08-2018, 02:35 PM
» Replies: 0
» Views: 1,150
Ravishankar Chavare
Paytm - 50% cashback on m...

Forum: Daily offers
Last Post: Ravishankar Chavare
02-26-2018, 07:18 AM
» Replies: 0
» Views: 1,013
Ravishankar Chavare
SQLiteDatabse In Android

Forum: Android
Last Post: Ravishankar Chavare
02-21-2018, 04:37 PM
» Replies: 0
» Views: 1,109
Ravishankar Chavare
Add Stylish Toast In Your...

Forum: Android
Last Post: Ravishankar Chavare
02-03-2018, 06:26 AM
» Replies: 0
» Views: 681
Ravishankar Chavare
Github Integration In And...

Forum: Android
Last Post: Ravishankar Chavare
02-02-2018, 06:22 PM
» Replies: 0
» Views: 482
Ravishankar Chavare
Be off campus job opening...

Forum: Off campus
Last Post: Ravishankar Chavare
01-19-2018, 12:54 PM
» Replies: 0
» Views: 1,402
Ravishankar Chavare
HSBC Java J2EE/Software E...

Forum: Direct Walkins
Last Post: Ravishankar Chavare
01-10-2018, 04:32 PM
» Replies: 0
» Views: 1,770

 
  Part 4- MVC AngularJS controller defined in another file
Posted by: Ravishankar Chavare - 12-06-2017, 04:31 PM - Forum: Angular Js - No Replies

As we Already know the basic of MVC architecture of AngularJS. If you doesn't know how to MVC work read tutorial Here


You need 3 files two are

1.index.html
2.appcode.js

and one angular.min.js




1.index.html

Code:
        <!DOCTYPE html>
            <html ng-app="myApp">
            <head>
                <title>mvc</title>
                <script src="../angular.min.js"></script> //give path of the angular.min.js where it plced in local system
                <script src="appcode.js"></script>
            </head>
            <body>
                <p>Show Model data in View through Controller</p>
                <div ng-controller="myController">
                    Name:{{person.name}}
                    <br>
                    Mobileno:{{person.mobile}}
                </div>
            </body>
            </html>


2.appcode.js
Code:
var app=angular.module("myApp",[]);
    app.controller("myController",function($scope){
        $scope.person={
            'name':'ravi',
            'mobile':'123456789'
        }
    });

If you any problem comment that problem


Part 3-MVC in AngularJS

Print this item

  Part 3-MVC in AngularJS
Posted by: Ravishankar Chavare - 12-06-2017, 02:14 PM - Forum: Angular Js - No Replies

In this Tutorial I am defining Model view Controller in single html file for better understanding
for defining model and controller in another javascript file read tutorial Here.


AngularJS support MVC Architecture

[Image: QAmBGWZ.png]

MVC : Model View Controller

-Model contains the data and logic,
-View contains the visual layout and presentation,
-Controller connects the two.

mvc is loosely couple and we can reuse the structure of the pattern


1.Model:

-Model contains the data and logic.
-Binding the view into the model.
-In AngularJS, model consists of all primitive data type such as integer, string and Boolean and complex type in form of object.
-Model is just a plain JavaScript object. But you can build your model from any database like SQL Server or MySQL or from JSON file.

Syntax and Example:

Code:
<script>
$scope.person={
'name':'ravi'
'mobile':'7507500084'
}
</script>


2.View:

-This directive creates new scope.
-View is the DOM element which is used to present or display the data.
-To display data the in the AngularJs Expressions is used,AngularJs support two-way data binding

Two-way data bind:

-Any changes to the view are immediately reflected in the model.
-Any changes in the model are propagated to the view.
-So it also called as MVC architecture.

[Image: Two_Way_Data_Binding.png]


Syntax and Example:
Code:
<script>
{{person.name}}
{{person.mobile}}
</script>


3.Controller:

-Model is lives inside in the Controller
-Controllers in AngularJS allow you to create an isolated scope and “control” data before it is passed to the view.
-In AngularJS, controller provide great control over view and model in order to fetch the data as per request and display in the view.
-Controller is a coordinator between the view and the model

Syntax and Example:


Code:
<script>
function Contact($scope){  //here Contact is your function name  
}
</script>



How to create Controller,Model,Initialize the AngularJS app

First initialize angular js module
Code:
var app = angular.module('applicationname', []);


Add app to controller
Code:
app.controller('controllername',function($scope){
});



Add model to function of controller
Code:
app.controller('controllername',function($scope){
//Model of controller
$scope.person={
'name':'ravi'
mobile':'123456789'
}
});



Full Code of AngularJS Model View Controller

Code:
    <!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>mvc</title>
<script src="../angular.min.js"></script>
<script type="text/javascript">
    var app=angular.module("myApp",[]);
    app.controller("myController",function($scope){
        $scope.person={
            'name':'ravi',
            'mobile':'123456789'
        }
    });
</script>
</head>
<body>
<p>Show Model data in View through Controller</p>
<div ng-controller="myController">
    Name:{{person.name}}
    <br>
    Mobileno:{{person.mobile}}
</div>
</body>
</html>
if any issue replay here 

Part 4- MVC AngularJS controller defined in another file

Print this item

  How to detect OTP automatically in android
Posted by: admin - 12-04-2017, 01:02 PM - Forum: Android - No Replies

OTP term:
                     A one-time password is a password that is valid for only one login session or transaction, on a computer system or other digital device.
                Now a days in android application are intelligent to detect mobile no stored on sim or detect OTP automatically  that are some advantages or some work for android application user. So programmer trying to detect OTP automatically in there android application.

Follow following simple steps to detect OTP automatically in android application.


Step 1: Create a android project named as MyOTPDetective

Step 2: In Android Manifest file add following Permission

   

Code:
<uses-permission android:name="android.permission.RECEIVE_SMS" />
   <uses-permission android:name="android.permission.READ_SMS" />
   <uses-permission android:name="android.permission.READ_PHONE_STATE"/>


Step 3: Now create a SMSBroadCastReceiver.java class and extends it with BroadcastReceiver and implements onReceive method inside it as follows.


Code:
public class SMSBroadCastReceiver extends BroadcastReceiver {
   @Override
   public void onReceive(Context context, Intent intent) {

   }
}



Step 4:Now add code for getting sms from bundle passed by SMS Intent  in SMSBroadCastReceiver.java as follows


Code:
public class SMSBroadCastReceiver extends BroadcastReceiver {
   @Override
   public void onReceive(Context context, Intent intent) {

       // Create a bundle object to get intent passed from SMS
       Bundle bundle = intent.getExtras();
       SmsMessage[] smsm = null;
       String sms_str ="";

       if (bundle != null)
       {
           // Get the SMS message from intent
           Object[] pdus = (Object[]) bundle.get("pdus");
           smsm = new SmsMessage[pdus.length];
           for (int i=0; i<smsm.length; i++){
               smsm[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
               sms_str += smsm[i].getMessageBody().toString();


               String Sender = smsm[i].getOriginatingAddress();
               //Sender Verification here
              
                   Intent smsIntent = new Intent("otp");
                   smsIntent.putExtra("message",sms_str);
                   LocalBroadcastManager.getInstance(context).sendBroadcast(smsIntent);
               

           }
       }
   }
}

Note: if you want to sender verification then just add following code this is not neccessary but if you want it you can modify code As following.

How to Test REST API in Android



Code:
//Sender Verification here
if(Sender.equals("sendernohere"))
{
  Intent smsIntent = new Intent("otp");
  smsIntent.putExtra("message",sms_str);
  LocalBroadcastManager.getInstance(context).sendBroadcast(smsIntent);
}





Step 5:Now Register broadcast receiver in android manifest inside <application> tag as following.

Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.ravisblogs.myotpdetective">
   <uses-permission android:name="android.permission.RECEIVE_SMS" />
   <uses-permission android:name="android.permission.READ_SMS" />
   <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

   <application
       android:allowBackup="true"
       android:icon="@mipmap/ic_launcher"
       android:label="@string/app_name"
       android:roundIcon="@mipmap/ic_launcher_round"
       android:supportsRtl="true"
       android:theme="@style/AppTheme">
       <activity android:name=".MainActivity">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />

               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
       <receiver android:name=".SMSBroadCastReceiver" >
           <intent-filter android:priority="999" >
               <action android:name="android.provider.Telephony.SMS_RECEIVED" />
           </intent-filter>
       </receiver>
   </application>

</manifest>

Step 6: Now in MainActivity.java  create BroadcastReceiver object and get message sent by SMS BroadcastReceiver

Code:
private BroadcastReceiver receiver = new BroadcastReceiver() {
       @Override
       public void onReceive(Context context, Intent intent) {
           if (intent.getAction().equalsIgnoreCase("otp")) {
               final String message = intent.getStringExtra("message");
               Toast.makeText(context, message, Toast.LENGTH_SHORT).show();

           }
       }
   };



Step 7: Now add some run time permission to read sms in MainActivity.java as follows:

Code:
private  boolean CheckSMSPermission() {
       int permissionSendMessage = ContextCompat.checkSelfPermission(this,
               Manifest.permission.SEND_SMS);
       int receiveSMS = ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS);
       int readSMS = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS);
       List<String> listPermissionsNeeded = new ArrayList<>();
       if (receiveSMS != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.RECEIVE_MMS);
       }
       if (readSMS != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.READ_SMS);
       }
       if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.SEND_SMS);
       }
       if (!listPermissionsNeeded.isEmpty()) {
           ActivityCompat.requestPermissions(this,
                   listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]),
                   REQUEST_ID_MULTIPLE_PERMISSIONS);
           return false;
       }
       return true;
   }


Note:
1. on  onResume() method  --> registerReceiver(This is used when application in OnResume() method means sms detected only when Application in OnResume() state )

2.on  onPause() method  --> unregisterReceiver(This will unregister sms broadcast recever means that your application in onPause() state the sms received in smsbox cant be detected by your android application)

Step 8: Full code of MainActivity.java as follows

Code:
public class MainActivity extends AppCompatActivity {
   public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       // now check here permission got or not
       if (CheckSMSPermission()) {
           // after got permission do main code here
       }




   }
   private BroadcastReceiver receiver = new BroadcastReceiver() {
       @Override
       public void onReceive(Context context, Intent intent) {
           if (intent.getAction().equalsIgnoreCase("otp")) {
               final String message = intent.getStringExtra("message");
               Toast.makeText(context, "SMS RECEIVED:"+message, Toast.LENGTH_SHORT).show();

           }
       }
   };
   private  boolean CheckSMSPermission() {
       int permissionSendMessage = ContextCompat.checkSelfPermission(this,
               Manifest.permission.SEND_SMS);
       int receiveSMS = ContextCompat.checkSelfPermission(this, Manifest.permission.RECEIVE_SMS);
       int readSMS = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_SMS);
       List<String> listPermissionsNeeded = new ArrayList<>();
       if (receiveSMS != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.RECEIVE_MMS);
       }
       if (readSMS != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.READ_SMS);
       }
       if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {
           listPermissionsNeeded.add(Manifest.permission.SEND_SMS);
       }
       if (!listPermissionsNeeded.isEmpty()) {
           ActivityCompat.requestPermissions(this,
                   listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]),
                   REQUEST_ID_MULTIPLE_PERMISSIONS);
           return false;
       }
       return true;
   }

   @Override
   public void onResume() {
       LocalBroadcastManager.getInstance(this).registerReceiver(receiver, new IntentFilter("otp"));
       super.onResume();
   }

   @Override
   public void onPause() {
       super.onPause();
       LocalBroadcastManager.getInstance(this).unregisterReceiver(receiver);
   }

}

OUTPUT:
[Image: 8tERSO2.png]


If Any Problem Found in above code replay me problem



How to Test REST API in Android

Print this item

  How to test REST API
Posted by: admin - 12-03-2017, 06:57 PM - Forum: Android - No Replies

well API is known as Application programming interface providing the content .Now a days in market there are many rest API tester or checker program available. From those I am here giving two topmost API checker.

1.Insomnia:

Download here

Features:


-Specify URL, payload, headers, and authorization all in one place. Then just hit send.
-Get all the details on every response. View status code, body, headers, cookies, and more!
-Create workspaces or folders, drag-and-drop requests, and easily import and export your data.

screenshot:

[Image: main.png]



2.Postman:

Download here

Features:

Postman is the most complete toolchain for API development

  • The most-used REST client worldwide

  • Designed from the ground up to support the API developer

  • Intuitive user interface to send requests, save responses, add tests, and create workflows


screenshot:

[Image: import-file.gif]

Print this item

  Part 2- AngularJS Installation
Posted by: admin - 12-02-2017, 06:24 PM - Forum: Angular Js - No Replies


Part 1-Introduction of AngularJS


For creating AngularJS program you first need text-editor to write down the angular js code 
you can use one of the following text editor  



Popular Text Editor

1.Brackets Here
2.Notepad ++ Here
3.Sublime Text Editor Here
4.Or any on you prefrence

Here I am using windows 10 os and  Smile sublime text editor Smile  to write down the AngularJS code


After Choosing the text-editor now download the AngularJs file from AngularJS official website

-Visit AngularJS Here.
-Click on Download AngularJS.
-Now in Build click on Uncompressed  and download angular.min.js file to your local system.
-Create a folder name as AngularJs and put that downloaded file inside it.
-Now create a simple html file and add reference of angularJS file inside that html file as follow.

Code:
<!DOCTYPE html>
<html>
<head>
<title>Angular Js Installation</title>
<script src="js/angular.min.js"></script>
</head>
<body>
<p>Hello Angular Bro</p>

</body>
</html>


Now finally we installed angularJs and referenced angularJS.min.js file in html



Part 1-Introduction of AngularJS

Print this item

  Part 1- Introduction of AngularJS
Posted by: admin - 12-02-2017, 05:59 PM - Forum: Angular Js - No Replies

[Image: JHiQslK.png]

Hello friends today  i am teaching you basic introduction about AngularJS

What is AngularJS?

AngularJS is a JavaScript-based open-source front-end web application framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications. AngularJS version 1.0 was released in 2012.



Before to start learn AngularJS we assume that you alredy know the following languages

1. HTML (Hyper TextMarkup Language)
2. JS (JavaScript)
3. CSS (Cascading Style Sheets)


 AngularJS is very popular powerfull web application framework maintained by Google.



Why do we need AngularJS?

-AngularJS provide mvc architecture
-write less code
-flexibility with codes
-unit testing ready

Print this item

  What is the output of following code
Posted by: Ravishankar Chavare - 11-30-2017, 08:50 AM - Forum: C - No Replies

What will be output of following programs
[Image: IMG_20171130_WA0002.jpg]

Answer:
On line 4 of main program evaluation of right side will be done because of "=" operator. So right side as there are only logic operators RHS will be evaluated from Left to right

So from left side "||" comes first and therefore (++x) value is checked to be true/false value
And as we know ++x is a truthy value, further condition is not checked

So ++y && ++z is not executed

Finally z value = 1
x value is incremented by 1 (because of ++x)
And y value is 1 due to initial declaration

So ans = 2,1,1?
If you don't get this, pm me, i will help further.

Print this item

  WhatsApp group for PHP Programming
Posted by: admin - 11-30-2017, 05:13 AM - Forum: Php - No Replies

[Image: NzOrFC-PcXva2setA0BU2cceQZyLUX0JgCcW3iv1...22-h282-nc]

Hello friends today we have created a WhatsApp group for PHP learning join following group


JOIN PHP GROUP HERE

Rules
-only discuss PHP related questions and answers
-spammers don't allowed here

Print this item

  How to create a unique key using php
Posted by: admin - 11-29-2017, 04:12 PM - Forum: Php - No Replies

Hello friends every web application or android app has user registration function we provide username and password for user verification with this verification we can easily add a simple unique token.
Today i am teaching you to how to create a unique token using php 

create following files

 token.php

PHP Code:
<?php
   function crypto_rand_secure
($min$max)
{
    $range $max $min;
    if ($range 1) return $min// not so random...
    $log ceil(log($range2));
    $bytes = (int) ($log 8) + 1// length in bytes
    $bits = (int) $log 1// length in bits
    $filter = (int) (<< $bits) - 1// set all lower bits to 1
    do {
        $rnd hexdec(bin2hex(openssl_random_pseudo_bytes($bytes)));
        $rnd $rnd $filter// discard irrelevant bits
    } while ($rnd $range);
    return $min $rnd;
}

function 
getToken($length)
{
    $token "";
    $codeAlphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $codeAlphabet.= "abcdefghijklmnopqrstuvwxyz";
    $codeAlphabet.= "0123456789";
    $max strlen($codeAlphabet); // edited

    for ($i=0$i $length$i++) {
        $token .= $codeAlphabet[crypto_rand_secure(0$max-1)];
    }

    return $token;
}

?>

in which file do you want to create token add following code
PHP Code:
include "token.php";
 
$uniquetoken=md5(getToken(20));

echo 
$uniquetoken


Note:If you want to create 15digit token key just replace 20 in getToken with your 15

Print this item

  can u guys help me to write a program and print this 1 121 12321 1234321
Posted by: admin - 11-29-2017, 12:43 PM - Forum: C - No Replies

can u guys help me to write a program and print this in c programs
1
121
12321
1234321

Print this item