Category Archives: Random

OOPSpam API – multiple spam filter


I was thinking about some ideas as a side-project. Well, I thought it would be nice to pass my project-based exams Mobile Applications and Cloud Computing, Human-Computer Interaction with the same idea. I came up with the idea of VirusTotal-like service but as a spam filter service. As a result, OOPSpam API came to light. After making a few research I found out there is actually well-developed solution like mine, however, the price seemed to be high. I started development by integrating a few major spam filer services such as Apache SpamAssassin and deployed the application to Heroku. Roughly, this is how it works:

arch1So, what is the OOPSpam API? It is a multiple spam filter service that has built-in integration with powerful machine learning and text analyzers. It takes a content as an input and sends it to various spam filter services and returns the likelihood of the content to be a spam.
Integration is quite simple, the only thing you have to do is to send a request to with JSON object :

{"text":"The example content!"}

As a result, you will get again JSON object as following :

"spam": 2,
"nospam": 1

As obvious it might seem It is worth to mention that spam and nospam stand for a number of services that recognized the content as a spam/not spam.

I’m planning to integrate other providers as well to make it even accurate. The project can be helpful for the folks who want to protect users from the spam contents.

Set up Git and initial commit to remote repository

As software developers, often we tend to work on local machine and upload a project when we’re done. This case is fine when the only developer who works on project is you and the changes are small.However when you are dealing with large project with more than one person , you will need to store source code and share it between developers in order to work on the same project.This case lead us to use version control software. The basic concept of version control is :

  • Check out the project from the repository
  • Make changes
  • Check in/commit/submit changes to the repository

Let’s start by downloading version control software (Git) to our machine. You can download it from and as a Git solution i’m going to use BitBucket, you can use GitHub or other services, the explanation above applies most of them.

Since i use Windows, after installing Git in the right click appears Git Bash Here and Git GUI Here options, do right click the folder that you want to Git to use and select Git Bash Here and it’ll automatically open console from that directory.

First thing you have to do is assign the folder as local git folder in order to do so run code below

git init # assigning the folder as local repository
git remote add origin # adding remote git URL

Now you almost done.The URL above in the code is remote URL of git repository.You can get it by simple creating repository on BitBucket.

As we don’t have any other branch except master which is default ,if you want to create new branch just run

git branch BranchName # will create branch

and to switch new branch

git checkout BranchName

checking which branch you are currently using and which files are not tracking or need to be commit

get status

So far we create local repository and branch and added new remote one.Time to commit some codes/files, since i have an existing project i’ll push the project to server.Before pushing our code optionally we can set our user name and email to git.

as i mentioned above i have already project that i want to push if i run get status Git will show me that the folder that my project located is not tracking therefore we need to add project folder to tracking system of Git by doing

get add .
After add, . (period) indicates including whole files and folders.Now we can push our project.
It will ask your password which is you set when you registered on Git repository service. 

In case you want to fetch a project from repository into your local use
git pull origin/master

Those are basic concept of Git,there are a lot more than this so go ahead and check documentation

Happy coding!

Entity Framework – NotMapped Attribute

If you include a property in the model,EF will attempt to read/write value from/to the database. In case if we want to exclude a property from the model,we just have to set it without a getter or setter.However there is another convenient/right way to do so by using Data Annotations attribute [NotMapped] which is located in System.ComponentModel.DataAnnotations

public class Company
   public int CompanyId { get; set; }
   public string CompanyName{ get; set; } 

   public DateTime EstablishedDate { get; set; }

Another approach is to use Fluent API as shown below

class ExampleContext : DbContext
        public DbSet<Company> Companies{ get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
                // here we ignore EstablishedDate from creating
.Ignore(b => b.EstablishedDate);