Learn Android for Free,issues for developers, mobengineers website provide complete solutions for developers issues posts.It also provides online training for android development

Wednesday, August 31, 2016

Api gateway - Api key- 403- "message": "Forbidden"

Aws api gateway with api giving the following error
 {"message": "Forbidden"} 
I am working with aws api gateway with nodejs as server. I defined my api using swagger yaml and  deployed to aws api gateway.

Next step is to implement authentication to the api.

Api gateway itself providing authentication mechanism.
Using api key to authenticate the request.

if API keys are enabled, you can set the x-api-key:{api_key} name/value pair here

If the api key is enabled for the api method, then you can set x-api-key: {api_key}  name/value pair in the header.

I used swgger ui and set the api key, but didnt work.
I resolved after few hours struggling.
Change frpm window.swaggerUi.api.clientAuthorizations.add( "bearer", apiKeyAuth ); with window.swaggerUi.api.clientAuthorizations.add( "jsonWebToken", apiKeyAuth );

The name you will assign to the ApiKeyAuthorization from client need to match the name you give the security scheme under swagger definitions.

Tuesday, August 23, 2016

Oracle database vs MongoDB

Oracle Database:

Oracle uses structured query language for database access.It will store data in tables.
It follows predefined schema and set up rules to govern the relationships.

MongoDB Database:

MongoDB stores data as JSON format. All the related information is stored together for faster data access.
At any time, you can change the structure of records by adding new fields.
It is a database which designed for big data storage and query.
It can gain its performance mainly by key value based design and easy to scale out
To achieve the performance and scalability, MongoDB ditches the transaction support.
We cannot use for transaction related applications like Payment gateway etc.

Both Oracle and MongoDB have a rich query language.
MongoDB is not meant to replace the relational databases.It simply fullfills the different needs.

Monday, August 8, 2016

QR Code Maximum payload/data

 Maximum data qr code can store depends on the following factors.Data type,Number of pixels and error correction level.

 Numeric only - Maximum 7,089 characters (0,1,2...9)

 Alpha Numeric - Maximum 4,296 characters (0–9, A–Z [upper-case only], space, $, %, *, +, -, ., /, :)

 Binary/byte   - Maximum 2,953 characters.

Tuesday, August 2, 2016

Operators in Swift

An Operator a special symbol that tells the compiler to perform mathematical or logical operations.

Assignment Operator:

The assignment operator (a=b) initailizes or updates the vlaue of a with a vlue of b.

let b = 12
var a = 10
a = b  // a is now 12

Arithmetic Operators :

Swift supports 4 arithmetic operators.


Remainder Operator :

9 % 4 = 1

5 % 1.5 = 0.5

Comparison Operator :

Equal to (a == b)
Not equal to (a != b)
Greater than (a > b)
less than (a < b)   .................etc

Ternary Conditional Operator :

Ternary conditional operator is a special operator with 3 parts.

question ? answer 1 : answer 2

if question {
answer 1
} else {

if question is true, it evaluates answer 1, otherwise, it evaluates answer 2.

Range Operators:

Closed Range Operator:

The closed range operator (a...b) defines a range from a to b,incluses vlues a and b.


  for index in 1...6 {
  print("\(index) times 6 is \(index * 5)")
  // 1 times 5 is 5
  // 2 times 5 is 10
  // 3 times 5 is 15
  // 4 times 5 is 20
  // 5 times 5 is 25
  Half- Open range operator :
  The half open range operator (a..<b) defines a range from a to b, but does not include b.

let countrynames = ["India","Malaysia","USA","Singapore","Thailand"]

 let count =  countrynames.count

 for i in 0..<count {
print("Country \(i+1) is called \(countrynames[i])")
// Country 1 is called India
// Country 2 is called Malaysia
//// Country 5 is called Thailand

Logical Operators :
Logical operators are similar to c, java languages.
Logical NOT (!a)
Logical AND (a && b)

Logical OR (a || b)

Swift Basics

Swift is an Open Source, powerful language for mac OS, iOS.
Swift 3 is the major release developed at Swift.org.

Declaring Constants :

let maximumMembers = 5
var minimumMembers = 2
let pi = 3.1416

Type Annotations :

var username: String
username = "Srinivas Nidadavolu"
println(username) // prints Srinivas Nidadavolu

Constant value cannot be changed.

var username = "SRINIVAS NIDADAVOLU"
username = "KARUNA" // compile time error - username cannot be changed

Comments :

Comments in swift is similar to other programming languages like java, javascipt and c etc.

// for comment

/* this is also a comment*/

Swift doesnt need a semicolon (;) after every statement. Its optional. If your using multiple statements in the same line, then its required.

Data Types :

32 Bit and 64 bit platforms :

32 bit platform:

Int is Int32
UInt is UInt32

64 bit platform:

Int is Int64
UInt is UInt64


let userActive = true

if userActive{
println("user is active")
println("user is inactive")

Swift handles the absence value with Optionals.

var userStr = String? = nil

import Cocoa

var userStr : String?=nil

if  userStr!=nil {
println("It contains nil")


20% off

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

NDTV Gadgets360

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts