Showing posts with label The Tutor. Show all posts
Showing posts with label The Tutor. Show all posts

Saturday, December 20, 2014

Running the webapp2 framework on Heroku

What is Heroku?

Heroku is a cloud platform that helps in developing and deploying apps written in several programming languages. What I like in Heroku is that it creates a Virtual Environment for every app you publish. So, you can have your own packages and frameworks from the language of your choice. 

What is webapp2?

webapp2 is a lightweight web development framework for Python by Google. It is one of the easiest frameworks to work with in Python. In fact, I started by journey of web development by learning this framework via the Google App Engine

Lets begin!

1) Set up Heroku on your system

I am not going to write much about this, as Heroku has given an awesome Getting Started tutorial for Python here. Follow that link and you will get the basics of the platform and be up and running with a Hello World application in Heroku in about 15 minutes. Yes, just 15 minutes. The tutorial will also talk about something called a Procfile, its a very important part of this project so, just have an idea about what it exactly does. I highly recommend you to follow that tutorial now, if you are new to Heroku. This tutorial follows a unix shell command line interface. 

2) Now, comes the fun part

By this time, you must have installed the Heroku tool belt. 
  1. Create a new folder called hellowebapp. This will be the project folder. All files must reside here.
  2. Now login to heroku.
    $ heroku login
  3. cd to the project directory
    $ cd hellowebapp
  4. Create a virtual environment. If you don't know what this is, follow this link.
    $ virtualenv venv
  5. Activate the virtual environment
  6. $ source venv/bin/activate
  7. Install WebOp, Paste and webapp2 using python's setup tools. We are going to use pip for this tutorial.
  8. $ pip install WebOp
    $ pip install Paste
    $ pip install webapp2
    
  9. Now, create a python file which defines your app. For the sake of the tutorial, we are going to run a simple hello world! example.:
    import webapp2
    
    class HelloWebapp2(webapp2.RequestHandler):
        def get(self):
            self.response.write('Hello, webapp2!')
    
    app = webapp2.WSGIApplication([
        ('/', HelloWebapp2),
    ], debug=True)
    
    def main():
        from paste import httpserver
        httpserver.serve(app, host='127.0.0.1', port='8080')
    
    if __name__ == '__main__':
        main()
    
  10. Create a file called Procfile.txt
    touch Procfile.txt
    nano Procfile.txt
    
  11. Add the following contents to that file and Save it
    web: gunicorn hello:app --log-file=-
  12. Test your app, locally. After the execution of this command, the app will mostly run at http://localhost:5000
    $ foreman start
  13. Copy the list of packages to a file called requirements.txt so that when you deploy, the web server installs the packages automatically. The pip freeze command will come to help.
    $ pip freeze > requirements.txt
  14. Create a git repository and save changes
  15. $ git init
    $ git add .
    $ git commit -m "First!"
    
  16. Create a Heroku app
    $ heroku create
  17. Push contents to cloud
    $ git push heroku master
  18. Lets just run one dyano of the app
     heroku ps:scale web=1 
Ta-da! Your webapp2 powered app is now running on heroku! Now start exploring the framework and continue with the work. Any problems? Just comment below. I will reply asap. If you have problems in setting up Heroku, you can ask that too.

Happy web developing!

Friday, June 28, 2013

How to set your Laptop up as a WiFi range extender?

Cost of project: around Rs. 800 ($13.3 approx)
Materials Required: A WiFi Adapter: Click here to buy one. << My Suggestion. You can get more by searching. I will be using the same throughout the tutorial.
Operating System: Windows 7/8


Lets extend the WiFi range of our router so that other devices receive a proper connection through our laptop.

 Step 1: Install MyPublicWiFi

Download and Install MyPublicWifi from this website: http://www.mypublicwifi.com/publicwifi/en/index.html
Yes, you will HAVE TO restart your computer after installation completes

Step 2: Connect your Wifi Adapter

Let the drivers install themselves, it might take time depending upon availability of updates, computer config, and may be internet speed.

Step 3: Start MyPublicWiFi in Administrator mode


You have to choose a network name and password. And in the Enable Internet Sharing dropdown menu, select the network you want to share. In this case, choose the WiFi connection which is made to the main router connected to internet.

Then hit Set Up and Start Hotspot.
On your device, connect to the network which is named by you in connectify.
Thats done! You have extended WiFi range for other devices to connect!

Check out more tutorials @ The Tutor
Got any problems or questions setting up? Ask me here on this link!



Wednesday, June 26, 2013

Make yourself secure online: Password Techniques and more..

So, basically to make your house secure, you need well, may be a gun, a security locker for valuable stuff and lots more. When you are on the internet, the only thing you can have is a password. And well, following some guidelines that can help you not getting into trouble and becoming a victim of a cyber crime. Well, you might as not well lose your life, but you know dignity and money are on the line.

Keyloggers:

Place of use: Cyber Cafe
Well, you might think these are outdated and old fashioned, but there are places where keyloggers are used. What keylogger does is that it logs all the keypresses and with a advanced software running in the background, passwords can be known to the person who installed it. Always check for such a thing, this is cuz no law forbids their use.
Solution: Get out of the place if you find something like this

Ctrl+Shift+Delete:

Place of use: All public computers
Always remember to clear all your data, ALL OF IT when work on a public computer is done. Sometimes, logging out does not only do the job. Here how you see the clear browsing data option:
Using Incognito Mode on computers is also an option, but if you even accidently close the windows, all your logins will go. Though more secure, it can sometimes make work complicated. Also change the "Obliterate the following items from" option to your desired one. My choice: "the past day".

Choose a secure password:

Problem: Mostly, passwords on websites are first hashed and then stored on the computer. A specific string(group of characters) has always the same hash code. For example, if your password is "securepassword", and someone else's password is also "securepassword", the same hash will be stored as passwords for your user ID. Hash code is basically conversion of normal English language to a complicated code(of base 16,32 or whatever).
Solution: Choose a password as unique as possible. Don't use phrases like 'iloveyou', 'thisismypassword', 'pass123', etc. etc. Think of something completely unique and then store your password.

If security cracking algorithms are run, the longer your password is more time it will take to finally reveal your password. Use of multi words password is more secure than using single word. Its always better to do so. In fact, using the password 'my password is one that is secret' is more secure than '!@JN#$%J(&%HJDDS'. 

Always devise algorithms to remember your passwords by yourself. This algorithm should also be a secret. I advise to do this because using a secure password algorithm, will help you remember them easily. Algorithm is basically a step by step guide that you remember to store your passwords in your brain.

Check if the website's security is certified:

Any website, just about any website unless the one you trust wholeheartedly, always check for a security certificate. How to do so?
Follow this:
If no verification, just don't submit it at all..

Well, did I miss something, comment it!
Do let me know view on this article, comment!
Ask me something! Ask me tech
Check more on The Tutor

Saturday, June 22, 2013

Bringing all your clouds together: Facebook, Drive, Box, Dropbox and more!

Well, Dropbox provides you 2GB, Box 5GB, Google Drive 5Gb, SkyDrive 5GB, Youtube is where you upload all your videos, Evernote is where you take notes. All these are located in different web addresses and you obviously need several tabs. And there is nothing unifying all these things under one roof and you need to keep switching tabs everytime.
What if all these services that we use regularly come under one hood! Well, Jolidrive does that work. In this tutorial, I will show you how you can set up a Jolidrive account and bring all your clouds together!

Now, the following is a step by step guide on how to connect all your cloud services using Jolidrive, a product of Jolicloud.
Step 1: In the website of Jolidrive, click the method by which you wanna Login. For this purpose, I chose Signing in with Google, as I wanna connect just about my entire world. You can also choose Facebook

In this Step, I chose to select all the Service I can use of Google's, but you can customize them for your own needs/

Buiding your Jolidrive


Add different Phot sharing websites. Just click on the app icon, log in to your provider and authorize Jolidrive to access your photos. Similarly, add Music and Video sharing websites as shown in the pic below



Finally keep adding your services Soundcloud, Mediafire, and whatever else you own and wanna bring it under your hood and on your Jolidrive!

Lets Go! Happy Clouding: Jolidrive

Hear more from The Tutor! Click here

Thursday, June 20, 2013

Set up the best web development environment - Netbeans + Apache + PHP + MySQL + jQuery and lots more!


Well, PHP, MySQL, jQuery - the three most essential tools we need to create the next gen websites or develop interactive content in the world of HTML5.
jQuery will run client side, but PHP and MySQL require server side programming. Hence we need to set up a similar environment on PC, and also we need something to code our thoughts and ideas using our knowledge. Netbeans is one of the best IDE(Integrated Development Environment) that can let you do this with much ease, and basically its free. Everything that you will need to complete this tutorial will be free.

Step 1: Set up a server

There are various apps that let you create an Apache+PHP+MySQL environment of your Windows PC. My favorites are:
Software Download Link Extra notes
Zend Server Click here More secure, High level server administration, might not have the latest version of PHP, MySQL and other modules
EasyPHP Click here Less Secure, Easy administration and installation of modules. Fast updates to PHP and MySQL << Recommended 
WampServer Click here Less secure,option to convert to web server, might not have the latest version of technologies(Apache, PHP, MySQL)

Well, just install these apps like you install any other Windows Software and your server will be up and running in no time.
This was easy, wasn't it?
Now comes the coding part..

Step 2: Install Netbeans

Why Netbeans?
Well, its fully featured, easy to use and has support for lots of languages and is FREE! You will also need JDK(Java SE) latest version. Here is the link.

Step 3: To create projects using NetBeans

Well, creating projects is easy. Now what you need is a simple selection to make when you are kick starting your development. In the New Project Wizard, choose PHP>PHP Application.

If you are creating a PHP project for the first time, Netbeans will take few seconds to activate the PHP Module.
 When you are in this screen when going through the New Project wizard, make sure you check the box copy files to a folder option as mentioned below. 
Now, select the path according to the location of your public www folder(also called document root). If you have downloaded any of the above softwares that I have mentioned, here is a guide to those folders:
ZendServer - <path to Zend Server installation directory>\Apache2.2\htdocs
EasyPHP - <path to EasyPHP installation directory>\data\localweb
WampServer - <path to WampServer installation directory>\www

Thats it! You are done!

Additional Notes:

  1. I prefer EasyPHP as they have latest technologies, so less or no bugs will be encountered when developing.
  2. Do set up root password for your MySQL databases. This makes your server quite secure, in case you decide to make the same server live.
  3. Copy the jQuery script into the folder where you can use it properly. For less amount of code, I prefer to save the .js file into the same directory as the main web page is.
  4. It is always better to choose a proper web host, rather than hosting the scripts yourself. Sure this is a DIY package for creating a web server, but its not secure enough.
  5. WAMPServer comes with phpMyAdmin by default, to access it use localhost\phpmyadmin. For ZendServer and EasyPHP you will have to install the modules.For tutorial on Zend Server, visit this link and for EasyPHP, just activate the phpMyAdmin module in the server administration GUI.
Now that you have set up a complete web Development server, how about kickstarting to learn web development? Check out one of the best books I recommend for beginners to start learning web development by clicking here!

Saturday, June 8, 2013

How to take screenshot on your mobile device?

Here's how to take screen shot on any mobile operating system if you can't find a Take Screenshot button on the screen or don't want to install any kind of app to do the same.

Android phone (Android 4.0+):
Method: Power button + volume down button (or) Power button + Home Button
Screenshot location: Mostly camera shots, you can find them in Gallery.

iPhone/iPad (iOS):
Method: Power button + Home button
Screenshot location: Camera roll

Windows Phone: 
Method: Power button + Windows key
Screenshot location: Screenshots album in Gallery

If they don't work, comment, I will help you out. More operating systems? Suggest me, you know the comment section is already a lonely place...

Thursday, June 6, 2013

Install apps to Windows Phone from SD card

I know that there has been a method given on the Microsoft Windows Phone website about how to install apps in XAP formats from SD Card to your phone. Just keep these things in mind:
1) NO, you will NOT get the full version of paid apps via XAP, you will have to download it frmo the store on the phone. Even if you find XAPs on other website claiming it to be full version, it will not work.
2) If your XAP apps are not being displayed on the store, or the SD Card option is missing on the apps, restart your phone, wait for a while(2-5 minutes) and then start Marketplace app. This problem occurs in mid end phones like Nokia Lumia 620, or lower end phones.

To install apps from SD Card, follow the tutorial given on windows phone store here.

Why this method:
1) The Windows Phone Store downloads are very unstable on phones, so downloading them on PC is much more faster and less head ache giving method.
2) Saves data costs, duh! Everybody loves saving money, so do it this way too.

Thursday, June 21, 2012

Getting Android to match the iOS

So, you think iOS is smart, well Android can be smarter. But for now, I am just going to share a few ways to  get your android on-level-terms with the iOS device. Though these apps might be available on iOS also, but that's exactly my point :D
The apps I am going to tell you are absolutely free.


  • Security: AVG Free + Smart App Lock
  • Offline reading: Pocket it
  • Social Gaming: There are now tons of games which come with Scoreloop and Openfient. These two frameworks add a lot of social features to your games. You don't need to download any additional app, the features are inbuilt and well connected game-to-game
  • 3D Maps are now up on Google Maps
  • Browser tab syncing is on the Google Chrome mobile browser, and also on Firefox
  • Your contacts are well synced with Google Accounts, but if you want more, Netqin Contacts Backup
  • Voice assistant: SpeakToIt and Google Voice which is in built in most phones. Else, download it from this link
  • Find my phone service: Where's My Droid
  • Wireless Cloud Backup: Google Drive
  • Note making and Taking: Evernote
  • News: and Magazine: Pressreader and Zinio
Anything more you need?