Help : Usage of FocusTraversalPolicy in 1.4.2_07

Dear All,
My existing application written in Jdk 1.3.1_15.Now,upgrading to 1.4.2_07.
Compilation in 1.4.2_07 throws so many warnings about the deprecated method setNextFocusableComponent(Component c);
Usage of setNextFocusableComponent
Assume 10 components are added in a container like Panel.
We can set the focus in random manner like comp1 ->comp3->comp5->comp4 etc.
So, the coding will be like,
comp1.setNextFocusablecomponent(comp3);
comp3.setNextFocusableComponent(comp5);
comp5.setNextFocusableComponent(comp4); etc ..etc..
Since this particular method is deprecated in 1.4.2_07, i get warnings.
I don't prefer this warnings and need clean compilation.
The alternative solution is implementing FocusTraversalPolicy class.
FocusTraversalPolicy class
It is an abstract class has subclasses ContainerOrderFocusTraversalPolicy and InternalFrameFocusTraversalPolicy .
I have an option to set ContainerOrderFocusTraversalPolicy to my container by the following line .
ContainerOrderFocusTraversalPolicy CTP= new ContainerOrderFocusTraversalPolicy();
panel.setFocusTraversalPolicy(CTP);
The above lines of coding let componets have the sequential order of focus like comp1->comp2->comp3 etc...
But i need to assign the random order of focus to components.
Could anyone please help me in this regard ? what i need to do further ?
Please help me to understand how to use this policy class for my need.Appreciate your responses.
Sample test program
import java.awt.*;
import javax.swing.*;
public class TestPanel {
public static void main(String args[]) {
JFrame frame = new JFrame();
Container content = frame.getContentPane();
JLabel l1,l2,l3,l4,l5;
JTextField jt1,jt2,jt3;
JComboBox jcb1;
JCheckBox jchb1;
JPanel jp= new JPanel();
l1=new JLabel();
l1.setText("name");
l2=new JLabel();
l2.setText("Age");
l3=new JLabel();
l3.setText("Qualification");
l4=new JLabel();
l4.setText("Male - Yes");
l5=new JLabel();
l5.setText("DOB");
jt1=new JTextField(10);
jt2=new JTextField(20);
jt3=new JTextField(20);
jcb1=new JComboBox();
jchb1=new JCheckBox();
jp.add(l1);
jp.add(jt1);
jp.add(l2);
jp.add(jt2);
jp.add(l3);
jp.add(jcb1);
jp.add(l4);
jp.add(jchb1);
jp.add(l5);
jp.add(jt3);
// deprecated methods commented to avoid warnings in 1.4.2_07
/* jt1.setNextFocusableComponent(jcb1);
jcb1.setNextFocusableComponent(jt3);
jt3.setNextFocusableComponent(jchb1);
jchb1.setNextFocusableComponent(jt2);
jt2.setNextFocusableComponent(jt1);*/
// New policy class
ContainerOrderFocusTraversalPolicy CTP= new ContainerOrderFocusTraversalPolicy();
// setting the policy class in panel
jp.setFocusTraversalPolicy(CTP);
content.add(jp, BorderLayout.CENTER);
frame.pack();
frame.show();
jp.getComponent(1).requestFocusInWindow();
Thanks and Regards
David Menfields

You need to actually write your own FocusTraversalPolicy class.
It's actually pretty easy - just subclass FocusTraversalPolicy and override all the methods. You need to have your own algorithm for determining the next/first/last/etc components and after a short look at your code my guess would be to hold a reference to each component on your form in an array in the order you want the focus to move in and then you can easily return the "next" or "previous" component by looking up the array.
Some of the methods can call others - e.g. getDefaultComponent, getFirstComponent, and getInitialComponent usually all return the same value.
Regards,
Tim

Similar Messages

  • Help. usage report.

    How can you look at detailed usage report?

    Hi kylineMc,
    You can view detailed calls or messages via your  My Verizon account.  Once you are logged in, to see your unbilled usage select Usage Details below My usage.  To view your billed usage details select My Bill then Usage Details.   I hope this information is helpful.  Please advise if you have any additional concerns.
    Thank you for your contribution to our community forums,

  • IOS7 help - usage issue!

    I have a problem. Ever since I updated to iOS7, 'MESSAGES' is now on usage. Where did that come from!? I think this is taking up the most space! But after I saw this, I deleted ALL OF MY MESSAGES and I go back to usage again, and it STILL says 7.9GB. WHAT IS GOING ON???

    Hello! I spoke to a guy working at Apple today for hours and he didn't really know what was causing this issue. He made me delete my messages several times (with airplane mode too) and made me reset my phone, but the messages somehow still came back! Even after I deleted my messages and backed up and then restored my phone again, the messages still somehow came back again! So finally, he told me that he thinks it might be a hardware/software issue or something? I forgot what he said, sorry . He said that restoring backup is not doing anything either and that there's probably a problem with that too. So he made me restore my whole iphone and set it up as a new phone which I just did right now and the message issue has gone. I'm going to have to re-install my apps though but that doesn't bother me. Atleast this weird issue has gone now and hopefully it doesn't come back! Good luck!

  • No output at all from weblogic.Admin HELP | GETSTATE | VERSION on linux

    Hi, somehow I am getting zero output from weblogic.Admin command, is it redirected somewhere?
    #>java -cp $WH/server/lib/weblogic.jar weblogic.Admin -adminurl $AURL -username weblogic -password $WPWD VERSION
    #>java -cp $WH/server/lib/weblogic.jar weblogic.Admin -adminurl $AURL -username weblogic -password $WPWD GETSTATE
    #>
    #>java -cp $WH/server/lib/weblogic.jar weblogic.Admin -username weblogic -password $WPWD HELP
    #>
    Thanks.

    Hi,
    You need to Run the SetDomainEnv.sh/cmd from the Domain_Home/bin and then you can execute the below Commands and they will execute succesfully
    Eg:From Windows Environment Same applies in Linux Environmet as well
    C:\Oracle\Middleware\wlserver_10.3\server\lib>java -cp weblogic.jar weblogic.Admin -adminurl  t3://localhost:7001  -username weblogic -password weblogic1 VERSION
    WebLogic Server 10.3.5.0  Fri Apr 1 20:20:06 PDT 2011 1398638
    C:\Oracle\Middleware\wlserver_10.3\server\lib>java -cp weblogic.jar weblogic.Admin -adminurl  t3://localhost:7001  -username weblogic -password weblogic1 GETSTATE
    Current state of "AdminServer" : RUNNING
    C:\Oracle\Middleware\wlserver_10.3\server\lib>java -cp weblogic.jar weblogic.Admin -adminurl  t3://localhost:7001  -username weblogic -password weblogic1 HELP
    Usage: java [<SSL trust options>] weblogic.Admin
            [ [-url | -adminurl] [<protocol>://]<listen-address>:<port>]
            -username <username> [-password <password>]
            <COMMAND> <ARGUMENTS>
    Hope it helps

  • Voximp help [solved]

    Hello I was just trying to install and run voximp. I have followed each step from
    http://ardoris.wordpress.com/2008/08/09 … ol-voximp/
    here is voximpconf.py. I did run voximp -c and the file voximpconf.pyc does exist
    languagemodel = '9882' #set this to something sensible
    keycommand = {
    'RIGHT': "super+Right", #move one tag to the right
    'LEFT': "super+Left", #move one tag to the left
    'TERMINAL': "ctrl+grave", #spawn the terminal
    'CLOSE': "alt+F4", #close window
    'ENTER': "Return",
    'SAVE': "ctrl+s",
    'NEW': "ctrl+n",
    'TAB': "ctrl+Tab", #for seeing next firefox tab
    'BACKSPACE': "BackSpace",
    'CUT': "ctrl+x",
    'COPY': "ctrl+c",
    'PASTE': "ctrl+v"
    for letter in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
    keycommand[letter] = letter.lower() #add all the letters - yes this is a true python file, you can do w/e you want in here
    programcommand = {
    'FIREFOX': "firefox",
    'NOTEPAD': "medit",
    'GOOGLE': "firefox www.google.com", #open google in a new tab in firefox
    'HIBERNATE': "sudo hibernate",
    'PLAY': "xmms2 play",
    'STOP': "xmms2 stop"
    mousecommand = {
    'CLICK': '1', #leftclick
    'RIGHTCLICK': '3' #rightclick
    progswithargs = {
    'ALERT': "notify-send" #just to demonstrate with arguments
    confirm = [ #anything listed here produces a confirm dialog before being executed
    'HIBERNATE'
    Here is /usr/bin/voximp
    #!/usr/bin/env python2
    # Copyright (c) 2008 Ben Duffield
    # Licensing - no idea
    # Probably w/e sphinx is, think it's MIT
    # Be nice!
    #REQUIRES:
    # gstreamer
    # pygtk
    # pocketsphinx
    # xdotool
    import pygtk
    pygtk.require('2.0')
    import gtk
    import gobject
    import pygst
    pygst.require('0.10')
    gobject.threads_init()
    import gst
    from subprocess import Popen
    import os
    import sys
    import getopt
    config_dir = os.path.join(os.path.expanduser("~"), '.config/voximp/')
    try:
    os.makedirs(config_dir)
    except:
    pass
    sys.path.append(config_dir)
    from voximpconf import *
    language_file = os.path.join(config_dir, str(languagemodel))
    config = {
    'hmm': '/usr/share/pocketsphinx/model/hmm/wsj1',
    'lm': '%s.lm' % language_file,
    'dict': '%s.dic' % language_file
    class Voximp(object):
    dial = None
    def __init__(self):
    self.init_gst()
    self.pipeline.set_state(gst.STATE_PLAYING)
    def init_gst(self):
    self.pipeline = gst.parse_launch('alsasrc device="hw:0,1" ! audioconvert ! audioresample '
    + '! vader name=vad auto-threshold=true '
    + '! pocketsphinx name=asr ! fakesink')
    asr = self.pipeline.get_by_name('asr')
    asr.connect('partial_result', self.asr_partial_result)
    asr.connect('result', self.asr_result)
    asr.set_property('lm', config['lm'])
    asr.set_property('dict', config['dict'])
    asr.set_property('configured', True)
    bus = self.pipeline.get_bus()
    bus.add_signal_watch()
    bus.connect('message::application', self.application_message)
    self.pipeline.set_state(gst.STATE_PAUSED)
    def asr_partial_result(self, asr, text, uttid):
    struct = gst.Structure('partial_result')
    struct.set_value('hyp', text)
    struct.set_value('uttid', uttid)
    asr.post_message(gst.message_new_application(asr, struct))
    def asr_result(self, asr, text, uttid):
    struct = gst.Structure('result')
    struct.set_value('hyp', text)
    struct.set_value('uttid', uttid)
    asr.post_message(gst.message_new_application(asr, struct))
    def application_message(self, bus, msg):
    msgtype = msg.structure.get_name()
    if msgtype == 'partial_result':
    self.partial_result(msg.structure['hyp'], msg.structure['uttid'])
    elif msgtype == 'result':
    self.final_result(msg.structure['hyp'], msg.structure['uttid'])
    #self.pipeline.set_state(gst.STATE_PAUSED)
    #self.button.set_active(False)
    def partial_result(self, hyp, uttid):
    print "partial: %s" % hyp
    def final_result(self, hyp, uttid):
    print "final: %s" % hyp
    prog = ''
    command = None
    if self.dial is not None:
    if hyp == 'YES':
    self.dial.response(gtk.RESPONSE_YES)
    else:
    self.dial.response(gtk.RESPONSE_NO)
    elif hyp in programcommand:
    prog = programcommand[hyp]
    command = hyp
    elif hyp in keycommand:
    prog = "xdotool key ``%s''" % keycommand[hyp]
    command = hyp
    elif hyp in mousecommand:
    prog = "xdotool click %s" % mousecommand[hyp]
    command = hyp
    else:
    values = hyp.split(' ')
    if len(values) <= 1:
    return
    if values[0] in progswithargs:
    prog = progswithargs[values[0]] + ' ' + ' '.join(values)
    command = values[0]
    else:
    for value in values:
    self.final_result(value, 0)
    if prog:
    print "command is %s" % command
    if command in confirm:
    self.confirm(prog)
    else:
    p = Popen(prog, shell=True)
    def confirm(self, prog):
    print "Confirming %s" % prog
    self.dial = gtk.MessageDialog(message_format = "Confirm?", type=gtk.MESSAGE_QUESTION)
    self.dial.format_secondary_markup("Say <b><i>yes</i></b> or <b><i>no</i></b>")
    self.dial.prog = prog
    self.dial.show_all()
    self.dial.connect("response", self.confirmCallback)
    def confirmCallback(self, dialog, response_id):
    print "callback called back"
    if response_id == gtk.RESPONSE_YES:
    p = Popen(dialog.prog, shell=True)
    self.dial.destroy()
    self.dial = None
    versionNumber = '0.0.1'
    usageInfo = '''Usage: voximp [options]
    Options:
    -v, --version show program version and exit
    -h, --help show this help message and exit
    -c, --corpus create a corpus.txt in current directory - used for generating language model files
    def usage():
    print "Voximp version %s" % versionNumber
    print usageInfo
    def version():
    print "Version %s" % versionNumber
    def corpus():
    words = []
    words.extend(keycommand.keys())
    words.extend(programcommand.keys())
    words.extend(mousecommand.keys())
    words.extend(progswithargs.keys())
    corpusText = "\n".join(words)
    filename = os.path.join(os.getcwd(), 'corpus.txt')
    print "Saving to %s" % filename
    corp = open(filename, 'w')
    corp.write(corpusText)
    corp.flush()
    corp.close()
    print "Corpus saved"
    print "Now visit http://www.speech.cs.cmu.edu/tools/lmtool.html"
    print " ==> choose the corpus file, click COMPILE KNOWLEDGE BASE"
    print " ==> save the three files to ~/.config/voximp/"
    print " ==> edit ~/.config/voximp/voximpconf.py and set the languagemodel string to the appropriate value \n\t- e.g. if the files are named 4766.dic, 4766.lm and 4766.sent, set languagemodel = '4766'"
    if __name__ == '__main__':
    try:
    opts, args = getopt.getopt(sys.argv[1:], "hcv", ["help", "corpus", "version"])
    except getopt.GetoptError:
    print "error"
    usage()
    sys.exit(2)
    for opt, arg in opts:
    if opt in ("-h", "--help"):
    usage()
    sys.exit()
    elif opt in ("-c", "--corpus"):
    corpus()
    sys.exit()
    elif opt in ("-v", "--version"):
    version()
    sys.exit()
    app = Voximp()
    gtk.main()
    here is my hardware
    **** List of CAPTURE Hardware Devices ****
    card 0: Intel [HDA Intel], device 0: ALC268 Analog [ALC268 Analog]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: Microphone [Logitech USB Microphone], device 0: USB Audio [USB Audio]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    I have also unmuted and turned up the mic in alsa mixer.
    Here is the output of voximp
    ** Message: pygobject_register_sinkfunc is deprecated (GstObject)
    INFO: cmd_ln.c(691): Parsing command line:
    gst-pocketsphinx \
    -samprate 8000 \
    -cmn prior \
    -fwdflat no \
    -bestpath no \
    -maxhmmpf 2000 \
    -maxwpf 20
    Current configuration:
    [NAME] [DEFLT] [VALUE]
    -agc none none
    -agcthresh 2.0 2.000000e+00
    -alpha 0.97 9.700000e-01
    -ascale 20.0 2.000000e+01
    -aw 1 1
    -backtrace no no
    -beam 1e-48 1.000000e-48
    -bestpath yes no
    -bestpathlw 9.5 9.500000e+00
    -bghist no no
    -ceplen 13 13
    -cmn current prior
    -cmninit 8.0 8.0
    -compallsen no no
    -debug 0
    -dict
    -dictcase no no
    -dither no no
    -doublebw no no
    -ds 1 1
    -fdict
    -feat 1s_c_d_dd 1s_c_d_dd
    -featparams
    -fillprob 1e-8 1.000000e-08
    -frate 100 100
    -fsg
    -fsgusealtpron yes yes
    -fsgusefiller yes yes
    -fwdflat yes no
    -fwdflatbeam 1e-64 1.000000e-64
    -fwdflatefwid 4 4
    -fwdflatlw 8.5 8.500000e+00
    -fwdflatsfwin 25 25
    -fwdflatwbeam 7e-29 7.000000e-29
    -fwdtree yes yes
    -hmm
    -input_endian little little
    -jsgf
    -kdmaxbbi -1 -1
    -kdmaxdepth 0 0
    -kdtree
    -latsize 5000 5000
    -lda
    -ldadim 0 0
    -lextreedump 0 0
    -lifter 0 0
    -lm
    -lmctl
    -lmname default default
    -logbase 1.0001 1.000100e+00
    -logfn
    -logspec no no
    -lowerf 133.33334 1.333333e+02
    -lpbeam 1e-40 1.000000e-40
    -lponlybeam 7e-29 7.000000e-29
    -lw 6.5 6.500000e+00
    -maxhmmpf -1 2000
    -maxnewoov 20 20
    -maxwpf -1 20
    -mdef
    -mean
    -mfclogdir
    -min_endfr 0 0
    -mixw
    -mixwfloor 0.0000001 1.000000e-07
    -mllr
    -mmap yes yes
    -ncep 13 13
    -nfft 512 512
    -nfilt 40 40
    -nwpen 1.0 1.000000e+00
    -pbeam 1e-48 1.000000e-48
    -pip 1.0 1.000000e+00
    -pl_beam 1e-10 1.000000e-10
    -pl_pbeam 1e-5 1.000000e-05
    -pl_window 0 0
    -rawlogdir
    -remove_dc no no
    -round_filters yes yes
    -samprate 16000 8.000000e+03
    -seed -1 -1
    -sendump
    -senlogdir
    -senmgau
    -silprob 0.005 5.000000e-03
    -smoothspec no no
    -svspec
    -tmat
    -tmatfloor 0.0001 1.000000e-04
    -topn 4 4
    -topn_beam 0 0
    -toprule
    -transform legacy legacy
    -unit_area yes yes
    -upperf 6855.4976 6.855498e+03
    -usewdphones no no
    -uw 1.0 1.000000e+00
    -var
    -varfloor 0.0001 1.000000e-04
    -varnorm no no
    -verbose no no
    -warp_params
    -warp_type inverse_linear inverse_linear
    -wbeam 7e-29 7.000000e-29
    -wip 0.65 6.500000e-01
    -wlen 0.025625 2.562500e-02
    INFO: cmd_ln.c(691): Parsing command line:
    -nfilt 20 \
    -lowerf 1 \
    -upperf 4000 \
    -wlen 0.025 \
    -transform dct \
    -round_filters no \
    -remove_dc yes \
    -svspec 0-12/13-25/26-38 \
    -feat 1s_c_d_dd \
    -agc none \
    -cmn current \
    -cmninit 56,-3,1 \
    -varnorm no
    Current configuration:
    [NAME] [DEFLT] [VALUE]
    -agc none none
    -agcthresh 2.0 2.000000e+00
    -alpha 0.97 9.700000e-01
    -ceplen 13 13
    -cmn current current
    -cmninit 8.0 56,-3,1
    -dither no no
    -doublebw no no
    -feat 1s_c_d_dd 1s_c_d_dd
    -frate 100 100
    -input_endian little little
    -lda
    -ldadim 0 0
    -lifter 0 0
    -logspec no no
    -lowerf 133.33334 1.000000e+00
    -ncep 13 13
    -nfft 512 512
    -nfilt 40 20
    -remove_dc no yes
    -round_filters yes no
    -samprate 16000 8.000000e+03
    -seed -1 -1
    -smoothspec no no
    -svspec 0-12/13-25/26-38
    -transform legacy dct
    -unit_area yes yes
    -upperf 6855.4976 4.000000e+03
    -varnorm no no
    -verbose no no
    -warp_params
    -warp_type inverse_linear inverse_linear
    -wlen 0.025625 2.500000e-02
    INFO: acmod.c(246): Parsed model-specific feature parameters from /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/feat.params
    INFO: feat.c(713): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
    INFO: cmn.c(142): mean[0]= 12.00, mean[1..12]= 0.0
    INFO: acmod.c(167): Using subvector specification 0-12/13-25/26-38
    INFO: mdef.c(517): Reading model definition: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/mdef
    INFO: mdef.c(528): Found byte-order mark BMDF, assuming this is a binary mdef file
    INFO: bin_mdef.c(336): Reading binary model definition: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/mdef
    INFO: bin_mdef.c(513): 50 CI-phone, 143047 CD-phone, 3 emitstate/phone, 150 CI-sen, 5150 Sen, 27135 Sen-Seq
    INFO: tmat.c(205): Reading HMM transition probability matrices: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/transition_matrices
    INFO: acmod.c(121): Attempting to use SCHMM computation module
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/means
    INFO: ms_gauden.c(292): 1 codebook, 3 feature, size:
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/variances
    INFO: ms_gauden.c(292): 1 codebook, 3 feature, size:
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(294): 256x13
    INFO: ms_gauden.c(354): 0 variance values floored
    INFO: s2_semi_mgau.c(903): Loading senones from dump file /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/sendump
    INFO: s2_semi_mgau.c(927): BEGIN FILE FORMAT DESCRIPTION
    INFO: s2_semi_mgau.c(1022): Using memory-mapped I/O for senones
    INFO: s2_semi_mgau.c(1296): Maximum top-N: 4 Top-N beams: 0 0 0
    INFO: dict.c(317): Allocating 4158 * 32 bytes (129 KiB) for word entries
    INFO: dict.c(332): Reading main dictionary: /home/tron/.config/voximp/9882.dic
    INFO: dict.c(211): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(335): 51 words read
    INFO: dict.c(341): Reading filler dictionary: /usr/share/pocketsphinx/model/hmm/en_US/hub4wsj_sc_8k/noisedict
    INFO: dict.c(211): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(344): 11 words read
    INFO: dict2pid.c(396): Building PID tables for dictionary
    INFO: dict2pid.c(404): Allocating 50^3 * 2 bytes (244 KiB) for word-initial triphones
    INFO: dict2pid.c(131): Allocated 60400 bytes (58 KiB) for word-final triphones
    INFO: dict2pid.c(195): Allocated 60400 bytes (58 KiB) for single-phone word triphones
    INFO: ngram_model_arpa.c(477): ngrams 1=49, 2=94, 3=47
    INFO: ngram_model_arpa.c(135): Reading unigrams
    INFO: ngram_model_arpa.c(516): 49 = #unigrams created
    INFO: ngram_model_arpa.c(195): Reading bigrams
    INFO: ngram_model_arpa.c(533): 94 = #bigrams created
    INFO: ngram_model_arpa.c(534): 3 = #prob2 entries
    INFO: ngram_model_arpa.c(542): 3 = #bo_wt2 entries
    INFO: ngram_model_arpa.c(292): Reading trigrams
    INFO: ngram_model_arpa.c(555): 47 = #trigrams created
    INFO: ngram_model_arpa.c(556): 2 = #prob3 entries
    INFO: ngram_search_fwdtree.c(99): 41 unique initial diphones
    INFO: ngram_search_fwdtree.c(147): 0 root, 0 non-root channels, 17 single-phone words
    INFO: ngram_search_fwdtree.c(186): Creating search tree
    INFO: ngram_search_fwdtree.c(191): before: 0 root, 0 non-root channels, 17 single-phone words
    INFO: ngram_search_fwdtree.c(326): after: max nonroot chan increased to 191
    INFO: ngram_search_fwdtree.c(338): after: 41 root, 63 non-root channels, 16 single-phone words
    Last edited by mich04 (2013-12-19 20:34:23)

    I figured out what I was doing wrong hw:1,0 not hw:0,1

  • Java command still not working - please help

    i have installed jdk1.6.0_05. The javac command works fine but the java command does not work at all. even when i try java HelloWorld i receive this exception message
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
    Caused by: java.lang.ClassNotFoundException: HelloWorld
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    please help (you to SUN)!!

    bart@kerberos:~$ javac -help
    Usage: javac <options> <source files>
    where possible options include:
      -g                         Generate all debugging info
      -g:none                    Generate no debugging info
      -g:{lines,vars,source}     Generate only some debugging info
      -nowarn                    Generate no warnings
      -verbose                   Output messages about what the compiler is doing
      -deprecation               Output source locations where deprecated APIs are used
      -classpath <path>          Specify where to find user class files and annotation processors
      -cp <path>                 Specify where to find user class files and annotation processors
      -sourcepath <path>         Specify where to find input source files
      -bootclasspath <path>      Override location of bootstrap class files
      -extdirs <dirs>            Override location of installed extensions
      -endorseddirs <dirs>       Override location of endorsed standards path
      -proc:{none,only}          Control whether annotation processing and/or compilation is done.
      -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
      -processorpath <path>      Specify where to find annotation processors
      -d <directory>             Specify where to place generated class files
      -s <directory>             Specify where to place generated source files
      -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
      -encoding <encoding>       Specify character encoding used by source files
      -source <release>          Provide source compatibility with specified release
      -target <release>          Generate class files for specific VM version
      -version                   Version information
      -help                      Print a synopsis of standard options
      -Akey[=value]              Options to pass to annotation processors
      -X                         Print a synopsis of nonstandard options
      -J<flag>                   Pass <flag> directly to the runtime systemSee the bold part.
    More information: [http://java.sun.com/docs/books/tutorial/java/package/managingfiles.html]

  • Bash script doesn't work (Also, help me condense it)...

    I am trying to make myself a bash script which combines files together based off of a config file. It is automating combining the audio book tracks I ripped of my CDs into chapters for easier reference. My first problem is that even though I used ', cat still thinks that everything is a separate file. My second problem is that it is way too long, any way I can have it automatically go up 1 chapter until a specified number (ie, until the value of the CHAPTERS variable)? Thanks to those who help.
    chapcomb.sh
    #!/bin/bash
    # * ChapterCombine *
    # * By smartboyathome *
    # * A script which was made to combine *
    # * chapters from ripped audio books *
    # * together, but can be edited to *
    # * combine just about anything. *
    # * The config file is located in your *
    # * home directory, under the name *
    # * '.chapcomb.config'. If you do not *
    # * have this file, create it. *
    # * Otherwise this script will not *
    # * run, as it won't have the proper *
    # * variables. *
    # * This can be changed by changing *
    # * the CONFIG variable below. *
    # * Licensed under: *
    # * SmartLicense version 1.0 *
    VERSION=0.1
    usage() {
    echo "Chapter Combine v$VERSION"
    echo "A configuration file must be made in order to use this script. Configuration files are located at $CONFIG. This can be changed by adding CONFIG='blah' before this command, or by changing the script directly. See the sample file for how it should look."
    while [ "$#" -ne "0" ]; do
    case $# in
    --help)
    usage
    exit 0
    -h)
    usage
    exit 0
    esac
    done
    # The config file stuff.
    if [ -z "$CONFIG" ]; then
    CONFIG="$HOME/.chapcomb.config"
    fi
    . $CONFIG
    cd "$BOOKDIR"
    combine() {
    # Checks if file exists, and if so, deletes it.
    if [ -a $NAME ]; then
    rm $NAME
    fi
    # Combines files
    cat $FILES >> $NAME
    # Checks to make sure that the chapter combined ok.
    if [ -s "$NAME" ]; then
    echo "File $NAME is ok."
    else
    echo "File $NAME had an error and didn't combine. Please fix config file and rerun this script."
    exit 0
    fi
    chapter01
    combine
    chapter02
    combine
    chapter03
    combine
    chapter04
    combine
    chapter05
    combine
    chapter06
    combine
    chapter07
    combine
    chapter08
    combine
    chapter09
    combine
    chapter10
    combine
    chapter11
    combine
    chapter12
    combine
    chapter13
    combine
    chapter14
    combine
    chapter15
    combine
    chapter16
    combine
    chapter17
    combine
    chapter18
    combine
    chapter19
    combine
    chapter20
    combine
    chapter21
    combine
    chapter22
    combine
    chapter23
    combine
    chapter24
    combine
    chapter25
    combine
    chapter26
    combine
    chapter27
    combine
    chapter28
    combine
    chapter29
    combine
    .chapcomb.config
    # Config file for ChapterCombine
    # DO NOT DELETE, OR CHAPTERCOMBINE WILL NOT FUNCTION!
    # Book's Directory
    BOOKDIR='/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    # Each chapter's settings.
    chapter01() {
    # FILES='Outcast\ Disc\ 1/01\ Track\ 1.mp3 Outcast\ Disc\ 1/02\ Track\ 2.mp3 Outcast\ Disc\ 1/03\ Track\ 3.mp3 Outcast\ Disc\ 1/04\ Track\ 4.mp3'
    FILES="'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter01.mp3'
    chapter02() {
    # FILES='Outcast\ Disc\ 1/05\ Track\ 5.mp3 Outcast\ Disc\ 1/06\ Track\ 6.mp3 Outcast\ Disc\ 1/07\ Track\ 7.mp3 Outcast\ Disc\ 1/08\ Track\ 8.mp3 Outcast\ Disc\ 1/09\ Track\ 9.mp3 Outcast\ Disc\ 1/10\ Track\ 10.mp3 Outcast\ Disc\ 1/11\ Track\ 11.mp3'
    FILES="'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter02.mp3'
    chapter03() {
    # FILES='Outcast\ Disc\ 1/12\ Track\ 12.mp3 Outcast\ Disc\ 1/13\ Track\ 13.mp3 Outcast\ Disc\ 1/14\ Track\ 14.mp3 Outcast\ Disc\ 1/15\ Track\ 15.mp3 Outcast\ Disc\ 1/16\ Track\ 16.mp3'
    FILES="'Outcast Disc 1'/{'12 Track 12','13 Track 13','14 Track 14','15 Track 15','16 Track 16'}.mp3"
    NAME='Chapter03.mp3'
    chapter04() {
    # FILES='Outcast\ Disc\ 2/01\ Track\ 1.mp3 Outcast\ Disc\ 2/02\ Track\ 2.mp3 Outcast\ Disc\ 2/03\ Track\ 3.mp3 Outcast\ Disc\ 2/04\ Track\ 4.mp3'
    FILES="'Outcast Disc 2'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter04.mp3'
    chapter05() {
    FILES="'Outcast Disc 2'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter05.mp3'
    chapter06() {
    FILES="'Outcast Disc 2'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter06.mp3'
    # This one needs some special parameters as the chapter is split between two Discs.
    chapter07() {
    FILES="{'Outcast Disc 2'/{'14 Track 4','15 Track 15','16 Track 16','17 Track 17'}.mp3,'Outcast Disc 3'/{'01 Track 1','02 Track 2','03 Track 3'}}.mp3"
    NAME='Chapter07.mp3'
    chapter08() {
    FILES="'Outcast Disc 3'/{'04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter08.mp3'
    chapter09() {
    FILES="'Outcast Disc 3'/{'09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter09.mp3'
    chapter10() {
    FILES="'Outcast Disc 3'/{'12 Track 12','13 Track 13','14 Track 14','15 Track 15'}.mp3"
    NAME='Chapter10.mp3'
    chapter11() {
    FILES="'Outcast Disc 4'/{'01 Track 1','02 Track 2','03 Track 3'}.mp3"
    NAME='Chapter11.mp3'
    chapter12() {
    FILES="'Outcast Disc 4'/{'04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter12.mp3'
    chapter13() {
    FILES="'Outcast Disc 4'/{'09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter13.mp3'
    chapter14() {
    FILES="'Outcast Disc 4'/{'12 Track 12','13 Track 13','14 Track 14'}.mp3"
    NAME='Chapter14.mp3'
    chapter15() {
    FILES="{'Outcast Disc 4'/'15 Track 15','Outcast Disc 5'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4','05 Track 5'}}.mp3"
    NAME='Chapter15.mp3'
    chapter16() {
    FILES="'Outcast Disc 5'/{'06 Track 6','07 Track 7','08 Track 8','09 Track 9'}.mp3"
    NAME='Chapter16.mp3'
    chapter17() {
    FILES="'Outcast Disc 5'/{'10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter17.mp3'
    chapter18() {
    FILES="{'Outcast Disc 5'/'15 Track 15','Outcast Disc 6'/{'01 Track 1','02 Track 2'}}.mp3"
    NAME='Chapter18.mp3'
    chapter19() {
    FILES="'Outcast Disc 6'/{'03 Track 3','04 Track 4','05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter19.mp3'
    chapter20() {
    FILES="'Outcast Disc 6'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13','14 Track 14'}.mp3"
    NAME='Chapter20.mp3'
    chapter21() {
    FILES="'Outcast Disc 6'/{'15 Track 15','16 Track 16','17 Track 17','18 Track 18','19 Track 19'}.mp3"
    NAME='Chapter21.mp3'
    chapter22() {
    FILES="'Outcast Disc 7'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter22.mp3'
    chapter23() {
    FILES="'Outcast Disc 7'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8'}.mp3"
    NAME='Chapter23.mp3'
    chapter24() {
    FILES="'Outcast Disc 7'/{'09 Track 9','10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter24.mp3'
    chapter25() {
    FILES="{'Outcast Disc 7'/{'14 Track 14','15 Track 15','16 Track 16','17 Track 17'},'Outcast Disk 8'/'01 Track 1'}.mp3"
    NAME='Chapter25.mp3'
    chapter26() {
    FILES="'Outcast Disc 8'/{'02 Track 2','03 Track 3','04 Track 4','05 Track 5'}.mp3"
    NAME='Chapter26.mp3'
    chapter27() {
    FILES="'Outcast Disc 8'/{'06 Track 6','07 Track 7','08 Track 8','09 Track 9'}.mp3"
    NAME='Chapter27.mp3'
    chapter28() {
    FILES="'Outcast Disc 8'/{'10 Track 10','11 Track 11','12 Track 12','13 Track 13'}.mp3"
    NAME='Chapter28.mp3'
    chapter29() {
    FILES="'Outcast Disc 8'/{'14 Track 14','15 Track 15','16 Track 16'}.mp3"
    NAME='Chapter29.mp3'

    kumyco wrote:
    for FILES=test/{a,b,c} you may want to do something like
    FILES=$(echo test/{a,b,c})
    That's a good one. And eval would work with simple examples, but once you have spaces and such in filenames it won't work I think.
    If you are going to do this often, then there are too many things that can go wrong with a script that tries to automatically generate the filenames. Even 01* can go wrong.
    So if you do have the filenames all in the .conf, then you can replace FILES= with cat and NAME= with >
    The actual script doesn't add that much, except checking if it exists (just use > instead of >>) and if it isn't empty (not really necessary) (why did you put a license on that? is that even legal?)
    So just use the .conf file as the main script.
    Turn this:
    BOOKDIR='/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    chapter01() {
    FILES="'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3"
    NAME='Chapter01.mp3'
    chapter02() {
    FILES="'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3"
    NAME='Chapter02.mp3'
    into this:
    cd '/media/Home/aabbott/Star Wars Fate of the Jedi Outcast'
    cat 'Outcast Disc 1'/{'01 Track 1','02 Track 2','03 Track 3','04 Track 4'}.mp3 > 'Chapter01.mp3'
    cat 'Outcast Disc 1'/{'05 Track 5','06 Track 6','07 Track 7','08 Track 8','09 Track 9','10 Track 10','11 Track 11'}.mp3 > 'Chapter02.mp3'
    Right?
    Why would you build anything around that?
    If you are sure the filenames are all the same, you can use *
    cat *\ 1/*\ {1..4}.mp3 > Chapter01.mp3
    cat *\ 100/*\ {70..99}.mp3 > Chapter99.mp3

  • Command help on linx

    Dear all,
    I am relatively new for linux. I am exciting about the perfomance of linux.
    Please can enyone explain how to resolve command help.
    eg how can i identify the arguments of commands
    what meaning by [] <> [ <>  <> ]
    # ifconfig --help
    Usage:
    ifconfig [-a] [-i] [-v] [-s] <interface> [[<AF>] <address>]
    [add <address>[/<prefixlen>]]
    [del <address>[/<prefixlen>]]
    [[-]broadcast [<address>]] [[-]pointopoint [<address>]]
    [netmask <address>] [dstaddr <address>] [tunnel <address>]
    [outfill <NN>] [keepalive <NN>]
    [hw <HW> <address>] [metric <NN>] [mtu <NN>]
    [[-]trailers] [[-]arp] [[-]allmulti]
    [multicast] [[-]promisc]
    [mem_start <NN>] [io_addr <NN>] [irq <NN>] [media <type>]
    [txqueuelen <NN>]
    [[-]dynamic]
    up ...
    if i coud undestand it i can resolve the others.
    Please help.
    Message was edited by:
    Upul Indika

    If you have hard time understand the simplified help message, you can always google the whole term on internet, there's plenty of resources.
    Also, man is a lot more descriptive in most cases,
    for example,
    man ifconfig
    ifconfig(1M)                                                   ifconfig(1M)
    NAME
          ifconfig - configure network interface parameters
    SYNOPSIS
          ifconfig [-m mod1[,mod2]...] interface [address_family]
               [address[dest_address]] [parameters]
          ifconfig interface [address_family]
    DESCRIPTION
          The first form of the ifconfig command assigns an address to a network
          interface and/or configures network interface parameters.  ifconfig
          must be used at boot time to define the network address of each
          interface present on a machine.  It can also be used at other times to
          redefine an interface's address or other operating parameters.  If the
          address_family is not specified, the address family defaults to IPv4.
          The second form of the command, without address_family, displays the
          current configuration for interface.  If address_family is not
          specified, ifconfig reports the details on all supported address
          families.  An exception is when the user has not configured any
          interface with an IPv6 address, ifconfig does not display the IPv6
          loopback interface.
          Only a user with appropriate privileges can modify the configuration
          of a network interface.  All users can run the second form of the
          command.
        Arguments
          ifconfig recognizes the following arguments:
               -m mod1[,mod2]...
                              A list of modules that can be pushed on a stream
                              associated with an interface.  The -m option can
                              be used to configure an interface manually with
                              the specified module names.  There is no space
                              between the module names and only a comma is used
                              to separate the module names.  If the -m option is
                              specified, ifconfig pushes all modules on the
                              stream associated with the interface in the
                              specified order.  For example, module mod2 is
                              pushed on top of module mod1.  The modules are
                              pushed between IP and network drivers.  If the -m
                              option is not specified, the modules (if any)
                              specified in the DEFAULT_INTERFACE_MODULES
                              variable are used for configuring the interface
                              (see netconf and netconf-ipv6 in
                              /etc/rc.config.d/).
               address        Either a host name present in the host name
                              database (see hosts(4)), or a DARPA Internet
    Hewlett-Packard Company            - 1 -      HP-UX 11i Version 2: Mar 2005
    ifconfig(1M)                                                   ifconfig(1M)
                              address expressed in Internet standard dot
                              notation (see inet(3N)) for an IPv4 address and in
                              colon notation (see inet6(3N)) for an IPv6
                              address.
               address_family Name of protocol on which naming scheme is based.
                              An interface can receive transmissions in
                              differing protocols, each of which may require
                              separate naming schemes.  The address_family,
    blah.........blah.....

  • Broken screen (LED does not light up) help

    ok..
    so i have a macbook 13.3 white.. im pretty good with computers/etc..
    So i turn on my macbook and the screen is dark.. but surely the macbook is on.. you can see the screen under bright light shined on the screen.
    But the screen does not light up.
    So i checked- my brightness settings.. then set power settings to normal.. set it to sleep and woke it up. NOPE.
    I bought a new screen and installed it properly. NOPE same thing.
    I bought a new power 'inverter'.. NOPE same thing
    I bought a LVDS cord (chord connecting screen to the logicboard). NO same thing!
    So at this point im real close to throwing it as far as i could from the side of the Golden Gate Bridge =/. but i refuse to.
    I KNOW THERE IS A SOLUTION AND SOMEONE OUT THERE TO KNOW!
    please help, and thank you much.

    HalosGhost wrote:
    Inxsible wrote:please use code tags when pasting code snippets.
    Definitely follow this advice. Makes life much easier. As for the code itself, first be aware that you can't just "sh" it. It runs using arguments, so you'd run something like
    # ./enlighten increase keyboard
    Though I wrote that script for zsh, I believe it should be compatible with bash without issue. Below is a much simpler version of the script which will only increase or decrease the keyboard backlights:
    #!/bin/bash
    #<- Configuration ->
    kbd=/sys/class/leds/toshiba::illumination/brightness
    kstep=15
    self="$(basename $0)"
    #<- Error Handling ->
    E_HELP=44
    E_PERMS=45
    #<- Function Declarations ->
    permissions () {
    if [ "$UID" != 0 ]; then
    echo "$self must be run with root privileges"
    exit "$E_PERMS"
    fi
    usage () {
    echo "Usage: $self [-h|--help] <increase|decrease>"
    exit "$E_HELP"
    update-kbd () {
    permissions
    sudo tee "$kbd" <<< "$new"
    exit 0
    #<- Run Contents ->
    case "$1" in
    -h|--help)
    usage
    increase)
    current="$(<"$kbd")"
    new="$(( current + kstep ))"
    update-kbd
    decrease)
    current="$(<"$kbd")"
    new="$(( current - kstep ))"
    update-kbd
    usage
    esac
    Assuming you have the correct file being pointed to, you should be able to just run (assuming you keep it named "enlighten")
    # ./enlighten increase
    Let me know how that works for you.
    All the best,
    -HG
    Ok so i copied that script, and tried to run "./enlighten increase" but it said i needed to be sudo, so i did it with sudo, and it said "sudo: ./enlighten: command not found"
    Then i just did 'sh enlighten increase" And this time it gave me:
    enlighten: line 29: `update-kbd': not a valid identifier
    I have no idea what that would mean.
    When i google "`update-kbd': not a valid identifier" all it comes up with is my topic lmfao. Not much help there.
      ~The Dyzaster

  • LED Keyboard does not light up.... Help?

    I have a keyboard which has LED Lights under it. When i power my computer up it will light up when accessing the BIOS, but once it gets to the Grub screen it turns off, and im not exactly sure how to enable the light, my BIOS setting is set to ALWAYS have it on, but that is not working and im trying to find out how and can enable and disable it upon command if possible.
    Ive googled and havent found anything on this, do you guys know what to do with this?
      ~The Dyzaster

    HalosGhost wrote:
    Inxsible wrote:please use code tags when pasting code snippets.
    Definitely follow this advice. Makes life much easier. As for the code itself, first be aware that you can't just "sh" it. It runs using arguments, so you'd run something like
    # ./enlighten increase keyboard
    Though I wrote that script for zsh, I believe it should be compatible with bash without issue. Below is a much simpler version of the script which will only increase or decrease the keyboard backlights:
    #!/bin/bash
    #<- Configuration ->
    kbd=/sys/class/leds/toshiba::illumination/brightness
    kstep=15
    self="$(basename $0)"
    #<- Error Handling ->
    E_HELP=44
    E_PERMS=45
    #<- Function Declarations ->
    permissions () {
    if [ "$UID" != 0 ]; then
    echo "$self must be run with root privileges"
    exit "$E_PERMS"
    fi
    usage () {
    echo "Usage: $self [-h|--help] <increase|decrease>"
    exit "$E_HELP"
    update-kbd () {
    permissions
    sudo tee "$kbd" <<< "$new"
    exit 0
    #<- Run Contents ->
    case "$1" in
    -h|--help)
    usage
    increase)
    current="$(<"$kbd")"
    new="$(( current + kstep ))"
    update-kbd
    decrease)
    current="$(<"$kbd")"
    new="$(( current - kstep ))"
    update-kbd
    usage
    esac
    Assuming you have the correct file being pointed to, you should be able to just run (assuming you keep it named "enlighten")
    # ./enlighten increase
    Let me know how that works for you.
    All the best,
    -HG
    Ok so i copied that script, and tried to run "./enlighten increase" but it said i needed to be sudo, so i did it with sudo, and it said "sudo: ./enlighten: command not found"
    Then i just did 'sh enlighten increase" And this time it gave me:
    enlighten: line 29: `update-kbd': not a valid identifier
    I have no idea what that would mean.
    When i google "`update-kbd': not a valid identifier" all it comes up with is my topic lmfao. Not much help there.
      ~The Dyzaster

  • 'Integration Class not found' - Please help

    Hi Guys
    My EM from browser stopped working unexpectedly.
    What happens is when I start login in, I can't move over login screen, no error messages displayed on browser screen. I use IE.
    Here is what I find in emoms.log:
    1510 2006-10-30 14:42:32,062 [Orion Launcher] ERROR app.Co
    ntextInitializer contextInitialized.256 - Integration Class n
    ot found: oracle.sysman.ocs.mntr.target.OcsOvfIntegration
    1511 2006-10-30 14:42:32,062 [Orion Launcher] ERROR app.Co
    ntextInitializer contextInitialized.256 - Integration Class n
    ot found: oracle.sysman.ocs.mntr.target.OcsWebconfIntegration
    1512 2006-10-30 14:42:32,078 [Orion Launcher] ERROR app.Co
    ntextInitializer contextInitialized.256 - Integration Class n
    ot found: oracle.sysman.ocs.mntr.target.OcsWirelessIntg
    1513 2006-10-30 14:42:32,078 [Orion Launcher] ERROR app.Co
    ntextInitializer contextInitialized.256 - Integration Class n
    ot found: oracle.sysman.ocs.mntr.target.OcsCalGrpIntegration
    1514 2006-10-30 14:44:23,015 [HttpRequestHandler-6627600]
    ERROR sec.auth doLogon.207 - Error logging on:
    1515 java.lang.NumberFormatException: multiple points
    1516 at java.lang.FloatingDecimal.readJavaFormatString(F
    loatingDecimal.java:1067)
    I tried to recompile package as it say in:
    http://forums.oracle.com/forums/thread.jspa?threadID=337544&tstart=0&messageID=1356947#1356947
    but only received message back:
    ORA-04043: object MGMT_AUDIT_LOG does not exist
    Is there anyway for me to fix this problem without database re-installation?
    Thank you, Gene.

    Hi guys
    Thank you for your support.
    Here is an answer on your question Ugonic.
    ( I use mks tools ksh port for windows 2k)
    Here is an output: ls C:/oracle/10/Db_1/opmn/bin
    ons.exe onsclient.dll
    C:/oracle/10/Db_1/opmn/bin> ./ons -help
    Usage: .\ons [-d]
    -d Daemon mode: forks and detached OPMN server process
    -a <admin command> Please type ".\ons -a" for usage
    I guess ons is a replacement of opmnctl on version 10.
    I could not find opmnctl on my SUSE installation neither.
    Now, I tried to experiment with em by using different URLs:
    http://127.0.0.1:5501/em this is a loopback ip
    http://10.104.3.79:5501/em this is my current ip
    http://n513gg0_d1:5501/em this is my pc name
    on
    netscape 8.1.2 ( by the way problem started when i - stupid me - upgraded it from 8.1 to 8.1.2)
    ie 6.0.280
    On netscape: all 3 commands do not work.
    ie: first two commands work and display all em functionality and the last one which uses my pc name - does not.
    I did not mention to you that my pc uses dhcp and from what I read em DOES NOT like it. It likes permanent address.
    I beleive I came accross of 2 problems:
    1. netscape 8.1.2 is an uncompatible browser for em application.
    2. name resolution does not work well with em. The proof for the last is error when I use http://n513gg0_d1:5501/em on ie, it does not trunslate it to ip address.
    I also went to page: http://n513gg0_d1:5501 and displayed page:
    Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)
    At the end of it I found test examples for:
    JSP
    servlets
    Each group provides multiple exampls. It's interesting that no netscape neither ie are not able to work with all JSP examples.
    For now I will be working with ie for em and I beleive problem is solved - you should be progmatic because dhcp/em/browser compatibility is too much to worry as long as it works.
    My only concern - and I only study oracle - that I view it as a major architectural flaw in Oracle 10 - this dependence on em windows interface.
    One can say: "you can do the same from command prompt" But how many of us who is learning Oracle or who used to use an old ie will be able to use command interface efficently specially when you need to react fast?
    And, if Oracle provides such a great tool and wants you to use it heavily, don't they have to provide a separate installation option for just a re-installation of em itself ?
    I was about to scratch my test installation and re-install it again. Would it be an option in production environment?
    Thank you guys for your help and I with best to you.
    Gene.

  • Help Installing "Denemo"

    I am trying to install the latest version of Denemo.  I have gotten the .tar from their website here
    I have untarred it and changed to the appropriate directory.  When i run ./configure, it runs and I eventually get this error:
    checking for xml2-config... /usr/bin/xml2-config
    checking for libxml - version >= 2.0.0... no
    *** Could not run libxml test program, checking why...
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means LIBXML was incorrectly installed
    *** or that you have moved LIBXML since it was installed. In the latter case, you
    *** may want to edit the xml2-config script: /usr/bin/xml2-config
    configure: error: Cannot find libxml: Is xml-config in path?
    I am pretty sure that i have installed the correct libxml packages, and i have looked at my xml2-config, but i did not see any that I knew how to fix or change.  Here are the contents of that file:
    #! /bin/sh
    prefix=/usr
    exec_prefix=${prefix}
    includedir=${prefix}/include
    libdir=${exec_prefix}/lib
    usage()
    cat <<EOF
    Usage: xml2-config [OPTION]
    Known values for OPTION are:
    --prefix=DIR change libxml prefix [default $prefix]
    --exec-prefix=DIR change libxml exec prefix [default $exec_prefix]
    --libs print library linking information
    --cflags print pre-processor and compiler flags
    --modules module support enabled
    --help display this help and exit
    --version output version information
    EOF
    exit $1
    if test $# -eq 0; then
    usage 1
    fi
    cflags=false
    libs=false
    while test $# -gt 0; do
    case "$1" in
    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
    esac
    case "$1" in
    --prefix=*)
    prefix=$optarg
    includedir=$prefix/include
    libdir=$prefix/lib
    --prefix)
    echo $prefix
    --exec-prefix=*)
    exec_prefix=$optarg
    libdir=$exec_prefix/lib
    --exec-prefix)
    echo $exec_prefix
    --version)
    echo 2.6.31
    exit 0
    --help)
    usage 0
    --cflags)
    echo -I${includedir}/libxml2
    --libtool-libs)
    if [ -r ${libdir}/libxml2.la ]
    then
    echo ${libdir}/libxml2.la
    fi
    --modules)
    echo 1
    --libs)
    if [ "`uname`" = "Linux" ]
    then
    if [ "-L${libdir}" = "-L/usr/lib" -o "-L${libdir}" = "-L/usr/lib64" ]
    then
    echo -lxml2 -lz -lm
    else
    echo -L${libdir} -lxml2 -lz -lm
    fi
    else
    echo -L${libdir} -lxml2 -lz -lm
    fi
    usage
    exit 1
    esac
    shift
    done
    exit 0
    does anyone know what i should do here?
    thanks

    make all-recursive
    make[1]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7'
    Making all in m4
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/m4'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/m4'
    Making all in doc
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc'
    Making all in templates
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates'
    Making all in brass
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/brass'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/brass'
    Making all in band
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/band'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/band'
    Making all in church
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/church'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/church'
    Making all in educational
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/educational'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/educational'
    Making all in jazz
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/jazz'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/jazz'
    Making all in misc
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/misc'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/misc'
    Making all in orchestral
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/orchestral'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/orchestral'
    Making all in strings
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/strings'
    make[4]: Nothing to be done for `all'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates/strings'
    make[4]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates'
    make[4]: Nothing to be done for `all-am'.
    make[4]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates'
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/templates'
    Making all in transformations
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/transformations'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/transformations'
    Making all in images
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc/images'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc/images'
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/doc'
    make[3]: Nothing to be done for `all-am'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc'
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/doc'
    Making all in include
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/include'
    Making all in denemo
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/include/denemo'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/include/denemo'
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/include'
    make[3]: Nothing to be done for `all-am'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/include'
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/include'
    Making all in keymaps
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/keymaps'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/keymaps'
    Making all in plugins
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/plugins'
    make[3]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/plugins'
    make[3]: Nothing to be done for `all-am'.
    make[3]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/plugins'
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/plugins'
    Making all in pixmaps
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/pixmaps'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/pixmaps'
    Making all in po
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/po'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/po'
    Making all in src
    make[2]: Entering directory `/home/loyd/denemo-0/denemo-0.7.7/src'
    if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../intl -I../intl -I../include -I../pixmaps -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc/\" -DPKGDATADIR=\"/usr/local/share/denemo/\" -I/usr/include/libxml2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/aubio -MT audiocapture.o -MD -MP -MF ".deps/audiocapture.Tpo" -c -o audiocapture.o audiocapture.c; \
    then mv -f ".deps/audiocapture.Tpo" ".deps/audiocapture.Po"; else rm -f ".deps/audiocapture.Tpo"; exit 1; fi
    audiocapture.c:77: error: expected declaration specifiers or '...' before 'PaTimestamp'
    audiocapture.c: In function 'recordCallback':
    audiocapture.c:91: error: 'outTime' undeclared (first use in this function)
    audiocapture.c:91: error: (Each undeclared identifier is reported only once
    audiocapture.c:91: error: for each function it appears in.)
    audiocapture.c: In function 'pa_main':
    audiocapture.c:136: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    audiocapture.c:136: error: 'stream' undeclared (first use in this function)
    audiocapture.c:191: warning: passing argument 2 of 'Pa_OpenStream' makes pointer from integer without a cast
    audiocapture.c:191: warning: passing argument 3 of 'Pa_OpenStream' makes pointer from integer without a cast
    audiocapture.c:191: warning: passing argument 5 of 'Pa_OpenStream' makes integer from pointer without a cast
    audiocapture.c:191: warning: passing argument 8 of 'Pa_OpenStream' makes pointer from integer without a cast
    audiocapture.c:191: error: too many arguments to function 'Pa_OpenStream'
    audiocapture.c: In function 'determine_frequency':
    audiocapture.c:316: warning: incompatible implicit declaration of built-in function 'lround'
    make[2]: *** [audiocapture.o] Error 1
    make[2]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/loyd/denemo-0/denemo-0.7.7'
    make: *** [all] Error 2
    there's the whole thing. When i ran it the first time there was alot more stuff going on during the first part and apparently it doesn't need to do it again "Nothing to be done for 'all' " or am i confusing whatever is going on there?
    I have used the one that is in the repos, but it doesn't work quite right.  I may try to use an even older version from their sourceforge page if i cannot get this to work.
    thanks

  • Node.js: running "npm help term " not working since upgrade to 0.8.3

    Running
    npm help <command>
    usually displays npm's man page on <command>. And if the the command doesn't exist, npm will show a "top hits" list of related commands.
    But since upgrading to 0.8.3, running it will always show the "top hits" list, even for existing commands.
    After digging around I found that the problem is the man files that npm uses in /usr/lib/node_modules/npm/man are gzipped (with filenames like install.1.gz) which breaks npm since npm is expecting ungizipped filenames.
    After further digging, it seems that the gzipping of npm's man pages was only added in node 0.8.2-2
    So, basically just checking if anyone has this same problem (and confirming it's not a problem with upstream) before submitting it to bugs.archlinux.org

    The man command should handle gzipped or non-zipped man pages just fine.  I'm not sure if there is an official standard, but packages are free to use gz'ed or non-zipped man pages - they both work just fine.  If it's not an official standard recommendation, though, gzipped man pages have become so common that they are almost a 'de facto' standard.  But package managers (at least pacman) do not gzip the man pages.  This is generally handled upstream or in the packages Makefile.
    But, more to the point for the present issue, while man can open either format of page, if you give a full path, you must include the extension.  Example:
    $pacman -Ql bash | grep man
    bash /usr/share/man/
    bash /usr/share/man/man1/
    bash /usr/share/man/man1/bash.1.gz
    bash /usr/share/man/man1/bashbug.1.gz
    $ man bash #works
    $ man /usr/share/man/man1/bash.1.gz #works
    $ man /usr/share/man/man1/bash.1
    man: /usr/share/man/man1/bash.1: No such file or directory
    No manual entry for /usr/share/man/man1/bash.1
    .... er ... I just installed this again and did some tinkering.  Most of what I've said is true (and perhaps someday useful) but currently irrelevant.  Npm does not use `man` at all.  It just echo's it's help information directly to the terminal.
    Perhaps the syntax has changed since the last version you used, but it seems to be doing just what it is supposed to:
    $ npm help
    Usage: npm <command>
    where <command> is one of:
    ... <snip> ...
    npm <cmd> -h quick help on <cmd>
    npm -l display full usage info
    npm faq commonly asked questions
    npm help <term> search for help on <term>
    npm help npm involved overview
    Specify configs in the ini-formatted file:
    /home/jmcclure/.npmrc
    or on the command line via: npm <command> --key value
    Config info can be viewed via: npm help config
    [email protected] /usr/lib/node_modules/npm
    $ npm help cache
    Top hits for "cache"
    npm help cache cache:23
    npm help config cache:20
    npm help folders cache:7
    npm help pack cache:2
    npm help index cache:2
    npm help changelog cache:1
    (run with -l or --long to see more context)
    $ npm cache -h
    npm cache add <tarball file>
    npm cache add <folder>
    npm cache add <tarball url>
    npm cache add <git url>
    npm cache add <name>@<version>
    npm cache ls [<path>]
    npm cache clean [<pkg>[@<version>]]
    Note in the first output it specifies that "npm help <term>" is only supposed to search for the term and return the top-listing list while "npm <command> -h" is the syntax to view the help information for a given command.
    Last edited by Trilby (2012-07-25 14:16:31)

  • Festival configuration help

    Hi,
    Just checking out festival. The WIKI mentions a "festivalrc" file, but I can't find any reference of where I might obtain a skeleton to start from, what options can go in one, or the like. "festival --help", for example, says nothing about how to set the voice. I know you can do it in the interactive mode, but I also don't see any mention of outputting to a file in the interactive mode when typing in "help."
    I'm assuming that THIS is the official manual (or is it THIS?), it doesn't mention a config file or its options, either.
    Lastly, flite is supposed to be the "lite" version... but it seems to have more options than festival, at least when looking at the output of "flite --help".
    If anyone has experience... should I just stick with flite? Festival seems to have more voices, but flite just seems to be in better shape option-wise.
    I guess I'm mainly looking for:
    - where is the festivalrc supposed to go and what are it's options?
    - does festival have the frequency, rate (words per minute), frequency, etc. options that flite has? Where are these?
    Thoughts?

    Well, that helps with the location of festivalrc, and yes, those options are shown in the wiki. I guess it just felt like not much was presented in the way of documentation. Again, I was also surprised that flite had such a wide variety of options compared to festival. Note the difference:
    ]$ festival --help
    Usage: festival Usage:
    festival <options> <file0> <file1> ...
    In evaluation mode "filenames" starting with ( are evaluated inline
    Festival Speech Synthesis System: 2.1:release November 2010
    -q Load no default setup files
    --libdir <string>
    Set library directory pathname
    -b Run in batch mode (no interaction)
    --batch Run in batch mode (no interaction)
    --tts Synthesize text in files as speech
    no files means read from stdin
    (implies no interaction by default)
    -i Run in interactive mode (default)
    --interactive
    Run in interactive mode (default)
    --pipe Run in pipe mode, reading commands from
    stdin, but no prompt or return values
    are printed (default if stdin not a tty)
    --language <string>
    Run in named language, default is
    english, spanish and welsh are available
    --server Run in server mode waiting for clients
    of server_port (1314)
    --script <ifile>
    Used in #! scripts, runs in batch mode on
    file and passes all other args to Scheme
    --heap <int> {1000000}
    Set size of Lisp heap, should not normally need
    to be changed from its default
    -v Display version number and exit
    --version Display version number and exit
    $ flite --help
    flite: a small simple speech synthesizer
    Carnegie Mellon University, Copyright (c) 1999-2009, all rights reserved
    version: flite-1.4-release December 2009 (http://cmuflite.org)
    usage: flite TEXT/FILE [WAVEFILE]
    Converts text in TEXTFILE to a waveform in WAVEFILE
    If text contains a space the it is treated as a literal
    textstring and spoken, and not as a file name
    if WAVEFILE is unspecified or "play" the result is
    played on the current systems audio device. If WAVEFILE
    is "none" the waveform is discarded (good for benchmarking)
    Other options must appear before these options
    --version Output flite version number
    --help Output usage string
    -o WAVEFILE Explicitly set output filename
    -f TEXTFILE Explicitly set input filename
    -t TEXT Explicitly set input textstring
    -p PHONES Explicitly set input textstring and synthesize as phones
    --set F=V Set feature (guesses type)
    -s F=V Set feature (guesses type)
    --seti F=V Set int feature
    --setf F=V Set float feature
    --sets F=V Set string feature
    -ssml Read input text/file in ssml mode
    -b Benchmark mode
    -l Loop endlessly
    -voice NAME Use voice NAME
    -lv List voices available
    -add_lex FILENAME add lex addenda from FILENAME
    -pw Print words
    -ps Print segments
    -pr RelName Print relation RelName
    -v Verbose mode

  • [SOLVED] tv_grab_nl_py works with python 2.6.5, fails on 3.1.2

    Hi All,
    I have updated my mediacenter. Now tv_grab_nl_py does not work anymore:
    [cedric@tv ~]$ tv_grab_nl_py --output ~/listings.xml --fast
    File "/usr/bin/tv_grab_nl_py", line 341
    print 'tv_grab_nl_py: A grabber that grabs tvguide data from tvgids.nl\n'
    ^
    SyntaxError: invalid syntax
    [cedric@tv ~]$
    the version of python on the mediacenter (running arch linux):
    [cedric@tv ~]$ python
    Python 3.1.2 (r312:79147, Oct 4 2010, 12:35:40)
    [GCC 4.5.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    I have copied the file to my laptop, there it looks like it's working:
    ./tv_grab_nl_py --output ~/listings.xml --fast
    Config file /home/cedric/.xmltv/tv_grab_nl_py.conf not found.
    Re-run me with the --configure flag.
    cedric@laptop:~$
    the version of python on my laptop (running arch linux):
    cedric@laptop:~$ python
    Python 2.6.5 (r265:79063, Apr 1 2010, 05:22:20)
    [GCC 4.4.3 20100316 (prerelease)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    the script I'm trying to run:
    [cedric@tv ~]$ cat tv_grab_nl_py
    #!/usr/bin/env python
    # $LastChangedDate: 2009-11-14 10:06:41 +0100 (Sat, 14 Nov 2009) $
    # $Rev: 104 $
    # $Author: pauldebruin $
    SYNOPSIS
    tv_grab_nl_py is a python script that trawls tvgids.nl for TV
    programming information and outputs it in XMLTV-formatted output (see
    http://membled.com/work/apps/xmltv). Users of MythTV
    (http://www.mythtv.org) will appreciate the output generated by this
    grabber, because it fills the category fields, i.e. colors in the EPG,
    and has logos for most channels automagically available. Check the
    website below for screenshots. The newest version of this script can be
    found here:
    http://code.google.com/p/tvgrabnlpy/
    USAGE
    Check the web site above and/or run script with --help and start from there
    HISTORY
    tv_grab_nl_py used to be called tv_grab_nl_pdb, first released on
    2003/07/09. The name change was necessary because more and more people
    are actively contributing to this script and I always disliked using my
    initials (I was just too lazy to change it). At the same time I switched
    from using CVS to SVN and as a result the version numbering scheme has
    changed. The lastest official release of tv_grab_nl_pdb is 0.48. The
    first official release of tv_grab_nl_py is 6.
    QUESTIONS
    Questions (and patches) are welcome at: paul at pwdebruin dot net.
    IMPORTANT NOTES
    If you were using tv_grab_nl from the XMLTV bundle then enable the
    compat flag or use the --compat command-line option. Otherwise, the
    xmltvid's are wrong and you will not see any new data in MythTV.
    CONTRIBUTORS
    Main author: Paul de Bruin (paul at pwdebruin dot net)
    Michel van der Laan made available his extensive collection of
    high-quality logos that is used by this script.
    Michael Heus has taken the effort to further enhance this script so that
    it now also includes:
    - Credit info: directors, actors, presenters and writers
    - removal of programs that are actually just groupings/broadcasters
    (e.g. "KETNET", "Wild Friday", "Z@pp")
    - Star-rating for programs tipped by tvgids.nl
    - Black&White, Stereo and URL info
    - Better detection of Movies
    - and much, much more...
    Several other people have provided feedback and patches (these are the
    people I could find in my email archive, if you are missing from this
    list let me know):
    Huub Bouma, Roy van der Kuil, Remco Rotteveel, Mark Wormgoor, Dennis van
    Onselen, Hugo van der Kooij, Han Holl, Ian Mcdonald, Udo van den Heuvel.
    # Modules we need
    import re, urllib2, getopt, sys
    import time, random
    import htmlentitydefs, os, os.path, pickle
    from string import replace, split, strip
    from threading import Thread
    from xml.sax import saxutils
    # Extra check for the datetime module
    try:
    import datetime
    except:
    sys.stderr.write('This script needs the datetime module that was introduced in Python version 2.3.\n')
    sys.stderr.write('You are running:\n')
    sys.stderr.write('%s\n' % sys.version)
    sys.exit(1)
    # XXX: fix to prevent crashes in Snow Leopard [Robert Klep]
    if sys.platform == 'darwin' and sys.version_info[:3] == (2, 6, 1):
    try:
    urllib2.urlopen('http://localhost.localdomain')
    except:
    pass
    # do extra debug stuff
    debug = 1
    try:
    import redirect
    except:
    debug = 0
    pass
    # globals
    # compile only one time
    r_entity = re.compile(r'&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z]+);')
    tvgids = 'http://www.tvgids.nl/'
    uitgebreid_zoeken = tvgids + 'zoeken/'
    # how many seconds to wait before we timeout on a
    # url fetch, 10 seconds seems reasonable
    global_timeout = 10
    # Wait a random number of seconds between each page fetch.
    # We want to be nice and not hammer tvgids.nl (these are the
    # friendly people that provide our data...).
    # Also, it appears tvgids.nl throttles its output.
    # So there, there is not point in lowering these numbers, if you
    # are in a hurry, use the (default) fast mode.
    nice_time = [1, 2]
    # Maximum length in minutes of gaps/overlaps between programs to correct
    max_overlap = 10
    # Strategy to use for correcting overlapping prgramming:
    # 'average' = use average of stop and start of next program
    # 'stop' = keep stop time of current program and adjust start time of next program accordingly
    # 'start' = keep start time of next program and adjust stop of current program accordingly
    # 'none' = do not use any strategy and see what happens
    overlap_strategy = 'average'
    # Experimental strategy for clumping overlapping programming, all programs that overlap more
    # than max_overlap minutes, but less than the length of the shortest program are clumped
    # together. Highly experimental and disabled for now.
    do_clump = False
    # Create a category translation dictionary
    # Look in mythtv/themes/blue/ui.xml for all category names
    # The keys are the categories used by tvgids.nl (lowercase please)
    cattrans = { 'amusement' : 'Talk',
    'animatie' : 'Animated',
    'comedy' : 'Comedy',
    'documentaire' : 'Documentary',
    'educatief' : 'Educational',
    'erotiek' : 'Adult',
    'film' : 'Film',
    'muziek' : 'Art/Music',
    'informatief' : 'Educational',
    'jeugd' : 'Children',
    'kunst/cultuur' : 'Arts/Culture',
    'misdaad' : 'Crime/Mystery',
    'muziek' : 'Music',
    'natuur' : 'Science/Nature',
    'nieuws/actualiteiten' : 'News',
    'overige' : 'Unknown',
    'religieus' : 'Religion',
    'serie/soap' : 'Drama',
    'sport' : 'Sports',
    'theater' : 'Arts/Culture',
    'wetenschap' : 'Science/Nature'}
    # Create a role translation dictionary for the xmltv credits part
    # The keys are the roles used by tvgids.nl (lowercase please)
    roletrans = {'regie' : 'director',
    'acteurs' : 'actor',
    'presentatie' : 'presenter',
    'scenario' : 'writer'}
    # We have two sources of logos, the first provides the nice ones, but is not
    # complete. We use the tvgids logos to fill the missing bits.
    logo_provider = [ 'http://visualisation.tudelft.nl/~paul/logos/gif/64x64/',
    'http://static.tvgids.nl/gfx/zenders/' ]
    logo_names = {
    1 : [0, 'ned1'],
    2 : [0, 'ned2'],
    3 : [0, 'ned3'],
    4 : [0, 'rtl4'],
    5 : [0, 'een'],
    6 : [0, 'canvas_color'],
    7 : [0, 'bbc1'],
    8 : [0, 'bbc2'],
    9 : [0,'ard'],
    10 : [0,'zdf'],
    11 : [1, 'rtl'],
    12 : [0, 'wdr'],
    13 : [1, 'ndr'],
    14 : [1, 'srsudwest'],
    15 : [1, 'rtbf1'],
    16 : [1, 'rtbf2'],
    17 : [0, 'tv5'],
    18 : [0, 'ngc'],
    19 : [1, 'eurosport'],
    20 : [1, 'tcm'],
    21 : [1, 'cartoonnetwork'],
    24 : [0, 'canal+red'],
    25 : [0, 'mtv-color'],
    26 : [0, 'cnn'],
    27 : [0, 'rai'],
    28 : [1, 'sat1'],
    29 : [0, 'discover-spacey'],
    31 : [0, 'rtl5'],
    32 : [1, 'trt'],
    34 : [0, 'veronica'],
    35 : [0, 'tmf'],
    36 : [0, 'sbs6'],
    37 : [0, 'net5'],
    38 : [1, 'arte'],
    39 : [0, 'canal+blue'],
    40 : [0, 'at5'],
    46 : [0, 'rtl7'],
    49 : [1, 'vtm'],
    50 : [1, '3sat'],
    58 : [1, 'pro7'],
    59 : [1, 'kanaal2'],
    60 : [1, 'vt4'],
    65 : [0, 'animal-planet'],
    73 : [1, 'mezzo'],
    86 : [0, 'bbc-world'],
    87 : [1, 'tve'],
    89 : [1, 'nick'],
    90 : [1, 'bvn'],
    91 : [0, 'comedy_central'],
    92 : [0, 'rtl8'],
    99 : [1, 'sport1_1'],
    100 : [0, 'rtvu'],
    101 : [0, 'tvwest'],
    102 : [0, 'tvrijnmond'],
    103 : [1, 'tvnoordholland'],
    104 : [1, 'bbcprime'],
    105 : [1, 'spiceplatinum'],
    107 : [0, 'canal+yellow'],
    108 : [0, 'tvnoord'],
    109 : [0, 'omropfryslan'],
    114 : [0, 'omroepbrabant']}
    # A selection of user agents we will impersonate, in an attempt to be less
    # conspicuous to the tvgids.nl police.
    user_agents = [ 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
    'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9',
    'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)',
    'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7',
    'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)',
    'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.9) Gecko/20071105 Firefox/2.0.0.9',
    'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9',
    'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071022 Ubuntu/7.10 (gutsy) Firefox/2.0.0.8'
    # Work in progress, the idea is to cache program categories and
    # descriptions to eliminate a lot of page fetches from tvgids.nl
    # for programs that do not have interesting/changing descriptions
    class ProgramCache:
    A cache to hold program name and category info.
    TVgids stores the detail for each program on a separate URL with an
    (apparently unique) ID. This cache stores the fetched info with the ID.
    New fetches will use the cached info instead of doing an (expensive)
    page fetch.
    def __init__(self, filename=None):
    Create a new ProgramCache object, optionally from file
    # where we store our info
    self.filename = filename
    if filename == None:
    self.pdict = {}
    else:
    if os.path.isfile(filename):
    self.load(filename)
    else:
    self.pdict = {}
    def load(self, filename):
    Loads a pickled cache dict from file
    try:
    self.pdict = pickle.load(open(filename,'r'))
    except:
    sys.stderr.write('Error loading cache file: %s (possibly corrupt)' % filename)
    sys.exit(2)
    def dump(self, filename):
    Dumps a pickled cache, and makes sure it is valid
    if os.access(filename, os.F_OK):
    try:
    os.remove(filename)
    except:
    sys.stderr.write('Cannot remove %s, check permissions' % filename)
    pickle.dump(self.pdict, open(filename+'.tmp', 'w'))
    os.rename(filename+'.tmp', filename)
    def query(self, program_id):
    Updates/gets/whatever.
    try:
    return self.pdict[program_id]
    except:
    return None
    def add(self, program):
    Adds a program
    self.pdict[program['ID']] = program
    def clear(self):
    Clears the cache (i.e. empties it)
    self.pdict = {}
    def clean(self):
    Removes all cached programming before today.
    Also removes erroneously cached programming.
    now = time.localtime()
    dnow = datetime.datetime(now[0],now[1],now[2])
    for key in self.pdict.keys():
    try:
    if self.pdict[key]['stop-time'] < dnow or self.pdict[key]['name'].lower() == 'onbekend':
    del self.pdict[key]
    except:
    pass
    def usage():
    print 'tv_grab_nl_py: A grabber that grabs tvguide data from tvgids.nl\n'
    print 'and stores it in XMLTV-combatible format.\n'
    print 'Usage:'
    print '--help, -h = print this info'
    print '--configure = create configfile (overwrites existing file)'
    print '--config-file = name of the configuration file (default = ~/.xmltv/tv_grab_py.conf'
    print '--capabilities = xmltv required option'
    print '--desc-length = maximum allowed length of programme descriptions in bytes.'
    print '--description = prints a short description of the grabber'
    print '--output = file where to put the output'
    print '--days = # number of days to grab'
    print '--preferredmethod = returns the preferred method to be called'
    print '--fast = do not grab descriptions of programming'
    print '--slow = grab descriptions of programming'
    print '--quiet = suppress all output'
    print '--compat = append tvgids.nl to the xmltv id (use this if you were using tv_grab_nl)'
    print '--logos 0/1 = insert urls to channel icons (mythfilldatabase will then use these)'
    print '--nocattrans = do not translate the grabbed genres into MythTV-genres'
    print '--cache = cache descriptions and use the file to store'
    print '--clean_cache = clean the cache file before fetching'
    print '--clear_cache = empties the cache file before fetching data'
    print '--slowdays = grab slowdays initial days and the rest in fast mode'
    print '--max_overlap = maximum length of overlap between programming to correct [minutes]'
    print '--overlap_strategy = what strategy to use to correct overlaps (check top of source code)'
    def filter_line_identity(m, defs=htmlentitydefs.entitydefs):
    # callback: translate one entity to its ISO Latin value
    k = m.group(1)
    if k.startswith("#") and k[1:] in xrange(256):
    return chr(int(k[1:]))
    try:
    return defs[k]
    except KeyError:
    return m.group(0) # use as is
    def filter_line(s):
    Removes unwanted stuff in strings (adapted from tv_grab_be)
    # do the latin1 stuff
    s = r_entity.sub(filter_line_identity, s)
    s = replace(s,'&nbsp;',' ')
    # Ik vermoed dat de volgende drie regels overbodig zijn, maar ze doen
    # niet veel kwaad -- Han Holl
    s = replace(s,'\r',' ')
    x = re.compile('(<.*?>)') # Udo
    s = x.sub('', s) #Udo
    s = replace(s, '~Q', "'")
    s = replace(s, '~R', "'")
    # Hmm, not sure if I understand this. Without it, mythfilldatabase barfs
    # on program names like "Steinbrecher &..."
    # We most create valid XML -- Han Holl
    s = saxutils.escape(s)
    return s
    def calc_timezone(t):
    Takes a time from tvgids.nl and formats it with all the required
    timezone conversions.
    in: '20050429075000'
    out:'20050429075000 (CET|CEST)'
    Until I have figured out how to correctly do timezoning in python this method
    will bork if you are not in a zone that has the same DST rules as 'Europe/Amsterdam'.
    year = int(t[0:4])
    month = int(t[4:6])
    day = int(t[6:8])
    hour = int(t[8:10])
    minute = int(t[10:12])
    #td = {'CET': '+0100', 'CEST': '+0200'}
    #td = {'CET': '+0100', 'CEST': '+0200', 'W. Europe Standard Time' : '+0100', 'West-Europa (standaardtijd)' : '+0100'}
    td = {0 : '+0100', 1 : '+0200'}
    pt = time.mktime((year,month,day,hour,minute,0,0,0,-1))
    timezone=''
    try:
    #timezone = time.tzname[(time.localtime(pt))[-1]]
    timezone = (time.localtime(pt))[-1]
    except:
    sys.stderr.write('Cannot convert time to timezone')
    return t+' %s' % td[timezone]
    def format_timezone(td):
    Given a datetime object, returns a string in XMLTV format
    tstr = td.strftime('%Y%m%d%H%M00')
    return calc_timezone(tstr)
    def get_page_internal(url, quiet=0):
    Retrieves the url and returns a string with the contents.
    Optionally, returns None if processing takes longer than
    the specified number of timeout seconds.
    txtdata = None
    txtheaders = {'Keep-Alive' : '300',
    'User-Agent' : user_agents[random.randint(0, len(user_agents)-1)] }
    try:
    #fp = urllib2.urlopen(url)
    rurl = urllib2.Request(url, txtdata, txtheaders)
    fp = urllib2.urlopen(rurl)
    lines = fp.readlines()
    page = "".join(lines)
    return page
    except:
    if not quiet:
    sys.stderr.write('Cannot open url: %s\n' % url)
    return None
    class FetchURL(Thread):
    A simple thread to fetch a url with a timeout
    def __init__ (self, url, quiet=0):
    Thread.__init__(self)
    self.quiet = quiet
    self.url = url
    self.result = None
    def run(self):
    self.result = get_page_internal(self.url, self.quiet)
    def get_page(url, quiet=0):
    Wrapper around get_page_internal to catch the
    timeout exception
    try:
    fu = FetchURL(url, quiet)
    fu.start()
    fu.join(global_timeout)
    return fu.result
    except:
    if not quiet:
    sys.stderr.write('get_page timed out on (>%s s): %s\n' % (global_timeout, url))
    return None
    def get_channels(file, quiet=0):
    Get a list of all available channels and store these
    in a file.
    # store channels in a dict
    channels = {}
    # tvgids stores several instances of channels, we want to
    # find all the possibile channels
    channel_get = re.compile('<optgroup label=.*?>(.*?)</optgroup>', re.DOTALL)
    # this is how we will find a (number, channel) instance
    channel_re = re.compile('<option value="([0-9]+)" >(.*?)</option>', re.DOTALL)
    # this is where we will try to find our channel list
    total = get_page(uitgebreid_zoeken, quiet)
    if total == None:
    return
    # get a list of match objects of all the <select blah station>
    stations = channel_get.finditer(total)
    # and create a dict of number, channel_name pairs
    # we do this this way because several instances of the
    # channel list are stored in the url and not all of the
    # instances have all the channels, this way we get them all.
    for station in stations:
    m = channel_re.finditer(station.group(0))
    for p in m:
    try:
    a = int(p.group(1))
    b = filter_line(p.group(2))
    channels[a] = b
    except:
    sys.stderr.write('Oops, [%s,%s] does not look like a valid channel, skipping it...\n' % (p.group(1),p.group(2)))
    # sort on channel number (arbitrary but who cares)
    keys = channels.keys()
    keys.sort()
    # and create a file with the channels
    f = open(file,'w')
    for k in keys:
    f.write("%s %s\n" % (k, channels[k]))
    f.close()
    def get_channel_all_days(channel, days, quiet=0):
    Get all available days of programming for channel number
    The output is a list of programming in order where each row
    contains a dictionary with program information.
    now = datetime.datetime.now()
    programs = []
    # Tvgids shows programs per channel per day, so we loop over the number of days
    # we are required to grab
    for offset in range(0, days):
    channel_url = 'http://www.tvgids.nl/zoeken/?d=%i&z=%s' % (offset, channel)
    # For historic purposes, the old style url that gave us a full week in advance:
    # channel_url = 'http://www.tvgids.nl/zoeken/?trefwoord=Titel+of+trefwoord&interval=0&timeslot='+\
    # '&station=%s&periode=%i&genre=&order=0' % (channel,days-1)
    # Sniff, we miss you...
    if offset > 0:
    time.sleep(random.randint(nice_time[0], nice_time[1]))
    # get the raw programming for the day
    total = get_page(channel_url, quiet)
    if total == None:
    return programs
    # Setup a number of regexps
    # checktitle will match the title row in H2 tags of the daily overview page, e.g.
    # <h2>zondag 19 oktober 2008</h2>
    checktitle = re.compile('<h2>(.*?)</h2>',re.DOTALL)
    # getrow will locate each row with program details
    getrow = re.compile('<a href="/programma/(.*?)</a>',re.DOTALL)
    # parserow matches the required program info, with groups:
    # 1 = program ID
    # 2 = broadcast times
    # 3 = program name
    parserow = re.compile('(.*?)/.*<span class="time">(.*?)</span>.*<span class="title">(.*?)</span>', re.DOTALL)
    # normal begin and end times
    times = re.compile('([0-9]+:[0-9]+) - ([0-9]+:[0-9]+)?')
    # Get the day of month listed on the page as well as the expected date we are grabbing and compare these.
    # If these do not match, we skip parsing the programs on the page and issue a warning.
    #dayno = int(checkday.search(total).group(1))
    title = checktitle.search(total)
    if title:
    title = title.group(1)
    dayno = title.split()[1]
    else:
    sys.stderr.write('\nOops, there was a problem with page %s. Skipping it...\n' % (channel_url))
    continue
    expected = now + datetime.timedelta(days=offset)
    if (not dayno.isdigit() or int(dayno) != expected.day):
    sys.stderr.write('\nOops, did not expect page %s to list programs for "%s", skipping it...\n' % (channel_url,title))
    continue
    # and find relevant programming info
    allrows = getrow.finditer(total)
    for r in allrows:
    detail = parserow.search(r.group(1))
    if detail != None:
    # default times
    start_time = None
    stop_time = None
    # parse for begin and end times
    t = times.search(detail.group(2))
    if t != None:
    start_time = t.group(1)
    stop_time = t.group(2)
    program_url = 'http://www.tvgids.nl/programma/' + detail.group(1) + '/'
    program_name = detail.group(3)
    # store time, name and detail url in a dictionary
    tdict = {}
    tdict['start'] = start_time
    tdict['stop'] = stop_time
    tdict['name'] = program_name
    if tdict['name'] == '':
    tdict['name'] = 'onbekend'
    tdict['url'] = program_url
    tdict['ID'] = detail.group(1)
    tdict['offset'] = offset
    #Add star rating if tipped by tvgids.nl
    tdict['star-rating'] = '';
    if r.group(1).find('Tip') != -1:
    tdict['star-rating'] = '4/5'
    # and append the program to the list of programs
    programs.append(tdict)
    # done
    return programs
    def make_daytime(time_string, offset=0, cutoff='00:00', stoptime=False):
    Given a string '11:35' and an offset from today,
    return a datetime object. The cuttoff specifies the point where the
    new day starts.
    Examples:
    In [2]:make_daytime('11:34',0)
    Out[2]:datetime.datetime(2006, 8, 3, 11, 34)
    In [3]:make_daytime('11:34',1)
    Out[3]:datetime.datetime(2006, 8, 4, 11, 34)
    In [7]:make_daytime('11:34',0,'12:00')
    Out[7]:datetime.datetime(2006, 8, 4, 11, 34)
    In [4]:make_daytime('11:34',0,'11:34',False)
    Out[4]:datetime.datetime(2006, 8, 3, 11, 34)
    In [5]:make_daytime('11:34',0,'11:34',True)
    Out[5]:datetime.datetime(2006, 8, 4, 11, 34)
    h,m = [int(x) for x in time_string.split(':')];
    hm = int(time_string.replace(':',''))
    chm = int(cutoff.replace(':',''))
    # check for the cutoff, if the time is before the cutoff then
    # add a day
    extra_day = 0
    if (hm < chm) or (stoptime==True and hm == chm):
    extra_day = 1
    # and create a datetime object, DST is handled at a later point
    pt = time.localtime()
    dt = datetime.datetime(pt[0],pt[1],pt[2],h,m)
    dt = dt + datetime.timedelta(offset+extra_day)
    return dt
    def correct_times(programs, quiet=0):
    Parse a list of programs as generated by get_channel_all_days() and
    convert begin and end times to xmltv compatible times in datetime objects.
    if programs == []:
    return programs
    # the start time of programming for this day, times *before* this time are
    # assumed to be on the next day
    day_start_time = '06:00'
    # initialise using the start time of the first program on this day
    if programs[0]['start'] != None:
    day_start_time = programs[0]['start']
    for program in programs:
    if program['start'] == program['stop']:
    program['stop'] = None
    # convert the times
    if program['start'] != None:
    program['start-time'] = make_daytime(program['start'], program['offset'], day_start_time)
    else:
    program['start-time'] = None
    if program['stop'] != None:
    program['stop-time'] = make_daytime(program['stop'], program['offset'], day_start_time, stoptime=True)
    # extra correction, needed because the stop time of a program may be on the next day, after the
    # day cutoff. For example:
    # 06:00 - 23:40 Long Program
    # 23:40 - 00:10 Lala
    # 00:10 - 08:00 Wawa
    # This puts the end date of Wawa on the current, instead of the next day. There is no way to detect
    # this with a single cutoff in make_daytime. Therefore, check if there is a day difference between
    # start and stop dates and correct if necessary.
    if program['start-time'] != None:
    # make two dates
    start = program['start-time']
    stop = program['stop-time']
    single_day = datetime.timedelta(1)
    startdate = datetime.datetime(start.year,start.month,start.day)
    stopdate = datetime.datetime(stop.year,stop.month,stop.day)
    if startdate - stopdate == single_day:
    program['stop-time'] = program['stop-time'] + single_day
    else:
    program['stop-time'] = None
    def parse_programs(programs, offset=0, quiet=0):
    Parse a list of programs as generated by get_channel_all_days() and
    convert begin and end times to xmltv compatible times.
    # good programs
    good_programs = []
    # calculate absolute start and stop times
    correct_times(programs, quiet)
    # next, correct for missing end time and copy over all good programming to the
    # good_programs list
    for i in range(len(programs)):
    # Try to correct missing end time by taking start time from next program on schedule
    if (programs[i]['stop-time'] == None and i < len(programs)-1):
    if not quiet:
    sys.stderr.write('Oops, "%s" has no end time. Trying to fix...\n' % programs[i]['name'])
    programs[i]['stop-time'] = programs[i+1]['start-time']
    # The common case: start and end times are present and are not
    # equal to each other (yes, this can happen)
    if programs[i]['start-time'] != None and \
    programs[i]['stop-time'] != None and \
    programs[i]['start-time'] != programs[i]['stop-time']:
    good_programs.append(programs[i])
    # Han Holl: try to exclude programs that stop before they begin
    for i in range(len(good_programs)-1,-1,-1):
    if good_programs[i]['stop-time'] <= good_programs[i]['start-time']:
    if not quiet:
    sys.stderr.write('Deleting invalid stop/start time: %s\n' % good_programs[i]['name'])
    del good_programs[i]
    # Try to exclude programs that only identify a group or broadcaster and have overlapping start/end times with
    # the actual programs
    for i in range(len(good_programs)-2,-1,-1):
    if good_programs[i]['start-time'] <= good_programs[i+1]['start-time'] and \
    good_programs[i]['stop-time'] >= good_programs[i+1]['stop-time']:
    if not quiet:
    sys.stderr.write('Deleting grouping/broadcaster: %s\n' % good_programs[i]['name'])
    del good_programs[i]
    for i in range(len(good_programs)-1):
    # PdB: Fix tvgids start-before-end x minute interval overlap. An overlap (positive or
    # negative) is halved and each half is assigned to the adjacent programmes. The maximum
    # overlap length between programming is set by the global variable 'max_overlap' and is
    # default 10 minutes. Examples:
    # Positive overlap (= overlap in programming):
    # 10:55 - 12:00 Lala
    # 11:55 - 12:20 Wawa
    # is transformed in:
    # 10:55 - 11.57 Lala
    # 11:57 - 12:20 Wawa
    # Negative overlap (= gap in programming):
    # 10:55 - 11:50 Lala
    # 12:00 - 12:20 Wawa
    # is transformed in:
    # 10:55 - 11.55 Lala
    # 11:55 - 12:20 Wawa
    stop = good_programs[i]['stop-time']
    start = good_programs[i+1]['start-time']
    dt = stop-start
    avg = start + dt / 2
    overlap = 24*60*60*dt.days + dt.seconds
    # check for the size of the overlap
    if 0 < abs(overlap) <= max_overlap*60:
    if not quiet:
    if overlap > 0:
    sys.stderr.write('"%s" and "%s" overlap %s minutes. Adjusting times.\n' % \
    (good_programs[i]['name'],good_programs[i+1]['name'],overlap / 60))
    else:
    sys.stderr.write('"%s" and "%s" have gap of %s minutes. Adjusting times.\n' % \
    (good_programs[i]['name'],good_programs[i+1]['name'],abs(overlap) / 60))
    # stop-time of previous program wins
    if overlap_strategy == 'stop':
    good_programs[i+1]['start-time'] = good_programs[i]['stop-time']
    # start-time of next program wins
    elif overlap_strategy == 'start':
    good_programs[i]['stop-time'] = good_programs[i+1]['start-time']
    # average the difference
    elif overlap_strategy == 'average':
    good_programs[i]['stop-time'] = avg
    good_programs[i+1]['start-time'] = avg
    # leave as is
    else:
    pass
    # Experimental strategy to make sure programming does not disappear. All programs that overlap more
    # than the maximum overlap length, but less than the shortest length of the two programs are
    # clumped.
    if do_clump:
    for i in range(len(good_programs)-1):
    stop = good_programs[i]['stop-time']
    start = good_programs[i+1]['start-time']
    dt = stop-start
    overlap = 24*60*60*dt.days + dt.seconds
    length0 = good_programs[i]['stop-time'] - good_programs[i]['start-time']
    length1 = good_programs[i+1]['stop-time'] - good_programs[i+1]['start-time']
    l0 = length0.days*24*60*60 + length0.seconds
    l1 = length1.days*24*60*60 + length0.seconds
    if abs(overlap) >= max_overlap*60 <= min(l0,l1)*60 and \
    not good_programs[i].has_key('clumpidx') and \
    not good_programs[i+1].has_key('clumpidx'):
    good_programs[i]['clumpidx'] = '0/2'
    good_programs[i+1]['clumpidx'] = '1/2'
    good_programs[i]['stop-time'] = good_programs[i+1]['stop-time']
    good_programs[i+1]['start-time'] = good_programs[i]['start-time']
    # done, nothing to see here, please move on
    return good_programs
    def get_descriptions(programs, program_cache=None, nocattrans=0, quiet=0, slowdays=0):
    Given a list of programs, from get_channel, retrieve program information
    # This regexp tries to find details such as Genre, Acteurs, Jaar van Premiere etc.
    detail = re.compile('<li>.*?<strong>(.*?):</strong>.*?<br />(.*?)</li>', re.DOTALL)
    # These regexps find the description area, the program type and descriptive text
    description = re.compile('<div class="description">.*?<div class="text"(.*?)<div class="clearer"></div>',re.DOTALL)
    descrtype = re.compile('<div class="type">(.*?)</div>',re.DOTALL)
    descrline = re.compile('<p>(.*?)</p>',re.DOTALL)
    # randomize detail requests
    nprograms = len(programs)
    fetch_order = range(0,nprograms)
    random.shuffle(fetch_order)
    counter = 0
    for i in fetch_order:
    counter += 1
    if programs[i]['offset'] >= slowdays:
    continue
    if not quiet:
    sys.stderr.write('\n(%3.0f%%) %s: %s ' % (100*float(counter)/float(nprograms), i, programs[i]['name']))
    # check the cache for this program's ID
    cached_program = program_cache.query(programs[i]['ID'])
    if (cached_program != None):
    if not quiet:
    sys.stderr.write(' [cached]')
    # copy the cached information, except the start/end times, rating and clumping,
    # these may have changed.
    tstart = programs[i]['start-time']
    tstop = programs[i]['stop-time']
    rating = programs[i]['star-rating']
    try:
    clump = programs[i]['clumpidx']
    except:
    clump = False
    programs[i] = cached_program
    programs[i]['start-time'] = tstart
    programs[i]['stop-time'] = tstop
    programs[i]['star-rating'] = rating
    if clump:
    programs[i]['clumpidx'] = clump
    continue
    else:
    # be nice to tvgids.nl
    time.sleep(random.randint(nice_time[0], nice_time[1]))
    # get the details page, and get all the detail nodes
    descriptions = ()
    details = ()
    try:
    if not quiet:
    sys.stderr.write(' [normal fetch]')
    total = get_page(programs[i]['url'])
    details = detail.finditer(total)
    descrspan = description.search(total);
    descriptions = descrline.finditer(descrspan.group(1))
    except:
    # if we cannot find the description page,
    # go to next in the loop
    if not quiet:
    sys.stderr.write(' [fetch failed or timed out]')
    continue
    # define containers
    programs[i]['credits'] = {}
    programs[i]['video'] = {}
    # now parse the details
    line_nr = 1;
    # First, we try to find the program type in the description section.
    # Note that this is not the same as the generic genres (these are searched later on), but a more descriptive one like "Culinair programma"
    # If present, we store this as first part of the regular description:
    programs[i]['detail1'] = descrtype.search(descrspan.group(1)).group(1).capitalize()
    if programs[i]['detail1'] != '':
    line_nr = line_nr + 1
    # Secondly, we add one or more lines of the program description that are present.
    for descript in descriptions:
    d_str = 'detail' + str(line_nr)
    programs[i][d_str] = descript.group(1)
    # Remove sponsored link from description if present.
    sponsor_pos = programs[i][d_str].rfind('<i>Gesponsorde link:</i>')
    if sponsor_pos > 0:
    programs[i][d_str] = programs[i][d_str][0:sponsor_pos]
    programs[i][d_str] = filter_line(programs[i][d_str]).strip()
    line_nr = line_nr + 1
    # Finally, we check out all program details. These are generically denoted as:
    # <li><strong>(TYPE):</strong><br />(CONTENT)</li>
    # Some examples:
    # <li><strong>Genre:</strong><br />16 oktober 2008</li>
    # <li><strong>Genre:</strong><br />Amusement</li>
    for d in details:
    type = d.group(1).strip().lower()
    content_asis = d.group(2).strip()
    content = filter_line(content_asis).strip()
    if content == '':
    continue
    elif type == 'genre':
    # Fix detection of movies based on description as tvgids.nl sometimes
    # categorises a movie as e.g. "Komedie", "Misdaadkomedie", "Detectivefilm".
    genre = content;
    if (programs[i]['detail1'].lower().find('film') != -1 \
    or programs[i]['detail1'].lower().find('komedie') != -1)\
    and programs[i]['detail1'].lower().find('tekenfilm') == -1 \
    and programs[i]['detail1'].lower().find('animatiekomedie') == -1 \
    and programs[i]['detail1'].lower().find('filmpje') == -1:
    genre = 'film'
    if nocattrans:
    programs[i]['genre'] = genre.title()
    else:
    try:
    programs[i]['genre'] = cattrans[genre.lower()]
    except:
    programs[i]['genre'] = ''
    # Parse persons and their roles for credit info
    elif roletrans.has_key(type):
    programs[i]['credits'][roletrans[type]] = []
    persons = content_asis.split(',');
    for name in persons:
    if name.find(':') != -1:
    name = name.split(':')[1]
    if name.find('-') != -1:
    name = name.split('-')[0]
    if name.find('e.a') != -1:
    name = name.split('e.a')[0]
    programs[i]['credits'][roletrans[type]].append(filter_line(name.strip()))
    elif type == 'bijzonderheden':
    if content.find('Breedbeeld') != -1:
    programs[i]['video']['breedbeeld'] = 1
    if content.find('Zwart') != -1:
    programs[i]['video']['blackwhite'] = 1
    if content.find('Teletekst') != -1:
    programs[i]['teletekst'] = 1
    if content.find('Stereo') != -1:
    programs[i]['stereo'] = 1
    elif type == 'url':
    programs[i]['infourl'] = content
    else:
    # In unmatched cases, we still add the parsed type and content to the program details.
    # Some of these will lead to xmltv output during the xmlefy_programs step
    programs[i][type] = content
    # do not cache programming that is unknown at the time
    # of fetching.
    if programs[i]['name'].lower() != 'onbekend':
    program_cache.add(programs[i])
    if not quiet:
    sys.stderr.write('\ndone...\n\n')
    # done
    def title_split(program):
    Some channels have the annoying habit of adding the subtitle to the title of a program.
    This function attempts to fix this, by splitting the name at a ': '.
    if (program.has_key('titel aflevering') and program['titel aflevering'] != '') \
    or (program.has_key('genre') and program['genre'].lower() in ['movies','film']):
    return
    colonpos = program['name'].rfind(': ')
    if colonpos > 0:
    program['titel aflevering'] = program['name'][colonpos+1:len(program['name'])].strip()
    program['name'] = program['name'][0:colonpos].strip()
    def xmlefy_programs(programs, channel, desc_len, compat=0, nocattrans=0):
    Given a list of programming (from get_channels())
    returns a string with the xml equivalent
    output = []
    for program in programs:
    clumpidx = ''
    try:
    if program.has_key('clumpidx'):
    clumpidx = 'clumpidx="'+program['clumpidx']+'"'
    except:
    print program
    output.append(' <programme start="%s" stop="%s" channel="%s%s" %s> \n' % \
    (format_timezone(program['start-time']), format_timezone(program['stop-time']),\
    channel, compat and '.tvgids.nl' or '', clumpidx))
    output.append(' <title lang="nl">%s</title>\n' % filter_line(program['name']))
    if program.has_key('titel aflevering') and program['titel aflevering'] != '':
    output.append(' <sub-title lang="nl">%s</sub-title>\n' % filter_line(program['titel aflevering']))
    desc = []
    for detail_row in ['detail1','detail2','detail3']:
    if program.has_key(detail_row) and not re.search('[Gg]een detailgegevens be(?:kend|schikbaar)', program[detail_row]):
    desc.append('%s ' % program[detail_row])
    if desc != []:
    # join and remove newlines from descriptions
    desc_line = "".join(desc).strip()
    desc_line.replace('\n', ' ')
    if len(desc_line) > desc_len:
    spacepos = desc_line[0:desc_len-3].rfind(' ')
    desc_line = desc_line[0:spacepos] + '...'
    output.append(' <desc lang="nl">%s</desc>\n' % desc_line)
    # Process credits section if present.
    # This will generate director/actor/presenter info.
    if program.has_key('credits') and program['credits'] != {}:
    output.append(' <credits>\n')
    for role in program['credits']:
    for name in program['credits'][role]:
    if name != '':
    output.append(' <%s>%s</%s>\n' % (role, name, role))
    output.append(' </credits>\n')
    if program.has_key('jaar van premiere') and program['jaar van premiere'] != '':
    output.append(' <date>%s</date>\n' % program['jaar van premiere'])
    if program.has_key('genre') and program['genre'] != '':
    output.append(' <category')
    if nocattrans:
    output.append(' lang="nl"')
    output.append ('>%s</category>\n' % program['genre'])
    if program.has_key('infourl') and program['infourl'] != '':
    output.append(' <url>%s</url>\n' % program['infourl'])
    if program.has_key('aflevering') and program['aflevering'] != '':
    output.append(' <episode-num system="onscreen">%s</episode-num>\n' % filter_line(program['aflevering']))
    # Process video section if present
    if program.has_key('video') and program['video'] != {}:
    output.append(' <video>\n');
    if program['video'].has_key('breedbeeld'):
    output.append(' <aspect>16:9</aspect>\n')
    if program['video'].has_key('blackwhite'):
    output.append(' <colour>no</colour>\n')
    output.append(' </video>\n')
    if program.has_key('stereo'):
    output.append(' <audio><stereo>stereo</stereo></audio>\n')
    if program.has_key('teletekst'):
    output.append(' <subtitles type="teletext" />\n')
    # Set star-rating if applicable
    if program['star-rating'] != '':
    output.append(' <star-rating><value>%s</value></star-rating>\n' % program['star-rating'])
    output.append(' </programme>\n')
    return "".join(output)
    def main():
    # Parse command line options
    try:
    opts, args = getopt.getopt(sys.argv[1:], "h", ["help", "output=", "capabilities",
    "preferredmethod", "days=",
    "configure", "fast", "slow",
    "cache=", "clean_cache",
    "slowdays=","compat",
    "desc-length=","description",
    "nocattrans","config-file=",
    "max_overlap=", "overlap_strategy=",
    "clear_cache", "quiet","logos="])
    except getopt.GetoptError:
    usage()
    sys.exit(2)
    # DEFAULT OPTIONS - Edit if you know what you are doing
    # where the output goes
    output = None
    output_file = None
    # the total number of days to fetch
    days = 6
    # Fetch data in fast mode, i.e. do NOT grab all the detail information,
    # fast means fast, because as it then does not have to fetch a web page for each program
    # Default: fast=0
    fast = 0
    # number of days to fetch in slow mode. For example: --days 5 --slowdays 2, will
    # fetch the first two days in slow mode (with all the details) and the remaining three
    # days in fast mode.
    slowdays = 6
    # no output
    quiet = 0
    # insert url of channel logo into the xml data, this will be picked up by mythfilldatabase
    logos = 1
    # enable this option if you were using tv_grab_nl, it adjusts the generated
    # xmltvid's so that everything works.
    compat = 0
    # enable this option if you do not want the tvgids categories being translated into
    # MythTV-categories (genres)
    nocattrans = 0
    # Maximum number of characters to use for program description.
    # Different values may work better in different versions of MythTV.
    desc_len = 475
    # default configuration file locations
    hpath = ''
    if os.environ.has_key('HOME'):
    hpath = os.environ['HOME']
    # extra test for windows users
    elif os.environ.has_key('HOMEPATH'):
    hpath = os.environ['HOMEPATH']
    # hpath = ''
    xmltv_dir = hpath+'/.xmltv'
    program_cache_file = xmltv_dir+'/program_cache'
    config_file = xmltv_dir+'/tv_grab_nl_py.conf'
    # cache the detail information.
    program_cache = None
    clean_cache = 1
    clear_cache = 0
    # seed the random generator
    random.seed(time.time())
    for o, a in opts:
    if o in ("-h", "--help"):
    usage()
    sys.exit(1)
    if o == "--quiet":
    quiet = 1;
    if o == "--description":
    print "The Netherlands (tv_grab_nl_py $Rev: 104 $)"
    sys.exit(0)
    if o == "--capabilities":
    print "baseline"
    print "cache"
    print "manualconfig"
    print "preferredmethod"
    sys.exit(0)
    if o == '--preferredmethod':
    print 'allatonce'
    sys.exit(0)
    if o == '--desc-length':
    # Use the requested length for programme descriptions.
    desc_len = int(a)
    if not quiet:
    sys.stderr.write('Using description length: %d\n' % desc_len)
    for o, a in opts:
    if o == "--config-file":
    # use the provided name for configuration
    config_file = a
    if not quiet:
    sys.stderr.write('Using config file: %s\n' % config_file)
    for o, a in opts:
    if o == "--configure":
    # check for the ~.xmltv dir
    if not os.path.exists(xmltv_dir):
    if not quiet:
    sys.stderr.write('You do not have the ~/.xmltv directory,')
    sys.stderr.write('I am going to make a shiny new one for you...')
    os.mkdir(xmltv_dir)
    if not quiet:
    sys.stderr.write('Creating config file: %s\n' % config_file)
    get_channels(config_file)
    sys.exit(0)
    if o == "--days":
    # limit days to maximum supported by tvgids.nl
    days = min(int(a),6)
    if o == "--compat":
    compat = 1
    if o == "--nocattrans":
    nocattrans = 1
    if o == "--fast":
    fast = 1
    if o == "--output":
    output_file = a
    try:
    output = open(output_file,'w')
    # and redirect output
    if debug:
    debug_file = open('/tmp/kaas.xml','w')
    blah = redirect.Tee(output, debug_file)
    sys.stdout = blah
    else:
    sys.stdout = output
    except:
    if not quiet:
    sys.stderr.write('Cannot write to outputfile: %s\n' % output_file)
    sys.exit(2)
    if o == "--slowdays":
    # limit slowdays to maximum supported by tvgids.nl
    slowdays = min(int(a),6)
    # slowdays implies fast == 0
    fast = 0
    if o == "--logos":
    logos = int(a)
    if o == "--clean_cache":
    clean_cache = 1
    if o == "--clear_cache":
    clear_cache = 1
    if o == "--cache":
    program_cache_file = a
    if o == "--max_overlap":
    max_overlap = int(a)
    if o == "--overlap_strategy":
    overlap_strategy = a
    # get configfile if available
    try:
    f = open(config_file,'r')
    except:
    sys.stderr.write('Config file %s not found.\n' % config_file)
    sys.stderr.write('Re-run me with the --configure flag.\n')
    sys.exit(1)
    #check for cache
    program_cache = ProgramCache(program_cache_file)
    if clean_cache != 0:
    program_cache.clean()
    if clear_cache != 0:
    program_cache.clear()
    # Go!
    channels = {}
    # Read the channel stuff
    for blah in f.readlines():
    blah = blah.lstrip()
    blah = blah.replace('\n','')
    if blah:
    if blah[0] != '#':
    channel = blah.split()
    channels[channel[0]] = " ".join(channel[1:])
    # channels are now in channels dict keyed on channel id
    # print header stuff
    print '<?xml version="1.0" encoding="ISO-8859-1"?>'
    print '<!DOCTYPE tv SYSTEM "xmltv.dtd">'
    print '<tv generator-info-name="tv_grab_nl_py $Rev: 104 $">'
    # first do the channel info
    for key in channels.keys():
    print ' <channel id="%s%s">' % (key, compat and '.tvgids.nl' or '')
    print ' <display-name lang="nl">%s</display-name>' % channels[key]
    if (logos):
    ikey = int(key)
    if logo_names.has_key(ikey):
    full_logo_url = logo_provider[logo_names[ikey][0]]+logo_names[ikey][1]+'.gif'
    print ' <icon src="%s" />' % full_logo_url
    print ' </channel>'
    num_chans = len(channels.keys())
    channel_cnt = 0
    if program_cache != None:
    program_cache.clean()
    fluffy = channels.keys()
    nfluffy = len(fluffy)
    for id in fluffy:
    channel_cnt += 1
    if not quiet:
    sys.stderr.write('\n\nNow fetching %s(xmltvid=%s%s) (channel %s of %s)\n' % \
    (channels[id], id, (compat and '.tvgids.nl' or ''), channel_cnt, nfluffy))
    info = get_channel_all_days(id, days, quiet)
    blah = parse_programs(info, None, quiet)
    # fetch descriptions
    if not fast:
    get_descriptions(blah, program_cache, nocattrans, quiet, slowdays)
    # Split titles with colon in it
    # Note: this only takes place if all days retrieved are also grabbed with details (slowdays=days)
    # otherwise this function might change some titles after a few grabs and thus may result in
    # loss of programmed recordings for these programs.
    if slowdays == days:
    for program in blah:
    title_split(program)
    print xmlefy_programs(blah, id, desc_len, compat, nocattrans)
    # save the cache after each channel fetch
    if program_cache != None:
    program_cache.dump(program_cache_file)
    # be nice to tvgids.nl
    time.sleep(random.randint(nice_time[0], nice_time[1]))
    if program_cache != None:
    program_cache.dump(program_cache_file)
    # print footer stuff
    print "</tv>"
    # close the outputfile if necessary
    if output != None:
    output.close()
    # and return success
    sys.exit(0)
    # allow this to be a module
    if __name__ == '__main__':
    main()
    # vim:tw=0:et:sw=4
    [cedric@tv ~]$
    Best regards,
    Cedric
    Last edited by cdwijs (2010-11-04 18:44:51)

    Running the script by python2 solves it for me:
    su - mythtv -c "nice -n 19 python2 /usr/bin/tv_grab_nl_py --output ~/listings.xml"
    Best regards,
    Cedric

Maybe you are looking for