Fixing DirectMusic on some 64-bit Windows versions
by CyberShadow on Jul.14, 2011, under Random
If you’re getting error messages such as “No sound device detected. Sounds might not play.” or “Failed to create Direct Music Performance.” when running Game Maker games, the following may help you. Here’s what I did to fix them on my system:
- Download the DirectX redistributable
- Unpack it
- Unpack dxnt.cab
- In dmusic.inf, search and replace “HKCR,” with “HKCR,Wow6432Node\”
- Install the edited dmusic.inf (from the right-click menu)
- Copy missing DLLs (dm*.dll) to %WINDIR%/SysWOW64.
That’s it! The same method could work for other DirectX components as well.
Referrer spam
by CyberShadow on Feb.04, 2011, under Website
I got tired of pesky referrer spambots junking up my logs, so I decided to find a way to get rid of them. Turns out, almost all referrer spam on my blog is generated with a small number of User-Agents:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.221.7 Safari/532.2
Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1
Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729)
All of these refer to outdated browsers, very rare configurations (the ones with non-English language codes), and genuinely fake UA strings.
Programmatically print SWF
by CyberShadow on Jan.17, 2011, under Code
I was looking for a way to programmatically print a SWF file. The stand-alone Flash player has an option to print a SWF, however there is no shell action registered for it.
After looking around a bit, I found that probably the easiest way is to use the ActionScript PrintJob API: (continue reading…)
Wolfram|Alpha IRC script
by CyberShadow on Jan.02, 2011, under Code
If you’re hanging out on the same GameSurge channel(s) as me, you probably know about Byte‘s tehh6x bot. I’ve recently added a Wolfram|Alpha command to it, allowing it to query W|A and return the results in a somewhat IRC-compatible format. Here’s the code:
(continue reading…)
Wikipedia Watchlist RSS
by CyberShadow on Jan.02, 2011, under Code
Wikipedia’s Watchlist has a RSS feed, which is a nice way to keep track changes on your watched articles. However, the RSS feed doesn’t seem to conform to the RSS standard, and confuses some feedreaders – notably, Opera M2.
Here’s a simple PHP script, which you can place on your website, that’ll fix the RSS feed. You’ll need to give it the URL to your RSS feed (which you can get by subscribing to your watchlist), since it contains your secret API key.
<?php
$rss_url = 'http://en.wikipedia.org/w/api.php'
. '?action=feedwatchlist'
. '&allrev=allrev'
. '&hours=72'
. '&wlowner=YOUR_USERNAME_HERE'
. '&wltoken=YOUR_API_KEY_HERE'
. '&feedformat=rss';
$feed = `wget -q -O - '$rss_url'`;
$rows = explode("\n", $feed);
header('Content-type: application/rss+xml');
foreach ($rows as $row)
{
if (strpos($row, '<item>')!==false)
$alldata = '';
if (strpos($row, '<guid>')!==false)
continue;
$alldata .= $row;
if (strpos($row, '</item>')!==false)
$row = '<guid isPermaLink="false">'
. md5($alldata)
. "</guid>\n"
. $row;
echo $row . "\n";
}
Color grep for Windows
by CyberShadow on Sep.12, 2010, under Random
Looking for color grep for Windows? I was. I didn’t find exactly what I was looking for; instead, I found something better.
ack is a tool like grep, designed for programmers with large trees of heterogeneous source code.
Worms Armageddon Devblog
by CyberShadow on Jul.28, 2010, under Website
We’ve launched the Worms Armageddon Beta Update Develeopment Blog. Visit it to get the latest news about W:A development.
data.d – unmanaged memory wrapper for D
by CyberShadow on Jul.15, 2010, under Code
I have written a module containing classes to manage raw data in external memory. It provides semantics similar to built-in void[] arrays, but has the following advantages:
- Faster allocation and deallocation, since memory is requested from the OS directly as whole pages
- Greatly reduced chance of memory leaks due to stray pointers
- Overall improved GC performance due to reduced size of managed heap
- Memory is immediately returned to the OS when data is deallocated
Source and more info here: http://github.com/CyberShadow/data.d
Import Wikipedia page history to git
by CyberShadow on Jun.16, 2010, under Code
I’ve written a small tool which downloads the history of a Wikipedia article, converts it and imports it into a new git repository. The main motivation behind writing it is being able to perform a per-line blame of the article’s history. I had tried levitation, but that tool seemed to be oriented towards large imports (or it might just be buggy), as it attempted to create huge binary files and ran longer than my patience would allow when I gave it the history of just one article. Also, I wanted the tool to take care of the downloading and importing part – so I could be one command away from a git repository of any WP article.
The tool can be made faster (all the XML and string management stuff adds an overhead), but right now it’s fast enough for me. One thing that can be optimized is making it not load the entire input XML into memory – it’s possible to do the conversion by “streaming” the XML. Another current limitation is that it’s currently hard-wired to the English Wikipedia.
Requires curl and (obviously) git. You’ll need a D1 compiler to compile the code.
Get it here: http://github.com/CyberShadow/wp2git
GraphStudio fork
by CyberShadow on Jun.07, 2010, under Code
I have made a few improvements to GraphStudio, the open-source GraphEdit clone:
- The limit for text entry in certain combo boxes has been removed
- Basic XML graph saving support has been added (only filters and connections at the moment)
- Pins are now referred by their indexes in XML rather than by ambiguous names
- Added command-line /render parameter, which loads a graph, plays it and exits
XML support and /render allow scripted generation and rendering of XML graph files.