The &tldr; of the matter is:
Under Manage Gravatars, an email address can be associated to a picture.
Refresh metacpan and voila!
Re: Getting Active Directory objectsid value using Net::LDAP - Help!
c. church says:
Looking on MSN, which describes the SID structure (urL :http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/sid_components.asp) it seems to say this:the format of the sid is S-R-S-S...
Where the first byte is the revision level of the SID structure, the next 48bits (6 bytes) are the authority that issued the SID and then a variable number of (48bit?) subauthority values, as defined in Winnt.h
The Microsoft URL referred to above is dead. (Microsoft has no idea how to keep the antiquated, yet useful, documentation they produce alive, yet they manage to keep Windows XP kickin' for over a decade. Go figure.)
Turns out Net::LDAP::Class::User::AD figured it out already.
my $sid_string = sid2string($record->{objectSID});sub sid2string {
my ($sid) = @_;
my ($revision_level, $authority, $sub_authority_count,
@sub_authorities) = unpack 'C Vxx C V*', $sid;
die if $sub_authority_count != scalar @sub_authorities;
my $string = join '-', 'S', $revision_level, $authority,
@sub_authorities;
if ( $ENV{LDAP_DEBUG} ) {
carp "sid = " . join( '\\', unpack '(H2)*', $sid );
carp "string = $string";
}
return $string;
}
One day I too will learn how to unpack!
]]>Here's what happened in my latest attempt, for your benefit:
This is the important part: Strawberry Perl sets ENV variables in an incompatible way to what ActivePerl wants.
11:26 <@BinGOs> they mess with how the META parsers work.
So I ran this at the command prompt:
set PERL_JSON_BACKEND= set PERL_YAML_BACKEND=
Everything started installing after clearing these variables.
Update: Per mstpan, one should not use Module::Install!
cpan Module::Install
Make a directory for your package to reside:
mkdir /home/you/My-Package
Put your module in the 'lib' directory. This is where all your code is going to live.
mkdir lib
mkdir My
touch My/Package.pm
Put your code in My/Package.pm, or copy the file you already wrote here.
Then, create a Makefile.PL in /home/you/My-Package:
use inc::Module::Install;
# Define metadata
name 'My-Package';
perl_version '5.006';
version '0.01';
license 'perl';
# Specific dependencies
test_requires 'Test::More' => '0.42';
WriteAll;
Then, just run your new shiny file, pal!
perl Makefile.PL && make && make install && make clean && rm Makefile.old
While your at it, put that in a file called 'install.sh' so you can execute that each time you install it. You've gotta be root to run this sucker!
Update: Don't install to system root! Use plenv!
sudo sh install.sh
Afterwards, your directory will looks like this:
inc/ install.sh* lib/ Makefile.PL META.yml
You're installed!
# where package is My/Package.pm
package My::Package;
# You can put it in the root directory if you wish
# and refer to it just as Package.pm, but try create your own namespace
# if you can
#
# package Package;
use warnings;
use strict;
use base 'Exporter';
# you will have your sub automatically accessible
our @EXPORT = qw(your_sub);
# Or, you can choose to explicitly import your subroutine name like
# this in your calling code: use My::Package qw/your_sub/
#
# our @EXPORT_OK = qw(your_sub);
sub your_sub {
return "foo";
}
1; # return a true value at the end of your module to keep things happy
Here's how you use it.
use My::Package;
my $bar = your_sub(); # $bar is now 'foo'
]]>
#!perl
use warnings;
use strict;
use Data::Dumper;
my $Registry;
use Win32::TieRegistry (
Delimiter => "/",
ArrayValues => 1,
TiedRef => \$Registry,
);
my $regkey = 'HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Uninstall/';
my @install_names;
foreach my $software ( values %{$Registry->{$regkey}} ) {
next unless my $software = $software->{DisplayName};
next unless $software->[0];
push @install_names, $software->[0];
}
print "$_\n" for sort {lc $a cmp lc $b} @install_names;
Win32::TieRegistry installs along with Strawberry Perl.
]]>I think I figured it out, at least one part of it.
It is possible because there are a lot of smart people out there being employed by employers who have no real idea of what is required in any given project. Therefore, programmers who have
can contribute amazing feats of collective heroism day in and day out, without having to worry about how they are going to pay for new shoes.
And then of course there is boredom. And the sheer enjoyment of coding. And altruism.
]]>i have a Motorola Droid and a first generation iPhone which I use on WiFi only. But I really can't get myself to use either of them for task management.
Nothing beats the feel of my Palm Tungsten C keyboard. And nothing really beats the simplicity of the Palm ToDo List. Well, not really nothing, but you know what I mean.
I was surprised and happy to notice active development still taking place on p5-Palm. Today, I decided to resurrect an old project I had started to create a Palm Sync daemon on my home server.
First, I confirmed that pilot-link was up and running on my server. Next, I refreshed my memory on the commands used to run a WiFi sync.The first step is to make sure the user of the Tungsten C and the user of pilot-link are one and the same. This overwrites the user on the device, so proceed with caution.
pilot-install-user -p net:any -i 1000 -u mike
After setting the user, make a full backup of the device, where 'backup' is a directory.
pilot-xfer -p net:any -b backup
You may need to include an exclude file list using '-e exclude.txt', where 'exclude.txt' is a file containing the Palm files to exclude from a backup (or a sync). When I first tried this, I ran into 'Segmentation fault' errors during backup. An upgrade to pilot-link-0.12.0-pre4 did nothing to alleviate the problem. I had to exclude the file (ImgFile-Foto.prc) causing the segmentation fault from the back up process (see http://www.jpilot.org/pipermail/jpilot/2005-January/004609.html).
Finally, you can sync the device like so:
pilot-xfer -p net:any -s backup
Now I needed a way to keep my pilot-xref sync process running on my server until Kingdom Come. In the end, I decided to turn to an old trusty friend for help in this matter, POE.
I knew I needed something to monitor the sync process running on my server to determine if the sync process was up and listening for my Palm or if it needed to be started. Because I am not the sharpest tool in the shed, my first impulse was to hack together something that parsed the output of ps -ef
. Then someone on #perl on Freenode reminded me that it's rarely wise to write something that parses text meant for human consumption. mst was kind enough to point out Proc::ProcessTable. This would easily match the name of my sync command in the process table to let me know if my script was running or not. But before cobbling this together, I took one more tour through the glorious CPAN and stumbled upon POE::Component::Supervisor::Supervised::Proc. Although not very aptly named, this module was to do the trick, very easily.
#!/usr/bin/perl
use warnings;
use strict;
use POE;
use POE::Component::Supervisor;
use POE::Component::Supervisor::Supervised::Proc;
my $program = "pilot-xfer -p net:any -s backup";
POE::Component::Supervisor->new(
children => [
POE::Component::Supervisor::Supervised::Proc->new(
program => [$program],
restart_policy => "permanent",
),
],
);
Sometimes the hardest part of programming is finding out what things are called on CPAN.
]]>Linux is my IDE.
Perl5 is my VM.
CPAN is my language.
(thanks, mst)