10-07-2002
Thanks,
I am just looking for general info, more out of curiosity then a job requirement.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to write a script that maintains many directories. I was wondering is there is a way to create a list of the directories inside a script so that you can then use “while read line” to perform different commands for each directory.
Something like this
#!/bin/sh
MYLIST:
/dir1
/dir2... (1 Reply)
Discussion started by: zasxes
1 Replies
2. Shell Programming and Scripting
Hi ,
well at the beginning i simply type :
cat file.1|grep 'update process'
but for looping and table needs , i wanted to do the following :
var1="grep 'update process'"
cat file1|"var1"
and i got error :
grep: can't open update
grep: can't open process
when it works if i... (6 Replies)
Discussion started by: Nicol
6 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies
4. Shell Programming and Scripting
Hi,
I am putting the finishing touches on a shell script.
I have the following which works FINE:
if ] && ]
then
/bin/mail -s "Illegal Loggon Attempts on MAIL" sysadmin@ghf.com < final_email.tmp
fi
However, I need to make several else clauses and the interpreter complains... (1 Reply)
Discussion started by: mojoman
1 Replies
5. Shell Programming and Scripting
I'm running into a problem with a differential backup script written in GNU Bash 3.0 - the following stripped down code demonstrates the problem quite nicely.
$ DATE="last tuesday"
$ date --date="$DATE"
Tue Jan 6 00:00:00 PST 2009
So far so good.
$ CMD="date --date=\"$DATE\""
$... (6 Replies)
Discussion started by: vertigo23
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I dont know whether it is the right space to put it... but didnt found related Embedded.
I want to start learning Embedded systems in Unix, It would be greatly appreciable if someone could help me to start off ....
Thanks (0 Replies)
Discussion started by: Deei
0 Replies
7. Programming
i have a problem in Use static variables in Qt C++ under CentOS 5.5
i need to pass a variable from GUI to class all function are static.
it always give me that error error: undefined reference to strChar
class QPython : public QObject
{
private:
public:
QString strChar;
static PuObject*... (1 Reply)
Discussion started by: HanyM.Magdy
1 Replies
8. Shell Programming and Scripting
Hi,
I would like to ask for someone more experience in programming, May i ask on where do i start or what langguage should i start inorder to create an APPS with nice GUI front end for visual display and a embedded Database in backend for records purposes, a stand alone apps, for example i want... (5 Replies)
Discussion started by: jao_madn
5 Replies
9. Shell Programming and Scripting
Greetings all,
i have csv file with pipe separated columns
SSN|NAME|ADDRESS|FILLER
123|abc|myaddress|xxx
234|BBB|my
add
ress
broken up|yyy
In the example above, the second record is broken into multiple lines. I need to keep going until I find a "|" since this issue is with the... (14 Replies)
Discussion started by: stayalive
14 Replies
10. UNIX for Dummies Questions & Answers
Hello.
I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations:
1. Linux and iOS are UNIX-like systems, POSIX compliant.
2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies
LEARN ABOUT DEBIAN
dbix::class::helper::resultset::correlaterelationship
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)