You might have stumbled upon some IBM developerWorks articles titled "Cultured Perl" while googling for random things. I think it's awesome and that it isn't linked to enough. Just a few weeks ago the latest article came out, Cultured Perl: Storage management on Amazon S3, which is well written and up-to-date with the latest technologies.
Thank you, Cultured Perl!
So I was right, I completely messed up the previous example and it wasn't electrified by Creox at all. But I've rectified this situation, and for your listening pleasure (pain?), here is a smaller snippet of just the guitar part of the song, before-and-after.
Original acoustic guitar
(mp3 file)
Electrified by Creox
(mp3 file)
I was playing with Creox the other day, which can make an acoustic guitar sound electric (amongst other things). I recorded a quick song... but it doesn't sound nearly as electric when I listen to it now as it did when I first recorded it (and now I wonder if I even had my Jack settings right for recording what I was hearing...). But it did end up with a fun crackly sound on the voice I think. Listen for yourself:
"Oh my baby" (mp3 file)
And it gave me an excuse to add an mp3 player plugin :)
In the class I'm taking (Intro to Data Mining) we get to implement a classifier. Alas... we must use either C++ or Java. I haven't programmed in either for quite a few years, and even with further pursuit I'm not allowed to use OCaml.
That's OK! Best to stretch my mind out a bit. I'm afraid I'm getting rusty at being multi-lingual in my old age anyway, so this is good exercise. First thing first, I have to read in the training data. But best start with the basic Hello World even before that. Google... I figure I'll start with the basics, and now I have:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}I don't even remember doing that std namespace thing last time I programmed in C++. Oh well. It runs! So from there I just keep searching and adding...
... and just like magic I am now reading the file, parsing it, and counting the frequency of items. Ahh the hive mind! Here's the result... it's messy and unstructured but damn... it works!
// Compile: g++ -o demo main.cpp
#include <iostream>
#include <fstream>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <map>
using namespace std;
typedef map<string, int> ItemSet;
int main() {
cout << "Hello World!" << endl;
ifstream fin("data/train1.txt");
// ifstream fin("data/small_train.txt");
string s;
vector< vector<string> > d;
ItemSet itemset;
while(getline(fin,s)) {
vector<string> row;
// cout << "Read from file: " << s << endl;
boost::split(row, s, boost::is_space());
d.push_back(row);
}
vector< vector<string> >::iterator d_iter;
vector<string>::iterator row_iter;
for(d_iter = d.begin(); d_iter != d.end(); d_iter++) {
cout << "[ ";
for(row_iter = d_iter->.begin(); row_iter != d_iter->end(); row_iter++) {
cout << *row_iter << " ";
itemset[*row_iter]++;
}
cout << "]" << endl;
}
cout << "Itemset:" << endl;
ItemSet::iterator itemset_iter;
for(itemset_iter = itemset.begin(); itemset_iter != itemset.end(); itemset_iter++) {
cout << itemset_iter->first << " : " << itemset_iter->second << endl;
}
return 0;
}I'll keep going like this for a bit, but then I'll start organizing into actual objects and such. There is a good chance that I'll switch data structures, or perhaps not even bother keeping all this in memory. Most likely I'm also violating some other C++ socio-political norms. Fun!
I've got to get this idea written down so that I can go back to doing other things... it is too distracting as-is.
In a nutshell -- more or less Devel::Trace except that at each step you record all of the lexical (global?) state. Then you can not only see the full execution history of your program, but the value of every variable at every point.
Now of course from the idea comes all of these questions -- do we store all that or just some of it (just what changes). Do we only keep local lexical scope at each step since the rest can be reconstructed? How do we record this... do we summarize it somehow? And so on.
But ignoring all that... the next idea that comes to my mind is to toss this into CGI::Inspect as a module, so that you can use the GUI browse not just the current lexical state (there is already a plugin for that), but also the complete historical state as well.
I got the idea from the Omniscient Debugger, but I'd actually seen it before in its more highly evolved form in the OCaml Debugger. The OCaml Debugger doesn't have to actually save all that state though, since in a lovely functional language you can actually just reconstruct the previous state (I believe). Still.
(If you're still reading and want something even MORE insane, then your homework is to use Nothingmuch's delimited continuations in perl and make it so that you can actually resume any of the historical states).
Code might eventually show up at http://thelackthereof.org/projects/perl/Devel-TraceState or perhaps Devel-TraceState.
META INFORMATION: This is the technical blog and wiki of Brock Wilcox (awwaiid). Entries focus on my current projects, interests, and sometimes life events. If you'd like you can check out the list of All Entries or the RSS Feed. I also have a LiveJournal syndication feed for LJ friends.