Enable UPNP Under FreeBSD

October 3rd, 2009 derek No comments

build and install from ports (/usr/ports/net/miniupnpd)

Add this to your /etc/rc.conf

miniupnpd_enable="YES"

Next add a few things to your /etc/pf.conf
rdr-anchor "miniupnpd"
anchor "miniupnpd"

pass out on $int_if from any to 239.0.0.0/8 keep state
pass in on $int_if from any to 239.0.0.0/8 keep state

Also change your NAT entry to add static-port
nat on $ext_if from $int_if:network to any -> ($ext_if) static-port

I tested from functionality from a couple OSX boxes with the following:
dns-sd -X udp 123 456 789

If upnp is working, it should return an address:
mifune:~ djh29$ dns-sd -X udp 123 456 789

Timestamp     if   External Address     Protocol        Internal Port   External Port   TTL  
10:32:20.589  0    70.90.241.189        16              123             0               0    
^C
mifune:~ djh29$

I fought with this thing for awhile before I realized that the multicast address rules were necessary under FreeBSD (per the INSTALL doc for miniupnpd).

Categories: Tech Tags: , , ,

Change the IR frequency for a Dish Network Remote

September 30th, 2009 derek No comments

I have a Philips 32″ LCD  - Model 32/PFL6704D - as my bedroom television.

It bathes the entire room with IR. This is a massive pain (My Roku refuses to work with this TV doing this). Here is a quick fix for getting a Dish Network receiver to transmit on a different frequency:
1. Display the System Information screen

2. Note the Remote Address

3. Hold the Sat button until all the mode buttons light up

4. Enter a number between 1 and 15 that is not the number noted in step 2

5. Press the # key (Sat button should blink three times upon release of the # key)

6. Press the Record key

Fixing Wordpress Upgrade Errors [Table 'wp_terms' doesn't exist]

July 8th, 2009 derek No comments

If you have ever seen one of these exceptionally annoying errors populating your apache logs after upgrading wordpress:
WordPress database error Table 'database.wp_terms' doesn't exist for query SELECT t.*, tt.* FROM wp_
terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.
taxonomy IN ('category') AND ( t.term_id <> 1 ) ORDER BY t.name ASC made by require, require_once, include, get_sidebar, locate_template, load_template, require_once, wp_list_cats, wp_list_categories, get_categories, get_terms

There is a relatively easy fix, however, finding it was not so easy.

I found a pointer here:

http://osterman.com/wordpress/2007/10/15/wordpress-database-error-table-wp_terms-doesnt-exist

However, this didn’t work for me. The page always mentioned the database was already upgraded. Digging around on the Wordpress Codex, revealed this handy link about forcing a database upgrade.

Here is what I did to fix the problem

Open mysql and select the db:
[root@host ~]# mysql -u dbuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15762
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use wordpress;

Database changed

Next change the value of the DB to a previous version or wordpress (check here for a list of values).
mysql> update wp_options set option_value='6124' where option_name="db_version";

Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql>

Next, run the upgrade script:

http://domain/wordpress/wp-admin/upgrade.php

If you receive errors, change the db_version to a different value and try again.

Categories: General, Tech Tags: , , ,

Nice way to clean out Gallery2 spam comments.

March 29th, 2009 derek No comments

Nice way to quickly cleanout Gallery2 spam comments.
>
mysql> delete ce, e, co from g2_ChildEntity ce, g2_Entity e, g2_Comment co where ce.g_id=e.g_id and e.g_id=co.g_id and e.g_entityType=’GalleryComment’ and (co.g_comment like ‘%[url=http://%’)
-> ;
Query OK, 930651 rows affected (1 min 5.68 sec)

mysql>

Categories: Tech Tags: ,