2013-06-17
Installing redmine 2.3.x on Ubuntu 12.04.
Add the following repo:
https://launchpad.net/~ondrej/+archive/redmine
The easy way to do this is by adding the ppa using add-apt-repository.
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/redmine
After you have that repo installed, you can use this tutorial: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step
2013-06-05
$VAR1 = {
'source' => '[path def]',
'git_server' => 'git://trident.classroom24-7.lan',
'permissions' => '0665',
'target_group' => 'www-data',
'rename' => 'gttest',
'target_owner' => 'www-data',
'target' => '.',
'preserve' => [
[
'moodlite_config.php',
'not_moodlite_config.php'
]
],
'title' => 'moodlite'
};
$VAR2 = {
'source' => '[path def]',
'permissions' => '755',
'target_group' => 'eellis',
'target_owner' => 'root',
'rename' => 'notmoodlite',
'target' => '.',
'preserve' => [
$VAR1->{'preserve'}[0]
],
'title' => 'moodlite/copy1'
};
2013-05-23
The following assumes you're using gitolite on a remote server.
#!/bin/bash
# to add repos for redmine, do the following:
# git clone --bare git@[server]:[repo]
# then add two stanzas here to get updates
echo "Running [repo]"
cd /path/to/repo.git
/usr/bin/git fetch origin '+refs/heads/*:refs/heads/*' -v
cd ~
Set the above in a cron (I have it run every 5 minutes) and all of your updates get pulled so Redmine can see them.
2013-04-19
Given the tables as follows:
courses
- id
- short_name
- long_name
i_courses_accreditors
- id
- courses_id
- accreditors_id
accreditors
- id
- name
Any given course can have multiple accreditors. I would like to return a single row with all accreditors for each course. I suspect either group_concat or concat_ws will come into play, but I can't put all the magic together yet.
2013-04-05
use strict;
use warnings;
my $string = "\n\nThis is a string";
my $start_time = time();
my $times = 9999999999999;
for (my $i = 0; $i == $times; $i++){
my $result = reverse($string);
$result = reverse(chomp($string));
}
my $end_time = time();
print "Double reverse = " . ($end_time - $start_time) . " seconds\n";
$start_time = time();
for (my $i = 0; $i == $times; $i++){
my $result = $string;
$result =~ s/\n//;
}
$end_time = time();
print "regex = " . ($end_time - $start_time) . " seconds";
2013-03-29
CREATE PROCEDURE `sp_DBR`(email_to varchar(50), global_filter varchar(
+50))
BEGIN
declare findme varchar(50) default '%';
IF CHAR_LENGTH(global_filter) >= 1 THEN
set findme = concat('%', global_filter, '%');
END IF;
select u.id as 'Id',
u.username as 'Username',
u.first_name as 'First_name',
u.last_name as 'Last_name',
u.email as 'Email',
from_unixtime(u.last_login) as 'Last login',
from_unixtime(u.reg_date) as 'Reg date',
u.organization as 'Organization'
from moodlite.users u
where u.id like findme;
END
$$
2013-03-21
use strict;
my $VAR1 = {
'wizard' => {
'spell' => 4,
'ppd' => 10,
'breath weapon' => 9,
'pp' => 7,
'rsw' => 5
},
'warrior' => {
'spell' => 6,
'ppd' => 3,
'breath weapon' => 4,
'pp' => 4,
'rsw' => 5
},
'rogue' => {
'spell' => 7,
'ppd' => 9,
'breath weapon' => 12,
'pp' => 8,
'rsw' => 6
}
};
my $stat = 'spell';
my $smallest;
foreach my $class (keys $VAR1) {
my $val = $VAR1->{$class}->{$stat};
if (!$smallest) {
$smallest->{'class'} = $class;
$smallest->{'val'} = $VAR1->{$class}->{$stat};
} else {
if ($smallest->{'val'} > $VAR1->{$class}->{$stat}) {
$smallest->{'class'} = $class;
$smallest->{'val'} = $VAR1->{$class}->{$stat};
}
}
}
print "Smallest value for $stat is in class $smallest->{'class'}, with
+ value $smallest->{'val'}";
2012-12-07
I'm having a similar problem on ActivePerl 5.14.2 and have made it to this point with troubleshooting:
Sample code:
use strict;
use warnings;
use WWW::Mechanize;
# LWP complains if this isn't included with the packaged executable.
# This may be because I'm on Win32. At any rate, PP isn't smart enoug
+h
# to know it's needed, so I include it here to make packaging easier.
use Encode::Byte;
# WWW::Mechanize debugging
# per http://search.cpan.org/~mstrout/WWW-Mechanize/lib/WWW/Mechanize/
+FAQ.pod#How_do_I_figure_out_why_$mech-%3Eget%28$url%29_doesn%27t_work
+?
use LWP::Debug qw(+);
# by default, PP picks Net::SSLeay
# It appears to test for IO::Socket::SSL first and use it if it's avai
+lable.
# use Crypt::SSLeay;
# use IO::Socket::SSL;
my $mech = WWW::Mechanize->new();
my $url = 'http://google.com';
$mech->get($url);
if ($mech->success() == 1) {
print "yay";
} else { die "Can't fetch $url"; }
I have verified that the site is reachable from a browser on my machine.
In the example above, I'm using a non-SSL site. It works both packaged and unpackaged as expected.
Altering the URL to try and talk https is where the problem starts to show.
Unpackaged, the script works as expected.
Packaged the problem rears its head:
Error GETing https://google.com: Can't connect to google.com:443 at script/mech_test.pl line 17.
So the problem definitely lies within the idea that something that's required is not being packaged by pp. The problem is that the documentation states that if you want to use SSL, you use either Crypt::SSLeay or IO::Socket::SSL, which we can explicity include, but it doesn't alter the result.
How I'm using pp: pp mech_test.pl -x -o mech_test.exe
-x is supposed to execute the program so pp can sort out what exactly it needs, per http://search.cpan.org/~autrijus/PAR-0.85_01/script/pp#OPTIONS.
Digging through the packed executable, it appears that both IO::Socket::SSL and Crypt::SSLeay are included with the output, so the the safe assumption is that one of those has a missing depenancy that it's not yelling about.
Crypt::SSLeay documentation (http://search.cpan.org/~nanis/Crypt-SSLeay-0.64/SSLeay.pm#DESCRIPTION) states that it provides Net::SSL which is loaded by LWD::Protocol::https, both of which are included in the resulting package.
IO::Socket::SSL documentation (http://search.cpan.org/~sullr/IO-Socket-SSL-1.81/lib/IO/Socket/SSL.pm#METHODS) states that it's an extension of IO::Socket::INET, which is also included with the packaged output. It does have a debug option, which when turned all the way up dumps an absurd amount of data when the script works, but hints at the problem when packaged:
C:\Users\eellis\Documents\git_portable\repos\posty>mech_test.exe
DEBUG: IO/Socket/SSL.pm:1213: Invalid certificate authority locationse
+rror:02001003:system library:fopen:No such process
SSL error: 32340: 1 - error:2006D080:BIO routines:BIO_new_file:no suc
+h file
SSL error: 32340: 2 - error:0B084002:x509 certificate routines:X509_l
+oad_cert_crl_file:system lib
Error GETing https://google.com: Can't connect to google.com:443 at sc
+ript/mech_test.pl line 17.
At least we're making some traction here. That error actually googles to another post here about a similar problem (that I happened to have in the past as well):
http://www.perlmonks.org/?node_id=920664
So adding the following to the beginning of the script:
use File::Spec;
if (exists $ENV{PAR_PROGNAME}) {
$ENV{PERL_LWP_SSL_CA_FILE} = File::Spec->catfile(
$ENV{PAR_TEMP},
'cacert.pem'
);
}
And altering the pp command line to: pp mech_test.pl -x -o mech_test.exe -l path/to/Mozilla/CA/cacert.pm should fix it.
But it doesn't. pp doesn't appear to be packing the file. -a doesn't work either, and -A kicks an error saying it can't read the file. I have verified the existence of the file and ensured that I have read permissions.
This appears to be a bug in PP.
2011-7-7
use warnings;
use strict;
my %hash1;
$hash1{'foo'} = 1;
$hash1{'bar'} = 2;
$hash1{'baz'} = 'this is the baz string';
$hash1{'a'} = 'This is the a string';
$hash1{'V'} = 'This is the V string';
my $hash2;
dupehash(\%hash1);
comphash(\%hash1);
sub dupehash {
$hash2 = {%{$_[0]}};
$hash2->{'a'} = 'this is a different a string';
}
sub comphash {
if (%{$_[0]} ~~ %{$hash2} and values %{$_[0]} ~~ values %$hash2) {
print values %{$_[0]}, "\n", values %$hash2;
}
else {
print 'no'; }
}
2011-06-21
foreach my $event (@event_hashes) {
# write a line that tells AVISynth to generate one second of v
+ideo for the image.
print VID2 $event->{'time'} . " = trim(ImageSource(\"$output\\
+" . $event->{'image'} . ", use_DevIL = true),0,24)\n";
# sort out how long I need to display the image.
my $duration;
# If this is my last image, I just need enough to end the vide
+o.
if ($next_event > scalar(@event_hashes)) {
my $wmv = Audio::WMA->new($_[0]->{'video_file'});
my $wmv_info = $wmv->info();
$duration = int($wmv_info->{'playtime_seconds'}) - $event-
+>{'time'};
}
else {
$duration = $event_hashes[$next_event]->{'time'} - $event-
+>{'time'};
}
# # write the part of the line that will be joined with the re
+st of the
# # video clips.
my $tmp = "loop(" . $event->{'time'} . "," . $duration . ")";
# if ($next_event < scalar(@event_hashes)) { $tmp = $tmp . " +
+\n"; }
# else {
$tmp = $tmp . "\n";
# }
push @output_string, $tmp;
$next_event = $next_event + 1;
warn scalar(@event_hashes);
}
2011-06-01
BEGIN {
# This is for the the PAR, so the executeable will know where the
# dll for tk is.
use File::Spec;
use Config ();
if (exists $ENV{PAR_PROGNAME}) {
$ENV{PERL_TCL_DL_PATH} = File::Spec->catfile($ENV{PAR_TEMP},
'tkkit.'.$Config::Config{dlext});
}
}
|