ad

Wednesday, 13 January 2016

How to get a domain name almost for free

Get discount on domain names

Web developers often create website for themselves when starting up a new project, it can be pretty expensive if you're working on projects one after another and buying new domain names. One of the way to get a cheap domain names is to find and test best coupon for maximum discount.

It's not always that easy to search web and find best promotional codes. More often than not it's a complete waste of time.

JoinHoney is a free plugin that finds and gives the best coupon code that you can use withing a few seconds. Say you're using godaddy for new domain, just choose whatever domain name you'd like and open the basket. It will show you the total, form there you can either add a promotional code or proceed to checkout. Now click on JoinHoney icon on top right of screen and click 'Try Codes'. Once that's done you should get the best working coupon for discount. Just apply the coupon and discount will be applied.

Click on 'Add' to add a promotional code/coupon.
godaddy promotional code

Tuesday, 12 January 2016

How to install a program on Linux VPS

Install third party program on VPS

Installing programs on linux really isn't a big deal, just like windows OS if you understand Linux it's a piece of cake, don't let linux command line Shell intimidate you!

Here's basic steps you would need to follow to install a software on linux VPS.
- Login to your server using Putty. It's a software for windows that gives you access to Shell. Shell's is just a command line for linux where you can execute commands, except it encrypted all the data.

 - You can find your login info in hositing access panel.

- Next download PSCP, Putty Secure Copy. It's a file transfer software.

- SET environment variable so PSCP can be called from command line. Read how to set environemnt variable http://www.computerhope.com/issues/ch000549.htm

- Now run just run pscp.exe PATH_WHERE_FILE_IS_IN_YOUR_PC LINUX_USERNAME@HOSTNAME WHERE_SAVE_ON_LINUX
Ex.  pscp.exe c:\files\file.exe webdevtown@my-ipaddress:/home/webdevtown

From here you should follow Author's instructions. You might be required to install java or extract file and run make file command etc..

Thursday, 7 January 2016

OAuth Explained with real world example

OAuth's an authorization standard to access user information from a website that user is member on, without the need to know that user's password.


Problem
Imagine your friend comes up with a website where users post their pictures so others can rate them. He wants users to be able to get all their Facebook picture so they can be processed and uploaded onto his server or linked on his website for others to rate.

Facebook API allows website like this to have access to LIMITED information about user that he/she has granted, but due obvious security reasons facebook cannot allow everyone to access anyone's information. This information's only accessable when user himself grants you access to it.

To get access to user information you would need access to particular facebook API code to which you've been granted access.

Here's a general flow.
1. Your server/client application communicates with OAuth endpoint to make sure you're who you say you are. During this process your client id is being checked. If same client is used on different website google will throw an error. This process doesn't require any action from user side.

2. You send user to authorization page where user allows or denys permission you're asking for. If user allows it, you're sent back to redirect uri with 'Authorization code'.

3. 'Authorization code' now can used to get an 'access token' that you can exchange with server to get user info. Auth code is not sent alone, it's sent along with your secret ID, scope(info you want access to) and redirect URI..

4. Now if you asked user to give permission to access their pictures in step 2. You can use 'access token' to get their pictures and use them on your website for users to rate.

Wednesday, 6 January 2016

How to add google map to website

Embed Google Map to your website

Google map's something that business websites must always have. It's much more convinenent for users to look at map and find where you're located than to get the address, copy paste in google maps and try figuring out if it's the right place. All this is a hassle, if a customer likes your product, there's chances that'd want to visit your place. Don't forget the fact not everyone knows about google maps, or how to check address on online maps.

We're going to use 'Google Maps Embed API' to create a map follow these steps:
1. Get your key for google Maps API. To get the key create a new Google Developer project and follow the instructions. When done you should get the Api key. Copy that.
Developer console https://console.developers.google.com/

2. Visit map building area and choose and fill necessary information
https://developers.google.com/maps/documentation/embed/start

3. When done click on 'Looks good', enter your API key and press 'Okay.

3. Google then will give you some HTML code that you'd paste into your website.
google maps







4. Copy paste the code in to your website and you should have your own map on your website

Monday, 4 January 2016

Check the Apps that have access to your information and revoke access

Revoke access to app

Just a quick little info about websites storing your details. OAuth gives web developer access token that can be used to access your information that you granted access to when trying to access an app online, sometimes you want to revoke the access as you no longer use their service. Note that you're just revoke that app access, usually developers store all your information in DB on your first login.

To check who you're sharing info with:
1. Go to https://myaccount.google.com/

2. In 'Sign in & Security' Tab click 'Connected apps & sites'


3. Under the 'Apps connected to your account' section click on 'Manage apps'.


4. Now you can click on any app and revoke the access. When you click it will also show you the stuff that the app can do on your behalf.

For example, here fiverr app has access to:
-My basic account info
- Age
- Language
- List of people from circle
- Basic profile info

Sunday, 3 January 2016

Decision making if/else in batch programming

Decision making's very important in any programming, not just batch. It allows your program to decide what to do. Here we're going to create a small program where it asks user for password and allows of denies access depending on whether password's right or not.

Here's if statement structure in batch
if CONDITION (
    do this
) else (
   do this
)

To compare two numbers we use double equal signs '=='. Lets ask our program if 1 is equal to 2.
if 1 == 2 (
   echo 1 is equal to 2
) else (
   echo 1 is not equal to 2
)

It returns whatever we put in else because 1 is obviously not equal to 2.

Here's our complete script where
1. Turn command display off
2. Get user input and store it in password variable
3. Use if/else statement you just learned. It will only allow access if password is 'webdevtown', anything else it wil echo 'access denied'.
4. Pause so program doesn't exit.

@echo off
SET /p name="Please enter password "
if %name%==webdevtown (
  echo Access granted
) else (
  echo Access deinied
)
pause


access denied



How to get user input in batch

Get user input 

You'll often need to get some soft of input from user that you can process and perhaps return some data back to user.

To syntax to get user input is 'SET /p yourName=[PROMPT MESSAGE]'
Type that in CMD and press enter, then type your name in and press enter again. Now as you'd expect, your name's been stored in 'yourName' vairable, now you can retrieve it.

To see that name user enter. echo the variable 'yourName', note that variable name must between % percent sign, like %variableName%.

Alright, lets ask user for his name and tell him nice to meet you with his name at the end.
Here's how we'd go about it.
1. First off lets disable commands from appearing on screen using command '@alerts off'
2. Prompt user to enter his name using 'SET /p yourName="Enter your username "'. The reason I've surrounded Enter your name with double quote is to add little bit of space after 'username' to when user enter his name there's space between 'username' and his name.
3. Write back to user 'Nice to meet you HIS NAME' by calling the variable 'yourName'
4. Pause so it doesn't exit

@echo off
SET /p name="Please enter your name "
echo Nice to meet you %name%
pause


command prompt