Saturday, March 25, 2017

Monday, March 13, 2017

Reverse a string using stack in java

In my previous post, I reversed a string in java. I'll do the same thing here using stack.

Steps : 1) Declare an empty stack.
              2) put the string elements in a character array.
              3) Push every single character of the array into the stack.
              4) Pop character one by one from the stack & add the removed character in an empty string.
             

import java.util.Scanner;
import java.util.Stack;

public class MyStack {

 
 public static void main(String[] args) {
  
  Scanner scanner = new Scanner(System.in);
  String string = scanner.nextLine();
  String output = "";
    
  Stack stack = new Stack();
  
  char[] array = string.toCharArray();
  
  for (char c : array) {
   stack.push(c);
  }
  
  for (int i = 0; i < array.length; i++){
   char c = (char) stack.pop();
   output += c;
  }
  
  System.out.println("Reversed string : " + output);
  
 }

}


continue reading Reverse a string using stack in java

Reverse a string in java

Here in this section I'll put solution of some simple programming problem which. The following one will reverse a string.

import java.util.Scanner;

public class MyStack {

 
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Scanner scanner = new Scanner(System.in);
  String string = scanner.nextLine();
  String output = "";
  StringBuilder stringBuilder = new StringBuilder();
  
  output = stringBuilder.append(string).reverse().toString();
  System.out.println(output);  
  
 }

}


continue reading Reverse a string in java

Tuesday, March 7, 2017

Display post categories or menu of blogspot site in mobile view

Due to lack of available space, blogspot site's mobile view doesn't provide gadgets like categories, menu etc. But this can be done by making some changes in the HTML. Follow the following steps :

Go to the layout section of dashboard

Click on "Edit" of the gadget. On the addressbar of the browser you'll see something like this - "widgetId=something". For example , here Id = Label2. Remember this Id.

Next, go to the theme section of dashboard. Hit on the setting icon under "Mobile" head. Select a custom theme. Also make sure that you select the first option just like the picture below.


Then click on "Edit HTML" button  in theme section. Find out the id of your desired gadget. Remember, in this example my Id was "Label2". Add an attribute for the gadget - mobile='yes'. Follow the image below.





Hit "Save theme" & you are done. Now you will see the gadget both from mobile & desktop.

 
continue reading Display post categories or menu of blogspot site in mobile view

Sunday, March 5, 2017

Open firefox browser from terminal

Opeing firefox from terminal is pretty simple. Follow the steps:

1.  Open terminal (Ctrl + Alt + T)
2.  firefox &

Thats all. If you want to open a website from terminal, just add the link just after "firefox" command. For example, following command will open facebook.
  
  firefox facebook.com  

 












continue reading Open firefox browser from terminal

Intro

Linux is an open source free operating system. Actually it is a kernel having lots of operating systems under it which are known as distro (distributions). I am an ubuntu user. In this section I'll write the solutions of ubuntu related problems that I face. So that I or anybody else can easily find the solutions of the same problems in future. If you have a better solution or if you find anything wrong in my post, please feel free to inform me I'll definitely make the correction.

On that note I would like to add some points about the advantage of using linux. The most important issue for which I prefer linux is that - it is almost free from virus. I am using linux distro since 2014. Till now, I haven't faced any virus related problems here. Among lots of issues, this is most important one for which I prefer linux.

Another important point is  linux is open source. One significant advantage of open source technologies is the wide range of options available to the end users. Being open source, linux offers several distributions to the end users. Ubuntu, CentOS, linux mint etc are some of the linux distributions which are completely free to download. The most popular smartphone OS, android, it is also based on linux kernel.


continue reading Intro