Categories
Databases

How to remove duplicate rows in SQL (works with Postgres)

Note to self more than anything, this snippet was handy for to remove duplicate rows in SQL, that crept into a Postgres database as a result of a dodgy join. There are probably more than a couple of ways of doing this but the best example I came up with after reading around is: DELETE FROM table_nameWHERE ctid NOT IN ( SELECT min(ctid) FROM table_name GROUP BY field1, field2); The reason this works revolves around the ctid field. This is a default field you don't have to specify Read more [...]
Categories
Productivity

Weekly Review Checklist App

I've been toying with the idea of creating an app that helps with a weekly review for a while. I first came across the idea when reading about Getting Things Done and the massive list of 'triggers' that comes with that. To be honest I found it a bit daunting and didn't need to check all those things every week.

So, in my own simple, trivial way I've written what is essentially just a web page with a list on it, except that the list updates a progress bar and nicely removes things from focus when Read more [...]

Categories
Technology

Insert Key (or equivalent) on Ubuntu using a Mac keyboard

Pretty niche audience for this one, but posting it for my own benefit as much as anything. Thanks to the original link at Ubuntu Forums for the following hints:

[fn]+[return]= Insert
[fn]+[UPARROW]= Pg Up
[fn]+[DOWNARROW]= Pg Down

Categories
R

Easy Sumif in R Using The Aggregate Function

This is a really simple (i.e. probably even the most basic possible) example of using the built in aggregate() function in R, basically a sumif in R.

Given a set of data where column a is the values and column b contains the data by which you wish to group (in this example categorical data with values of a or b):
> data
a b
1 0 a
2 0 a
3 1 b
4 2 a
5 2 b
6 2 a
7 3 b
8 4 b
9 7 b
The aggregate function as I have used it below takes the following arguments -- data$a is the Read more [...]

Categories
HTML

Top 10 HTML Beginner Resources

Beginning with HTML
Over the past few weeks I've noticed a few people have been asking me if I had any tips for the best HTML beginner resources. This is something that comes up for myself once in while when needing some bit of HTML reference that I have forgotten through under-use.

In order to kill two (three?) birds with one stone I thought I would make a list for myself--in the form of a post--that I could share with those people. There are lots of sites with tutorials and tips on HTML Read more [...]