How to use npm behind a proxy

NPM Logo

Coding some examples from the book Arquitecturas Web con Angular.js about setting up a basic web server using Node.js and Express.js and i needed to install Express.js on my project. At the moment i’m in corporate environment and we are behind a proxy. So, i tried to install Express using npm with this command:

And i got this error:

Because of the proxy. So, how do you configure npm to work behind a proxy?

Continue reading

Hibernate validator: Difference between @NotBlank and @NotEmpty

Recently i was teaching about using Hibernate Validator with Spring MVC. Because of that, i was checking the complete list of available annotations for bean properties.

Then, i discovered annotation @NotBlank, which was new for me because i only knew @NotEmpty and @NotNull. The documentation is clear to establish the difference between them:

Continue reading

How to change double/single quotes in Microsoft Office

Bad Quotes on Microsoft Office

Not about programming, but very useful. As a computer scientist, is usual to write technical documents for people which contains snippets of code of any programming language or database stuff. Problem comes when you have to write single or double quotes and you get the “final user” quotes style instead straight double and single quotes we write when we are programming. Those are called smart quotes. It’s possible to change them?

Continue reading

Oracle PL/SQL: Table is mutating ERROR

You have TABLE_A which has a trigger AFTER SOMETHING which actually does something, in the body of the trigger or through calling a PL/SQL function. Anyways, the PL/SQL code in some way interacts with TABLE_A, the same one which triggers the trigger. When you test the trigger by INSERTING/UPDATING/DELETING a record, you get the next error:

Which causes this?

Continue reading

How to create a Singleton Class in C#?

Recently i had to work in a .NET project (not usual, mainly because i haven’t developed in C# since a couple of years) using C# of a multithread application executing the same process through various threads (at the end i used Parallel Tasks) and i wanted to handle Oracle Database connections properly. I’m going to write some posts about my experience and what i’ve learned.

Right now i just wanna share this simple but useful article about how to create Singleton classes in C#. In my case i created a ConnectionManager Singleton class to serve connections to all the running Tasks. The article covers the scenario of a single thread application and a multithread application. Enjoy it.

https://msdn.microsoft.com/en-us/library/ff650316.aspx

Change beans.xml filename in Spring MVC

Spring Framework logo

If you start using Spring MVC to develop Web Applications and you declare the DispatcherServlet in web.xml, it’s a little bit annoying to rename the Spring beans file to xxxx-servlet.xml, for example, if you declare DispatcherServlet like this:

Your beans.xml file has to be renamed to springservlet-servlet.xml to let DispatcherServlet find the configuration file. But, we can change this behavior by specifying to DispatcherServlet the name of our Spring Beans file in the next way:

Continue reading

Set/change sheet name in Excel (Apache POI)

I’ve been working on a project involving a lot of Excel files processing using Apache POI library. I was coding a method to generate an Excel report with various sheets, and to stylish a little bit i wanted to set sheet names, but looking for a method like sheet.setName(), i couldn’t find anything. Looking in the documentation i couldn’t find anything, but navigating a little bit i found this post on stackoverflow:

http://stackoverflow.com/questions/21942056/is-it-possible-to-change-sheet-name-with-apache-poi-ms-excel-java-android

Basically, you use the Workbook object instead Sheet object, based on sheet index beginning from zero: