Sample iptables config for a web server

Posted by robbiebow on 17 August, 2008 under geek | Be the First to Comment

I’ve cribbed this sample iptables config from the one at IPTablesRocks – basically restricting the incoming ports down to SSH (port 22) and HTTP (port 80). Be sure to follow their precautions before trying to change your iptables – get it wrong and it could cost you a fair price to get your web hosts to flush your iptables.

Add Options to a Select with jQuery : IE7

Posted by robbiebow on 7 August, 2008 under geek | 2 Comments to Read

Problem: trying to add a new option to a select drop-down menu doesn’t display the text in IE7.

Solution:

var thisValue = 12;
var thisText  = 'December';
var thisOpt   = document.createElement('option');
thisOpt.value = thisValue;
thisOpt.appendChild(document.createTextNode(thisText));
$(".months_menu").append(thisOpt);

MySQL: Selecting non-unique records

Posted by robbiebow on under geek | Be the First to Comment

Scenario: you want to select all records that have a non-unique value in a column. Use a subquery:

SELECT ... FROM ...
WHERE ... IN (
SELECT ... FROM ...
GROUP BY ... HAVING COUNT(*) > 1
);

So, to give an example, you want to select all rows from the table "books" that have a non-unique title:

SELECT * FROM books
WHERE title IN (
SELECT title FROM books
GROUP BY title HAVING COUNT(*) > 1
);