Supermind Search Consulting Blog 
Solr - Elasticsearch - Big Data

Dynamic facet population with Solr DataImportHandler

Posted by Kelvin on 02 Aug 2010 | Tagged as: programming, Lucene / Solr / Elasticsearch / Nutch

Here's what I'm trying to do: Given this mysql table: CREATE TABLE `tag` ( `id` INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, `name` VARCHAR(100) NOT NULL UNIQUE, `category` VARCHAR(100) ); INSERT INTO tag (name,category) VALUES ('good','foo'); INSERT INTO tag (name,category) VALUES ('awe-inspiring','foo'); INSERT INTO tag (name,category) VALUES ('mediocre','bar'); INSERT INTO tag (name,category) VALUES ('terrible','car'); and this […]

Xpath select by node text value

Posted by Kelvin on 31 Jul 2010 | Tagged as: programming

//someparent/somenode[text() = 'foobar']

A kick-ass PHP mysql escaping function

Posted by Kelvin on 31 Jul 2010 | Tagged as: programming, PHP

Hate calling mysql_real_escape_string repeatedly in your code? Use these functions cobbled together from http://www.php.net/manual/en/function.mysql-real-escape-string.php /** * USAGE: mysql_safe( string $query [, array $params ] ) * $query – SQL query WITHOUT any user-entered parameters. Replace parameters with "?" * e.g. $query = "SELECT date from history WHERE login = ?" * $params – array of […]

Hacking Django to set ENGINE=InnoDB for MySQL

Posted by Kelvin on 27 Jul 2010 | Tagged as: programming

In order to get Django to output innodb tables in MySQL, you either need to 1. output ALL tables as innodb or 2. selectively issue alter table commands The first is sub-optimal (MyISAM is faster for query-dominant tables) and the second is a pain and hack-ish. Here's a simple patch to Django 1.1 to allow […]

SIGSEGV from memcpy+0x1c

Posted by Kelvin on 01 Jul 2010 | Tagged as: programming

JVM errors are mysterious and often difficult to reproduce, much less fix. I've been getting some SIGSEGV from memcpy+0x1c JVM errors recently in long-running crawl processes, and in attempting to hunt down their cause, stumbled upon this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6366468 The interesting bit is here, from Thragor: It seems I have found a way to reproduce this […]

TokyoCabinet PHP Extension

Posted by Kelvin on 29 Jun 2010 | Tagged as: programming, PHP

I guess no one really interfaces directly with TokyoCabinet from PHP. For most cases, TokyoTyrant is probably more appropriate. If you do need to though, check out http://code.google.com/p/1bacode/source/browse/trunk/front-end/extension/?r=12#extension/tokyocabinet. Works great, and was surprisingly hard to find. See my other post for help compiling the PHP extension.

How to compile a PHP extension

Posted by Kelvin on 29 Jun 2010 | Tagged as: programming, PHP

Short answer sudo apt-get install php5-dev cd /path/to/extension The extension directory must have a minimum of 1. config.m4 2. php_sample.h 3. sample.c phpize ./configure make sudo make install Now add the dynamic extension to your php.ini files in /etc/php5. ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; ; If you wish to have an extension loaded […]

BuddyPress Activity Stream as Home Page results in Page Not Found

Posted by Kelvin on 23 Jun 2010 | Tagged as: programming

This is most likely the result of a deliberate or (in my case) accidental upgrade to WordPress 3.0, with which BuddyPress 1.2.4 is NOT compatible with. The straightforward answer: downgrade WordPress 3.0 back to 2.9. 1. SSH into the server 2. Download WordPress 2.9 3. Go to the installation directory where WordPress 3.0 is installed. […]

How to migrate a subversion repository to Dreamhost

Posted by Kelvin on 23 Jun 2010 | Tagged as: programming

I recently decided to host a subversion repository that was located on another server to Dreamhost. Here are the steps: 1. LOCAL STEP: Create your Dreamhost svn repository via CPanel. 2. LOCAL STEP: Verify that your new svn repository has been created. cd /tmp svn co http://svn.mydreamhostserver.com/project 3. REMOTE STEP: SSH into your dreamhost account […]

Use Proxoid with subversion with proxychains

Posted by Kelvin on 17 Jun 2010 | Tagged as: programming

Proxoid doesn't support subversion methods. The workaround on Linux is simple: use proxychains! Install proxychains sudo apt-get install proxychains Setup your proxychains.conf mkdir ~/.proxychains gedit ~/.proxychains/proxychains.conf Paste this into the text editor DynamicChain tcp_read_time_out 15000 tcp_connect_time_out 10000 [ProxyList] http 127.0.0.1 8080 Now instead of running svn up run proxychains svn up Done!

« Previous PageNext Page »