Skip to main content

Posts

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 ...

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 ...