Using Sinatra: Building a Web Application (part ll)

Hi There! in the previous article you learned about setting up Sinatra and HTTP request methods.In this article we will use the things that we learned to build a web app. I’ve changed my mind about “Scissor ,Paper ,Rock ” game.We’ll now be encrypting and decrypting a key using my algorithm and will learn the basic of ERB.

What’s ERB ?

Embedded Ruby is a templating system that embeds Ruby into a text document. It is often used to embed Ruby code in an HTML document, similar to ASP, JSP and PHP.”So we’ll be embeding our code on a HTML Page.

ERB Syntax :

The key concept of ERB is simple: it allows you to write HTML with bits of Ruby code interspersed with regular HTML. Before the template is sent back to the user, it’s compiled. This means that any Ruby code in the template is executed, and all we’re left with is regular HTML.


like this:

<h1>Today's date is <%= Time.now %> </h1>


The ruby codes are written “<% here %>”.

Some more examples:

<% 5.times do %>
<h1>Today's date is
<%= Time.now %> </h1>
<% end %>


So lets get started.
 Before we proceed,lets have a look at the Directory Structure of the project.


i) PROJECT_DIR/view − The views subdirectory holds the display templates to fill in with data from our application, convert to HTML, and return to the user’s browser.
ii)PROJECT_DIR/app.rb – This is where we be writing codes and handing HTTP requests.

Work Flow:

 So the app.rb will be handling the request and displaying the erb files as per the requests.

The Idea of the Algorithm :

–  I have three arrays (@@key1 ,@@key2,@@key3) and an array of alphabets   ‘@@letters’.

 For Cipher :
-Take input as String.

– I generate random numbers between 0 and 2, suppose if n comes then I choose the @@key[n] array and  then I pull out the index of all the alphabets of input by comparing it  with @@letters array and then further I  compare it with @@key array replace the elements of the input.

 


def encode(key) #method for encoding

req_key=key.downcase.split("") #converting into downcase and spliting
key_val=rand(1..3) #generating random numbers
gen_key=Array.new #creating an array to hold the index

i=0
    if key_val==1              #if generated random numbers=1,
while i<req_key.length
gen_key.push(@@letters.index(req_key[i])) #pushing index by comparing with @@letters
i+=1
end

s=match(gen_key,@@key1) #matching and replacing the elements with @@key array

elsif key_val==2 #if generated random numbers=1 
              while i<req_key.length
gen_key.push(@@letters.index(req_key[i]))
i+=1
end
s=match(gen_key,@@key2)

elsif key_val==3
while i<req_key.length
gen_key.push(@@letters.index(req_key[i]))
i+=1
end
s=match(gen_key,@@key3)
end


@final_key="#{@@letters[key_val-1]}#{s}"
return @final_key
end

 – Everytime I want to cipher my text ,different output will be produced.
 – The Decipher key is the random number generated,I’ll use that to know which array elements replaced the text. 

For Decipher :
–  We Will take the input as String
–  Suppose the generate output after cipher was “bwbjqomiain”(10+1key)
–  We will split the “bwbjqomiain” and slice out the first alphabet which is “b”.
–  Now we will find the index of “b” in @@letters array,so its 2.Which means that the
 @@array2 elements were used to replaced the text,so we will compare the index of the input with @@array2 and push the index in an array which we further compare with the @@letters array to get the result.

def decode(key)
du=key.split()
first=key.slice du[0]
su=key.sub(du[0],)
ary=su.split()
hold=Array.new
ne=Array.new
i=0
j=1
while i<ary.length && j<ary.length
ne.push(#{ary[i]}#{ary[j]})
i+=2
j+=2
end
i=0
if first==a
while i<ne.length
hold.push(@@key1.index(ne[i]))
i+=1
end
#s=match(gen_key,@@key1)
elsif first==b
while i<ne.length
hold.push(@@key2.index(ne[i]))
i+=1
end
elsif first==c
while i<ne.length
hold.push(@@key3.index(ne[i]))
i+=1
end
end
@deci= match(hold,@@letters)
return @deci
end

Handling the HTTP Request:
The request will be made by the POST method,to handle
Type:

get / do
erb:form     #throws erb when we visit localhost

end
 Writing ERB:

 Type the following in your “views/form.erb”

<html>
<body>
<h1><center> Welcome to <i>MyCipher</i> </center></h1>
<ul>
<ul>1.Do not put any space b/w text</ul>
<ul>2.The output will be in small letters</ul>
<ul>
<p> <ul>Your Input</ul>
<p>
<form method=post action=/function>
Select: <input type=text name=name>
<ul>
<p>
<ul> <input type=submit name=s1 value=Cipher Text> </input></ul>
<p>
<ul> <input type=submit name=s2 value=Decipher Text> </input></ul>
</ul>
</form>
<p>
<h3><font color=blue>The Result </h3><p>
<h2><font color=red> <%= @final_key%></h2>

<h2><font color=red> <%= @deci%></h2> 

The User Interface would look like this:

Handling the Form :

Type following in your app.rb file :

post /function do
ci=params[:s1].to_s
di=params[:s2].to_s
val=params[:name].to_s
if ci!=
encode(val)
else
decode(val)
end
erb:app

end

Voila ! Its Completed ,now its time to test it.Here is the screenshot of the working model:

Giving Input for cipher:

 
 The Resulted cipher:

The Output of Decipher:

Here’s the link to the download  code . 

Special thanks to Rajat Srivastav for creating the sketch .
Take Care,Aloha!

Debug django webapps like react native

Debug django webapps like react native

Introduction

Most websites/webapps are now mobile first. Internet browsers these days all have the mobile view that lets you see how the app looks on your phones. But this is not enough to judge the full mobile experience. So, it is better to debug it on an actual phone. To do this, we should either host the app on a server and open the URL on your phone. Or you can locally host it on your WiFi network.

What happens in react native

React native is a framework of javascript that allows you to build native mobile applications. Debugging in it is made beautifully. A server is started, this prints a QR code on the terminal itself. This QR code is then scanned through an app called Expo. This app automatically installs the app on your phone and runs it. This is the most convenient way I have ever done debugging.

What happens in Django

In Django, you have to run an HTTP server locally and either debug on your browser or connect your phone on the same network and access it on your phone through the IP address of your computer. This is a little troublesome. In the new method, we will essentially be doing the same thing. But most of the process will be automated.

Steps to follow

Extracting the IP address
  1. ‘ifconfig’ (‘ipconfig’ on windows) will give you all the IP addresses of the computer.
  2. We need to write a script to parse the output of ifconfig. We can use a function called check_output(), which is a part of the package ‘subprocess’.
  3. Now we can parse the IP address using string functions or regular expressions and make a list of available IP addresses.
Generating QR code on the terminal
  1. Now we will make a prompt on the terminal to choose the network where you want to host the app.
  2. Once the network is chosen, we can prepare the URL by putting the IP address in ‘http://IP:port/’ format.
  3. Now, we have the URL of the web app. We just need to generate a QR code and print it on the terminal.
  4. The QR code can be generated and printed with literally 2 lines of code.
    url = pyqrcode.create(“http://IP:port/”)
    print url.terminal(quiet_zone=1)
  5. Run this script and you will see that the QR code will be printed on the terminal.
Enjoy debugging
  1. Once the QR code is printed on the terminal, it can be scanned by a QR code scanner on your phone. This will open the web app in your browser.
  2. For a more app-like experience, you can make a simple android app with a built-in QR code scanner which opens the URL in a webview.

Now you can debug web apps a little more easily. Hope this method makes your life a bit easier.

Using Sinatra :A Web App Development Library(Part l)

Ruby is blessed with several web application frameworks such as Ruby on Rails, Merb, Nitro,  Camping and Sinatra.Many of us might have heard about Ruby on Rails ,In simple words, Sinatra is an alternative to it and the other frameworks mentioned above.Sinatra was designed and developed by Blake Mizerany in 2007 and named after musician Frank Sinatra.

In this article we’ll learn about :
i.   Installing and Setting up Sinatra
ii.  Handling the HTTP Request

Prerequisites:  One Must Know Ruby to proceed further.

So let’s begin :

Installing and Setting up Sinatra:
 i.  Open the Terminal.
ii.   Type “gem install sinatra” without ” “.

Voila! The gem got install.Now its time to Test it.So, for this we will create  file named “app.rb” and type:

require "sinatra" #to use the sinatra module

and run the app by typing “ruby /directory_name/app.rb” without “”  and then go to the web browser and type in the search bar ‘localhost:port_number’ ,in my case its ‘localhost:4567’  without ” you can find the port number on the running terminal.Then something like this will appear :

Its Hosted on RACK.

 ii.  Handling the HTTP Request

HTTP is a request protocol,When you type something in a web Browser it sends a request for some information  and the web server sends back a response.

You must’ve observed that when you click on Your name in your facebook’s timeline then your profile gets opened , have you noticed that in the search bar ,the link gets changed to “www.facebook.com/profile” from ” www.facebook.com/home “.Thats what the HTTP request is.You requested for profile page and server sent back the response by landing you on the profile page. We will discuss about the two most common HTTP Request Methods i.e. “GET and POST”. HTTP POST requests supply additional data from the client (browser) to the server in the message body. In contrast, GET requests include all required data in the URL.  

Making Response to the HTTP request in Sinatra :  

To do this ,create a file “app.rb” and type:

 
require "sinatra"

get "/" do
"This is a Home Page!"
end

get "/about" do
"This is a about Page!"
end

get "/contact" do
"This is a Contact Page!"
end
 

Now using GET method we are requesting for specific response, when the app.rb will be run and user will visit “localhost:4567/about” the response will be “This is about Page!”.

Simillarly when we will request for the Contact page by visiting “localhost:4567/contact” we will receive a message “This is a Contact Page!”.

In the next part we will be developing a smalll web application ‘Scissor,Paper,Rock’
on Sinatra.

Thanks for your time, Aloha !

Different tools for serving static files through HTTP

Introduction

Serving static files through HTTP is not a difficult task. Every little web developer is doing it. But not many people understand the real action that is happening underneath. HTTP protocol is very simple to understand and needs to be understood by everyone as it is one of the most used protocols in the world wide web.

Working of HTTP

The working of the protocol is very simple. It works on the basis of the request and response. A client (generally a user’s browser) makes a request for a particular file and the server it. There are 4 basic types of requests: GET, POST, PUT and DELETE. GET is the most used type of request. When a URL is entered into the browser, the browser makes a GET request to the server. The server serves the required HTML file and the browser renders it.

But for this, we need to have a server which is capable of accepting requests and processing them. There are several tools available to make a simple HTTP server. We are going to have a look at some of them today.

Tools for creating an HTTP server

  • Apache
  • SimpleHTTPServer
  • NGinX

Apache

Apache is the oldest way to render files through HTTP. It is generally used with PHP to make websites. There are two ways to start an Apache server, either through CLI or using a GUI client like XAMP or WAMP.

But the thing about Apache is, it requires you to place all the files you want to serve into a folder called WWW inside the directory where Apache is installed. This is not very convenient if you want to create a server on your own personal machine.

SimpleHTTPServer

This is an HTTP client that comes built in with python. I personally use it when I need to serve a static backendless website/webapp. This can be used to serve any directory on the computer on HTTP. And only that particular directory and its sub-directories are served. 
This can only be used on CLI. But the command to run it is very simple: python -m SimpleHTTPServer

NGinX

NGinX, pronounced as “engine x” is a very powerful Python library capable of not just creating HTTP servers but also proxy servers and email servers. It is very powerful and is used widely. It requires a configuration file for specifying details of the HTTP server.

Little more about HTTP

Creating an HTTP server under some specific directory means, you will be serving all the files under that directory over a particular network. These files can be accessed viewed/downloaded by anyone on that network(except if there is some kind of an authentication system). 
Hope this below average blog post helped you in some way. If you know of any other good HTTP clients, please do mention them in the comments below.

 

Fix “0xc00007b” error in Windows

It happens the best of us. We have a new game to play now and after spending hours downloading it, you launch it and are greeted with an error. The fix for the problem is not really given by a website clearly and I want to share the solution that works for everyone! Familiar with this?




> What exactly happens? 

As soon as you encounter the error code 0xc00007b, a dialogue box may prompt up on your screen and flashing the message stating, “The Application was unable to start correctly (0xc00007b). Click OK to close the Application”

> The reason why : 

There can be various scenarios under which you encounter error code 0xc00007b. You may get this error while doing any of the following:

● You might be trying to play a Game on your PC and after launching the application, error code 0xc00007b may flash on your screen.
● You might be launching software but unfortunately the error code 0xc00007b may resist you to do so.
● You may encounter 0xc00007b error when you install a 32-bit application on a 64-bit operating system.
● Some game installers replace 32-bit DDL files to 64-bit ones and vise-versa.

> How to fix it? (Step-by-Step)

>> Try these common fixes first. (You can skip them if you have tried them from other sources) 
1) Latest version of DirectX. Download Installer HERE.
NOTE :
  [1] Windows 8, 8.1 or 10 users can skip this file since it’s already integrated in Windows.  Just check for updates from ‘Windows Update’ to make sure you have the latest updates. More info is Here (https://support.microsoft.com/en-us/kb/179113).

  [2] Older games published before ~2008 require a special Directx package called “Directx 9.0c” to work which is available here –  (Online) (Offline)
 This package can be installed on ANY version of Windows.


2) Microsoft Visual C++ packages (2005-2013) 

These are downloadable from Microsoft’s website but to save your time, have uploaded a (.zip) file containing all the packages.

● 32-bit systems only need to install packages containing the characters “x86” in the name of the file.

● 64-bit systems need to install all the packages regardless of the filename.

● Check for updates again from ‘Windows Update’ to install security updates for the packages.

● If you are unaware which “system” is installed in your PC. Follow these steps to find out!
– Right-click on “My Computer” or “This PC” (depending upon your Windows version) and click on “Properties”.
– The “System type” will be visible there.
After installing the above files you’ll not be needing any installations of ‘Visual C++’ softwares from Games and other programs since all the packages are already installed in your system. ^_^


3) Latest version of .NET framework.
If you keep your Windows updated you’ll already have the latest .NET framework installed in your PC. If you don’t, install the latest version Here
Previous versions (for old games) : 2.0 (SP 2), 3.0 (SP 1), 3.5 (SP 1).
You can first verify the installed .NET frameworks in your PC by downloading the (netver.zip) file in “Troubleshooting .NET frameworks” folder.
4) Run the application as an administrator. 
There are certain applications, especially some software that are required to be run as an administrator for security purposes. This can also cause error 0xc00007b to occur. If this is the case, follow the steps given below to fix error 0xc00007b.
  • Go to the respective application
  • Right Click on its icon.
  • Select Properties.
  • Click the compatibility Tab.
  • Check mark the “Run this program as an administrator” option.
  • Click “OK”.
>> If all the above mentioned methods fail, you’ll need to do what I did! 
1) Download (.zip) file in the folder “Replace DLLs” depending upon your “System type”.
NOTE : I am assuming Windows is installed in the drive with the letter “C”.
2) For 32-bit Systems :  Windows will not let you replace the DLL files you just downloaded unless you modify the permissions. 
To do that, follow these steps :

  • Navigate to C:Windows. Here you’ll find a folder named “System32”.
  • Right-click on it and click on “Properties”. Then, click on “Advanced” in “Security” Tab there. A new window will be tell you that the owner of the folder is “TrustedInstaller”. 
For Windows 7 users, you’ll find “Trustedinstaller” in “Owner” Tab of the window.
  • Click on “Change” and type your username (or “administrators”) in the field “Enter the object name to select”. Check the box beside “Replace owner on subcontainers and objects” and click “Apply”.
  • Windows will prompt you with certain dialog boxes. Just click “Yes” on them and ignore the files that . 
  • Once you do that, click on “OK” and you’ll be returned to the “Security” Tab. Click on “Edit” and grant yourself (or “administrators”) “Full Control” over the folder by check marking it. 
  • You’re ready! Just replace the files in the appropriate (.zip) file to the folder “System32” and you’re done!


>> [Updated] Final Fix (Based on feedback) 

1) Make sure your Windows is up-to-date from ‘Windows update’. 
2) See if running “DirectX 9.0c” installer (mentioned above) fixes the issue.
3) If it doesn’t, visit) For 64-bit Systems : Follow the steps mentioned for 32-bit Systems but this time do the same for “SysWOW64” folder found in the same directory (C:Windows). Replace the files in the appropriate (.zip) file in both the folders and you’re done!

NOTE : (64-bit Windows only) If you replaced DLL files from (0xc000007b ERROR ComboTech.zip) suggested online, this error may not go away particularly if dyou trying to play games released in or prior to 2011. This file contained DLL files of 32-bit systems and you need to undo the changes. I have provided a separate (.zip) file in “Replace DLL files” folder to do it.

4) Visit Here. Search for the list named “List of file failures that the DirectX End-User Runtime package fixes” under “To resolve this issue, go to the following Microsoft website to install DirectX End-User Runtime:”. Now, search the files mentioned there in “System32” and “sysWOW64”, delete them and then run the installer (previously mentioned) again.  

If this fixes your issues, prevent any game from installing DirectX or Visual C++ (since you already installed all of them) on your PC. Let ‘Windows Update’ handle that.

Hands-on with the new XDA Feed App

Greetings Droids, 

Today we are going to explore an app released by XDA called “XDA Feed – Customize Your Android“. It’s the universal version of the app already available for a couple of devices. It’s available in Google Play Store and virtually any device running Android Lollipop and higher (5.0+).


The purpose of the app is believed to curate the best stuff from the XDA forums. As going through the forums can be a daunting place for a lot of people.It’s easy to miss out on latest ROM releases or must have icon packs. All content from feed is handpicked by humans to ensure quality. If you like to modify your phone or stay up-to-date (with posts notifications) with the latest the community has to offer then this app is what you need. 



Earlier, the app was specially made for Pixel, Pixel XL and OnePlus 3/3T which contained device specific content like ROMs, kernals and Mods and also general content like wallpapers, icon packs and themes. But, with this new app you can see the general content for all the devices unless you happen to own a Pixel/XL or OnePlus 3/3T. 

You can contribute to the app by sliding out from the side and tapping on “Suggest to Feed”. This will allow you to submit a forum link, a title, pick a category, add an image under the optional feeds and add a description. This is one of the ways you can market the content that deserves people’s attention.

This app was announced in the forums by one of the devs and was later featured on XDA. To report any bugs, you can use this official support forum link.

Screenshots : 


APK breakdown


– Average Rating : 4.8 (112 reviews)

– Content Rating : 12+

– Permissions : Storage


– Current Version : 0.28.1

 Requires Android : 5.0+ (Lollipop)


How to serve a django app on a local area network

In this post, I will show you how I automated the process of hosting a django app on a local area network.
The usual way to host a django app locally is by running “python manage.py runserver”. This just hosts the app at 127.0.0.1:8000. Now, this app cannot be accessed by others on your network.

In order for other devices to access your app, you will have to host the app with the IP address that your computer has on the network. For example, if your IP address is 192.168.1.3, your will have to host the django app at 192.168.1.3:8000. The port number 8000 can be different. To do so, you have to run the command “python manage.py runserver 192.168.1.3:8000”. Now your django app will be hosted on the local area network and can be accessed by others using the address http://192.168.1.3:8000/.

To get you IP address, you can run the command “ifconfig” on the shell and find out (or “ipconfig” for windows). And then you copy and paste the IP address in the command. 

But there is also a way in which you can make the django app accessible through all the IP addresses available on the local machine. And this is by using 0.0.0.0 in place of the IP address.

But you should add the domain (IP address) that is going to be used to the ALLOWED_HOSTS list in the settings.py file. This process can be automated with a small snippet of code.


Paste this snippet right below the ALLOWED_HOSTS line in the settings.py file. And to start the server, execute the command “python manage.py runserver 0.0.0.0:8000” (you can use any other port).

This code snippet will collect all the IP addresses available on the local machine and add them to the ALLOWED_HOSTS list. 

If you want to just host it only on a specific network, you can check out this git repository. Feel free to contribute to it.

Doing this saves time and effort. Also, this is useful if you are planning to use the django app in production.

If you have any questions or suggestions, please share it in the comments below.  



How to geek: Learn to code like a pro

Warning! Philosophical text ahead. Skip to the next section to avoid it.
A lot of people come up with a lot of brilliant ideas. But not all of them are able to execute their ideas due to lack of programming knowledge. Lack of programming knowledge is something that can only be solved by sitting your ass down and doing a course patiently without giving any excuses. It is important to assess yourself thoroughly. If you don’t know something, you need to accept it. You can’t call yourself a web developer after editing a few HTML templates. If you want to be a web developer, stop editing templates and start building one from scratch. Speed is not more important than fundamentals. If you go after speed, you will end up becoming like season one flash.
Another thing I’ve noticed in people is, they are not able to stay motivated for more than a day. They start a course online, binge watch a few videos and then forget about it the next day. An online course is not the same as a TV show. You cannot watch it continuously and expect to not get bored. Every small concept you learn needs to be practically implemented. Implementing small concepts will play a vital role in boosting your confidence. And that in turn will allow you to stay motivated till the next day. A small exercise you can do to carry over the motivation the next day is: Take up a small concept and implement only half of it. And implement the rest the next day. That way you will be curious to see the output on the next day, and after you see the output you will feel like doing more.
In the world of programming, curiosity to explore is very important. I started to learn to code at the age of 13 like a stereotypical geek. I had the language “visual basic” as a part of my school curriculum. If you are getting into programming now, you probably haven’t even heard of visual basic because your mind is only mobile responsive. We were introduced to making window based applications. This involved creating a few text fields, fetching data from the user and giving a relevant response. We did this for the entire year. But I was not satisfied with this. I wanted to know how to make applications that involved going from one window to another based on user response. My teacher refused to teach me this because it was not in the curriculum. Also, she probably didn’t know it herself. But by the end of the year, I finally figured it out by myself. I didn’t explore anymore into window based applications after that. But when 13-year-old figures out a way to solve a problem on his own, the motivation stays for a pretty long time. That’s why starting early is important in this field.

Enough philosophical talk for today.

Two important keywords from the above section: Motivation, curiosity.
If you are learning to code from scratch, I suggest you take up a modern programming language like python, ruby etc. Don’t you dare start with C++ or JAVA (if you are a victim of the Indian education system, you have no choice. I am truly sorry).
The advantage of learning languages like python is that it has a wide verity of capabilities right out of the box. For example, python can be used for making web apps, desktop apps, crawlers, automation scripts and what not. So, it lets you explore a lot of domains at a very early stage. Based on that you can pick a domain of your choice and build you skills based on it.
And once you know one programming language, learning another is not a big deal. It can be done over a weekend.
If you want to learn your first language fast, then for god sake don’t buy a book (or an eBook). Leverage the power of the internet. signup for a course on websites like edx, coursera, or udacity. And complete the course. Don’t watch all the videos at once, save some curiosity for the next day. You cannot go from noob to pro in one day.

When you complete the course, do some competitive programming on hackerrank (not hackerearth, their code editor sucks). This will help you think computationally. Thinking computationally is another topic for another day.
Also, do a project of your own. It doesn’t matter how small it is. (For Indians: If you are thinking about doing projects like library management system or restaurant billing system, you need to come out of the shitty zone that your school/college has put you in and think more realistically). Make something creative and interesting, it need not change the world, it just needs to change you.
I hope this gets you started. All the very best for the beautiful journey you have chosen. May the compiler be with you.


Vim: The Text Editor For Geeks

Many of us just love to work with Vim , a simplified text editor with Mouse and GUI is rarely something we use.Being a touch typist we don’t want to move our hands from their position on the keyboard.In simple words,there’s command to everything,from moving the cursor to save and exit.

But wait, should I start using Vim just because I’m too lazy to move my hands around mouse?
Let me complete,
Vim can be used remotely. We can use Vim everywhere and can be run over an SSH connection and it works just well. So if you need to do remote work you only need to learn one tool so why not Vim?
What’s Vim?
I’m not good with the definitions so lets just copy it from Wikipedia ,
Vim (a contraction of Vi IMproved) is a clone of Bill Joy‘s vi text editor program for Unix. It was written by Bram Moolenaar based on source for a port of the Stevie editor to the Amigaand first released publicly in 1991. Vim is designed for use both from a command-line interface and as a standalone application in a graphical user interface. Vim is free and open source software and is released under a license that includes some charitywareclauses, encouraging users who enjoy the software to consider donating to children in Uganda.The license is compatible with the GNU General Public License.

Although Vim was originally released for the Amiga, Vim has since been developed to be cross-platform, supporting many other platforms. In 2006, it was voted the most popular editor amongst Linux Journal readers; in 2015 the Stack Overflow developer survey found it to be the third most popular text editor; and in 2016 the Stack Overflow developer survey found it to be the fourth most popular development environment.

Some Basic Tutorial :-
1) Starting Vim :
Open terminal window and type ‘vim’ without ‘’.Somthing like this will appear:
2) Lets get started by creating a simple java Hello, World!program(please don’t judge me I want it to keep simple)


step 1.

open terminal and type “vi filename.java” without “”,somthing like this :

step 2.


Now its the time to command vim that I want to ‘insert’(type) something


So for this , I’ll hit the ‘i’ button to be in the Insert mode ,Now I can type anything .So ,I typed this simple program.

 

step 3.

By Hitting ‘Esc’ button ,I’ll enter in the command mode,So if I want to command something in between like save the file or copy a block of text or anything, I can type there.


Now I want to save and exit,so for this ,I’ll hit the ‘Esc’ button and will type ‘:wq’ in the command mode and hit Enter key . Something like this :

 
for just saving the file,type ‘:w’ without ‘’ in the command mode,for just quitting,type ‘:q’ .If you’ll try to quit without saving ,You’ll get the warning too.
Vim is also available for Windows.
The Best part is Vim helps to raise fund for the poor children in Uganda.
Thanks for reading the post with the patience,Hope you liked it.Stay Connected with us for more interesting articles.
                                                Have a nice day.

What went wrong with Arrow?

At the beginning of the production of the first season of Arrow, showrunner Greg Berlanti stated that the theme of the series will be loosely based upon Christopher Nolan’s Dark Knight Trilogy henceforth the inception of series was with the neo-noir touch.



The character background of Nolan’s Batman is very realistic and thus each of its characters suits to the neo-noir genre. Nolan chose the Joker to be an anarchist psychopath with assaulted facial scars rather than a sick eerie smiling clown who gets deranged due to a genetic reaction with a chemical waste.


Similarly in Arrow, The Count is shown as a drug dealer who rolls drug onto the streets by the name of Vertigo rather than the last descendant of a royal family in the country of Vlatava, who dons an eye gear emitting the EM waves which gives vertigo.



The series stick to its continuous theme but when Berlanti announced that he’ll be producing another series with The CW this time of Flash which will be in same chronology, then the entire theme of Arrow started to collapse.
To fix the Arrow now into the science fiction theme, there were impromptu crossovers such as in the season finale of The Flash, when they are trying to defeat Reverse Flash, there is an appearance of Oliver Queen for a few seconds. This may seem sensual to “cute little Fanboys”, but let’s be serious it’s pathetic way of inducing a major character to a well potential chronology. 

   
 Now Queen gives motivational speeches to Flash who is neither similar to him nor has the same dramatic conflicts. But guess what? Berlanti have to keep the shows running.


Nice work Green Arrow!! I mean Arrow, I mean Berlanti.