10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hello. I'm trying to self learn Perl and am stuck. I have a data.csv file that contains the following:
5,10,15,20,15,30
1,2,3,4,5
3,10
11
I'm trying to get Perl to take the indexes and add them all together to get 134. It says I need to use split and invoke the file via
<> (built-in... (2 Replies)
Discussion started by: Eric7giants
2 Replies
2. Shell Programming and Scripting
Example
I have following requirements where i need to search for particular string from the log files.Files will be archived with number attached end to it and creates a new log file.
First Day i will ran at 8:00 AM
Filename:a.log1
Wed Aug 24 04:46:34... (1 Reply)
Discussion started by: nareshnani211
1 Replies
3. Shell Programming and Scripting
Dear all,
I would like to split a file incrementally. My file looks like:
$path {
$name "path_sparc_ifu_dec_1" ;
$transition {
"dtu_inst_d" v ; // (in)
"U622/Y" ^ ; // (INVX16_LVT)
"U870/Y" ^ ; // (AND2X1_LVT)
"U873/Y" v ; // (INVX1_LVT)
"U872/Y" ^ ; // (NAND3X0_LVT)... (3 Replies)
Discussion started by: jypark22
3 Replies
4. Shell Programming and Scripting
Please, i have a question about rsync command:
Here is the command that i have used in my script:
rsync -ratlz --rsh="/usr/bin/sshpass ssh -o StrictHostKeyChecking=no" -aAXHltzh --progress --numeric-ids --devices --rsync-path="rsync" $1 $hostname:$1
using this command, i can... (0 Replies)
Discussion started by: chercheur111
0 Replies
5. Shell Programming and Scripting
Hi, I was wondering if someone could help with what is probably a fairly easy problem. I have two variables, i is between 1-5, j is between 11-15
I'd like to produce this:
1_11
2_12
3_13
4_14
5_15
Each number goes up incrementally with the other.
But my shoddy code is not... (5 Replies)
Discussion started by: hubleo
5 Replies
6. Web Development
We have been tuning MySQL lately and I ran accoss two useful tools that you might be interested in:
mysqltuner.pl
tuning-primer.sh
Both of these scripts are quite useful for MySQL tuning. Here is some sample output of mysqltuner.pl
>> MySQLTuner 0.9.8 - Major Hayden... (3 Replies)
Discussion started by: Neo
3 Replies
7. Shell Programming and Scripting
I wanted to use matrixs in awk and got some problem, here is some of the script code, from the BEGIN tag:
row_char="a";row_char="b";row_char="c";row_char="d";row_char="e"$
row_char="h";row_char="i";row_char="j";row_char="k";
from the proccess passage:
sentence,1]=1;
diffrence=4;
i=7;... (2 Replies)
Discussion started by: tal
2 Replies
8. Shell Programming and Scripting
Hello UNIX and Oracle Gurus,
After doing an intensive search from different websites, the UNIX forum I am posting this message seeking help..
I am trying to accomplish the following tasks through the shell script:
1. Rebuild indexes on a Table in Oracle
2. Analyze indexes and table... (0 Replies)
Discussion started by: madhunk
0 Replies
9. UNIX for Dummies Questions & Answers
Hi people,
Is this possible and if so any tips are very welcome.
Im trying to do the following:
this is what I have:
800__1__
this is what I want:
8000010
12345678
Im... (1 Reply)
Discussion started by: seaten
1 Replies
10. Shell Programming and Scripting
I've refined the filesystem size using awk and directed to a file name.
eg, here's the content in a file called "numbers"
$cat numbers
345
543
23423456
44435
546
.
.
how do you write a script to all these numbers to get the total?
thanks a lot. (9 Replies)
Discussion started by: kiem
9 Replies
MongoDB::Indexing(3pm) User Contributed Perl Documentation MongoDB::Indexing(3pm)
NAME
MongoDB::Indexing - Indexing collections
CREATING AN INDEX
Unique and non-unique indexes can be created on collections using "MongoDB::Collection::ensure_index".
For example, to create a non-unique index on "x":
$collection->ensure_index({'x' => 1})
To create a unique index on "y":
$collection->ensure_index({"y" => 1}, {"unique" => 1});
Multi-key indexes can be created to speed up queries like "sort by name, then by age." Index direction (1 or -1) is only important for
multi-key indexes and should be the sort order. So, for example, if we want a fast sort by name ascending and age descending, we'd write:
my $idx = Tie::IxHash->new(name => 1, age => -1);
$collection->ensure_index($idx);
Keep in mind that you should use Tie::IxHash for multi-key indexes to guarantee the keys will be saved in the correct order.
Options
The second parameter to "MongoDB::Collection::ensure_index" specifies index options. Available options are:
"unique => boolean"
By default, indexes are not unique. To create a unique index, pass "unique => true". "true" can be boolean::true or any other true
value.
"drop_dups => boolean"
If a unique index is being created on an existing set of data that has duplicate values, creating the index will fail. To force the
index creation by deleting duplicate values, use this option. Again, any value that evaluates to true will work.
"safe => boolean"
If the update fails and safe is set, this function will return 0. You should check "MongoDB::Database::last_error" to find out why the
update failed.
"background => boolean"
Create the index as a background operation.
"name => string"
Give the index a non-default name. This can be useful if the index contains so many keys that you get an "index name too long"
assertion, or if you just prefer a more human-readable name.
See Also
MongoDB documentation on indexing: <http://dochub.mongodb.org/core/indexes>.
GEOSPATIAL INDEXES
Starting in version 1.3.3 of MongoDB, you can create geospatial indexes. These are useful for querying for "N documents nearest this
point" or "documents within this shape."
To create an index for geospatial queries, use "2d" instead of 1 or -1. For example, this would create an index on the "location" field:
$coll->ensure_index({"location" => "2d"});
Then, you can query for documents using $near:
my $cursor = $coll->query({"location" => {'$near' => [44, -70]}})->limit(10);
This finds the 10 nearest documents (automatically sorted by distance ascending) to latitude -70, longitude 44.
Documents must have some sort of pair in the "location" field, although the database is pretty flexible as to what it will accept:
# valid geospatial locations
$coll->insert({"location" => [44, -70]});
$coll->insert({"location" => {"x" => 44, "y" => -70}});
$coll->insert({"location" => {"foo" => 44, "bar" => -70}});
You can save values in "(x,y)" or "(y,x)" order, but you must be consistent.
By default, the geospatial index assumes that points will lie between -180 and 180, for longitude and latitude queries.
Options
"min => int"
By default, the geospatial index assumes that points will lie between -180 and 180, for longitude and latitude queries. If you need an
alternative minimum value, you can use this option. This value is exclusive: if you specify "min => 0", you cannot save a point with a
0 value coordinate.
"max => int"
Alternative maximum value, exclusive.
See Also
MongoDB documentation on geospatial indexes: <http://dochub.mongodb.org/core/geo>.
perl v5.14.2 2011-08-29 MongoDB::Indexing(3pm)