[SOLVED] In need of an String formatter

Hi!
Is the a string format feature in Flex that can:
1) Capitalize first letters of words
2) Replace special characters with other characters or spaces
Ex:
station_name --> Station Name
Please answer if you know,
Christo

Thanks Greg, that's just what Ive been looking for!
Best Regards,
Kenwio

Similar Messages

  • Accessing a JSTL variable in a JSP Scriptlet (need to replace string )

    I have
    <c:set var="myVar" value="..." />
    I need to replace single quotes and double quotes to be escaped because I pass them into javascript functions and set them as ID for div sections
    ... onclick ="func('${myVar}')" ..
    <div id="${myVar}">
    but if the string contains ' single quotes it messes up the javascript or double quotes messes up the ID portion of the HTML tag
    I know there is the JSTL function fn but I can't figure out how to do it properly in JSTL
    <c:set var="myVar"
    value="${fn:replace(myVar, "'", "\"")"/>
    But that gets tricky since the value portion is enclosed in quotes
    So I was thinking of using a Scriptlet part instead.

A: Accessing a JSTL variable in a JSP Scriptlet (need to replace string )

escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
  return .......
}Then define the function in a tld:
<function>
    <description>
      Escapes a string for javascript purposes
    </description>
    <name>escapeJavascript</name>
    <function-class>com.mypackage.ELFunctions</function-class>
    <function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
    <example>
      <c:out value="${myfunc:escapeJavascript(name)}">
    </example>
  </function>Cheers,
evnafets

escaping quotes within quotes within quotes.... ARGH!
Recipe for a headache if ever there was one.
However you must be strong and resist the temptations of the dark side (Scriptlet code)
My suggestion for cleaning this up - write your own static function for escaping javascript strings.
public static String escapeJavascriptString(String s){
  return .......
}Then define the function in a tld:
<function>
    <description>
      Escapes a string for javascript purposes
    </description>
    <name>escapeJavascript</name>
    <function-class>com.mypackage.ELFunctions</function-class>
    <function-signature>java.lang.String escapeJavascript(java.lang.String)</function-signature>
    <example>
      <c:out value="${myfunc:escapeJavascript(name)}">
    </example>
  </function>Cheers,
evnafets

  • Need help in String operations

    HI all,
    I need help in String operations.I am getting file path of an image as
    c:\test\img\abc.gif"
    I need to convert it in to c:/test/img/abc.gif".
    Can any one suggest the solution for this.
    Thanks,
    Durga.

    [email protected] wrote:
    I used String replace method but I am not able to do it because "/" is a special character."/" is not a special character, "\" is a special character, which needs to be escaped by "\" itself.

  • Lost original disks-will buying Tiger solve the need for them?

    I have lost the original disks for my iMac Flatscreen. Now I need to re-install the system so that I can get the computer to start up again.
    1. Will brand new Tiger disks solve my need for the original disks?
    2. My husband & I have owned probably 20 Macintoshes over the years and we have many sets of original disks on the shelves. Perhaps my lost ones are mingled in there. But how do I tell which ones go with the iMac Flatscreen? Neither the disks nor the packaging indicates what computer they go with. Is there some sort of code I can refer to?
    3. What I really need my Flatscreen for is to run OS 9 and non-Intel Mac applications. Can Tiger accommodate me?
    iMac flatscreen   Mac OS X (10.3)  

    Hello "O":
    Welcome to Apple discussions.
    I have lost the original disks for my iMac
    Flatscreen. Now I need to re-install the system so
    that I can get the computer to start up again.
    1. Will brand new Tiger disks solve my need for the
    original disks?
    A retail version of OS X (10.4) will install the operating system without problem. If you go that route, I suggest wiping the HD first - although an erase and install will do that as well (overkill, I suppose).
    2. My husband & I have owned probably 20 Macintoshes
    over the years and we have many sets of original
    disks on the shelves. Perhaps my lost ones are
    mingled in there. But how do I tell which ones go
    with the iMac Flatscreen? Neither the disks nor the
    packaging indicates what computer they go with. Is
    there some sort of code I can refer to?
    I have a G4 (flat panel). My original software came on two DVDs - gray in color and labeled iMac Software install (1 of 2 and 2 of 2). My G5 software install DVD has "G5" on it.
    3. What I really need my Flatscreen for is to run OS
    9 and non-Intel Mac applications. Can Tiger
    accommodate me?
    iMac
    flatscreen   Mac OS X (10.3)  
    OS X 10.4 (Tiger) will certainly run non-Intel applications. I have not run OS 9 for years, but I understand that OS 9 applications will run under OS X 10.4 (see this knowledge base article):
    http://docs.info.apple.com/article.html?artnum=106678
    Barry
    P.S. The next version of the operating system (code named Leopard) is due for release later this year.

  • [Solved] Help needed to interpret errors (python)

    Have the following code (Haven't written it my self and don't know much about how it does what it's supposed to do.):
    #!/usr/bin/python
    import sys
    import os
    import re
    import logging
    import json
    if sys.version_info < (3, 0):
    from urllib2 import Request
    from urllib2 import urlopen
    from urlparse import urlparse
    else:
    from urllib.request import Request
    from urllib.request import urlopen
    from urllib.parse import urlparse
    raw_input = input
    useragent = 'Mozilla/5.0'
    headers = {'User-Agent': useragent}
    intro = """
    Usage: drdown.py url
    This script finds the stream URL from a dr.dk page so you can
    download the tv program.
    def fetch(url):
    """Download body from url"""
    req = Request(url, headers=headers)
    response = urlopen(req)
    body = response.read()
    response.close()
    # convert to string - it is easier to convert here
    if isinstance(body, bytes):
    body = body.decode('utf8')
    return body
    class StreamExtractor:
    def __init__(self, url):
    self.url = url.lower()
    self.urlp = urlparse(self.url)
    def get_stream_data(self):
    """supply a URL to a video page on dr.dk and get back a streaming
    url"""
    if self.urlp.netloc not in ('dr.dk', 'www.dr.dk'):
    raise Exception("Must be an URL from dr.dk")
    self.html = fetch(self.url)
    logging.info("Player fetched: " + self.url)
    # Standalone show?
    if self.urlp.path.startswith('/tv/se/'):
    return self.get_stream_data_from_standalone()
    # Bonanza?
    elif self.urlp.path.startswith('/bonanza/'):
    return self.get_stream_data_from_bonanza()
    # Live tv?
    elif self.urlp.path.startswith('/tv/live'):
    return self.get_stream_data_from_live()
    else:
    return self.get_stream_data_from_series()
    def get_stream_data_from_rurl(self, rurl):
    """Helper method to parse resource JSON document"""
    body = fetch(rurl)
    resource_data = json.loads(body)
    qualities = resource_data.get('links')
    # sort by quality
    qualities = sorted(qualities, key=lambda x: x['bitrateKbps'],
    reverse=True)
    stream_data = qualities[0]
    stream_url = stream_data.get('uri')
    logging.info("Stream data fetched: " + stream_url)
    playpath, filename = self.get_metadata_from_stream_url(stream_url)
    stream_data = {'stream_url': stream_url,
    'playpath': playpath,
    'filename': filename,
    'is_live': False}
    return stream_data
    def get_metadata_from_stream_url(self, stream_url):
    """Helper method to extacts playpath and filename suggestion from a
    rtmp url"""
    parsed = urlparse(stream_url)
    playpath_s = parsed.path.split('/')[2:]
    playpath = '/'.join(playpath_s)
    # rerun to split the parameter
    path = urlparse(parsed.path).path
    filename = path.split('/')[-1]
    return playpath, filename
    def get_stream_data_from_standalone(self):
    """Extracts stream data from a normal single program page.
    The data is hidden in a resource URL, that we need to download
    and parse.
    mu_regex = re.compile('resource: "([^"]+)"')
    m = mu_regex.search(self.html)
    if m and m.groups():
    resource_meta_url = m.groups()[0]
    return self.get_stream_data_from_rurl(resource_meta_url)
    def get_stream_data_from_bonanza(self):
    """Finds stream URL from bonanza section. Just pick up the first RTMP
    url.
    stream_regex = re.compile('rtmp://.*?\.mp4')
    m = stream_regex.search(self.html)
    if m and m.group():
    stream_url = m.group()
    else:
    raise Exception("Could not find Bonanza stream URL")
    playpath, filename = self.get_metadata_from_stream_url(stream_url)
    stream_data = {'stream_url': stream_url,
    'playpath': playpath,
    'filename': filename,
    'is_live': False}
    return stream_data
    def get_stream_data_from_live(self):
    stream_url = 'rtmp://livetv.gss.dr.dk/live'
    quality = '3'
    playpaths = {'dr1': 'livedr01astream',
    'dr2': 'livedr02astream',
    'dr-ramasjang': 'livedr05astream',
    'dr-k': 'livedr04astream',
    'dr-update-2': 'livedr03astream',
    'dr3': 'livedr06astream'}
    urlend = self.urlp.path.split('/')[-1]
    playpath = playpaths.get(urlend)
    filename = 'live.mp4'
    if playpath:
    playpath += quality
    filename = urlend + '.mp4'
    stream_data = {'stream_url': stream_url,
    'playpath': playpath,
    'filename': filename,
    'is_live': True}
    return stream_data
    def get_stream_data_from_series(self):
    """dr.dk has a special player for multi episode series. This is the
    fall back parser, as there seems to be no pattern in the URL."""
    slug_regex = re.compile('seriesSlug=([^"]+)"')
    m = slug_regex.search(self.html)
    if m and m.groups():
    slug_id = m.groups()[0]
    else:
    raise Exception("Could not find program slug")
    logging.info("found slug: " + slug_id)
    program_meta_url = 'http://www.dr.dk/nu/api/programseries/%s/videos'\
    % slug_id
    body = fetch(program_meta_url)
    program_data = json.loads(body)
    if not program_data:
    raise Exception("Could not find data about the program series")
    fragment = self.urlp.fragment
    if fragment.startswith('/'):
    fragment = fragment[1:]
    fragment = fragment.split('/')
    video_id = fragment[0]
    logging.info("Video ID: " + video_id)
    video_data = None
    if video_id:
    for item in program_data:
    if item['id'] == int(video_id):
    video_data = item
    if not video_data:
    video_data = program_data[0]
    resource_meta_url = video_data.get('videoResourceUrl')
    return self.get_stream_data_from_rurl(resource_meta_url)
    def generate_cmd(self):
    """Build command line to download stream with the rtmpdump tool"""
    sdata = self.get_stream_data()
    if not sdata:
    return "Not found"
    filename = sdata['filename']
    custom_filename = raw_input("Type another filename or press <enter> to keep default [%s]: " % filename)
    if custom_filename:
    filename = custom_filename
    cmd_live = 'rtmpdump --live --rtmp="%s" --playpath="%s" -o %s'
    cmd_rec = 'rtmpdump -e --rtmp="%s" --playpath="%s" -o %s'
    if sdata['is_live'] is True:
    cmd = cmd_live % (sdata['stream_url'], sdata['playpath'], filename)
    else:
    cmd = cmd_rec % (sdata['stream_url'], sdata['playpath'], filename)
    return cmd
    def main():
    if len(sys.argv) > 1:
    url = sys.argv[1]
    extractor = StreamExtractor(url)
    cmd = extractor.generate_cmd()
    os.system(cmd)
    else:
    print(intro)
    if __name__ == "__main__":
    main()
    When I run the script with an appropriate URL as parameter, I get this:
    Traceback (most recent call last):
    File "./drdown.py", line 243, in <module>
    main()
    File "./drdown.py", line 235, in main
    cmd = extractor.generate_cmd()
    File "./drdown.py", line 211, in generate_cmd
    sdata = self.get_stream_data()
    File "./drdown.py", line 65, in get_stream_data
    return self.get_stream_data_from_standalone()
    File "./drdown.py", line 123, in get_stream_data_from_standalone
    return self.get_stream_data_from_rurl(resource_meta_url)
    File "./drdown.py", line 87, in get_stream_data_from_rurl
    reverse=True)
    TypeError: 'NoneType' object is not iterable
    I should note that I didn't expect it to work out of the box, but so far I've been unable even to figure out what the problem is, no less solve it.
    I've tried my best to go through the code, looking for typos and such, but I haven't had any luck and much of what happens I don't really understand.
    So please, if you can, I'd very much appreciate a little help.
    Best regards.
    NB:
    Some might conclude that this script does something illegal. In actuality that is not so, just make that clear. Also, testing from outside Denmark, will probably not be possible.
    Last edited by zacariaz (2013-11-08 18:00:33)

    Trilby wrote:
    zacariaz wrote:Have the following code (Haven't written it my self and don't know much about how it does what it's supposed to do.)
    You know a lot more than we do: like where you then found this code, and what it is supposed to do.
    My only first thought without looking through random code that allegedly serves some unknown purpose and comes from some unknown source is that the shebang is ambiguous: it may be a python 2 script while /usr/bin/python is now python 3.
    I've pretty much concluded that python 3.3 is the right choice, sp that should not be a problem, as for what it does, it uses "rtmpdump" to record or "rip" video from a danish site "dr.dk", which is a public service television network.
    I have it from reliable sources that this actually works, or at least did at some point, on Windows machines, but of course i'm on linux, and that complicated matters.
    All in all, as I understand it, what the script really does, is retrieving the relevant rtmp link. The rest is up to "rmtpdump" which I should be able to manage.
    In any case, I'm not really that concerned with learning what the script does at this point, but rather what the error mean.
    The only actual error description I see is: "TypeError: 'NoneType' object is not iterable" and I haven't a clue what that implies. I've read through the script, but haven't been able to find any obvious flaws..

  • Need to convert string data to numbers.

    I have string data that I need to convert to numbers so that I can graph it or perform calculations on it. The data (file attached) is in three columns (tab separated) and is in the format time/double/time (saved as a string with Write haracters to File.) When I try Read From Spreadsheet I get 0.0000 for column 1 and 2.0000 for column 3.
    Attachments:
    testOK.txt ‏1 KB

    Hi,
    I've done this through scan from file, using %s%f%s%s so I get the relative time, numeric, time, PM
    See the attached .vi.
    Hope it helps
    S.
    // it takes almost no time to rate an answer
    Attachments:
    disect_data.vi ‏46 KB

  • How to get the Values i need from a String???

    hi i need some help on my program,
    I have a Server that actually sent some data to my Client.
    The data consist of some messages and intergers . The whole piece of data is stores as a String message.
    ARRAY 'Monitor Chart' 2 5
    'Total OverFlow' 'Queued' 'Completed' 'Host Resets' 'Errors'''
    0.0 1.0 2.0 3.0 4.0
    'Series1' 11.0 0.6 8.6 11.5 6.6
    'Series2' 12.8 6.7 21.6 11.1 30.0Inside the Client i need to get the values out to showed on my textfields
    Example :
    Tf1 = 11.0
    Tf2 = 0.6
    Tf3 = 8.6
    Tf4 = 11.5
    Tf5 = 6.6
    Question: How to i get the values out from the String???

    using the split() method. i am able to split everything now
    so it appear somthing like this :
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class testing{
         String d1 =     "ARRAY 'Monitor Chart' 1 5";
         String d2 = "'Total OverFlow' 'Queued' 'Completed' 'Host Resets' 'Errors'";
         String d3 = "'' 0.0 1.0 2.0 3.0 4.0 ";
         String d4 = "'Series1' 11.0 0.6 8.6 11.5 6.6 ";
         String d5 = "'Series2' 12.8 6.7 21.6 11.1 30.0 ";
         String data = d1 + d2 + d3 + d4 + d5;     
         public testing(){
              System.out.println(data);
              String[] result = data.split("\\s");
              for(int x=0;x<result.length;x++)
              System.out.println(result[x]);
         public static void main (String args[])throws IOException{
            testing Application = new testing();
    }ARRAY
    'Monitor
    Chart'
    2
    5
    'Total OverFlow'
    'Queued'
    'Completed'
    'Host Resets'
    'Errors'''
    0.0
    1.0
    2.0
    3.0
    4.0
    'Series1'
    11.0
    0.6
    8.6
    11.5
    6.6
    'Series2'
    12.8
    6.7
    21.6
    11.1
    30.0
    but how do i get the values out ??how do i noe it is which index or wad?
    11.0
    0.6
    8.6
    11.5
    6.6

  • HELP ME i need to pass String variables from one Frame to another

    I need help with some code.
    i need to pass a set of string values from one frame to another.
    from the mainscreen i need to pass what type of seats the user has requested this is done by radio buttons. i need this information to then be passed onto the next frame called Mydialog1 and placed in a textbox with label st. it dosn't comple and i don't know why
    this is getting me depressed. I need some serious help with this
    can anybody get this to work??
    here is the code
    Mainscreen1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
    private Image layout1;
    private int frame;
    private int xpos,ypos,xdir,ydir;
    public TextField tn, tt1, tt2, total;
    public int value, ticketnum, sum, nr_seats, ctot;
    public Label title, seat, need, payable;
    public Button b1, b2, b3;
    Mydialog1 d;
    String stype, c1, sr;
    public void init()
         setBackground(Color.pink);
    setSize (600, 460);
    setLayout(null);
    //Mydialog1.mehod(sr);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(100,0,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
    seat=new Label("Please choose a seating location:");
         seat.setBounds(300,40,190,20);
         seat.setFont(new Font("Verdana", Font.BOLD,12));
         add(seat);
    payable=new Label("Total Payable:�");
         payable.setBounds(300,390,100,20);
         payable.setFont(new Font("Verdana", Font.BOLD,12));
         add(payable);
         need=new Label("Please enter the number of seats needed:");
         need.setBounds(300,180,245,20);
         need.setFont(new Font("Verdana", Font.BOLD,12));
         add(need);
         CheckboxGroup sr = new CheckboxGroup();
         Checkbox Stalls = new Checkbox("Stalls", true, sr);
         Stalls.setBounds(490,40,60,25);
         add(Stalls);
         Stalls.addItemListener(this);
         Checkbox Balcony = new Checkbox("Balcony", false, sr);
         Balcony.setBounds(490,65,65,25);
         add(Balcony);
         Balcony.addItemListener(this);
         Checkbox Concessions = new Checkbox("Concessions", false,
    sr);
         Concessions.setBounds(490,90,94,25);
         add(Concessions);
         Concessions.addItemListener(this);
    Button b1=new Button("Quote");
         b1.setBounds(20,395,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Confirm booking");
         b2.setBounds(110,395,100,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(480,410,100,30);
         add(b3);
         b3.addActionListener( this );
         tt1=new TextField(60);
         tt1.setBounds(300,250,270,20);
    add(tt1);
         tt1.setEditable (false);
         tt1.addActionListener(this);
         tt2=new TextField(60);
         tt2.setBounds(300,300,150,20);
         add(tt2);
         tt2.setEditable (false);
         tt2.addActionListener(this);
         tn=new TextField(3);
         tn.setBounds(545,180,30,20);
         add(tn);
         tn.addActionListener(this);
         total=new TextField(5);
         total.setBounds(400,390,45,20);
         add(total);
         total.setEditable (false);
         total.addActionListener(this);
         xpos = getSize().width/-1400;
         ypos = getSize().height/12;
         layout1 = getImage(getDocumentBase(),"layout1.gif");
         repaint();
    public void itemStateChanged(ItemEvent e)
         String c1 = (String) e.getItem();
         if (c1 == "Stalls")
              value = 20;
         else if (c1 == "Balcony")
              value = 15;
         else
              value = 10;
         tt1.setText("You have chosen to sit in the " + c1 + "
    area");
         tt2.setText("Each seat will cost: �" + value);
         repaint();
    public void clearValue()
              //cb.setSelectiob
              total.setText("");
              tt1.setText("");
              tt2.setText("");
              tn.setText("");
    public void actionPerformed ( ActionEvent e )
    if( e.getActionCommand() == "Quote" )
         int nr_seats = Integer.parseInt(tn.getText());
         total.setText("" +nr_seats*value);
    else if( e.getActionCommand() == "Confirm booking")
         int nr_seats = Integer.parseInt(tn.getText());
         int ctot = Integer.parseInt(total.getText());
         //String stype = String.parseString(c1.getText());
         total.setText("" +nr_seats*value);   
         d = new Mydialog1();      
         d.set_text(nr_seats);
         d.set_texts(ctot);
         stype = sr.getSelectedItem();
    else if ( e.getActionCommand() == "Clear")
         clearValue();
              ticketnum = Integer.parseInt(tn.getText());
              repaint();
         public void paint(Graphics g)
              g.setColor(Color.black);
              g.drawString ("You have chosen:" + ticketnum +"
    seats", 300, 365);
              g.drawImage(layout1,xpos,ypos,null);
    Mydialog1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Mydialog1 extends Frame implements ItemListener,
    ActionListener
    public Label title, custd, custd1, custfn, custad, custsn, custpc,
    custph, custem, custem1, need;
    public Button b1, b2, b3;
    public TextField cfnt, csnt, cdt,cdt2,cdt3,cdt4, tf, tt, st,
    cpct, cph, cem;
    public int value, nr_seats, ctot;
    creditcard cc;
    String stype, c;
    public Mydialog1() //constructor
         init();
    public void init()
         custer(String c)
         stype = c;
         setBackground(Color.yellow);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         CheckboxGroup ct = new CheckboxGroup();
         Checkbox Mr = new Checkbox("Mr", true, ct);
         Mr.setBounds(5,190,36,25);
         add(Mr);
         Mr.addItemListener(this);
         Checkbox Mrs = new Checkbox("Mrs", false, ct);
         Mrs.setBounds(50,190,42,25);
         add(Mrs);
         Mrs.addItemListener(this);
         Checkbox Miss = new Checkbox("Miss", false, ct);
         Miss.setBounds(95,190,45,25);
         add(Miss);
         Miss.addItemListener(this);
    custd=new Label("If above booking details are correct please
    fill in your deatils below");
         custd.setBounds(5,140,400,30);
         add(custd);
         custd1=new Label("If they are incorrect please click on
    close and re-book seats.");
         custd1.setBounds(5,160,400,30);
         add(custd1);
         custfn=new Label("*ForeName:");
         custfn.setBounds(5,220,60,20);
         add(custfn);
         cfnt=new TextField(60);
         cfnt.setBounds(70,220,150,20);
    add(cfnt);
         custsn=new Label("*SurName:");
         custsn.setBounds(230,220,60,20);
         add(custsn);
         csnt=new TextField(60);
         csnt.setBounds(300,220,150,20);
    add(csnt);
         custad=new Label("*Address:");
         custad.setBounds(5,250,55,20);
         add(custad);
         cdt=new TextField(60);
         cdt.setBounds(70,250,180,20);
    add(cdt);
         cdt2=new TextField(60);
         cdt2.setBounds(70,270,180,20);
    add(cdt2);
         cdt3=new TextField(60);
         cdt3.setBounds(70,290,180,20);
    add(cdt3);
         cdt4=new TextField(60);
         cdt4.setBounds(70,310,180,20);
    add(cdt4);
         custpc=new Label("*Postcode:");
         custpc.setBounds(5,330,60,20);
         add(custpc);
         cpct=new TextField(60);
         cpct.setBounds(70,330,180,20);
    add(cpct);
         custph=new Label("*Telephone:");
         custph.setBounds(5,360,65,20);
         add(custph);
         cph=new TextField(60);
         cph.setBounds(70,360,180,20);
    add(cph);
         custem=new Label("E-mail:");
         custem.setBounds(5,390,65,20);
         add(custem);
         cem=new TextField(60);
         cem.setBounds(70,390,180,20);
    add(cem);
         custem1=new Label("eg: [email protected]");
         custem1.setBounds(250,390,150,20);
         add(custem);
         need=new Label("* = required field.");
         need.setBounds(350,400,150,20);
         add(need);
         //seat number being pased into this textbox
         tf = new TextField();
    tf.setBounds(5, 80, 160,20);
         tf.setEditable (false);
    add(tf);
         //seat number being pased into this textbox
         tt = new TextField();
    tt.setBounds(5, 100, 160,20);
         tt.setEditable (false);
    add(tt);
         //seat number being pased into this textbox
         st = new TextField(stype);
    st.setBounds(5, 120, 230,20);
         st.setEditable (false);
    add(st);
         setVisible(true);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(350,440,100,30);
         add(b3);
         b3.addActionListener( this );
    public void itemStateChanged(ItemEvent e)
         String c2 = (String) e.getItem();
         if (c2 == "Mr")
              value = 20;
         else if (c2 == "Mrs")
              value = 15;
         else
              value = 10;
    public void clearValuea()
              //cb.setSelectiob
              cem.setText("");
              cph.setText("");
              cdt.setText("");
              cdt2.setText("");
              cdt3.setText("");
              cdt4.setText("");
              cfnt.setText("");
              csnt.setText("");
              cpct.setText("");
              cph.setText("");
              cem.setText("");
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    cc = new creditcard();
    else if( e.getActionCommand() == "Clear")
    clearValuea();
         public void set_text (int nr_seats)
         tf.setText (" You have booked " + nr_seats + " seat/s");
         public void set_texts (int ctot)
         tt.setText (" The total is � " + ctot);
         public void SetTextField(String c1)
         st.setText(c1);
    creditcard
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class creditcard extends Frame implements ActionListener
         public Label title, ccd1, ccfn;
         public Button b1, b2;
         public TextField cnt, cdt, ccfnt;
         public String cfnt;
    public creditcard() //constructor
         init();
    public void init()
         setBackground(Color.green);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         ccd1=new Label("If billing address is different please edit below information.");
         ccd1.setBounds(5,50,400,20);
         ccd1.setFont(new Font("Verdana", Font.BOLD,12));
         add(ccd1);
         ccfn=new Label("*ForeName:");
         ccfn.setBounds(5,220,60,20);
         add(ccfn);
         ccfnt=new TextField(60);
         ccfnt.setBounds(70,220,150,20);
    add(ccfnt);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    setBackground(Color.red);

    Here's the new mainscreen1.java file...
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
      private Image layout1;
      private int frame;
      private int xpos,ypos,xdir,ydir;
      public TextField tn, tt1, tt2, total;
      public int value, ticketnum, sum, nr_seats, ctot;
      public Label title, seat, need, payable;
      public Button b1, b2, b3;
      Mydialog1 d;
      CheckboxGroup checkGroup; // heres the new global CheckboxGroup variable.
      String stype, c1, dialogString; // new name for the string too...
      public void init()
        setBackground(Color.pink);
        setSize(600, 460);
        setLayout(null);
        //dialogString = "Hi";
        //Mydialog1.mehod(dialogString);
        title=new Label("The Almeida Theater booking system");
        title.setBounds(100,0,400,30);
        title.setFont(new Font("Verdana", Font.PLAIN,24));
        add(title);
        seat=new Label("Please choose a seating location:");
        seat.setBounds(300,40,190,20);
        seat.setFont(new Font("Verdana", Font.BOLD,12));
        add(seat);
        payable=new Label("Total Payable:�");
        payable.setBounds(300,390,100,20);
        payable.setFont(new Font("Verdana", Font.BOLD,12));
        add(payable);
        need=new Label("Please enter the number of seats needed:");
        need.setBounds(300,180,245,20);
        need.setFont(new Font("Verdana", Font.BOLD,12));
        add(need);
        checkGroup = new CheckboxGroup(); // instantiate the global CheckboxGroup
        Checkbox Stalls = new Checkbox("Stalls", true, checkGroup); // add to the CheckboxGroup
        Stalls.setBounds(490,40,60,25);
        add(Stalls);
        Stalls.addItemListener(this);
        Checkbox Balcony = new Checkbox("Balcony", false, checkGroup);
        Balcony.setBounds(490,65,65,25);
        add(Balcony);
        Balcony.addItemListener(this);
        Checkbox Concessions = new Checkbox("Concessions", false, checkGroup);
        Concessions.setBounds(490,90,94,25);
        add(Concessions);
        Concessions.addItemListener(this);
        Button b1=new Button("Quote");
        b1.setBounds(20,395,80,30);
        add(b1);
        b1.addActionListener( this );
        Button b2=new Button("Confirm booking");
        b2.setBounds(110,395,100,30);
        add(b2);
        b2.addActionListener( this );
        Button b3=new Button("Clear");
        b3.setBounds(480,410,100,30);
        add(b3);
        b3.addActionListener( this );
        tt1=new TextField(60);
        tt1.setBounds(300,250,270,20);
        add(tt1);
        tt1.setEditable(false);
        tt1.addActionListener(this);
        tt2=new TextField(60);
        tt2.setBounds(300,300,150,20);
        add(tt2);
        tt2.setEditable(false);
        tt2.addActionListener(this);
        tn=new TextField(3);
        tn.setBounds(545,180,30,20);
        add(tn);
        tn.addActionListener(this);
        total=new TextField(5);
        total.setBounds(400,390,45,20);
        add(total);
        total.setEditable(false);
        total.addActionListener(this);
        xpos = getSize().width/-1400;
        ypos = getSize().height/12;
        layout1 = getImage(getDocumentBase(),"layout1.gif");
        repaint();
      public void itemStateChanged(ItemEvent e) {
        String c1 = (String) e.getItem();
        if (c1 == "Stalls") {
          value = 20;
        else if (c1 == "Balcony") {
          value = 15;
        else {
          value = 10;
        tt1.setText("You have chosen to sit in the " + c1 + " area");
        tt2.setText("Each seat will cost: �" + value);
        repaint();
      public void clearValue() {
        //cb.setSelectiob
        total.setText("");
        tt1.setText("");
        tt2.setText("");
        tn.setText("");
      public void actionPerformed( ActionEvent e ) {
        if( e.getActionCommand() == "Quote" ) {
          int nr_seats = Integer.parseInt(tn.getText());
          total.setText("" +nr_seats*value);
        else if( e.getActionCommand() == "Confirm booking") {
          int nr_seats = Integer.parseInt(tn.getText());
          int ctot = Integer.parseInt(total.getText());
          total.setText("" +nr_seats*value);
          d = new Mydialog1();
          d.set_text(nr_seats);
          d.set_texts(ctot);
          // You can do your checkbox selection data transfer here like this...
          // I used d.SetTextField because you had that defined in the Mydialog1 class.
          Checkbox chkBx = checkGroup.getSelectedCheckbox();
          d.SetTextField(chkBx.getLabel());
        else if ( e.getActionCommand() == "Clear") {
          clearValue();
        ticketnum = Integer.parseInt(tn.getText());
        repaint();
      public void paint(Graphics g)
        g.setColor(Color.black);
        g.drawString("You have chosen:" + ticketnum +" seats", 300, 365);
        g.drawImage(layout1,xpos,ypos,null);
    }

  • Urgent help needed in Java Strings

    Hi guys/gals..
    I want to know how to i Capitalize onlt the first Alphabet of a String.
    Eg if i hav the string "swing". i need it as "Swing" ie the first alpha shud be capitalized. How to do tat. The Java method of toUpperCase wud be of now use since it capitalizes the whole string.
    Tks.
    Divya...

    I use this. Maybe not the most optimal way, but it works :)
         public static String capString(String inp)
          byte[] buf = inp.getBytes();
          // first character is between 'a' and 'z', substract 32 from it to capitalize the character
          if(buf[0] >= 97 && buf[0] <= 122)
           buf[0] -= 32;
          return new String(buf);
         }

  • [Solved] help needed with wireless setup (ralink 2860 driver)

    Hi,
    I'm new to Arch so please be gentle ;-)
    I recently upgraded hoping to find improved support for my wireless.  I now find that the kernel recognises and loads the appropriate module:
    [root@akoya ~]# uname -a
    Linux akoya 2.6.29-ARCH #1 SMP PREEMPT Wed Apr 8 12:47:56 UTC 2009 i686 Pentium(R)
    [root@akoya ~]# lspci | grep Net
    05:00.0 Network controller: RaLink RT2860
    [root@akoya ~]# lsmod | grep 2860
    rt2860sta 514808 1
    I checked over the kernel source and the rt2680sta module is the code from ralink cleaned up for the 2.6.29 kernel.  (I tried building the ralink release but it needs patching for 2.6.29)
    However getting the thing to connect using WPA is another thing altogether
    [root@akoya ~]# ifconfig ra0 up
    [root@akoya ~]# wpa_supplicant -B -Dwext -i ra0 -c /etc/wpa_supplicant.conf
    [root@akoya ~]# dhcpcd ra0
    ra0: dhcpcd 4.0.12 starting
    ra0: waiting for carrier
    ra0: timed out
    I'm not even sure if iwconfig is communicating with this driver (though I can find my router using "iwlist ra0 scan"):
    [root@akoya ~]# iwconfig ra0 essid "sodor"
    [root@akoya ~]# iwconfig
    ra0 RT2860 Wireless ESSID:"" Nickname:"RT2860STA"
    Mode:Auto Frequency=2.412 GHz Access Point: 00:21:91:FE:DA:97
    And if I try to configure using wicd I see the following log when trying to connect to the wireless:
    2009/04/17 01:16:43 :: Connecting to wireless network sodor
    2009/04/17 01:16:43 :: Putting interface down
    2009/04/17 01:16:43 :: ifconfig ra0 down
    2009/04/17 01:16:43 :: Releasing DHCP leases...
    2009/04/17 01:16:43 :: Setting false IP...
    2009/04/17 01:16:43 :: ifconfig ra0 0.0.0.0
    2009/04/17 01:16:43 :: ifconfig eth0 0.0.0.0
    2009/04/17 01:16:43 :: Stopping wpa_supplicant and any DHCP clients
    2009/04/17 01:16:43 :: killall wpa_supplicant
    2009/04/17 01:16:43 :: Flushing the routing table...
    2009/04/17 01:16:43 :: route del dev ra0
    2009/04/17 01:16:43 :: route del dev eth0
    2009/04/17 01:16:43 :: Attempting to authenticate...
    2009/04/17 01:16:43 :: ['wpa_supplicant', '-B', '-i', 'ra0', '-c', '/var/lib/wicd/configurations/002191feda97', '-D', 'wext']
    2009/04/17 01:16:43 :: Putting interface up...
    2009/04/17 01:16:43 :: ifconfig ra0 up
    2009/04/17 01:16:43 :: iwconfig ra0 mode Managed
    2009/04/17 01:16:43 :: ['iwconfig', 'ra0', 'essid', 'sodor', 'channel', '1', 'ap', '00:21:91:FE:DA:97']
    2009/04/17 01:16:43 :: WPA_CLI RESULT IS None
    2009/04/17 01:16:43 :: Failed to find status in wpa_cli result
    2009/04/17 01:16:43 :: exiting connection thread
    It is driving me crazy being tied to a cable so I'd really like to get this working... but I'm really not sure what to try.  Do I need to rebuild wpa_supplicant?  If so is there a package-based way of doing that in arch?
    Thanks in advance.
    Last edited by drandre (2009-04-17 19:40:41)

    drandre wrote:
    If so is there a package-based way of doing that
    OK... to answer my own questions ...
    two questions:
    1. Does this mean support for the ralink driver is included by default or *not* included by default?
    It seems it means *not*
    2. If I uncomment this line then makepkg refuses to build the package because the config file's md5 is no longer valid.  How then am I *meant* to make modifications to the build configuration?
    right or wrong I used makepkg -g to generate checksums for my modified config file and pasted these into PKGBUILD.  It then builds happily.  After installing I can run wpa_supplicant with no args and confirm ralink is in the list of drivers.  Excellent.  But still no success.
    Two things I have noticed:
    1. wicd places quotes "" around my pre-shared key.  If I run wpa_supplicant from the command line and use the conf file created by wicd it reports the PSK as being unparsable.  If I remove the quotes then the file is parsed correctly.
    2. It doesn't solve my problem :-(

  • Need a query string to a specific point and zoom in a public GIS Flash document

    I am working with a client's website, and have no developer access to the Flash document, only public access.
    I have been given the url for a county map that is presented in an interactive Flash document.
    http://68.156.95.45/newberrygis//#1
    Client would like me to focus in on their specific development, which requires panning the map and zooming in.
    How can I find a query string that will help me to do that?

    The functionality of the GIS map was important. I was given the email for the person in charge of the map, who helped me out. It appeared that he was able to outline the road in the neighborhood that I needed to focus on. That provided a parcel ID, which in turn made it possible to focus in on the proper area. This is supposition on my part; perhaps he has other info that gave him the parcel ID.
    I'm not a huge fan of Flash on other than desktops and laptops, but it is what it is, client needs to use it, I need to help the client out!
    B

  • Need help for string tokenizer!

    I need help in writing out the string tokenizer.. i've got all of the functions written except for the nexttokken function which i am stuck in. Can anyone help me out in writing the function?

    An example of splitting string by comma
    String str"A,B,C";
    StringTokenizer st = new StringTokenizer(str,",");
    while (st.hasMoreTokens()) {
    System.out.println(st.nextToken());
    This is just an example of usage; i would prefer to use split() function instead

  • [SOLVED] kernel26-selinux "ugly" release string

    I am maintainer of kernel26-selinux in AUR. Recently I noticed that built kernel sais (uname -r) 2.6.35-selinux-gd4918f4-dirty instead just 2.6.35-selinux, which I would expect. I found option CONFIG_LOCALVERSION_AUTO which I think should solve it if set to no, but in that case the release string is actualy 2.6.35-selinux+ (note the plus symbol).
    Would someone kindly tell me, what to change, so that uname -r would show just 2.6.35-selinux? Or give some arguments why the other way is better, in case it is?
    PS Here is link for up-to-date tarball, as AUR doesn't yet support splitpackages: http://profi.edisk.cz/stahnout-soubor/1 … 1.9KB.html
    PPS I am quite new to building kernel stuff, so please speak slowly to me.
    Last edited by Nicky726 (2010-08-19 17:49:14)

    Nicky726 wrote:
    Well the sed line used in kernel26-ice is in fact wrong.
    instead of:
    sed 's/head=$(git rev-parse --verify --short HEAD 2>\/dev\/null)/0/' \
    ${srcdir}/linux-${_basekernel}/scripts/setlocalversion > \
    ${srcdir}/linux-${_basekernel}/scripts/setlocalversion
    there should be:
    sed -i 's/head=$(git rev-parse --verify --short HEAD 2>\/dev\/null)/0/' \
    ${srcdir}/linux-${_basekernel}/scripts/setlocalversion
    as the former deletes contents of whole file.
    EDIT:
    And the contents of the if to be changed by the sed did changed too. So hopefully last modification of the hack is:
    sed -i -e "s/head=\`git rev-parse --verify --short HEAD 2>\/dev\/null\`/0/" \
    ${srcdir}/linux-${_basekernel}/scripts/setlocalversion
    Yes, if you read the comments I commented that I'd already fixed that, but in git. The maintainer just hasn't gotten around to updating my fix to the AUR PKGBUILD.

  • Help. Need code for string verification

    I am trying to create a swing program that will verify a string then move a directory from a CD to the users hard drive. I have tried many different combinations of code with no success. I simply need a window with a text pane and a button that when clicked copies the content of the windows clipboard into the text pane, then compares it to a predefined string, then moves a directory from a CD to the harddrive.
    It seems very simple but I am new to java, with alot of c++ experiance, and I cant seem to get it to work. If someone could help me out here it would be much apprecaited. Thank you and sorry if I am not using the correct terminology, I tried to be as clear as possible.

    Here is the code: I just decided to make it command line instead of a GUI; I had too many problems.
    The code runs fine but for some reason i get this error when you get to the part about copying the file:
    123456789
    Verification complete copying files.
    Exception in thread "main" java.io.FileNotFoundException: C:\copy (Access is denied)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at CompString.main(CompString.java:20)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 5 seconds)
    Here is the code:
    import java.io.*;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    public class CompString{
    public static void main(String[] args) throws IOException{
    System.out.println("Please go to http://mytatwear.com/verify.html and follow the instructions");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Please enter number provided on the website");
    String str1 = bf.readLine();
    String str2 = "123456789";
    if (str1.equals(str2)){
    System.out.println("Verification complete copying files.");
    File inputFile = new File("C:\\copy");
    File outputFile = new File("C:\\tearwear");
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;
    while ((c = in.read()) != -1)
    out.write(c);
    in.close();
    out.close();
    else{
    System.out.println("The number is not valid");
    I had tried to change the permissions on the folder so it is not "Read only" but whenever my program access's it it is for some reason read only.
    Any help apprecaited

  • [SOLVED]Pacman needs gcc-libs, that are already up to date

    ...but this is the output
    error: failed to prepare transaction (could not satisfy dependencies)
    :: gcc: requires gcc-libs=4.7.0-3
    Pacman needs to update itself first, but needs gcc-libs...
    ...however...
    pacman -Ss gcc-libs
    core/gcc-libs 4.7.0-5 (base) [installed: 4.7.0-3]
    Runtime libraries shipped by GCC
    Granted, I could do this:
    pacman's --force
    but, how harmfull is that to my system?
    Thanks for a reply!
    Thor
    EDIT - searching the boards now...but I found some stale breadcrumbs...
    EDIT2 - upated pacman on its own...that seemd to work...
    pacman -S pacman
    the system is updating now...Solved
    EDIT3 - definetly solved, upgrading pacman on its own did the trick. The system is back after a reboot...thanks to everyone here
    Last edited by Thor@Flanders (2012-04-21 19:08:27)

    Hi everyone!
    @ Loafer
    Well, I did not refuse pacman to update...not updating one package could potentially bring down the depenging chain...so I let it update...
    @ Sara - I updated pacman on its own as detailed in the first post, then I did a sysup. the packages are in, and the update is running as we speak...
    I guess this could work for you too...good luck!
    Thor
    Last edited by Thor@Flanders (2012-04-21 19:02:21)

  • Maybe you are looking for

    • Multi-row sub query returns  ORA-00904 :invalid identifier error

      I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2. I was usi

    • TS1424 I am having trouble getting Itunes to open

      I am having trouble getting ITUNES to work I have deleted itunes and everything associated with it and reinstalled and I still get the same errors, The application has failed to start because of MSVCR80.DLL INTUNES WAS NOT INSTALLED CORRECTLY  ERROR

    • 10g forms server & report server only

      We are currently running 9ias 9.0.2.3, but would like to upgrade to 10g AS. We only use the forms and reports servers with apache, no portal, wireless, etc. and would like to do away with the infrastructure database. Which version of the 10g AS do we

    • Re-Rendering the entire panel with components based on list value selection

      Hi, I am new to swing.Wondering how to refresh the panel with modified data on selection from list. Here's the code I am trying . the function below is called withdifferent set of value s being passed in based on add,remove conditions. public void in

    • .MOV file

      hi, I made a movie using iMovie which was saved as a quicktime .MOV file. I want to put it on Youtube, but every time i try to upload it it says it was "an empty .MOV file" Do i need to use a different file or convert this one to something else? If s