Page 19 of 28
Remote Oracle Connections
Like many ‘enterprise solutions,’ Oracle is a despicable piece of software that has a tendency to eat copious amounts of memory and processor time. Alas, ranting on my hatred of enterprise hardware and software is not the subject of this post. A big part of enterprise applications is that they are usually accompanied by abundant amounts of documentation, sadly, much of it useless. The tomes (physical or electronic) included often overlook the simplest of functions delving straight into the guts of the system and focusing on minutiae. Despite the fact that everyone needs to perform these elementary tasks that are buried deep within the documentation, it’s often difficult to find a solution by searching the internet. My search for how to use sqlplus
to connect to a remote database (I had previously only used it locally, on the server running Oracle) turned up a few results and led me to this solution:
~$ sqlplus uname/pass@[//hostname[:port]/]sid
Really, it’s quite straightforward.
Koni Yellows
I installed Koni Adjustable Sport shocks on my M3 a few months ago and before even driving the car I turned them to full stiff, like ya do. Who want’s anything but the most hardcore? I finally got around to turning them down this past week (it’s not like I go to the track all that often) and what a difference that makes! Koni Yellows on full-soft are just like stock shocks and with a few turns under the hood, they become a good bit more go-kart like.
Introduction to Genres of Electronic Music through Remixes
Undoubtedly, the most comprehensive map to electronic music is Ishkur’s Guide which covers every genre, even reaching out to Rap, much of which contains electronic elements. Ishkur’s Guide is certainly worth perusing if you’re interested in electronic music, but is a bit cumbersome for someone simply looking for an overview. The best way to get a quick understanding of the different genres within electronic music is to hear the same song presented through different interpretations. Madonna’s Like a Prayer fits this bill nicely, as it has been remixed by numerous artists in a myriad of styles.
The original version of the song is a pop-styled electronic-backed vocal ensemble with a number of distinct elements. Taking note of the song’s components is important to understanding which parts the remixes keep, which they alter and what from the song is tossed out completely. The archetype begins with an odd riff from a guitar that isn’t heard anywhere else in the song, nor in any remixes; such introductions are often thrown to the wayside when songs are remixed. From there, the song progresses with an ethereal chorus backing Madonna’s airy and LOVING vocals which sets the mood. From there, the an 80’s electric bass and drum set are added, which come and go throughout the balance of the tune. As you will hear in the remixes all of the elements of the song will be subject to change.
First is a version by Mad'House, a short-lived ensemble which only made remixes of Madonna songs. I would describe this mix as having a house feel, which is certainly in keeping the the group’s intentions. It adds a harder base beat, electronic bass kicks and replaces Madonna’s vocals with those of Buse Ünlü, the group’s vocalist. This track keeps true to the feeling of the original, while forgoing the instrumentation in pop princess’ version entirely.
Break out your subwoofer, because the club mix is here. Club music is, hence the name, intended for dance clubs, which accounts for the overpowering bass kick. Beyond Mad'House’s mix, this track brings the aforementioned bass beat, more heavily altered vocals and transforms the choir to make them sound much more anthem-esque. Club mixes are all about big sounds in a vain attempt to keep from being drowned out in the hustle of late-night dancing and in doing so, share the self righteousness that Anthem Trance (see Ishkur’s guide) is known for; all tension and power without any release.
HI-NRG is the music of raver kiddies. If you’ve ever seen the movie Go, you know what raves are about. Lots of drugs, ecstacy in particular, sex and dancing…all..night…long. The dancing, not the sex. Really. Only when rolling would one feel the need to dance to such fast-paced music for 10 hours straight. 150 beats per minute is the minimum here, folks. A continuous rising and falling ethereal piano is a staple of HI-NRG, as are the high-pitched vocals replacing the calmer and more subdued singing of Madonna. Anabolic Frolic’s Happy2bHardcore series of mix albums is characteristic of the genre.
150 beats per minute, no less. Deafening bass beats, chipmunk vocals and hard charging melodies. These are the tenets of gabber. The original song? Yeah, it’s in there somewhere, represented in the tings, thumps and industrial sounds pervasive within the gabber genre. When someone who doesn’t enjoy electronic music (or, more often, thinks they won’t like it) describes “techno,” this is what a sketch artist would build from their description. In reality, however, gabber is on the fringe of the electronic genre, the bastard child of industrial and HI-NRG.
You probably wouldn’t have guessed that someone could make Like a Prayer sound evil and depressing, but here it is. Replace the vocals with those of an angsty adolescent, simplify the beats down to electronic drum hits, replace the melody with a spartan version from a machine and you’ve got yourself darkcore.
Your current security settings do not allow this action
Windows Server 2003 (or maybe it’s just Internet Explorer 7) has a number of wonderful features that will make every day a cheery adventure. Among them are draconian security policies that, beyond making little sense, are controlled from places they don’t belong. Apparently a mapped network share is considered a web page. Who would have guessed that? Well, if you get the error in the title when trying to run or even right-click something from a share on the network, it can be fixed from Internet Options. From IE7, press ‘alt’ to show the menu, go to Tools>Internet Options. In the Internet Options window, go to the security tab, select the 'Internet’ zone and click 'Custom’ near the bottom right. In the resulting window under 'Miscellaneous’, set things that say 'disable’ to 'prompt’ or 'enable’. I’m not sure which one controls the above mentioned behavior, but it ought to be fairly obvious which are involved; just allow them.
Wikipedia recent changes and watchlist
Mediawiki got a new feature recently, pages shown on your watchlist or the recent changes page now show the number of bytes added (green) or removed (red) from the page.
psad on Ubuntu
psad
(PortScan Attack Detector) is a useful tool for detecting portscans against a system and, optionally, blocking the offending host. To use psad
you configure your firewall to drop and log all packets that are not specifically allowed, i.e., those that are handled by services on the machine. The configuration for psad
can cause a little bit of grief because it depends on some quite particular firewall setup and, if you don’t want massive logfiles, some editing of syslog.conf
. To begin with, you’ll need to install psad
which can be done via apt:
$ sudo aptitude install psad
There are some configuration details that should be changed in /etc/psad/psad.conf
, most notably the hostname and email variables. Make sure that if you set the email address to something other than one of the accounts on the machine that your mail daemon is setup to deliver mail to the outside world. Next, setup the firewall to accept packets for the services that your machine runs then drop and log all others. In this example, the machine runs a web server (port 80) and ssh (port 22):
$ sudo iptables -F INPUT
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -A INPUT -i lo -j ACCEPT
$ sudo iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
$ sudo iptables -A INPUT -j LOG --log-prefix "DROP " --log-level debug
$ sudo iptables -A INPUT -j DROP
Which should probably be put into a script that will be run on startup. Finally alter the /etc/syslog.conf
so that your /var/log/messages
doesn’t fill up as the second-to-last rule above writes a logline each time a packet is dropped. First, I changed the line that controls kern.log
from this:
kern.* -/var/log/kern.log
to this:
kern.info;kern.!debug -/var/log/kern.log
and adding this line at the end:
*.=debug |/var/lib/psad/psadfifo
The first syslog change keeps your /var/log/kern.log and /var/log/messages from getting a line each time a packet is dropped (which is quite often) and the latter change sends all those dropped packet notifications (which are at the ‘debug’ loglevel) to psad.
Windows Server 2003 Updates
Dear Microsoft,
I am running Windows Server 2003 on, get this, a server! I know that I haven’t restarted since running an update, please stop telling me.
Thanks,
Admins Everywhere
MD5 Digests in Java
File hashes have a multitude of uses and MD5 is, despite the fact that weaknesses have been found in the algorithm, still very useful and widely employed. Creating MD5 digests in Java is quite easy, but the documentation for MessageDigest is a little bit tricky. Here is a simple method that takes in a string of input and returns the hash of the string.
public static String md5(String input) {
// Compute the MD5 digest of the passed String
MessageDigest algorithm = null;
try {
algorithm = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) { e.printStackTrace(); }
algorithm.reset();
byte[] hash = algorithm.digest(input.getBytes());
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // Convert it to a String StringBuffer ret = new StringBuffer(); for (int x = 0; x < hash.length; x++) { String hexString = Integer.toHexString(0xFF & hash[x]); if (hexString.length() == 1) hexString = "0" + hexString; ret.append(hexString); // Add the dashes if (x == 3 || x == 5 || x == 7 || x == 9) ret.append("-"); } //for return ret.toString().toUpperCase(); |
} //md5
Perl Just Like sed
I came across a post today in which someone mentioned that they used Perl for text replacement and, despite the simplicity of the solution, I hadn’t ever thought of it. By simply using three options with the perl
command, you can run a quick script to do regex replacement in a file. The -p
option tells Perl to treat your script as a loop, reading in from the diamond (<>
) operator. -i
makes it do in-place editing of files and -e
allows you to script from the command line. For example:
~$ perl -p -i -e "s/foo/bar/g" baz.txt
The above command will replace ‘foo’ with 'bar’ throughout the file 'baz.txt’
Writing your own Perl modules
Making your own Perl modules is actually really easy, only involving a few special alterations to a script and an environment variable to make them easy to utilize. To make Perl modules, you first need to understand Object Oriented Perl, so if that’s new to you, check out Tom’s object-oriented Perl Tutorial. Onward.
For this example, I’ll just use a simplified version of the ‘Person’ class from the above-mentioned tutorial:
package Person; use strict;sub new { my $self = { NAME => undef, AGE => undef, PEERS => [], }; bless($self); return $self; } sub name { my $self = shift; if (@) { $self->{NAME} = shift } return $self->{NAME}; } sub age { my $self = shift; if (@) { $self->{AGE} = shift } return $self->{AGE}; } sub peers { my $self = shift; if (@) { @{ $self->{PEERS} } = @ } return @{ $self->{PEERS} }; } 1;
To begin with, let’s make a directory where you will put all the modules you make; say, ~/perl-modules
. Take the code above and save it as Person.pm
in your new perl-modules
directory. Notice the .pm
extension that perl
will look for when you go to use
this module. Now, we need to let perl
know where to look for the modules you write. When you ask for a Perl module by writing use foo
in a script, perl
, by default, it looks in a bunch of system directories and in the current directory for anything named foo.pm
. You can tell it to look other places by adding to the PERL5LIB
environment variable. For ease, I simply put this into my .bashrc
:
export PERL5LIB=~/perl-modules
Now, anywhere that I write a perl script, I can simply say use Person
and the Person class will be grabbed from my perl-modules
directory.
Another thing to keep in mind when writing modules is that you should load the Carp
module and use the functions carp
and croak
rather than warn
and die
respectively. Carp
’s functions produce errors that reference the proper context in the user’s code when an error occurs, rather then saying there is a problem in your module.