Clearcache - another script to selectively clear your pacman cache.

https://aur.archlinux.org/packages.php?ID=50498
I learned there are a number of scripts designed to do the same thing after I
wrote the basic framework, but I went ahead and finished it anyway.
clearcache has a number of features I haven't seen elsewhere,
usage: clearcache [options] [targets]
Options:
  -h, --help          display this help menu
  -d, --dry           dry run, simply list targets instead of removing
  -q, --quiet         only prints filenames for -d/--dry or -l/--list-targets
  -f, --force         force removal of package files
  -i, --ignore <pkg>  specify package(s) to ignore. this can be a comma
                      separated list, or '-' reads a list from stdin, one
                      per line. can be used more than once.
  -k, --keep <num>    specify number of old package files to keep. by default,
                      clearcache will keep the two most recent versions.
  -l, --list-targets  list targets to remove, using PAGER/less, before
                      removing. may not be used with -d/--dry
  -t, --threads <num> use <num> threads. the default value is 5. using a
                      large number will not gain you much, and is not
                      recommended, but there is no hard limit.
  -u, --uninstalled   remove all package files for packages that are not
                      currently installed, while still keeping the
                      specified number of old files for installed packages
  -v, --verbose       output more
  there MUST be a space between the option and its argument.
Targets:
  targets are package names, as you would specify them to pacman.
  if targets are specified, only package files belonging to them will be
  removed. if no targets are specified, all packages except for thos
  specified to be ignored will be removed.
It now uses the .PKGINFO file within the package itself, in order to know which
package it belongs to (Thanks again brisbin).  This eliminates any issues with
parsing the name from the version info, in the filename.
Obviously using alpm or such would be faster, but this was a quick project.  I
wrote a short snippet for myself, and decided to extend it.
Anyway, hope someone else finds this useful, let me know if you find any bugs,
or have any feature reqs.
Potential issues:
  As seems to be the most common issue with scripts like this, it assumes the
  most recent package in the cache is the one installed, or the one you would
  want to keep.  I'm considering parsing pacman output to compare the versions,
  at least as an option.
EDIT:
  Now with multithreading!  It has taken about 10% off the execution time on a single
  core netbook, and gets faster on better processors.  If nothing else, it was a good
  experiment, but I think it turned out rather well.
Last edited by freak (2011-07-07 01:56:45)

https://aur.archlinux.org/packages.php?ID=50498
I learned there are a number of scripts designed to do the same thing after I
wrote the basic framework, but I went ahead and finished it anyway.
clearcache has a number of features I haven't seen elsewhere,
usage: clearcache [options] [targets]
Options:
  -h, --help          display this help menu
  -d, --dry           dry run, simply list targets instead of removing
  -q, --quiet         only prints filenames for -d/--dry or -l/--list-targets
  -f, --force         force removal of package files
  -i, --ignore <pkg>  specify package(s) to ignore. this can be a comma
                      separated list, or '-' reads a list from stdin, one
                      per line. can be used more than once.
  -k, --keep <num>    specify number of old package files to keep. by default,
                      clearcache will keep the two most recent versions.
  -l, --list-targets  list targets to remove, using PAGER/less, before
                      removing. may not be used with -d/--dry
  -t, --threads <num> use <num> threads. the default value is 5. using a
                      large number will not gain you much, and is not
                      recommended, but there is no hard limit.
  -u, --uninstalled   remove all package files for packages that are not
                      currently installed, while still keeping the
                      specified number of old files for installed packages
  -v, --verbose       output more
  there MUST be a space between the option and its argument.
Targets:
  targets are package names, as you would specify them to pacman.
  if targets are specified, only package files belonging to them will be
  removed. if no targets are specified, all packages except for thos
  specified to be ignored will be removed.
It now uses the .PKGINFO file within the package itself, in order to know which
package it belongs to (Thanks again brisbin).  This eliminates any issues with
parsing the name from the version info, in the filename.
Obviously using alpm or such would be faster, but this was a quick project.  I
wrote a short snippet for myself, and decided to extend it.
Anyway, hope someone else finds this useful, let me know if you find any bugs,
or have any feature reqs.
Potential issues:
  As seems to be the most common issue with scripts like this, it assumes the
  most recent package in the cache is the one installed, or the one you would
  want to keep.  I'm considering parsing pacman output to compare the versions,
  at least as an option.
EDIT:
  Now with multithreading!  It has taken about 10% off the execution time on a single
  core netbook, and gets faster on better processors.  If nothing else, it was a good
  experiment, but I think it turned out rather well.
Last edited by freak (2011-07-07 01:56:45)

Similar Messages

  • When i try to use hulu acc.i keep getting the same message / sorry we are unable to load the player please check your internet connection clear your browser cache and try again. i thought i did it right .

    Question
    when i try to use hulu acc.i keep getting the same message / sorry we are unable to load the player please check your internet connection clear your browser cache and

    I found a solution! (at least, for my platform; Windows XP Home SP3, Firefox 4.0.1) =) Go to http://labs.adobe.com and download the Release Candidate 1 version of Adobe Flash 10.3.181.5. I swear, the Second I installed this, it worked INSTANTLY xD. Best of luck to you! (and anyone else who sees this =)
    -Erik P.

  • HT5343 Why is killing mDNSResponder the recommended method of clearing your DNS cache in 10.7+?

    mDNSResponder is also in control of Bonjour advertisement and unicast DNS resolution. So killing mDNSResponder is a good way to clear your cache in the same way that throwing your computer out a window is a good way to turn it off.
    Why not continue to use "sudo dscacheutil -flushcache" like we always have? It still even works in 10.7+.

    As Linc indicated, the command recommended by Apple is:
    sudo killall -HUP mDNSResponder
    This restarts the process; it doesn't kill it. In 10.7 and 10.8 the mDNSResponder daemon caches DNS query results, so even if you flush the other cache, old results can still crop up. Restarting the mDNSResponder daemon clears that cache.
    Regards.

  • Partial clearing of pacman cache

    Is there a way of partially clearing the cache of old packages. I'll explain, every now and then I have to downgrade a package, due to some sort of issue, (usually wine or ati packages). Down grading to the previous version is usually good enough, but sometimes I need to go back further. So that I can do this I don't clear the cache to frequently.
    Now I know that doing a "pacman -Sc" will remove all the old packages upto the currently installed one, and a "pacman -Scc" removes everything. But it would be nice (for me anyway) if you could add a parameter to the "c" to leave that many versions of a package in the cache
    example "pacman -Sc=3" this would leave the 3 latest versions of packages alone, but clear out anything older. If there wasn't 3 versions of a package, in the cache, then it would be left alone.
    People could keep the number of copies that they feel comfortable with, or not specify a number and things would work as they currently do.
    Does anyone know of a way to do a partial clearing alongs the lines discribed?
    Thanks

    test1000 wrote:
    you could always go into /var/cache/pacman/pkg/ and delete the packages you don't need.
    posting your suggestion to the bugzilla might yield better chances of it being implemented as a feature.
    Thanks for the input, I was just asking to see if anyone new of a way to achieve this currently, and also to see if it other thought it would be useful.

  • Another simple bash script to clean pacman cache

    here is a simple script that I have written which cleans pacman cache folder in a way that only the packages which are now "updated" in the repositories, will get removed. This is different from what "pacman -Sc" does. pacman -Sc also removes any package which is not installed, while this script keeps all the packages which are updated whether they are installed or not.
    The functionality is some how like what "apt-get autoclean" does in debian.
    to use this script you need to run it with "list" or "clean" arguments.  you can also use the "help" argument for more help.
    I hope it helps
    #! /bin/bash
    # clcache - This script cleans pacman cache folder in a way that only the packages
    #+ which are now updated in the repositories, will get removed. This is
    #+ different from what "pacman -Sc" does. pacman -Sc also removes any package
    #+ which is not installed, while this script keeps all the packages which are
    #+ updated whether they are installed or not.
    # I have tweaked this script to be as fast as possible, it might still need a
    #+ couple of minutes to compelete based on the size of your cache folder.
    # to use this script you need to run it with "list" or "clean" arguments.
    # you can also use the "help" argument for more help.
    # This script is written by "Ali Mousavi". Please report bugs to [email protected]
    DIR="/var/cache/pacman/pkg" #the default directory of pacman cache.
    ROOT_UID=0 #Only users with $UID 0 have root privilages.
    TMPFILE="/tmp/cache.tmp"
    # Run as root
    if [ "$UID" -ne "$ROOT_UID" ]
    then
    echo "Must be root to run this script"
    exit 1
    fi
    # Check for the arguments
    if [ -z "$1" ]
    then
    echo -e 'What should I do?\nValid Argument are "list", "clean" or "help"'
    exit 1
    elif [ "$1" = "list" ]
    then
    ACTION="ls"
    MESSAGE="Are you sure you want to continue?"
    elif [ "$1" = "clean" ]
    then
    ACTION="rm -vf"
    MESSAGE="Are you sure you want to remove outdated packages? This process can not be undone!"
    elif [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]
    then
    echo -e "This script checks the packages in your pacman cache directory and removes the packages that are outdated. It doesn't matter if the package is installed or not.\n\n3 arguments can be passed to the script:\n\nlist:\n\tchecks for package that are outdated and prints the names.\n\nclean:\n\tremoves outdated packages.\n\nhelp,-h,--help:\n\tprints this help text.\n\nThis script is written by \"Ali Mousavi\". Please report bugs to [email protected]"
    exit 0
    else
    echo 'Valid Argument are "list", "clean" or "help"'
    exit 1
    fi
    # Check if the user is sure!
    echo "This might take a while based on the amount of cached packages."
    echo -n "$MESSAGE(y/n) "
    read ANS
    if [ $ANS = "y" -o $ANS = "Y" -o $ANS = "yes" ]
    then
    echo "Processing packages..."
    elif [ $ANS = "n" -o $ANS = "N" -o $ANS = "No" ]
    then
    echo "Exiting on user request"
    exit 0
    else
    echo "Invalid answer"
    exit 1
    fi
    # Process the packages
    cd $DIR #change to cache directory.
    pacman -Sl | awk '{ print $2" "$3; }' > $TMPFILE
    for f in $(ls $DIR)
    do
    pname=$(file $f | cut -d: -f1) #Produces filename, like: fetchmail-6.3.19-1-i686.pkg.tar.xz"
    spname=$(echo $pname | sed 's/-[0-9][0-9]*.*//g') #removes package version: fetchmail
    pver=$(echo $pname | sed 's/.*-\([0-9\-\.][0-9\-\.]*-[0-9\-\.][0-9\-\.]*\).*/\1/g') #using pacman -Qi for all files takes a lot of time.
    if [ $(echo $pver | grep '[^0-9\-\.\-\-]' | wc -l) != 0 ] #checks if package version is alright
    then
    pver=$(pacman -Qpi $f | grep Version | awk '{print $3}')
    fi
    newpver=$(grep -e "^$spname " $TMPFILE | awk '{ print $2 }')
    if [[ $newpver != $pver ]]
    then
    $ACTION $f
    fi
    done
    rm -f $TMPFILE
    echo "Outdated packages processed successfully!"
    exit 0
    Last edited by tuxitop (2011-09-13 09:24:26)

    tuxitop wrote:# Check for the arguments
    if [ -z "$1" ]
    then
    echo -e 'What should I do?\nValid Argument are "list", "clean" or "help"'
    exit 1
    elif [ "$1" = "list" ]
    then
    ACTION="ls"
    MESSAGE="Are you sure you want to continue?"
    elif [ "$1" = "clean" ]
    then
    ACTION="rm -vf"
    MESSAGE="Are you sure you want to remove outdated packages? This process can not be undone!"
    elif [ "$1" = "help" -o "$1" = "-h" -o "$1" = "--help" ]
    then
    echo -e "This script checks the packages in your pacman cache directory and removes the packages that are outdated. It doesn't matter if the package is installed or not.\n\n3 arguments can be passed to the script:\n\nlist:\n\tchecks for package that are outdated and prints the names.\n\nclean:\n\tremoves outdated packages.\n\nhelp,-h,--help:\n\tprints this help text.\n\nThis script is written by \"Ali Mousavi\". Please report bugs to [email protected]"
    exit 0
    else
    echo 'Valid Argument are "list", "clean" or "help"'
    exit 1
    fi
    1. `echo -e 'foo\nbar\nbaz'` gets long and unreadable quickly. Instead, use here documents:
    cat <<EOF
    What should I do?
    Valid Argument are "list", "clean" or "help"
    EOF
    2. Use a case command, looks cleaner:
    case "$1" in
    list) ... ;;
    clean) ... ;;
    help|-h|--hep) ... ;;
    # Check if the user is sure!
    echo "This might take a while based on the amount of cached packages."
    echo -n "$MESSAGE(y/n) "
    read ANS
    if [ $ANS = "y" -o $ANS = "Y" -o $ANS = "yes" ]
    then
    echo "Processing packages..."
    elif [ $ANS = "n" -o $ANS = "N" -o $ANS = "No" ]
    then
    echo "Exiting on user request"
    exit 0
    else
    echo "Invalid answer"
    exit 1
    fi
    Try:
    read -p "hello: " -r
    echo $REPLY
    And again, `case` should be cleaner in this case.
    # Process the packages
    cd $DIR #change to cache directory.
    pacman -Sl | awk '{ print $2" "$3; }' > $TMPFILE
    While you quoted a lot, you left these two out. "$DIR" and "$TMPFILE" should be quoted, otherwise whitespaces will break the code.
    for f in $(ls $DIR)
    Apart from the same missing quotes, calling `ls` is a waste here. The following is sufficient and (maybe surprisingly) more accurate:
    for f in *
    How is it more accurate? Run this test script:
    #!/bin/bash
    DIR=/tmp/foo
    mkdir -p "$DIR"
    cd "$DIR"
    touch a\ b c$'\n'd
    for i in *; do
    printf '+%s+\n' "$i"
    done
    printf '%s\n' ---
    for i in $(ls $DIR); do
    printf '+%s+\n' "$i"
    done
    Let's not go too far here. Just get the idea.
    do
    pname=$(file $f | cut -d: -f1) #Produces filename, like: fetchmail-6.3.19-1-i686.pkg.tar.xz"
    Calling `file` here is, again, unnecessary. Also, filename of a package can contain ":", e.g., vi-1:050325-1-i686.pkg.tar.xz, which breaks your code.
    Don't complicate things:
    pname=$f
    spname=$(echo $pname | sed 's/-[0-9][0-9]*.*//g') #removes package version: fetchmail
    Broken for ntfs-3g-2011.4.12-1-i686.pkg.tar.xz, nvidia-173xx-utils-173.14.31-1-i686.pkg.tar.xz, etc...   Something less lousy:
    sed 's/\(-[^-]\+\)\{3\}$//' <<< "$pname"
    pver=$(echo $pname | sed 's/.*-\([0-9\-\.][0-9\-\.]*-[0-9\-\.][0-9\-\.]*\).*/\1/g') #using pacman -Qi for all files takes a lot of time.
    Although this might work for now, this would break if we had an architecture that starts with a digit, e.g. 686.  Something less lousy:
    sed 's/\(.*\)-\([^-]\+-[^-]\+\)-[^-]\+$/\2/' <<< "$pname"
    if [ $(echo $pver | grep '[^0-9\-\.\-\-]' | wc -l) != 0 ] #checks if package version is alright
    then
    pver=$(pacman -Qpi $f | grep Version | awk '{print $3}')
    fi
    Again, calling `wc` here is a waste. Anyway, why is this check necessary at all?
    newpver=$(grep -e "^$spname " $TMPFILE | awk '{ print $2 }')
    if [[ $newpver != $pver ]]
    then
    $ACTION $f
    fi
    done
    rm -f $TMPFILE
    echo "Outdated packages processed successfully!"
    exit 0
    The post is getting too long, so so much from me. If there's anything you don't understand yet, read bash(1).
    If I sound harsh or anything, don't be discouraged. Just keep reading, keep improving.
    Last edited by lolilolicon (2011-09-13 12:53:04)

  • Making a form field required when another field is selected

    I have a contact form with the usual fields required (name, address, city, etc.). I'm adding a Country pull-down list to the form, which will default to the US being selected. Since a "State" field is not relevant for anyone filling out the form from another country, I'd like to make the State field required only if the country selected is United States, and not required for any other country. Is there a way to do this?
    Thanks,
    R-Co

    What you need is to be able to create a required textfield when the first textfield shows USA and destroy the required field when another country is selected.
    The following may help to understand create and destroy
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Deleting and rebuilding validations</title>
    <link href="http://labs.adobe.com/technologies/spry/widgets/textfieldvalidation/SpryValidationTextFiel d.css" rel="stylesheet">
    </head>
    <body>
    <form id="form1" method="post" action="#">
      <p>
        <input type="radio" name="radio" id="Married" value="Married" onclick="val(this);">
        <label for="Married">Married</label>
      </p>
      <p>
        <input type="radio" name="radio" id="Defacto" value="Defacto" onclick="val(this);">
        <label for="Defacto">Defacto</label>
      </p>
      <p>
        <input type="radio" name="radio" id="Single" value="Single" onclick="val(this);">
        <label for="radio">Single</label>
      </p>
      <hr>
      <span id="sprytextfield1">
        <label for="f_married">Married</label>
        <input name="married" id="f_married" type="text" value="">
        <span class="textfieldRequiredMsg">A value is required.</span>
      </span>
      <span id="sprytextfield2">
        <label for="f_defacto">Defacto</label>
        <input name="defacto" id="f_defacto" type="text" value="">
        <span class="textfieldRequiredMsg">A value is required.</span>
      </span>
      <span id="sprytextfield3">
        <label for="f_single">Single</label>
        <input name="single" id="f_single" type="text" value="">
        <span class="textfieldRequiredMsg">A value is required.</span>
      </span>
      <hr>
      <input type="submit" value="Submit" />
    </form>
    <script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryValidationTextField.js"></script>
    <script>
    var sprytextfield1,
            sprytextfield2,
            sprytextfield3;
    // build validations and delete / destroy them
    function val(e){
        // get the value
        value = e.value;
        // see what radion button we have
        if(value == "Married"){
            // if there inst a validaton build one
            if(!sprytextfield1){
                sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
            // if there is a validaiton in sprytextfield destory it, and clear the variable
            if(sprytextfield2 && sprytextfield2.destroy){
                sprytextfield2.resetClasses();
                sprytextfield2.destroy();
                sprytextfield2 = null;
            // same as the rest
            if(sprytextfield3 && sprytextfield3.destroy){
                sprytextfield3.resetClasses();
                sprytextfield3.destroy();
                sprytextfield3 = null;
        } else if(value == 'Defacto'){
            if(!sprytextfield2){
                sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
            if(sprytextfield1 && sprytextfield1.destroy){
                sprytextfield1.resetClasses();
                sprytextfield1.destroy();
                sprytextfield1 = null;
            if(sprytextfield3 && sprytextfield3.destroy){
                sprytextfield3.resetClasses();
                sprytextfield3.destroy();
                sprytextfield3 = null;
        } else if(value == 'Single'){
            if(!sprytextfield3){
                sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
            if(sprytextfield1 && sprytextfield1.destroy){
                sprytextfield1.resetClasses();
                sprytextfield1.destroy();
                sprytextfield1 = null;
            if(sprytextfield2 && sprytextfield2.destroy){
                sprytextfield2.resetClasses();
                sprytextfield2.destroy();
                sprytextfield2 = null;
        // proceed with the rest as normal
        return true;
    </script>
    </body>
    </html>

  • ICR: FBICS3 selects cleared documents and old documents

    Hi, I have just gone live with ICR functionality (processes 002 & 003) and I have notice that FBICS3 transaction is not working as I expected:
    1/ "Old documents": If I set in the program FBICS3 "year = 2010" & "month = 01"" I expected that the program would select document posted on period 1 year 2010. The reality is that the program has selected data from 2007 to now. I am surprised but probably the problem is that I did not understand how FBICS3 select data.  I assume It is correct and was my error. Since fiscal year and period are used to determine the key date of open items (open items "opened" at mm yyyy).
    2/But my real problem is that FBICS3 has selected cleared items and shows them on FBICA3 which I am sure is not correct.
    Does any body know if there is a SAP note that applies on this issue?
    Thanks a lot

    In order to give more information:
    I have already implemented following SAP Notes
    1159776     ICR: Select data from newGL     FI-GL-GL-G
    1235689     ICR: Runtime error TSV_TNEW_PAGE_ALLOC_FAILED     FI-GL-GL-G
    1337276     ICR: Cleared documents are not deleted     FI-GL-GL-G
    Thanks in advance for your help

  • Using variables defined in another script

    hallo
    i have two separate scripts trigered by two unique shortcuts:
    lets say first SCRIPT_1 takes a color (or any other property) of currentlly selected object and saves it in a variable "objCOLOR"
    than i work on something else for a while or select different objects and eventually run SCRIPT_2 where id like to use value "objCOLOR" which i defined a while ago using SCRIPT_1
    is it possible to define variables in one script and after a while use them in another script ? some kind of SUPER GLOBAL variables stored in memory of InDesign ? available to be used by various scripts ?

    I'm not JS man - but you can do this other way - use InsertLabel and ExtractLabel
    description from VB:
    Sub InsertLabel(Key As String, Value As String)
    Member of InDesign.Document
    Sets the label to the value associated with the specified key. / Key: The key. / Value: The value.
    Function ExtractLabel(Key As String) As String
    Member of InDesign.Document
    Gets the label value associated with the specified key. / Return value: The label. / Key: The key.
    example in VB:
    first script:
    myDoc.InsertLabel("objCOLOR","0,120,24,0")
    second script:
    myColor = myDoc.ExtractLabel("objCOLOR")
    I don't know if you can save color value directly ...
    I'm not sure - but you can use .InsertLabel and .ExtractLabel with all objects in InDesign
    robin
    www.adobescripts.com

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • Graph your pacman activity!

    Today I wanted to create a simple script that would graph my pacman activity, and I thought I might as well share it with community. Below you can find a python script that serves that purpose. You will need python2-matplotlib to use it. And here what my version of the graph looks like:
    Copyright (C) 2011 Yaşar Arabacı
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    import re
    import datetime
    import time
    import matplotlib.pyplot as plt
    import matplotlib.dates as mdates
    from collections import Counter
    months = mdates.MonthLocator() # every month
    days = mdates.DayLocator() # Every day
    monthsFmt = mdates.DateFormatter('%m-%Y')
    logfile = "/var/log/pacman.log"
    interesting_line = re.compile(
    r"\[(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2})\] "
    "(?P<action>installed|upgraded|removed)")
    installs = Counter()
    upgrades = Counter()
    removes = Counter()
    with open(logfile) as logfile:
    for line in logfile:
    match = interesting_line.search(line)
    if match:
    struct = time.strptime(match.group("datetime"),"%Y-%m-%d %H:%S")
    date = datetime.date(struct.tm_year, struct.tm_mon, struct.tm_mday)
    if match.group("action") == "installed":
    installs[date] += 1
    elif match.group("action") == "upgraded":
    upgrades[date] += 1
    elif match.group("action") == "removed":
    removes[date] += 1
    fig = plt.figure()
    ax = fig.add_subplot(111)
    insdatenumpairs = zip(installs.keys(), installs.values())
    insdatenumpairs = sorted(insdatenumpairs, key = lambda pair: pair[0])
    upgdatenumpairs = zip(upgrades.keys(), upgrades.values())
    upgdatenumpairs = sorted(upgdatenumpairs, key = lambda pair: pair[0])
    remdatenumpairs = zip(removes.keys(), removes.values())
    remdatenumpairs = sorted(remdatenumpairs, key = lambda pair: pair[0])
    ax.plot([pair[0] for pair in insdatenumpairs],[pair[1] for pair in insdatenumpairs],"b")
    ax.plot([pair[0] for pair in upgdatenumpairs],[pair[1] for pair in upgdatenumpairs],"g")
    ax.plot([pair[0] for pair in remdatenumpairs],[pair[1] for pair in remdatenumpairs],"y")
    ax.xaxis.set_major_locator(months)
    ax.xaxis.set_major_formatter(monthsFmt)
    ax.xaxis.set_minor_locator(days)
    ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
    ax.grid(True)
    fig.autofmt_xdate()
    plt.legend(("installs","upgrades","removes"))
    plt.xlabel("Date")
    plt.ylabel("# of packages")
    plt.show()
    Last edited by yasar11732 (2012-01-08 11:58:35)

    Here is a little bit different version, only showing total number of packages over time.
    Copyright (C) 2011 Yaşar Arabacı
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    import re
    import datetime
    import time
    import matplotlib.pyplot as plt
    import matplotlib.dates as mdates
    from collections import Counter
    months = mdates.MonthLocator() # every month
    days = mdates.DayLocator() # Every day
    monthsFmt = mdates.DateFormatter('%m-%Y')
    logfile = "/var/log/pacman.log"
    interesting_line = re.compile(
    r"\[(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2})\] "
    "(?P<action>installed|removed)")
    total = 0
    packs = Counter()
    with open(logfile) as logfile:
    for line in logfile:
    match = interesting_line.search(line)
    if match:
    struct = time.strptime(match.group("datetime"),"%Y-%m-%d %H:%S")
    date = datetime.date(struct.tm_year, struct.tm_mon, struct.tm_mday)
    if match.group("action") == "installed":
    total += 1
    elif match.group("action") == "removed":
    total -= 1
    packs[date] = total
    fig = plt.figure()
    ax = fig.add_subplot(111)
    datenumpairs = zip(packs.keys(), packs.values())
    datenumpairs = sorted(datenumpairs, key = lambda pair: pair[0])
    ax.plot([pair[0] for pair in datenumpairs],[pair[1] for pair in datenumpairs])
    ax.xaxis.set_major_locator(months)
    ax.xaxis.set_major_formatter(monthsFmt)
    ax.xaxis.set_minor_locator(days)
    ax.format_xdata = mdates.DateFormatter('%Y-%m-%d')
    ax.grid(True)
    fig.autofmt_xdate()
    plt.xlabel("Date")
    plt.ylabel("# of packages")
    plt.show()
    Last edited by yasar11732 (2012-01-08 11:59:09)

  • When server start, get "Waiting for another script to finish..." message and doesn't go anywhere.

    Hello, my engineer (Japanese) is trying to start AdobeMediaServer but he got stuck after getting "Waiting for another script to finish..." message. Any idea how to resolve this situation?
    [root@NA1SIBZDH02 /opt/adobe/ams]# ./server start
    NPTL 2.5
    chmod: changing permissions of `./tmp/': 読み込み専用ファイルシステムです
    Waiting for another script to finish...
    [root@NA1SIBZDH02 /opt/adobe/ams]#
    [root@NA1SIBZDH02 /opt/adobe/ams]#
    [root@NA1SIBZDH02 /opt/adobe/ams]# ls -l
    合計 52324
    drwxr-xr-x 15 ams  ams      4096  9月 11 17:54 Apache2.2
    -rwxr-xr-x  1 root root  1061035  9月 11 17:54 License.htm
    -rwxr-xr-x  1 root root    43374  9月 11 17:54 License.txt
    -rwxr-xr-x  1 root root    58827  9月 11 17:54 ReleaseNotes.htm
    -rwxr-xr-x  1 root root     5715  9月 11 17:54 adminserver
    -rwxr-xr-x  1 root root      871  9月 11 17:54 adobe-lq.png
    -rwxr-xr-x  1 root root     2912  9月 11 17:54 ams_icon.png
    -rwxr-xr-x  1 root root  3220552  9月 11 17:54 amsadmin
    -rw-r--r--  1 root root        6  9月 11 17:54 amsadmin.pid
    -rwxr-xr-x  1 root root 11187664  9月 11 17:54 amscore
    -rwxr-xr-x  1 root root  4331472  9月 11 17:54 amsedge
    -rwxr-xr-x  1 root root  3070840  9月 11 17:54 amsmaster
    -rw-r--r--  1 root root        6  9月 11 17:54 amsmaster.pid
    -rwxr-xr-x  1 root root     5242  9月 11 17:54 amsmgr
    drwxrwxrwx  6 ams  ams      4096  9月 11 17:54 applications
    -rwxr-xr-x  1 root root      960  9月 11 17:54 cleanup
    drwxr-x---  3 ams  ams      4096  9月 11 17:54 conf
    drwxr-xr-x  5 ams  ams      4096  9月 11 17:54 creds
    drwxr-xr-x  3 root root     4096  9月 11 17:54 documentation
    -rwxr-xr-x  1 root root 16368842  9月 11 17:54 libadbe_dme.so
    -rwxr-xr-x  1 root root   336065  9月 11 17:54 libadbe_flv.so
    -rwxr-xr-x  1 root root    59248  9月 11 17:54 libasneu.so.1
    -rwxr-xr-x  1 root root    71263  9月 11 17:54 libcares.so
    -rwxr-xr-x  1 root root    71263  9月 11 17:54 libcares.so.2
    -rwxr-xr-x  1 root root    71263  9月 11 17:54 libcares.so.2.0.0
    -rwxr-xr-x  1 root root  1968482  9月 11 17:54 libcrypto.so.1.0.0
    -rwxr-xr-x  1 root root   162403  9月 11 17:54 libexpat.so.1
    -rwxr-xr-x  1 root root  3497472  9月 11 17:54 libfmsccme.so
    -rwxr-xr-x  1 root root  6992879  9月 11 17:54 libhds.so
    -rwxr-xr-x  1 root root   403767  9月 11 17:54 libssl.so.1.0.0
    drwxr-xr-x  2 root root     4096  9月 11 17:54 licenses
    drwxrwxrwx  2 root root     4096  9月 11 17:54 logs
    drwxr-xr-x  5 root root     4096  9月 11 17:54 modules
    drwxr-xr-x  6 root root     4096  9月 11 17:54 samples
    drwxr-xr-x  3 root root     4096  9月 11 17:54 scriptlib
    -rwxr-xr-x  1 root root     7494  9月 11 17:54 server
    -rwxr-xr-x  1 root root   300864  9月 11 17:54 shmrd
    -rwxr-xr-x  1 root root    36206  9月 11 17:54 tcSrvMsg
    drwxrwxrwx  2 root root     4096  9月 11 17:54 tmp
    drwxr-xr-x  9 root root     4096  9月 11 17:54 tools
    -rwxr-xr-x  1 root root     2411  9月 11 17:54 uninstallAMS
    drwxr-xr-x  8 ams  ams      4096  9月 11 17:54 webroot
    [root@NA1SIBZDH02 /opt/adobe/ams]#
    [root@NA1SIBZDH02 /opt/adobe/ams]#
    ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.<br />
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    * https://support.mozilla.com/kb/Server+not+found
    * https://support.mozilla.com/kb/Firewalls

  • Waiting for another script to finish...

    I can no more start or stop FMS3 server, it says :
    Waiting for another script to finish...
    According to the start script, i check
    /home/fms/tmp/script.lck and i have this file as empty, what should
    i do then ?
    Do you all have this file ? /home/fms/tmp/script.lck ?
    Jerome

    My reply is late i just read your problem after having the same, it locked up my whole Ubuntu system.
    Its easy to solve just delete the lock folder you see. Server should restart and work fine.

  • Is it possible to clear your photo stream?

    I was just wondering if it's possible to clear your photo stream...that is all.

    Do you want to delete the photos in your PhotoStream?
    You can do that. Find the screen with all the thumbnails of the photos in your PhotoStream. Tap on Select. Then select the photos you want to delete. Tap on trash.

  • Illustrator script to select multiple layers

    I have about 74 layers in illustrator and i want to run a script to select combination of layers at a time.
    For e.g. I want 5 layers to be selected and save them as one .jpg. Then say i need to select other 3 layers to save it as a seperate .jpg file. If i do it manually it comes upto 300,000 images.
    I can create a csv file with all layers to be selected presented in a row. I need help with the command to select 4 or more layers at a time, say if i have layer1, layer2, layer3, layer4 then a command to select those 4 layers and save them as a .jpg file.
    Any help will be greatly appreciated.
    Thanks
    H Patel
    CEO
    Data Entry India

    Create a csv or .text file ( i used "test.txt"  and place it at any location say C:\\)
    Enter the layer names to be exported in each row separated by ";"  like
    Layer 1;Layer 2
    Layer 4;Layer 5;Layer 7      // you can type in the names of as many layers you wanted to export in a single jpeg
    Open your main .Ai file in Illustrator and run the following script
    var count;
    count =1;
    var f = new File ("C:\\test.txt");
    f.open("r");
    while(!f.eof)
    c=f.readln();
    var arr = c.split(";");
    var len= arr.length;
    for(i=0;i<len;i++)
       lay= app.activeDocument.layers.getByName(arr[i]);
       lay.hasSelectedArtwork=true;
    app.copy();
    app.documents.add();   
    app.paste();
       var exportOptions = new ExportOptionsJPEG();
       var type = ExportType.JPEG
       var fileSpec = new File("c:\\"+count+".jpg");
        app.activeDocument.exportFile( fileSpec, type, exportOptions );
    app.activeDocument.close();
    for(i=0;i<len;i++)
        app.activeDocument.layers.getByName(arr[i]).hasSelectedArtwork=false;
    count ++;
    What this script is doing is
    it is reading a line from the .txt file (c:\\test.txt in this case)  and pushing the layers to be exported in an array
    then selecting the objects on the layers to be exported
    copying the selected contents
    pasting the contents on the new doc
    exporting as jpeg
    closing the doc
    deselecting the selected objects
    Hope this will solve your problem ...

  • Im stuck on trying to call another script

    I have a script that I want to excute another script that places phone calls. I have both scripts done but my main script is not excuting my phone call script. From what I have read on the forum the highlighted line is what i think is what im supposed to do but it does not seem to be working. Sorry if this is a dumb question I am new at UCCX scripting.

    Matt, I don't see what you are talking about when you say "the highlighted line."
    Also, you didn't mention how your calling the second script from the first one.  I wonder if you meant to upload a screenshot?
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

Maybe you are looking for

  • How to select a new table in logical database after creating the Infoset

    I have created a abap query report ,i have used logical data base ADA in the infoset in SQ02.In the logical database i had selected only two tables then ANALV and ANLB.Now my client wants one more field to be added and thats is from table ANEK.Now i

  • HT201303 What happened to the music I paid for and downloaded to my Ipod?

    I downloaded a new album to my older ipod where I had credit of $29.99   I hasn't downloaded onto the ipod which was connected to mycomputer

  • PROLEM IN RETRIVING MATNR FROM MSEG IN STOCK REPORT

    HI FRIENDS , IAM DOING A REPORT IN WHICH I HAVE TO DISPLAY THOSE MATERIAL NUMBER WHICH HAS UNRESTRICTED STOCK AS OF TODAY AND ALSO THOSE WHICH HAVE TRANSACTION DONE IN LAST ONE YEAR THAT I THINK HAVE TO TAKE FRM MKPF AND MSEG , I SELECTED MATNR FROM

  • ECC 6 Best Practice

    Dear all, I hope someone can help me as I am a bit confused. We are implementing ECC 6 Automotive OEM Best Practice. The customer has a number of SD requirements which I do not seem to find anywhere in the pre configured scenarios. Furthermore, I am

  • Different behavior when URL Parameter clientDebug is set

    Hi experts I'm facing a strange behavior in my WebDynpro application. Whenever I launch it with the URL parameter sap-wd-clientDebug set to X the interactiveForm element on one of my views works flawlessly (i.e. the assigned context nodes on my view