9 More Discussions You Might Find Interesting
1. What is on Your Mind?
Time for a new poll. Just wondering how members in this forum prefer to read books.
Paper
E-reader
Tablet
Laptop/Desktop
Smartphone
Audiobook
Not much of a reader
Other
A poll is added. If you select option: Other, please specify what it is. :b: (14 Replies)
Discussion started by: Yoda
14 Replies
2. What is on Your Mind?
I bought a Sony PRS-650 Reader to read books and I'm loving it.
For one thing, there are zillions of free books in epub format available for download for free. Many of them are out of print, so you would have to pay a high price to get a printed copy. Most current releases have to be paid for,... (15 Replies)
Discussion started by: KenJackson
15 Replies
3. Shell Programming and Scripting
I am trying to add free and used memory (so that i can compute percentage used)of remote nodes using shell script. I use the openssh-server,expect tool and ssh script.
1)login.txt (info of nodes):
ip1|username|password
ip2|username|password
.
.
.
3)sshlogin.sh
#!/bin/bash ... (1 Reply)
Discussion started by: marmik1903
1 Replies
4. Shell Programming and Scripting
Hi All,
Am using the following command to add a user in Unix box
useradd -d <default_path> -g 90 -p <pwd for the user> <user_name>
But am getting an error while using this command by root user.Let me know if this cmd is right or else is there any other command to add a user in unix... (9 Replies)
Discussion started by: Ashok_oct22
9 Replies
5. Shell Programming and Scripting
Hi
I have a file like
a,1
b,2
d,3
a,2
b,3
c,7
Result Desired:
a,3
b,5
d,3
c,7
i.e on the bases of 1st field the addition is done of the 2nd field and result printed out. (3 Replies)
Discussion started by: gauravgoel
3 Replies
6. UNIX for Dummies Questions & Answers
im very new to unix/linux operating system and having a hard time understanding the command ( grep, ls, echo and variables) is there any book that is simple to understand... after taking this unix/linux operating system i need to take unix operating system..can someone help me please!!! (1 Reply)
Discussion started by: 2071fox
1 Replies
7. Shell Programming and Scripting
Hi
I have a file with specified format .
Hxxxxxxxyyyyyggggggguuuuuuuuuurrrrrrrrrrrrrrrrrrrrrrrr
xxxxxxxxyyyyyggggggguuuuuuuuuurrrrrrrrrrrrrrrrrrrrrrrr
xxxxxxxxyyyyyggggggguuuuuuuuuurrrrrrrrrrrrrrrrrrrrrrrr
xxxxxxxxyyyyyggggggguuuuuuuuuurrrrrrrrrrrrrrrrrrrrrrrr... (3 Replies)
Discussion started by: asinha63
3 Replies
8. Shell Programming and Scripting
Hai All
Iam looking for books in unix on shell scripting which has more stuff on how to run Oracle procedures or functions and the best methods to follow passing unix variables as parameters to Oracle.
Thanks in advance
Krishna (2 Replies)
Discussion started by: krishnasai
2 Replies
9. New to Unix. Which books should I read?
I'm just looking for really good unix book on programming in all shells, and system adminstrator books, and well as just all around really good books on unix.
I know the "Unix Shell Programming" book that Neo recommends I recently purchased that it is very good.
But when I heard that Neo has... (13 Replies)
Discussion started by: Astudent
13 Replies
DBIx::Class::Helper::ResultSet::CorrelateRelationship(3pUser Contributed Perl DocumentatDBIx::Class::Helper::ResultSet::CorrelateRelationship(3pm)
NAME
DBIx::Class::Helper::ResultSet::CorrelateRelationship - Easily correlate your ResultSets
VERSION
version 2.013002
SYNOPSIS
package MyApp::Schema::ResultSet::Author;
use base 'DBIx::Class::ResultSet';
__PACKAGE__->load_components(qw(Helper::ResultSet::CorrelateRelationship));
sub with_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
book_count => $self->correlate('book')->count_rs->as_query
}
});
}
1;
And then elsewhere, like in a controller:
my $rows = $schema->resultset('Author')->with_book_count->all;
DESCRIPTION
Correlated queries are one of the coolest things I've learned about for SQL since my initial learning of SQL. Unfortunately they are
somewhat confusing. DBIx::Class has supported doing them for a long time, but generally people don't think of them because they are so
rare. I won't go through all the details of how they work and cool things you can do with them, but here are a couple high level things
you can use them for to save you time or effort.
If you want to select a list of authors and counts of books for each author, you could use "group_by" and something like "COUNT(book.id)",
but then you'd need to make your select list match your "group_by" and it would just be a hassle forever after that. The "SYNOPSIS" is a
perfect example of how to implement this.
If you want to select a list of authors and two separate kinds of counts of books for each author, as far as I know, you must use a
correlated subquery in DBIx::Class. Here is an example of how you might do that:
package MyApp::Schema::ResultSet::Author;
use base 'DBIx::Class::ResultSet';
__PACKAGE__->load_components(qw(Helper::ResultSet::CorrelateRelationship));
sub with_good_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
good_book_count => $self->correlate('books')->good->count_rs->as_query
}
});
}
sub with_bad_book_count {
my $self = shift;
$self->search(undef, {
'+columns' => {
bad_book_count => $self->correlate('books')->bad->count_rs->as_query
}
});
}
1;
And then elsewhere, like in a controller:
my $rows = $schema->resultset('Author')
->with_bad_book_count
->with_good_book_count
->all;
This assumes that the Book resultset has "good" and "bad" methods.
See "NOTE" in DBIx::Class::Helper::ResultSet for a nice way to apply it to your entire schema.
METHODS
correlate
$rs->correlate($relationship_name)
Correlate takes a single argument, a relationship for the invocant, and returns a resultset that can be used in the selector list.
AUTHOR
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-06-18 DBIx::Class::Helper::ResultSet::CorrelateRelationship(3pm)