panopticum array for illustrator 1.0

panopticum array for illustrator 1.0

Sponsored Links
Sponsored Links

panopticum array for illustrator 1.0

No.
Title
Catelory
Price
License
Expand All
1
System -> Monitoring
GPL GNU General Public License
Array-util project was tested on: It gives you an overview of all logical and physical drives, including basic information on sizes etc. It is supposed to become a configuration tool in the future. Note that it only works with SmartArray driver version 1.0.1+

Array-util project was tested on:

· Compaq Proliant 2500 with SmartArray 2DH
· Compaq Proliant 1600 with SmartArray 2DH
· Compaq Proliant ML350 with an additional Smart Array 431-Controller (thanks to Christian Bauer)
· Compaq Proliant DL380 with Internal SmartArray controller (thanks to Jason Sturgeon)
· Compaq Proliant ML370 with Integrated SmartArray (thanks to Brian Rossmeisl)
· Compaq Proliant 5500 with a SmartArray 3200 (thanks to Andrew A. Neuschwander)
· Compaq Proliant 1850R with a SmartArray 3200 (thanks to Brian Towles)
· Compaq Proliant 6400R with a SmartArray 3200 (thanks to Brian Towles)
· Compaq Proliant 3000 with a SmartArray 3200 (thanks to Brian Towles)
· Compaq Proliant DL580 with two SmartArray 4200 (thanks to Dietmar Stein)

Known bugs:

Array-util: Blinking is not working on a DL380.
Array-util: Hotspares are not listed in array-util.
Array-util: There is no progess indicator of the rebuild process.

2
Programming -> Libraries
Perl Artistic License
Array::Utils module contains small utils for array manipulation.

SYNOPSIS

use Array::Utils qw(:all);

my @a = qw( a b c d );
my @b = qw( c d e f );

# symmetric difference
my @diff = array_diff(@a, @b);

# intersection
my @isect = intersect(@a, @b);

# unique union
my @unique = unique(@a, @b);

# check if arrays contain same members

if ( !array_diff(@a, @b) ) {
# do something
}

FUNCTIONS

unique

Returns an array of unique items in the arguments list.

intersect

Returns an intersection of two arrays passed as arguments.

array_diff

Return symmetric difference of two arrays passed as arguments

3
Programming -> Libraries
Perl Artistic License
Array::Iterator is a simple class for iterating over Perl arrays.

SYNOPSIS

use Array::Iterator;

# create an iterator with an array
my $i = Array::Iterator->new(1 .. 100);

# create an iterator with an array reference
my $i = Array::Iterator->new(@array);

# create an iterator with a hash reference
my $i = Array::Iterator->new({ __array__ => @array });

# a base iterator example
while ($i->hasNext()) {
if ($i->peek() < 50) {
# ... do something because
# the next element is over 50
}
my $current = $i->next();
# ... do something with current
}

# shortcut style
my @accumulation;
push @accumulation => { item => $iterator->next() } while $iterator->hasNext();

# C++ ish style iterator
for (my $i = Array::Iterator->new(@array); $i->hasNext(); $i->next()) {
my $current = $i->current();
# .. do something with current
}

# common perl iterator idiom
my $current;
while ($current = $i->getNext()) {
# ... do something with $current
}

This class provides a very simple iterator interface. It is is uni-directional and can only be used once. It provides no means of reverseing or reseting the iterator. It is not recommended to alter the array during iteration, however no attempt is made to enforce this (although I will if I can find an efficient means of doing so). This class only intends to provide a clear and simple means of generic iteration, nothing more (yet).

4
Programming -> Libraries
Perl Artistic License
Variable::Strongly::Typed::Array is a Perl module for strongly typed array.

SYNOPSIS

This class is utilized by Variable::Strongly::Typed - you dont access this directly

my @array_of_ints :TYPE(int); # Each slot must contain an int
my @array_of_rgb :TYPE(&red_green_blue); # my enumerated type

# ... and later ...

$array_of_ints[23] = 44; # Groovy
$array_of_ints[12] = yah; # croak!

# Return 1 if this val is RED, BLUE, or GREEN
# 0 otherwise
sub red_green_blue {
local $_ = shift;

/A RED z/xms || /A BLUE z/xms || /A GREEN z/xms;
}

$array_of_my_very_own_types[23] = 99; # croak!
$array_of_my_very_own_types[2] = BLUE; # OK!

5
Programming -> Libraries
Perl Artistic License
Array::Each::Tutorial - POD giving various examples how to use Array::Each.

SYNOPSIS

man Array::Each
man Array::Each::Tutorial

or

perldoc Array::Each
perldoc Array::Each::Tutorial

Overview

This tutorial contains only POD, so dont do this:

use Array::Each::Tutorial; # dont do this

Rather, simply read the POD (as you are doing). But first, please read the docs for Array::Each, because the whole scoop is there.

This tutorial is intended to augment those docs with examples showing situations where you might want to use Array::Each instead of other techniques.

EXAMPLES

Parallel Arrays vs. Using a Hash

First of all, use a hash. Its almost always the best solution if you want to associate a "key" with a "value". And there are modules available that will let you do wonderful things with hashes, like keeping the keys sorted or keeping them in the order they were added.

So given a hash, you might at some point want to do this:

my %h = ( a=>1, b=>2, c=>3, d=>4, e=>5 );
while( my( $k, $v ) = each %h ) {
# ... do something with $k and $v ...
}

On the other hand, if parallel arrays better implement your algorithm, then you may find you want to do something like this:

my @k = qw( a b c d e );
my @v = qw( 1 2 3 4 5 );
for my $i ( 0 .. $#k ) {
my( $k, $v ) = ( $k[$i], $v[$i] );
# ... do something with $k and $v (and maybe $i) ...
}

Using Array::Each, you could do the same thing this way:

use Array::Each;
my @k = qw( a b c d e );
my @v = qw( 1 2 3 4 5 );
my $obj = Array::Each->new( @k, @v );
while( my( $k, $v, $i ) = $obj->each ) {
# ... do something with $k and $v (and maybe $i) ...
}

If you dont need $i at all, you can leave it out, e.g.,

while( my( $k, $v ) = $obj->each ) {
# ... do something with $k and $v ...
}

If you have more than two parallel arrays, include them all in the call to new() and add as many "capture" variables as you need, e.g.,

my @k = qw( a b c d e );
my @v = qw( 1 2 3 4 5 );
my @p = qw( - + ~ = : );
my $obj = Array::Each->new( @k, @v, @p );
while( my( $k, $v, $p, $i ) = $obj->each ) {
# ... do something with $k, $v, and $p (and maybe $i) ...
}

6
Programming -> Libraries
Perl Artistic License
Array::PatternMatcher is a pattern matching for arrays.

SYNOPSIS

This section inlines the entire test suite. Please excuse the ok()s.

use Array::PatternMatcher;

Matching logical variables to input stream

# 1 - simple match of logical variable to input
my $pattern = AGE ;
my $input = 969 ;
my $result = pat_match ($pattern, $input, {} ) ;
ok($result->{AGE}, 969) ;

# 2 - if binding exists, it must equal the input
$input = 12;
my $new_result = pat_match ($pattern, $input, $result) ;
ok(!defined($new_result)) ;

# 3 - bind the pattern logical variables to the input list

$pattern = [qw(X Y)] ;
$input = [ 77, 45 ] ;
my $result = pat_match ($pattern, $input, {} ) ;
ok($result->{X}, 77) ;
Matching segments (quantifying) portions of the input stream
# 1
{
my $pattern = [a, [qw(X *)], d] ;
my $input = [a, b, c, d] ;

my $result = pat_match ($pattern, $input, {} ) ;
ok ("@{$result->{X}}","b c") ;
}

# 2
{

my $pattern = [a, [qw(X *)], [qw(Y *)], d] ;
my $input = [a, b, c, d] ;
my $result = pat_match ($pattern, $input, {} ) ;
ok ("@{$result->{Y}}","b c") ;

}
# 3
{
my $pattern = [a, [qw(X +)], d] ;
my $input = [a, b, c, d] ;
ok ("@{$result->{X}}","b c") ;
}
# 4
{
my $pattern = [ a, [qw(X ?)], c ] ;
my $input = [ a, b, c ] ;
my $result = pat_match ($pattern, $input, {} ) ;
ok ("$result->{X}","b") ;
}
# 5
{
my $pattern = [ qw(X OP Y is Z),
[
sub { "($_->{X} $_->{OP} $_->{Y}) == $_->{Z}" },
IF?
]
] ;
my $input = [qw(3 + 4 is 7) ] ;
my $result = pat_match ($pattern, $input, {} ) ;
ok ($result) ;
}
Single-matching:
Take a single input and a series of patterns and decide which pattern
matches the input:

# 1 - Here all input patterns must match the input

{
my @pattern ;
push @pattern, [ qw(X Y) ] ;
push @pattern, [ qw(22 Z ) ] ;
push @pattern, [ qw(M 33) ] ;

my $input = [ qw(22 33) ] ;

my $meta_pattern = [ AND?, @pattern ] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($meta_pattern, $input, {} ) ;
ok ($result->{Z},33) ;
}

# 2 - Here, any one of the patterns must match the input

{
my @pattern ;
push @pattern, [ qw(99 22) ] ;
push @pattern, [ qw(33 22) ] ;
push @pattern, [ qw(44 3) ] ;
push @pattern, [ qw(22 Z) ] ;

my $input = [ qw(22 33) ] ;

my $meta_pattern = [ OR?, @pattern ] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($meta_pattern, $input, {} ) ;
ok ($result->{Z},33) ;
}

# 3 - Here, none of the patterns must match the input

{
my @pattern ;
push @pattern, [ qw(99 22) ] ;
push @pattern, [ qw(33 22) ] ;
push @pattern, [ qw(44 3) ] ;
push @pattern, [ qw(22 Z) ] ;

my $input = [ qw(22 33) ] ;

my $meta_pattern = [ NOT?, @pattern ] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($meta_pattern, $input, {} ) ;
ok (scalar keys %$result == 0) ;
}

# 4 - here the input must satisfy the predicate
{
sub numberp { $_[0] =~ /d+/ }

my $pattern = [ qw(X age), [qw(IS? N), νmberp] ] ;
my $input = [ qw(Mary age), thirty-four ] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($pattern, $input, {} ) ;
ok (!defined($result));
}

# 5 - same thing, but this time a failing result ---
# not undef because it is the return val of numberp
{
sub numberp { $_[0] =~ /d+/ }

my $pattern = [ qw(X age), [qw(IS? N), νmberp] ] ;
my $input = [ qw(Mary age), 34 ] ;
my $result = pat_match ($pattern, $input, {} ) ;

ok ($result->{N},34) ;
}
Segment-matching:
Match a chunk of the input stream using *, +, ?

# 1 - * is greedy in this case, but not with 2 consecutve * patterns
{
my $pattern = [a, [qw(X *)], d] ;
my $input = [a, b, c, d] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($pattern, $input, {} ) ;
warn sprintf "X*RETVAL: %s", Data::Dumper::Dumper($result) ;
ok ("@{$result->{X}}","b c") ;
}
# 2 - X* gets nothing, Y* gets all it can:
{

my $pattern = [a, [qw(X *)], [qw(Y *)], d] ;
my $input = [a, b, c, d] ;

# if no bindings, add a binding between pattern and input
my $result = pat_match ($pattern, $input, {} ) ;
warn sprintf "X*Y*RETVAL: %s", Data::Dumper::Dumper($result) ;
ok ("@{$result->{Y}}","b c") ;

}
# 3 - samething , but require at least one match for X
{
my $pattern = [a, [qw(X +)], d] ;
my $input = [a, b, c, d] ;

my $result = pat_match ($pattern, $input, {} ) ;
warn sprintf "RETVAL: @{$result->{X}}" ;
ok ("@{$result->{X}}","b c") ;
}
# 4 - require 0 or 1 match for X
{
my $pattern = [ a, [qw(X ?)], c ] ;
my $input = [ a, b, c ] ;


my $result = pat_match ($pattern, $input, {} ) ;

ok ("$result->{X}","b") ;
}
# 5 - evaluate a sub on the fly after match
{
my $pattern = [ qw(X OP Y is Z),
[
sub { "($_->{X} $_->{OP} $_->{Y}) == $_->{Z}" },
IF?
]
] ;
my $input = [qw(3 + 4 is 7) ] ;

my $result = pat_match ($pattern, $input, {} ) ;

ok ($result) ;
}
# --- 6 same thing, but fail
{
my $pattern = [ qw(X OP Y is Z),
[
sub { "($_->{X} $_->{OP} $_->{Y}) == $_->{Z}" },
IF?
]
] ;
my $input = [qw(3 + 4 is 8) ] ;

my $result = pat_match ($pattern, $input, {} ) ;
warn sprintf "IF_RETVAL2: *%s*", Data::Dumper::Dumper($result);
ok ($result eq ) ;
}

7
Programming -> Assembler-Tools
MITX Consortium License
AVL Array is an STL-like container for C++ that fills the gap between vector (or deque) and list, providing both fast random access and fast insertion/removal, all O(log n).

This is not a map; in an avl_array, the "keys" always range from 0 to size-1, and they automatically change on insertion or removal. As a sequence container, like vector and list, it respects the order of elements.

Whats New in This Release:

· documentation
· source reorganized for readability
· compliance with higher standards
· performance improvements

8
Programming -> Libraries
Perl Artistic License
Tie::Array::RestrictUpdates can limit the number of times you change elements in an array.

SYNOPSIS

use Tie::Array::RestrictUpdates;

tie @foo,"Tie::Array::RestrictUpdates",1;
# Default limit is 1.
# Every element from the array can only be changed once
@foo = qw(A B C D E);
for(0..4) { $foo[$_] = lc $foo[$_]; }
print join("-",@foo);
# This will print A-B-C-D-E and a bunch of warnings

-or-

use Tie::Array::RestrictUpdates;

tie @foo,"Tie::Array::RestrictUpdates",[1,2,3,4];
# This forces the limits of the first 3 indexes
# This also forces any extra elements from the array to have a 0 limit
# and therefor be unchangable/unsettable
@foo = qw(A B C D E);
for(0..3) { $foo[$_] = lc $foo[$_]; }
for(0..3) { $foo[$_] = uc $foo[$_]; }
for(0..3) { $foo[$_] = lc $foo[$_]; }
for(0..3) { $foo[$_] = uc $foo[$_]; }
print join("-",@foo);
# This will print A-b-C-d and a bunch of warnings

9
Programming -> Libraries
GPL GNU General Public License
Tie::FlatFile::Array is a Perl extension which treats a flatfile database as an array of arrays.

This module allows the programmer to treat a flatfile database as as array of arrays. For example, lets say you have a datafile that has fixed-length records like so:

Field-name Type
URL ASCII characters, length 30
Referals Integer, 4 bytes, binary in network order

If you were going to use pack to create a record like this, youd use a format string of A30N. Since Tie::FlatFile::Array does the packing and unpacking behind the scenes, you would use that pack format string in the call to tie:

tie @flat, Tie::FlatFile::Array, data.file,
O_RDWR | O_CREAT, 0644, { packformat => A30N }
or die("Tie failure: $!");

To insert an item into the data file, you would assign an array reference to one of the arrays elements like so:

$flat[0] = [ www.yahoo.com, 3601 ];

10
Programming -> Libraries
Perl Artistic License
Set::Array Perl module contains arrays as objects with lots of handy methods (including Set comparisons) and support for method chaining.

SYNOPSIS

my $sao1 = Set::Array->new(1,2,4,"hello",undef);
my $sao2 = Set::Array->new(qw(a b c a b c));
print $sao1->length; # prints 5
$sao2->unique->length->print; # prints 3

Set::Array allows you to create arrays as objects and use OO-style methods on them. Many convenient methods are provided here that appear in the FAQs, the Perl Cookbook or posts from comp.lang.perl.misc. In addition, there are Set methods with corresponding (overloaded) operators for the purpose of Set comparison, i.e. +, ==, etc.

The purpose is to provide built-in methods for operations that people are always asking how to do, and which already exist in languages like Ruby. This should (hopefully) improve code readability and/or maintainability. The other advantage to this module is method-chaining by which any number of methods may be called on a single object in a single statement.

OBJECT BEHAVIOR

The exact behavior of the methods depends largely on the calling context.
Here are the rules:

* If a method is called in void context, the object itself is modified.
* If the method called is not the last method in a chain (i.e. its called in object context), the object itself is modified by that method regardless of the final context or method call.
* If a method is called in list or scalar context, a list or list refererence is returned, respectively. The object itself is NOT modified.

Heres a quick example:

my $sao = Set::Array->new(1,2,3,2,3);
my @uniq = $sao->unique(); # Object unmodified. @uniq contains 3 values.
$sao->unique(); # Object modified, now contains 3 values

Here are the exceptions:

* Methods that report a value, such as boolean methods like exists() or other methods such as at() or as_hash(), never modify the object.
* The methods clear(), delete(), delete_at(), and splice will always modify the object. It seemed much too counterintuitive to call these methods in any context without actually deleting/clearing/substituting the items!
* The methods shift() and pop() will modify the object AND return the value that was shifted or popped from the array. Again, it seemed much too counterintuitive for something like $val = $sao->shift to return a value while leaving the objects list unchanged. If you really want the first or last value without modifying the object, you can always use the first() or last() method, respectively.
* The join() method always returns a string and is really meant for use in conjunction with the print() method.

BOOLEAN METHODS

exists(val) - Returns 1 if val exists within the array, 0 otherwise. If no value (or undef) is passed, then this method will test for the existence of undefined values within the array.
is_empty() - Returns 1 if the array is empty, 0 otherwise. Empty is defined as having a length of 0.

STANDARD METHODS

at(index) - Returns the item at the given index (or undef). A negative index may be used to count from the end of the array. If no value (or undef) is specified, it will look for the first item that is not defined.

clear() - Empties the array (i.e. length becomes 0). You may pass a 1 to this method to set each element of the array to undef rather than truly empty it.

compact() - Removes undefined elements from the array.

count(?val?) - Returns the number of instances of val within the array. If val is not specified (or is undef), the method will return the number of undefined values within the array.

delete(list) - Deletes all items within list from the array that match. This method will crash if list is not defined. If your goal is to delete undefined values from your object, use the compact() method instead.

delete_at(index, ?index?) - Deletes the item at the specified index. If a second index is specified, a range of items is deleted. You may use -1 or the string end to refer to the last element of the array.

duplicates - Returns a list of N-1 elements for each element N in the set. For example, if you have set "X X Y Y Y", this method would return a the list "X Y Y".

fill(val,?start?,?length?) - Sets the selected elements of the array (which may be the entire array) to val. The default value for start is 0. If length is not specified the entire array, however long it may be at the time of the call, will be filled. Alternatively, a quoted integer range may be used.

e.g. $sao->fill(x,3-5);

The array length/size may not be expanded with this call - it is only meant to fill in already-existing elements.

first() - Returns the first element of the array (or undef).

flatten() - Causes a one-dimensional flattening of the array, recursively. That is, for every element that is an array (or hash, or a ref to either an array or hash), extract its elements into the array.

e.g. my $sa = Set::Array->new([1,3,2],{one=>a,two=>b},x,y,z);

$sao->flatten->join(,)->print; # prints "1,3,2,one,a,two,b,x,y,z"

foreach(sub ref) - Iterates over an array, executing the subroutine for each element in the array. If you wish to modify or otherwise act directly on the contents of the array, use $_ within your sub reference.

e.g. To increment all elements in the array by one...

$sao->foreach(sub{ ++$_ });

get - Alias for the indices() method.

index(val) - Returns the index of the first element of the array object that contains val. Returns undef if no value is found.

Note that there is no dereferencing here so if youre looking for an item nested within a ref, use the flatten method first.

indices(val1,?val2?, ?val...?) - Returns an array consisting of the elements at the specified indices or undef if the element is out of range.

A range may also be used. It must be a quoted string in 0..3 format.

join(?char?) - Joins the individual elements of the list into a single string with the elements separated by the value of char. Useful in conjunction with the print() method. If no character is specified, then char defaults to a comma.

e.g. $sao->join(-)->print;

last() - Returns the last element of the array (or undef).

length() - Returns the number of elements within the array.

max() - Returns the maximum value of an array. No effort is made to check for non-numeric data.

pack(template) - Packs the contents of the array into a string (in scalar context) or a single array element (in object or void context).

pop() - Removes the last element from the array. Returns the popped element.

print(?1?) - Prints the contents of the array. If a 1 is provided as an argument, the output will automatically be terminated with a newline.

This also doubles as a contents method, if you just want to make a copy of the array, e.g. my @copy = $sao->print;

Can be called in void or list context, e.g.

$sao->print(); # or... print "Contents of array are: ", $sao->print();

push(list) - Adds list to the end of the array, where list is either a scalar value or a list. Returns an array or array reference in list or scalar context, respectively. Note that it does not return the length in scalar context. Use the length method for that.

reverse() - Reverses the order of the contents of the array.

rindex(val) - Similar to the index() method, except that it returns the index of the last val found within the array.

set(index,value) - Sets the element at index to value, replacing whatever may have already been there.

shift() - Shifts the first element of the array and returns the shifted element.

sort(?coderef?) - Sorts the contents of the array in alphabetical order, or in the order specified by the optional coderef. Use your standard $a and $b variables within your calling program, e.g:

my $sao = Set::Array->new( { name => Berger, salary => 20000 }, { name => Berger, salary => 15000 }, { name => Vera, salary => 25000 }, );
my $subref = sub{ $b->{name} cmp $a->{name} || $b->{salary} $a->{salary} };
$sao14->sort($subref)->flatten->join->print(1);

splice(?offset?,?length?,?list?) - Splice the array starting at position offset up to length elements, and replace them with list. If no list is provided, all elements are deleted. If length is omitted, everything from offset onward is removed.

Returns an array or array ref in list or scalar context, respectively. This method always modifies the object, regardless of context. If your goal was to grab a range of values without modifying the object, use the indices method instead.

unique() - Removes/returns non-unique elements from the list.

unshift(list) - Prepends a scalar or list to array. Note that this method returns an array or array reference in list or scalar context, respectively. It does not return the length of the array in scalar context. Use the length method for that.

ODDBALL METHODS

as_hash() - Returns a hash based on the current array, with each even numbered element (including 0) serving as the key, and each odd element serving as the value. This can be switched by using the key_order option and setting it to odd, in which case the even values serve as the values, and the odd elements serve as the keys. The default is even.

Of course, if you dont care about insertion order, you could just as well do something like, $sao-reverse->as_hash;>

Carp::croaks if the array contains an odd number of elements. This method does not actually modify the object itself in any way. It just returns a plain hash in list context or a hash reference in scalar context. The reference is not blessed, therefore if this method is called as part of a chain, it must be the last method called.

impose(?append/prepend?,string) - Appends or prepends the specified string to each element in the array. Specify the method by using either the keyword append or prepend. The default is append.

randomize() - Randomizes the order of the elements within the array.

rotate(direction) - Moves the last item of the list to the front and shifts all other elements one to the right, or vice-versa, depending on what you pass as the direction - ftol (first to last) or ltof (last to first). The default is ltof.

e.g. my $sao = Set::Array->new(1,2,3);

$sao->rotate(); # order is now 3,1,2

$sao->rotate(ftol); # order is back to 1,2,3

11
Programming -> Libraries
Perl Artistic License


SYNOPSIS

use Array::Compare;

my $comp1 = Array::Compare->new;
$comp->Sep(|);
$comp->Skip({3 => 1, 4 => 1});
$comp->WhiteSpace(0);
$comp->Case(1);

my $comp2 = Array::Compare->new(Sep => |,
WhiteSpace => 0,
Case => 1,
Skip => {3 => 1, 4 => 1});

my @arr1 = 0 .. 10;
my @arr2 = 0 .. 10;

$comp1->compare(@arr1, @arr2);
$comp2->compare(@arr1, @arr2);

If you have two arrays and you want to know if they are the same or different, then Array::Compare will be useful to you.
All comparisons are carried out via a comparator object. In the simplest usage, you can create and use a comparator object like this:

my @arr1 = 0 .. 10;
my @arr2 = 0 .. 10;

my $comp = Array::Compare->new;

if ($comp->compare(@arr1, @arr2)) {
print "Arrays are the samen";
} else {
print "Arrays are differentn";
}

Notice that you pass references to the two arrays to the comparison method.

Internally the comparator compares the two arrays by using join to turn both arrays into strings and comparing the strings using eq. In the joined strings, the elements of the original arrays are separated with the ^G character. This can cause problems if your array data contains ^G characters as it is possible that two different arrays can be converted to the same string.

To avoid this, it is possible to override the default separator character, either by passing and alternative to the new function

my $comp = Array::Compare->new(Sep => |);

or by changing the seperator for an existing comparator object

$comp->Sep(|);

In general you should choose a separator character that wont appear in your data.

You can also control whether or not whitespace within the elements of the arrays should be considered significant when making the comparison. The default is that all whitespace is significant. The alternative is for all consecutive white space characters to be converted to a single space for the pruposes of the comparison. Again, this can be turned on when creating a comparator object:

my $comp = Array::Compare->new(WhiteSpace => 0);

or by altering an existing object:

$comp->WhiteSpace(0);

You can also control whether or not the case of the data is significant in the comparison. The default is that the case of data is taken into account. This can be changed in the standard ways when creating a new comparator object:

my $comp = Array::Compare->new(Case => 0);

or by altering an existing object:

$comp->Case(0);

In addition to the simple comparison described above (which returns true if the arrays are the same and false if theyre different) there is also a full comparison which returns a list containing the indexes of elements which differ between the two arrays. If the arrays are the same it returns an empty list. In scalar context the full comparison returns the length of this list (i.e. the number of elements that differ). You can access the full comparision in two ways. Firstly, there is a DefFull attribute. If this is true then a full comparison if carried out whenever the compare method is called.

my $comp = Array::Compare->new(DefFull => 1);
$comp->compare(@arr1, @arr2); # Full comparison

$comp->DefFull(0);
$comp->compare(@arr1, @arr2); # Simple comparison

$comp->DefFull(1);
$comp->compare(@arr1, @arr2); # Full comparison again

Secondly, you can access the full comparison method directly

$comp->full_compare(@arr1, @arr2);

For symmetry, there is also a direct method to use to call the simple comparison.

$comp->simple_compare(@arr1, @arr2);

The final complication is the ability to skip elements in the comparison. If you know that two arrays will always differ in a particular element but want to compare the arrays ignoring this element, you can do it with Array::Compare without taking array slices. To do this, a comparator object has an optional attribute called Skip which is a reference to a hash. The keys in this hash are the indexes of the array elements and the values should be any true value for elements that should be skipped.

For example, if you want to compare two arrays, ignoring the values in elements two and four, you can do something like this:

my %skip = (2 => 1, 4 => 1);
my @a = (0, 1, 2, 3, 4, 5);
my @b = (0, 1, X, 3, X, 5);

my $comp = Array::Compare->new(Skip => %skip);

$comp->compare(@a, @b);

This should return true, as we are explicitly ignoring the columns which differ.

Of course, having created a comparator object with no skip hash, it is possible to add one later:

$comp->Skip({1 => 1, 2 => 1});

or:

my %skip = (1 => 1, 2 => 2);
$comp->Skip(%skip);

To reset the comparator so that no longer skips elements, set the skip hash to an empty hash.

$comp->Skip({});

You can also check to see if one array is a permutation of another, i.e. they contain the same elements but in a different order.

if ($comp->perm(@a, @b) {
print "Arrays are permsn";
else {
print "Nope. Arrays are completely differentn";
}

In this case the values of WhiteSpace and Case are still used, but Skip is ignored for, hopefully, obvious reasons.

12
Programming -> Libraries
Perl Artistic License
Array::Unique is a tie-able array that allows only unique values.

SYNOPSIS

use Array::Unique;
tie @a, Array::Unique;

Now use @a as a regular array.

This package lets you create an array which will allow only one occurrence of any value.

In other words no matter how many times you put in 42 it will keep only the first occurrence and the rest will be dropped.

You use the module via tie and once you tied your array to this module it will behave correctly.

Uniqueness is checked with the eq operator so among other things it is case sensitive.

As a side effect the module does not allow undef as a value in the array.

EXAMPLES

use Array::Unique;
tie @a, Array::Unique;

@a = qw(a b c a d e f);
push @a, qw(x b z);
print "@an"; # a b c d e f x z

When you are collecting a list of items and you want to make sure there is only one occurrence of each item, you have several option:

1) using an array and extracting the unique elements later. You might use a regular array to hold this unique set of values and either remove duplicates on each update by that keeping the array always unique or remove duplicates just before you want to use the uniqueness feature of the array. In either case you might run a function you call @a = unique_value(@a);

The problem with this approach is that you have to implement the unique_value function (see later) AND you have to make sure you dont forget to call it. I would say dont rely on remembering this.

There is good discussion about it in the 1st edition of the Perl Cookbook of OReilly. I have copied the solutions here, you can see further discussion in the book.

----------------------------------------
Extracting Unique Elements from a List (Section 4.6 in the Perl Cookbook 1st ed.)

# Straightforward

%seen = ();
@uniq = ();
foreach $item (@list) [
unless ($seen{$item}) {
# if we get here we have not seen it before
$seen{$item} = 1;
push (@uniq, $item);
}
}

# Faster
%seen = ();
foreach $item (@list) {
push(@uniq, $item) unless $seen{$item}++;
}

# Faster but different
%seen;
foreach $item (@list) {
$seen{$item}++;
}
@uniq = keys %seen;

# Faster and even more different
%seen;
@uniq = grep {! $seen{$_}++} @list;

----------------------------------------
2) using a hash
Some people use the keys of a hash to keep the items and
put an arbitrary value as the values of the hash:

To build such a list:
%unique = map { $_ => 1 } qw( one two one two three four! );

To print it:
print join ", ", sort keys %unique;

To add values to it:
$unique{$_}=1 foreach qw( one after the nine oh nine );

To remove values:
delete @unique{ qw(oh nine) };

To check if a value is there:
$unique{ $value }; # which is why I like to use "1" as my value

(thanks to Gaal Yahas for the above examples)

There are three drawbacks I see:

1) You type more.
2) Your reader might not understand at first why did you use hash and what will be the values.
3) You lose the order.

Usually non of them is critical but when I saw this the 10th time in a code I had to understand with 0 documentation I got frustrated.

3) using Array::Unique

So I decided to write this module because I got frustrated by my lack of understanding whats going on in that code I mentioned. In addition I thought it might be interesting to write this and then benchmark it. Additionally it is nice to have your name displayed in bright lights all over CPAN ... or at least in a module.

Array::Unique lets you tie an aray to hmmm, itself (?) and makes sure the values of the array are always unique.

Since writing this I am not sure if I really recommend its usage. I would say stick with the hash version and document that the variable is aggregating a unique list of values.

4) Using real SET

There are modules on CPAN that let you create and maintain SETs. I have not checked any of those but I guess they just as much of an overkill for this functionality as Unique::Array.

13
Programming -> Libraries
Perl Artistic License
Tie::Array::PackedC is a tie a Perl array to a C-style array (packed; elements of a single, simple data type).

SYNOPSIS

use Tie::Array::PackedC qw(packed_array packed_array_string);
my $ref=packed_array(1,2,3,4);
my $ref2=packed_array_string(my $s,1,2,3,4);

use Tie::Array::PackedC Double=>d;
tie my @array,Tie::Array::PackedC::Double,1..10;
$array[0]=1.141;

Provides a perl array interface into a string containing a C style array. In other words the string is equivelent to the string that would be returned from the equivelent pack command (defaulting to pack type "l!") using a normal array of the same values. Eg:

my @foo=(1..10);
my $string=pack "l!*",@foo;

leaves $string in basically the same condition as

my (@foo,$string);
tie @foo,Tie::Array::PackedC,$string,1..10;

Its only basically the same and not exactly the same because the tie version may be longer due to preallocation.

14
System -> Networking
GPL GNU General Public License
IP-Array is a Linux iptables firewall script written in bash. IP-Array allows the creation of precise, stateful rules, while remaining easy to configure.

Goals:

An easy to configure firewall

· still leaving the user the possiblillity to configure detailed rules
· which creates thight ruleset
· which is easy to customize, extendable, scriptable
· with senseful presets for common situations

Here are some key features of "IP Array":

· Multiple LANs.
· VPN (ipsec).
· A DMZ.
· Traffic shaping.
· Autoconfig options for i.e: DNS, FTP.
· Logging functionality.
· MAC address matching.
· Easy and fast to configure through one main config and one rule file.
· Muliple verbose modi with(out) logging to syslog.
· Different startup logic according to command line parameter(s).
· Test mode to test new configurations.
· Creates tight stateful rules, always using both interfaces, when forwarding.
· Various SysCtl settings.
· and more ...

Whats New in This Release:

+ - Added function color_msg() to display coloured messages.
+ - Added the configuration options to allow the user to define the colours
used for main-title, subtitle, info-title, notice, warning and error
messages.
+ - Added function precheck_config(), to validate configuration entries
before any action is performed.
+ - Added limit / burst options to all filter table rules.
+ - Added options IFBOUND and IPBOUND to RESTRICT_OUTPUT config option,
which create either interface, or IP address bound rules.
+ - Added interface classifying chains for mangle table.
+ - Added support for non case-sensitive configuration values at places
where it makes sense and the called program supports them.
+ - Added cburst and mtu options to tc class routines.
+ - Added startup parameter save-tc-commands to save tc commands to file.
+ - Added startup parameter save-iptables-commands to save the iptables
commands to file.
+ - Added startup parameter dry-run, which runs IP-Array without executing
any resulting command.
+ - Added saving of sysctl settings commands.
+ - Added error counter for sysctl commands.
* - Changed startup parameter save-commands to save all commands, including
iptables, tc and sysctl settings.
* - Made LAN DNS preset work for all local networks including dmz networks,
which were missing previously.
* - Adapted end_msg() to display different status message according to
runmode.
* - Commands for sysctl settings are now also cached into an array like
iptables and tc commands.
* - Rewrote function flushdel_tables(), which is now more generic.
* - Rewrote function validate_rule(). Parameter validations are now in
separate sub functions. All global rule handling variables are now of
local type.
* - Comments inside rule variables (arrays) can now be placed on the
same line as the rule, not only on separate lines like before.
* - Changed IP-Array structure:
Main script is now executable in BIN_DIR/{stable,test}.
* - Changed the look of the init script usage() output.
* - Major optimizations in the init script.
* - More detailed (error)log output in some functions.
* - Various code optimizations.
! - Fixed a bug in reqparm(), where the function only returned
on error, instead of reporting a missing parameter.
! - Minor bugfixes concerning wrong log output.
- - Removed options -p, -q, -z from log() function.
- - Removed config option SET_TTL, as its functionality is given by
ENABLE_TTL_NETS.

15
System -> Monitoring
GPL GNU General Public License
CPQ Array Daemon project keeps on monitoring your controller and checks for abnormal conditions. By default is only reports to the syslogs, but you can make it send SNMP Traps to selected hosts.

This tool can run on a linux based intel box with a smart array controller from Compaq. It reports status changes in the disks both to the syslog and to a snmp trap host.

The default is to only log to the syslog. You can specify traphosts with the -t parameter at the commandline. Multiple traphosts are allowed. It checks for valid input, but any errors are non-fatal, in fact the traphost is just ignored..

To ensure correct opereration compile it for the same kernel that runs on the machine where you want to use this. At least make sure that the version of the SmartArray driver is the same. Strange things can happen otherwise.

Installation:

The simplest way to compile this package is:

1. `cd to the directory containing the packages source code and type `./configure to configure the package for your system. If youre using `csh on an old version of System V, you might need to type `sh ./configure instead to prevent `csh from trying to execute `configure itself.

Running `configure takes awhile. While running, it prints some messages telling which features it is checking for.

2. Type `make to compile the package.

3. Optionally, type `make check to run any self-tests that come with the package.

4. Type `make install to install the programs and any data files and documentation.

5. You can remove the program binaries and object files from the source code directory by typing `make clean. To also remove the files that `configure created (so you can compile the package for a different kind of computer), type `make distclean. There is also a `make maintainer-clean target, but that is intended mainly for the packages developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution.

16
Programming -> Libraries
Perl Artistic License
POE::XS::Queue::Array is an XS implementation of POE::Queue::Array.

This class is an implementation of the abstract POE::Queue interface. It implements a priority queue using C, with an XS interface supplied.

The current implementation could use some optimization, especially for large queues.

Please see the POE::Queue documentation, which explains this ones functions, features, and behavior.

The following extra methods are added beyond POE::Queue::Array:

dump

Dumps the internal structure of the queue to stderr.

verify

Does limited verification of the structure of the queue. If the verification fails then a message is sent to stderr and the queue is dumped as with the dump() method, and your program will exit.

17
Programming -> Libraries
GPL GNU General Public License
EZMorph is simple Java library for transforming an Object to another Object.

It supports transformations for primitives, Objects, and multidimensional arrays, compatibility with JDK 1.3.1, and small memory footprint (~60K).

EZMorph began life as the converter package in Json-lib but became a project on its own.

· Supports transformations for primitives and Objects
· Supports transformations for multidimensional arrays
· JDK 1.3.1 compatible
· Small memory footprint (~60K)

EZMorph comes with another feature: ArrayAssertions . JUnit 3.x does not have an assertEquals() method for asserting array equality, and JUnit 4.x has a limited one (it only supports Object[] not primitive arrays).

With ArrayAssertions is possible to compare a boolean[] with a boolean[] or even a Boolean[], an those arrays can be multidimensional too. EZMorph began life as the converter package on Json-lib but seeing that the features provided were more generic than JSON parsing, it became a project on its own.

Whats New in This Release:

· This release can override existing morphers for a type when registering a new one, and clear all morphers for a type.
· The Javadocs have been updated.

18
System -> Monitoring
GPL GNU General Public License
pcap2c converts a pcap capture file (such as one from Ethereal/Wireshark or tcpdump) into a C source file, where the packets are stored as unsigned char arrays. These packets can then be compiled into a C program where they can be easily used for further manipulation, retransmission, etc.

Usage: ./pcap2c < libpcap capture file > < C source file >

The program creates a dedicated unsigned char array for every packet (i.e. packet0[], packet4[]). After all of these dedicated character arrays have been created, a master packets array is created, which is an array of pointers to each of the dedicated packet arrays. With its complement, the master packet lengths array, a C program can look up packet data by its index in the master packets array, and look up the packet’s length with the master packet lengths array (i.e. allPackets[4] and allPacketLengths[4]).

pcap2c should compile with gcc on just about anything.

This project is released under the GNU General Public License version 2.

Sample output “icmp_ping.c”:

unsigned char packet0[98] = {0x00,0x0F,0x66,0xCD,0x06,0xDE,0x00,0x16,0xCB,
0xA2,0x94,0xB2,0x08,0x00,0x45,0x00,0x00,0x54,0x00,0x00,0x40,0x00,0x40,0x01,
0xB6,0xF3,0xC0,0xA8,0x01,0x64,0xC0,0xA8,0x01,0x01,0x08,0x00,0x51,0x78,0x6E,
0x3B,0x00,0x01,0x3D,0xBB,0x79,0x46,0x94,0x46,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char packet1[98] = {0x00,0x16,0xCB,0xA2,0x94,0xB2,0x00,0x0F,0x66,
0xCD,0x06,0xDE,0x08,0x00,0x45,0x00,0x00,0x540xB9,0xD1,0x00,0x00,0x40,0x01,
0x3D,0x22,0xC0,0xA8,0x01,0x01,0xC0,0xA8,0x01,0x64,0x00,0x00,0x59,0x78,0x6E,
0x3B,0x00,0x01,0x3D,0xBB,0x79,0x46,0x94,0x46,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char packet2[98] = {0x00,0x0F,0x66,0xCD,0x06,0xDE,0x00,0x16,0xCB,
0xA2,0x94,0xB2,0x08,0x00,0x45,0x00,0x00,0x54,0x00,0x00,0x40,0x00,0x40,0x01,
0xB6,0xF3,0xC0,0xA8,0x01,0x64,0xC0,0xA8,0x01,0x01,0x08,0x00,0xF4,0x6A,0x6E,
0x3B,0x00,0x02,0x3E,0xBB,0x79,0x46,0xF0,0x52,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char packet3[98] = {0x00,0x16,0xCB,0xA2,0x94,0xB2,0x00,0x0F,0x66,
0xCD,0x06,0xDE,0x08,0x00,0x45,0x00,0x00,0x54,0xB9,0xD2,0x00,0x00,0x40,0x01,
0x3D,0x21,0xC0,0xA8,0x01,0x01,0xC0,0xA8,0x01,0x64,0x00,0x00,0xFC,0x6A,0x6E,
0x3B,0x00,0x02,0x3E,0xBB,0x79,0x46,0xF0,0x52,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char packet4[98] = {0x00,0x0F,0x66,0xCD,0x06,0xDE,0x00,0x16,0xCB,
0xA2,0x94,0xB2,0x08,0x00,0x45,0x00,0x00,0x54,0x00,0x00,0x40,0x00,0x40,0x01,
0xB6,0xF3,0xC0,0xA8,0x01,0x64,0xC0,0xA8,0x01,0x01,0x08,0x00,0xB8,0x69,0x6E,
0x3B,0x00,0x03,0x3F,0xBB,0x79,0x46,0x2B,0x53,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char packet5[98] = {0x00,0x16,0xCB,0xA2,0x94,0xB2,0x00,0x0F,0x66,
0xCD,0x06,0xDE,0x08,0x00,0x45,0x00,0x00,0x54,0xB9,0xD3,0x00,0x00,0x40,0x01,
0x3D,0x20,0xC0,0xA8,0x01,0x01,0xC0,0xA8,0x01,0x64,0x00,0x00,0xC0,0x69,0x6E,
0x3B,0x00,0x03,0x3F,0xBB,0x79,0x46,0x2B,0x53,0x02,0x00,0x08,0x09,0x0A,0x0B,
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37};

unsigned char *allPackets[6] = {packet0, packet1, packet2, packet3, packet4, packet5};

int allPacketLengths[6] = {98, 98, 98, 98, 98, 98};
19
Programming -> Libraries
MPL Mozilla Public License
Simple Sound for Small Devices (libsssd) is a simple cross-platform audio library. Simple Sound for Small Devices is designed primarily for games on portable devices such as smart phones, PDAs, and hand-helds.

Simple Sound for Small Devices is designed as a very portable, cross-platform API for sound playback on small and embedded devices. Target platforms include smartphones, PDAs, Smart displays, webpads and embedded systems.

Target OSes include Linux (OSS/Free), Win32, WinCE/PPC/Smartphone, Symbian, and AmigaDE (both hosted and native). The library is biased toward real-time audio applications (like games), but is suitable for a wide array of other uses.

Installation:

To install the libsssd library, cd to the src direcotry and type make install
To make the demo applications, cd to the test directory and type make

Whats New in This Release:

· Updated code to work with libsndfile 1.0.5
· Modularized each function for OSs that support tool libraries (AmigaDE)
· Added initAudio() and freeAudio() functions to allocate the control structure as different compilers may not pack the struct the same.
· Added support to init the audio player with different sample rates, bit depths, and channels (stereo, mono). Added support for user setting max number of playing channels and max number of cached samples at init time.
· fixed bug in player thread overflow functions (la,lb)

20
Programming -> Libraries
GPL GNU General Public License
XMLParser is a library that assists in parsing XML documents into generic PHP arrays. It also comes with RSSParser, an extension of XMLParser that creates simple RSS-specific array structures from RSS feeds.

My Software
You have not saved any software. Click "Save" next to each software to save it to your software basket
Related Information
Sponsored Links
TOP POPULAR DOWNLOAD