Skip to main content

Posts

Showing posts from 2016

Installing Oracle Database 11g Release 2 hangs at Desktop Class (step 4) in Windows 7

The following steps should be followed to solve this problem. 1. Run cmd as Administrator. 2. Navigate to the directory where the your setup.exe resides for oracle 11g using the cmd. 3. Type the following command and press enter. Remember to give the path to where your java jdk is installed in your system here. Most importantly, I have used PROGRA~1 as a replacement for the string "Program Files". The reason for the installer to hang at step 4 is it cannot find the correct path to the JDK when the path contains spaces. Use PROGRA~2 as a replacement for the string "Program Files (x86)". This depends on where your JDK is installed. setup.exe -jreLoc C:\PROGRA~1\Java\jdk1.8.0_40 Cheers :)

How to undo an accidental git merge that has not been pushed to GitHub yet?

There are several ways to do this. You can try out one of the following commands . 1. git reset --hard <commit_sha> Check  git log  to find the commit_sha for the command above. 2. git reset --hard HEAD~5 Five here is the number of commits that you need to get back. 3. git reset --hard ORIG_HEAD   ORIG_HEAD  will point to a commit directly before merge has occurred. You don't need to find for the commit_sha. Cheers. :)

How to delete multiple files from Git at once in Git Bash or Ubuntu?

You can easily delete a single file from GitHub through the browser, but how can we delete a bunch of files altogether using Git so that you do not have to delete them one by one? The most easiest step is to type the following command to track all the files that are deleted and remove them. git ls-files --deleted -z | xargs -0 git rm   After executing the above command, when you type the following command, you will see that all the deleted files have been added to commit. They are in green. git status Now you have to make a commit and push to your origin. Note: To remove a single file or a couple of files from the command line or git bash, you type the following. git rm file1 file2 file3 Cheers. :)

How to connect my database instance with elastic beanstalk instance in AWS?

If you have deployed your web application in Elastic Beanstalk in AWS and now you need to connect a database to this instance, and your database is actually residing in a different instance, how can you actually connect them? It's easy with Elastic Beanstalk. I will explain an example scenario that I used for connecting my elastic beanstalk web application with another instance containing my MongoDB database. By looking at this, you can customize as per your need. Don't worry. This is easy. :) The only things you need here are the details about the 1. Database name that you need to connect to. Ex:- "myDB" 2. Port at which the database instance is listening. EX:- In the case of MongoDB, the listening port is 27017 3. Host name of your database instance. EX:- Like localhost, in this case, it will be the Public DNS of your database instance 4. The password of your database if exists. First these details need to be set as environment variables in Elastic Be

How to install MongoDB in Ubuntu 14.04 LTS?

This is a very quick guide to installing MongoDB in Ubuntu through the terminal. If you need a more detailed explanation and why and how of the steps, you can refer this link from which I got the source to write this blog post. Here you will finished installing MongoDB for Ubuntu 14.04 LTS in 5 steps. It is really easy. 1.  Import the public key used by the package management system. sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 2.  Create a list file for MongoDB. echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list 3.  Reload local package database. sudo apt-get update 4.  Install the MongoDB packages. sudo apt-get install -y mongodb-org 5.  Start MongoDB. sudo service mongod start Cheers. :)

[org.springframework.web.servlet.PageNotFound] (default task-44) No mapping found for HTTP request with URI in DispatcherServlet with name

When using the Spring MVC architecture for developing a web application, with spring annotations and after deploying it in your server(JBOSS, Tomcat etc.), the above error might appear when clicking on a link to a web page in your application. Does the error seem to be weird? "I did it correct. How can this happen?" - Do you feel like this? The reason could be as simple as the following. "Missing the  @Controller annotation just above the class of your controller which defines the request URI in question." Check whether this annotation is there in your controller. Cheers. :)  

Training a SOM network using nctool in Matlab

1. Type  " nctool " in the command window of Matlab. Then you will get this window. 2. Then click Next . Then in the Get Data from Workspace section, select your dataset file . I use a csv file here. The format of the dataset file is important to consider here. It should be as follows. I use a dataset whose classes are already known. (Even though here we use an unsupervised learning approach) This is a section of the dataset I have. Just to give you an understanding about the format of the dataset. The dataset has 218 samples with 17 feature elements. In my dataset file, the samples are oriented as Rows. Therefore I also need to select the Rows radio button in the Select Data window in the nctool. It will be different in your case if features are arranged as rows and each column represents a sample as opposed to the above orientation in my data file. 3. Then click on Next and Finish in the smaller windows that appear when you select your dataset. 4. The

How to find files that match some pattern with the grep command in Linux?

In Linux, if you know that a particular directory has a very large number of files (say close to 30,000) and you need to find a file in it, typing the ls  command in the command prompt will actually not help you. This is because it will take some amount of time (few minutes may be) to load them in. Instead, if you know at least some part of the name of the file, you can type the following command and print it out in the command prompt.   For example, the following command finds the file containing ' galvan ' as full or part of its name in the directory given by /data . find /data - type f - print | grep 'galvan'

How to add a system call in xv6?

I will explain a simple example on adding a system call in xv6. Assume that you have to add a system call to get the address space size of the currently running user program. You can name your system call as getmysize() and call this system call from within a user program. You can write your user program as follows. Let the program name be  myprog.c  I assume that you know how to add a user program to xv6. So I will skip mentioning those steps here because it will be off the topic. #include "types.h" #include "stat.h" #include "user.h" int main(void){ printf(1,"The size of my address space is %d bytes\n", getmysize()); exit(); } This program is written for the purpose of demonstrating the working of the system call only. Now we will add our system call to xv6. First add the following line at the end of the file  syscall.h . #define SYS_getmysize 23 Note that the 23 here might change depending on the number given before the li

Integrating Bootstrap with Spring MVC in Maven

We can integrate Bootstrap with Spring MVC in different ways. We are going to use one approach to do it. Bootstrap can be added as webjars . For this, put the following dependencies into the pom.xml. <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>3.3.6</version> </dependency> You need to add a dependency for jQuery as well as follows. <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>2.2.3</version> </dependency> Now you are ready to go. But before that, add the following line of code to your servlet.xml file  <mvc:resources mapping="/webjars/**" location="/webjars/" /> Now add the following lines to your view pages within the head tag. <link rel="stylesheet" href="webjars/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="style

How to create a SpringMVC web application in Eclipse with MongoDB and maven?

Use my previous blog post here  to create a basic helloworld SpringMVC web application without integrating it to a specific database. That will be a starting point for you to create this project that I am going to explain here with MongoDB. To know how to setup MongoDB have a look at my blog post here . This is if you are using a windows environment. I will list down the files that you need to create. As an overview, you will create or make use of the following files in this project. Song.java - This is the POJO or the model class that holds all the fields that should go in your database along with the getters and setters for the fields. Here the class represents a document(a record) that goes in the database. SongDAO.java - This is a java interface that contains the method declarations of the methods that will be used to perform database manipulations(that is the CRUD operations basically). SongDAOImpl.java - This class implements the SongDAO interface and provides the

Initial Integration steps of MongoDB with a Spring MVC web project in Eclipse using Maven

To start developing applications with MongoDB, you need to install a driver for your chosen programming language. I select Java here . There you don't need to download the driver if you are using maven to build the project. Just include the following dependency to the parent pom. <Your Language> -> Releases -> Installation will give the dependency that should be added. <dependencies> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> <version>2.14.2</version> </dependency> </dependencies> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-commons</artifactId> <version>1.12.1.RELEASE</version> </dependency> But remember if you are including the below dependency, you don't need to put the dependency for the mongo-java-driver above. That is because

How to setup MongoDB on Windows?

Download the current MongoDB windows installation .msi file from https://www.mongodb.org/downloads   matching your requirement. Run the file and carry out the installation process. It is easy. You will be guided through the installation process. PS: The 3.2 and 3.0 releases of MongoDB does not work in windows. But the older releases does. In my case, I installed MongoDB 2.6 Standard version. Now open the command prompt and go to the bin folder of the MongoDB installation. In my case, it is C:\Program Files\MongoDB 2.6 Standard\bin Run the mongod.exe file there by typing the command                                                                       mongod You will find an error saying \data\db does not exists as shown in the figure below, and the .exe stops. Then go to the directory where MongoDB is installed and create a folder structure named data/db. But you can create it where ever you like. In my case it is as above. Then run the following command in the co

Create a Spring MVC web app in Eclipse

I take  http://o7planning.org/web/fe/default/en/document/8108/spring-mvc-tutorial-for-beginners site as a reference for this blog post. First create a maven project. (Be in the Spring mode to do this)                                       File -> New -> Maven Project Select the "Use default Workspace location" option and click Next. Under the "Select an Archetype" window, in "Filter" text field, type the word "webapp". Then from the listed set, select maven-archetype-webapp and click Next. Here you can specify a Group ID and an Artifact ID for the project and click on Finish to finish creating the basic structure of the project. Now you are ready to go with the implementation stuff. If you want to change the JRE for the project, right click on the "JRE System Library" folder and select "Properties". Here, the "Execution Environment" and the "Alternate JRE" options could be changed to th