Category: Open Sourced

How to Set Up A Microphone With Virtual DJ 7 (and the Hercules DJ Control MP3 e2)

I’m just putting this here so I won’t forget it and have to troll the virtualdj.com message boards in the future. Hopefully you’ll find it useful as well.

Basically, in Virtual DJ 7, you need to map your mic to a deck or decks in order to use your microphone with Virtual DJ.

Go to Config, Skins, and then choose a four deck skin. I have a big monitor, so I use the 1440x1024 one. Then go to Mappers. I used

deck 3 linein ‘mic’ & deck 4 linein ‘mic’

(replace the curly apostrophes with the straight ones, if you copy/paste) to map the “Scratch” button on my Hercules DJ Control MP3 e2 to enable the mic on both decks, so it doesn’t matter which side the crossfader is at. If you don’t have a controller, you can use another key: “M”, for example.

That ought to be it - let me know if you have any questions. Note: if your mic isn’t working in Windows in general, then it won’t work in Virtual DJ. Make sure to set it up in Windows first, and to test it with the sound recorder program or Audacity, before you start trying to get it to work in Virtual DJ.


Posted on Oct 24, 2011 - 12:23 AM

Pipe Delimited U.S. State List

Copy/paste this if you need a pipe-delimited U.S. state list for some reason:

AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC

|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY

(Inspired by Trevor Davis’ ExpressionEngine form builder tutorial.)


Posted on Apr 25, 2011 - 02:44 PM

rsync from Linux to a Windows partition, ext3 to NTFS

Just figured out a solid way to use rsync to efficiently sync data from a Linux host (ext2, ext3 or ext4) to a Windows-based NTFS filesystem.

rsync -rltDvu --modify-window=--progress --delete /mnt/sata /media/windows

/mnt/sata here is the Linux directory to be backed up, and /media/windows is the NTFS-formatted Windows destination.

The crucial part is “—modify-window=1”. Because Windows and Linux use slightly different formats for file creation/modification timestamps, a regular rsync operation won’t recognize identical files between ext3 and NTFS filesystems. The “—modify-window=1” option tells rsync to allow for a 1 second difference in timestamps between files; once rsync knows to be slightly less literal in its definitions of “same”, it works quite well.

Hope someone finds this useful. I’m using it to make a backup copy of my MythBuntu media (ripped movies and music) to an external hard drive (formatted with NTFS instead of ext3 or 4 so I can easily share it with friends).


Posted on Sep 05, 2010 - 08:34 PM

Search function for the User Groups module for ExpressionEngine

I wrote a quick search function for the User Groups module for ExpressionEngine. It searches groups (names and descriptions) as well as topics and topic replies. It respects group types as well - results from private groups will not show up in the topic or topic replies search results. You can download it here or see it here.

Ideally it’d be rewritten to use MySQL’s full-text search, but the way it is now works fine for my purposes.

Let me know if you have any questions or comments. I’ll probably end up updating it as new versions of the User Groups module come out.

The search form I use with it is below:

<form id="group_search" method="post" action="{homepage}/groups/search/">
<
input type="text" id="group_search_box" name="group_search_box" />
<
input type="hidden" id="member_id" name="member_id" value="{member_id}" />

<
input type="radio" name="search" value="search_discussions" id="search_discussions" checked>Discussions
<input type="radio" name="search" value="search_groups" id="search_groups"Groups<br />
<
input type="submit" value="Submit"/>
</
form

Posted on Nov 19, 2009 - 06:15 PM

How to create categories from the frontend in ExpressionEngine

I figured out a nifty way to let users on the frontend create categories in the backend. (This isn’t currently possible with the SAEF.) It’s a little bit of a hack, but it works - if you have improvements upon it, please let me know.

You’ll need two templates: one with the form that the user submits with the category name and description (I’ll call this the index template), and one with PHP enabled (parsed on input, NOT output), which I’ll call the create template. In this instance, I’m creating a groups equivalent for users based on categories.     

Here’s the entire contents of my index template:

{if logged_in}
<form action="{homepage}/groups/create/" method="post" name="group_create">
<
p>Group Name
<input type="text" name="group_name">
<
br />
Group Description
<
input type="text" name="group_description">
</
p>
<
input type="submit" value="Submit" />
</
form>
{/if} 

And here’s what I have in the create template:

<?php

global $DB$REGX;

$_POST $REGX->xss_clean$_POST );

$cat_query $DB->query("SELECT AUTO_INCREMENT FROM information_schema.tables WHERE 
table_name='exp_categories' AND TABLE_SCHEMA='your_db_name' ORDER BY Auto_increment DESC LIMIT 1"
);
foreach(
$cat_query->result as $row){}

$cat_id 
$row['AUTO_INCREMENT'];
$site_id "1";
$group_id "4";
$parent_id "0";
$cat_name=$_POST['group_name'];
$cat_title $REGX->create_url_title($cat_name);
$cat_description =$_POST['group_description'];
$cat_image "";
$cat_order "0";

//Creates the SQL query: see http://expressionengine.com/docs/development/usage/database.html
$data = array('cat_id' => $cat_id'site_id' => $site_id'group_id' => $group_id,
 
'parent_id' => $parent_id'cat_name' => $cat_name'cat_url_title' => $cat_title,
 
'cat_description' => $cat_description'cat_image' => $cat_image'cat_order' =>
 
$cat_order);
 
$sql $DB->insert_string('exp_categories'$data);

//echoes the SQL query instead of inserting it - uncomment $DB->query($sql); to make it live.
echo $sql;
//$DB->query($sql);
?> 

A couple of notes: I hard-coded the group_id, site_id and parent_id as well as a couple of other fields, because that’s how I wanted the categories created by users to be. Also, I’m certain there’s a better way to get the next cat_id for the query than using this ridiculous SQL query:

SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name=‘exp_categories’ AND TABLE_SCHEMA=‘your_db_name’ ORDER BY Auto_increment DESC LIMIT 1”);

If you know of a better way, let me know - I’m all ears. In the query, be sure to replace “your_db_name” with your actual database name.

Needless to say, be careful where you use this: you don’t want a spam bot or malicious user coming through and adding a bunch of junk to your categories table.

Updated 4/17/2010 - Added