Reducing local SQL Server DBs Disk space usage

Software Development
First, you can check its Disk usage at: right click on database > Reports > Disk usage. Which also tells you how much space is used by data and how much for logging. 1. Remove full logging Right click on db > Properties > Options > Recovery model > Set to "Simple". 2. Clean up the database Right click on db > Tasks > Shrink > Database > Ok Now you can refresh the report and check how the log data is mostly gone. Shrinking the database also reduces the amount of space data uses a bit.
Read More

Updating Node and npm in Visual Studio

Software Development
Visual Studio comes now with its own default Node.js plus npm on first install (if chosen) which saves you time on first set up, but unfortunately it doesn't make it so easy to update due to its version of Node and npm being local. So how do you update them? First, a couple of useful tricks: How do I check which global Node/Npm version I have installed? Open a command line and write: "node -v" or "npm -v" depending on which one you want to check. How do I check which Node/Npm version Visual Studio is using? There's a Visual Studio plugin called "Visual Studio Command Prompt" that can help you with this so you can open a command line and do as before. If not, you can use the…
Read More

Node Sass could not find a binding for your current environment: Windows 32-bit with Node 0.10.x

Software Development
Node Sass could not find a binding for your current environment: Windows 32-bit with Node 0.10.x I ran into this error today and took a bit to find what the problem was. After triple-checking I did not have another version of Node installed, uninstalling, reinstalling, restarting Visual Studio, ... we finally found the issue: Visual Studio was using its own Node version, which was an older version and didn't really fit with what was set on the packages. Solution We just got into Visual Studio > Tools > Options > Projects and Solutions > External Web Tools and then moved the $(Path) variable upper in the chain so that it had more priority than Microsoft's Web Tools folder. This would make Visual Studio use my installed version of Node instead…
Read More

Some notes on DDD

Software Architecture, Software Development
Some Vocabulary Problem Domain/Domain The actual problem our software is going to solve, the purpose it is built for. Core Domain It's a subset of the previous ones. It's the essential part of the problem domain, the part which cannot be delegated and must be solved by us, software developers. Business Logic, Business Rules, Domain Logic, Domain Knowledge, Domain Model The business logic you enclose in your code represents the knowledge that you as a software developer have about the problem domain. The business logic of an application typically resides in the two innermost layers of the onion architecture. We refer to the notions of those two layers as domain classes, so a domain class might be a repository, an entity, aggregate, ... nut not an application service. Main concepts…
Read More

Setting up Selenium in C#

Software Development, Web programming
1. Download Selenium WebDriver for C# Go to SeleniumHG website and get into Downloads, scroll down until you see the different versions of the WebDriver and get the C# version. Extract the zip files into a folder. Create a project Create a Test Project using VS (File > New > Project > Test > Unit Test). Add the WebDriver libraries: References > Right click > Add Reference... > Browse > Take the right ones for your framework (35 or 40). Note: You can create a different type of project, like a Console App, but this other allows you to get test reports, config different suites of tests, etc. Start testing Now you can start testing, include the namespaces inside OpenQa. For example to test in Chrome: using OpenQA.Selenium; using OpenQA.Selenium.Chrome;…
Read More

Slipping images with AngularJS

Software Development
Lately there are many effects added to websites related to user's scroll down event. One of them consists on sliding elements across the page as if they were slipping up or down, Adidas did an awesome addition of such effect in their snowboarding section giving the effect that certain elements were slipping up and down only to return to their original place. I tried to copy part of that effect (without checking the scrolling speed) and this is what I got: First, let's add the listeners on our controller. One of these listeners is going to check for when does the scrolling happen and in which direction. By making use of Angular, we will add a flag the the scope to tell the element that we are scrolling in such…
Read More

Sublime is sublime!! :D

Software Development
I am a great fan of Visual Studio, but sometimes it lacks some of the lightness and flexibility you can get with other frameworks. It's too heavy on loading and has so many tools you aren't going to use just right now. And that's where Sublime seems to be doing it's best: it's light, very light, as it only comes with the basics for editing and you can then add plugins to it as need to customize it's features according to your needs. Just as a quick comparison, Visual usually takes around 200MB of memory, sometimes 400 or 500, Sublime seems to be fine with 50. Also, the opensource community seems to be quite into this project always adding new plugins for it with each new tool they make available.…
Read More

Upgrading WordPress blogs

Software Development
Once in a while you must do this and, if you end up lazy for years like me, may even feel nightmares about upgrading from version 2.x to version 4.x, luckily upgrading Wordpress is one of the easiest things you can do: Making a backup It's always wise to backup your site before you make such a change. Don't worry, you don't need to backup absolutely everything, but check which things you need to backup depending on your needs: 1. Your posts and comments: which is as easy as going to admin > Tools > Export and save an XML (maybe JSON in future?) file with all the relevant content. Whatever happens now, any wordpress version should be able to recover your most relevant data. 2. Your wp-content: usually you…
Read More

Quick introduction to SVN

Software Development
SVN or Subversion is a source control repository technology that allows to save code statuses on a centralized server from which the developers can save the current status of their project, merge with what others devs have been doing, create branches of a project to develop new features or solve bugs in an isolated space and finally merge back to the trunk to include the changes into the next release. SVN also has some clients that connect to the centralized repository and help you committing changes into it or getting the latest changes from it: one of them is Tortoise. Getting a Repository You can use Windows explorer to handle everything, so getting a project from the repository is as easy as creating a new folder anywhere in your computer,…
Read More

AngularConnect 2015 London

Software Development
So I’ve been at the AngularConnect Conference these two days and these are some of the things I got from it: TypeScript You know something has become popular when all the speakers using javascript (and in this conf that was around 95% of them) use it. TypeScript is a language made by Microsoft that allows you to use classes and interfaces in javascript (and some other things) and then can be compiled into plain javascript. The reason for it to become that popular is that being able to create interfaces or classes is crucial when developing big apps, I have been finding it increasingly difficult to deal with the codes complexity as my company's project has grown and was starting to worry as it is to grow more, definitely, I…
Read More

First steps with Protractor

Software Development
Once installed in your computer, it's time to start messing with it :) First of all, we will use their websites tutorial test. Create this spec.js file: [sourcecode language="js" wraplines="false"] // spec.js describe('Protractor Demo App', function() { it('should have a title', function() { browser.get('http://juliemr.github.io/protractor-demo/'); expect(browser.getTitle()).toEqual('Super Calculator'); }); });[/sourcecode] That's just a basic test. Then create this config file to set up Protractor: [sourcecode language="js" wraplines="false"] // conf.js exports.config = { framework: 'jasmine2', seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] }[/sourcecode] Starting the webdriver manager To make it run you need to open the console and run the webdriver manager, so open it and exec: webdriver-manager start Executing the tests Now that the webdriver manager is running, open another console window, move to the folder where you created those two files and exec this:…
Read More

Installing Protractor

Software Development
First of all, make sure you have Node.js installed in a newer version than 0.10. Open cmd, exec: node -v If it's not the right one, go to node.js page and get the latest .msi for Windows. Install Python You are going to need to install Python 2.7, just get the installer from Python's download page and follow the steps. To make your life easier, you will need to add python as an environment variable, you can do this manually or check the option "Add python.exe to path" at the "Customize install" screen during the installation: select "Will be installed on local harddrive". Restart your cmd command window (close and open, changes on environment variables may not be effective if not). Note: You may need to restart your computer at…
Read More

Using Google Tag Manager with AngularJS

Software Development, Web programming, Web statistics
One would expect that being Angular a Google product and Google Tag Manager another of their products combining them would be quite simple and straightforward, but I personally had my doubts and not much documentation on how are we supposed to make them work. Should I just paste the code as usual or will that get into conflict with Angular? Is it going to register "page views" whenever I change the routing or not as it's not a standard page view? I checked some things and here are some of my results: Adding Google Tag Manager snippet into the page First of all, I didn't find any problem with just copy-pasting the code before the /body closing tag, but I wanted to angularize it and have everything in one piece…
Read More

Spying with Mocha and Sinon.js

Software Development
Sinon spies Spies on sinon are redirected functions that will notify of any call to them. Let's see an example: [sourcecode language="js" wraplines="false"] var myGreatObject = { myAwesomeMethod: function () { console.log(1); //do something } }; it('test spies', function () { myGreatObject.myAwesomeMethod(); // 1 //Now let's reconvert it into an spy: myGreatObject.myAwesomeMethod = sinon.spy(); console.log(myGreatObject.myAwesomeMethod.called); // false myGreatObject.myAwesomeMethod(); console.log(myGreatObject.myAwesomeMethod.called); // true console.log(myGreatObject.myAwesomeMethod.callCount); // 1 myGreatObject.myAwesomeMethod(); myGreatObject.myAwesomeMethod(); console.log(myGreatObject.myAwesomeMethod.callCount); // 3 }); [/sourcecode] I think that's a good example of how spies work in Mocha+Sinon. We have an object and we can make use of it, as usual. We then redirect the object's method to an spy, this is, the method "myAwesomeMethod" is actually a pointer, so we point to a different function, that's all. If we check if the spy has…
Read More

Configuring Karma to test Angular apps using RequireJS

Software Development
Installing and configuring a testing environment for an Angular application hasn't been very straightforward for me but here are the steps I took (the right ones, at least). Configuring Karma First of all, we need to have installed and working: Node.js + Karma + Mocha + Chai + Sinon + Karma-RequireJs (the plugin for Karma, not the standard library). Once that works, we still need to configure it all to test our app, which is a big angular app and uses RequireJS to load its modules. First of all, we can configure Karma by executing "karma init" on the console (make sure you do that on the main folder of your project!!). That will give us a config file with the basic config done. We wanted to use Mocha, Chai…
Read More