Monday, December 26, 2011

Sooner or later, software licenses

Sooner or later, as a software developer (or even as a server admin) you'll have to deal with software licenses. You just can't escape it.

For the uninitiated, a software license defines what you can do with a piece of software. As for the case of a developer, it defines what someone can do with YOUR software. There's a lot of licenses freely available in the internet like BSD, GPL and LGPL. The discussion of permissive, not-so-permissive, free-but-closed, etc. families of licenses will be like writing a research paper. That's too much work for me.

In any case, these licenses are a bit thick or has too much legalese which sometimes I don't like. So, I found sometime that's easier to read and people to understand, the DBAD license.

Quoting Phil Sturgeon,
"As developers we all want to protect our code from dicks that try to steal, sell, infringe or just generally rip us off. For this we have licenses like GPL, MIT, etc.
Sometimes however, you release a project where you just don't care what happens to the code. For this Sam Hocevar created the WTFPL which is a brilliant license.
For those of you who want something in between, try the DBAD license."
Here's the full verbatim text of the license.


                    Version 1, December 2009

 Copyright (C) 2009 Philip Sturgeon

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

                  DON'T BE A DICK PUBLIC LICENSE

  1. Do whatever you like with the original work, just don't be a dick.

     Being a dick includes - but is not limited to - the following instances:

 1a. Outright copyright infringement - Don't just copy this and change the name.
 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick.
 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick.

  2. If you become rich through modifications, related works/services, or supporting the original work,
 share the love. Only a dick would make loads off this work and not buy the original works
 creator(s) a pint.

  3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back.

Thursday, December 22, 2011

6 Simple types of Inverted Queries

Whatever kind of database you are working on - NoSql, ORM, relational, or OO you will still need to query for data.

There are two ways in which data can be queried. The first way is for each entity to have a identifying or unique attribute. This identifying or unique attribute then can be used to select the entity or entities. The second way is an inversion of the first and is designed so that the entity identifiers associate with a given attribute may be obtained. The first way is useful for answering the question: What are the properties of a given entity? The second is useful for answering: What entities have a given property?

Assuming that we have entities E; attributes, A; and their attribute values, V. We have these 6 types:

Form Type of Query Example
Common attribute inquiry How much did Saleman No. 15 earn last month?
Which entities have the given value? Which salesman or men earned more that 20,000 last month?
List all attributes having a given set of values for a given entity Which month's earnings for Salesman No. 15 have exceeded 20,000?
Request for all information about a given entity List all the information stored about Saleman No. 15
List the value of a given attribute for every entity List last month's earnings for every salesman
List all entity attributes having a given set of values For every salesman, list every month when this earnings exceeded 20,000
You can mix and match the six types to create very complex queries. You could for example ask the question: Which salesman earned more that 20,000 in May OR June OR July?

Sunday, December 11, 2011

Enable that Drupal Module from inside Netbeans

Drupal development - module or theme - in Netbeans work but you'll have to deal with a few quirks, gotchas and trade-offs. One of my pet peeves is where that I have to open a command outside of Netbeans to use Drush. I have gotten use to my Java flow where I can call or use Maven or Ant inside Netbeans. I don't have to suffer anymore! Because I have found a plugin that makes Drupal development in Netbeans cool, pleasurable again. Introducing NDDT or Netbeans Drupal Development Tool.

NDDT is developed by Jamie Holly who just happens to be the owner of Holly Information Technologies which owns the code to NDDT. Amazingly he is currently allowing Drupalist to freely download the plugin as a NBM package. A NBM package is the file format for Netbean plugin. 

I haven't tried out all the features as of yet but I've noticed that I've been using three features of the NDDT everytime for the past week since I installed NDDT.
  1. Drush console - No more opening the admin module page for me. I just run pm-enable from Netbeans.
  2. The snippet and templating feature - You just gotta love any feature that cuts down on the typing
  3. Drupal API search feature - I don't have to keep open a tab for the site. 
Any Drupalista who uses Netbeans SHOULD give NDDT a spin. It's FREE and it WICKED!