Setting up swap space ..
Oct 17, 2008 in Linux
# dd if=/dev/zero of=/swapfile bs=1M count=128 # mkswap -L swapfile /swapfile # swapon /swapfile [...] # swapoff /swapfile # rm /swapfile
Oct 17, 2008 in Linux
# dd if=/dev/zero of=/swapfile bs=1M count=128 # mkswap -L swapfile /swapfile # swapon /swapfile [...] # swapoff /swapfile # rm /swapfile
Oct 10, 2008 in Microsoft, Windows
To unmount a USB memory stick from a batch (or some other)
script in Windows, use the DevCon utility here:
Oct 09, 2008 in Perl
#!/usr/bin/perl -w
use strict;
sub showHash($)
{
my(%hashh) = %{$_[0]};
my($temp);
foreach $temp (keys(%hashh)) { print “$temp=” . $hashh{$temp} . “\n”; }
print “\n”;
}
sub higherLevel($)
{
my(%hashh) = %{$_[0]};
showHash(\%hashh);
}
my %hash = (”1″=>”one”,”2″=>”two”,”3″=>”three”);
higherLevel(\%hash);
Oct 09, 2008 in Perl
From http://www.cs.cf.ac.uk/Dave/PERL/node61.html ..
@array1 = (1..5);
@array2 = ("A".."E");
firstSub( \@array1, \@array2); # One
sub firstSub {
my($ref_firstArray, $ref_secondArray) = @_; # Two
print("The first array is @{$ref_firstArray}.\n"); # Three
print("The second array is @{$ref_secondArray}.\n"); # Three
}
Oct 07, 2008 in Perl
#!/usr/bin/perl
use strict;
{ package SomeClass;
sub new {
my $class = shift;
my $self = {
v1 => undef,
v2 => undef,
};
bless($self, $class);
return $self;
}
sub setV1($) {
my $self = shift;
if (@_) {
$self->{v1} = shift
}
return $self->{v1};
}
sub getV1() {
my $self = shift;
return $self->{v1};
}
}
main();
sub main() {
my $foo = SomeClass->new();
$foo->setV1(38);
print $foo->getV1() . "\n";
}
To view a tree of USB devices in Linux, install ‘usbview’ (apt-get install usbview)
or get the ‘usbtree’ script from here:
http://www.linux-usb.org/usb2.html
Furthermore, if /dev/bus/usb/devices is not enabled, tweak
/etc/init.d/mountdevsubfs.sh to do so. See here for more info:
https://bugs.launchpad.net/debian/+source/usbview/+bug/156085