Reading a string of characters

Hi all,
How would one allow for a user to enter a random set of 80 characters and put each one of those characters in a cell in an array (one cell for one character)? Is there a special tokenizer or something I could use?
Thanks,
Mike

does something like this work for you?... // read in a line of characters...
BufferedReader in = new BufferedReader(new InputStreamReader(System.in) ;
String str = in.readLine() ;
// put string's chars into an array (limit to 80 chars)...
char[] buf = new char[80] ;
int len = str.length() ;
if (len > buf.length) len = buf.length ;
str.getChars(0, len, buf, 0) ;     // *************

Similar Messages

  • PL/SQL function to read a string of characters into an array

    I was wondering if there is an easier way than using the substr function multiple times. Here is the example:
    Suppose you have a varchar2 variable that contains the word 'Apple'. The function should take it and produce an array. We would invoke it like this:
    <what data structure?> a := stringunpackerfunction(x);
    // x is the varchar2 containing 'Apple'.
    The resulting a would be such that a[0] is 'A', a[1] is 'p', a[2] is 'p', a[3] is 'l' and a[4] is 'e'.
    If there is no direct function to do this in a single invocation, is there a function to simply read a string of characters and return 'the next character'?
    Thanks,
    Regards,
    Srini

    There is a procedure out there called PS_PARSE which takes a string and converts to an array provided with an identified separator. Works for us pretty well.
    I just grabbed this off of google. I am presuming this should work fine. It has been sometime since we implemented ours that I forget if there were any additional modifications that we made. I think there was one regarding the size of the string that could be handled. I forget precisely. Anyways... take a peek at it. Its makes things easy in that your logic is pretty streamlined.
    Barry C
    http://www.myoracleportal.com
    create or replace PACKAGE PS_Parse
    IS
         || PL/SQL table structures to hold atomics retrieved by parse_string.
         || This includes the table type definition, a table (though you can
         || declare your own as well, and an empty table, which you can use
         || to clear out your table which contains atomics.
         TYPE atoms_tabtype IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;
         atoms_table atoms_tabtype;
         empty_atoms_table atoms_tabtype;
         || The standard list of delimiters. You can over-ride these with
         || your own list when you call the procedures and functions below.
         || This list is a pretty standard set of delimiters, though.
         std_delimiters VARCHAR2 (50) := ' !@#$%^&*()-_=+\|`~{{]};:''",<.>/?';
         /* Display contents of table using DBMS_OUTPUT */
         PROCEDURE display_atomics
              (table_in IN atoms_tabtype, num_rows_in IN NUMBER);
         || The parse_string procedure: I provide two, overloaded definitions.
         || The first version puts all atomics into a PL/SQL table and would
         || be used in a PL/SQL Version 2 environment. The second version places
         || all atomics into a string, separating each atomic by a vertical bar.
         || (My code does NOT do any special handling when it finds a "|" in
         || the string. You have to deal with that when you extract the atomics.
         ||
         || See the program definition for more details on other parameters.
         PROCEDURE parse_string
              (string_in IN VARCHAR2,
              atomics_list_out OUT atoms_tabtype,
              num_atomics_out IN OUT NUMBER,
              delimiters_in IN VARCHAR2 := std_delimiters);
         PROCEDURE parse_string
              (string_in IN VARCHAR2,
              atomics_list_out IN OUT VARCHAR2,
              num_atomics_out IN OUT NUMBER,
              delimiters_in IN VARCHAR2 := std_delimiters);
         /* Count the number of atomics in a string */
         FUNCTION number_of_atomics
              (string_in IN VARCHAR2,
              count_type_in IN VARCHAR2 := 'ALL',
              delimiters_in IN VARCHAR2 := std_delimiters)
         RETURN INTEGER;
         /* Return the Nth atomic in the string */
         FUNCTION nth_atomic
              (string_in IN VARCHAR2,
              nth_in IN NUMBER,
              count_type_in IN VARCHAR2 := 'ALL',
              delimiters_in IN VARCHAR2 := std_delimiters)
         RETURN VARCHAR2;
    END PS_Parse;
    create or replace PACKAGE BODY PS_Parse
    IS
    /* Package variables used repeatedly throughout the body. */
    len_string     NUMBER;
    start_loc     NUMBER;
    next_loc     NUMBER;     
    || Since the PUT_LINE procedure regards a string of one or more
    || spaces as NULL, it will not display a space, which is in
    || PS_Parse a valid atomic. So I save a_blank in the PL/SQL
    || table instead of the space itself.
    a_blank CONSTANT VARCHAR2(3) := '" "';
    /*--------------------- Private Modules ---------------------------
    || The following functions are available only to other modules in
    || package. No user of PS_Parse can see or use these functions.
    FUNCTION a_delimiter
    (character_in IN VARCHAR2,
    delimiters_in IN VARCHAR2 := std_delimiters)
    RETURN BOOLEAN
    || Returns TRUE if the character passsed into the function is found
    || in the list of delimiters.
    IS
    BEGIN
    RETURN INSTR (delimiters_in, character_in) > 0;
    END;
    FUNCTION string_length (string_in IN VARCHAR2)
    RETURN INTEGER
    IS
    BEGIN
    RETURN LENGTH (LTRIM (RTRIM (string_in)));
    END;
    FUNCTION next_atom_loc
    (string_in IN VARCHAR2,
    start_loc_in IN NUMBER,
    scan_increment_in IN NUMBER := +1)      
    || The next_atom_loc function returns the location
    || in the string of the starting point of the next atomic (from the
    || start location). The function scans forward if scan_increment_in is
    || +1, otherwise it scans backwards through the string. Here is the
    || logic to determine when the next atomic starts:
    ||
    ||          1. If current atomic is a delimiter (if, that is, the character
    ||               at the start_loc_in of the string is a delimiter), then the
    ||               the next character starts the next atomic since all
    ||               delimiters are a single character in length.
    ||
    ||          2. If current atomic is a word (if, that is, the character
    ||               at the start_loc_in of the string is a delimiter), then the
    ||               next atomic starts at the next delimiter. Any letters or
    ||               numbers in between are part of the current atomic.
    ||
    || So I loop through the string a character at a time and apply these
    || tests. I also have to check for end of string. If I scan forward
    || the end of string comes when the SUBSTR which pulls out the next
    || character returns NULL. If I scan backward, then the end of the
    || string comes when the location is less than 0.
    RETURN NUMBER
    IS
    /* Boolean variable which uses private function to determine
    || if the current character is a delimiter or not.
    was_a_delimiter BOOLEAN :=
    PS_Parse.a_delimiter (SUBSTR (string_in, start_loc_in, 1));     
    /* If not a delimiter, then it was a word. */
    was_a_word BOOLEAN := NOT was_a_delimiter;
    /* The next character scanned in the string */
              next_char VARCHAR2(1);
    || The value returned by the function. This location is the start
    || of the next atomic found. Initialize it to next character,
    || forward or backward depending on increment.
    return_value NUMBER := start_loc_in + scan_increment_in;
    BEGIN
    LOOP
    -- Extract the next character.
    next_char := SUBSTR (string_in, return_value, 1);
    -- Exit the loop if:
    EXIT WHEN
    /* On a delimiter, since that is always an atomic */
    a_delimiter (next_char)
    OR
    /* Was a delimiter, but am now in a word. */
    (was_a_delimiter AND NOT a_delimiter (next_char))
    OR
    /* Reached end of string scanning forward. */
    next_char IS NULL
    OR
    /* Reached beginning of string scanning backward. */
    return_value < 0;
    /* Shift return_value to move the next character. */
    return_value := return_value + scan_increment_in;
    END LOOP;
    -- If the return_value is negative, return 0, else the return_value
    RETURN GREATEST (return_value, 0);
    END;
    PROCEDURE increment_counter
    (counter_inout IN OUT NUMBER,
    count_type_in IN VARCHAR2,
    atomic_in IN CHAR)
    || The increment_counter procedure is used by nth_atomic and
    || number_of_atomics to add to the count of of atomics. Since you
    || can request a count by ALL atomics, just the WORD atomics or
    || just the DELIMITER atomics. I use the a_delimiter function to
    || decide whether I should add to the counter. This is not a terribly
    || complex procedure. I bury this logic into a separate module,
    however,
    || to make it easier to read and debug the main body of the programs.
    IS
    BEGIN
    IF count_type_in = 'ALL' OR
    (count_type_in = 'WORD' AND NOT a_delimiter (atomic_in)) OR
    (count_type_in = 'DELIMITER' AND a_delimiter (atomic_in))
    THEN
    counter_inout := counter_inout + 1;
    END IF;
    END increment_counter;
    /* ------------------------- Public Modules -----------------------*/
    PROCEDURE display_atomics
    (table_in IN atoms_tabtype, num_rows_in IN NUMBER)
    || Program to dump out contents of table. Notice I must also pass in
    || the number of rows in the table so that I know when to stop the
    || loop. Otherwise I will raise a NO_DATA_FOUND exception. For a more
    || elaborate display_table module, see Chapter 7 on PL/SQL tables.
    IS
    BEGIN
    FOR table_row IN 1 .. num_rows_in
    LOOP
    DBMS_OUTPUT.PUT_LINE (NVL (table_in (table_row), 'NULL'));
    END LOOP;
    END;
    PROCEDURE parse_string
    (string_in IN VARCHAR2,
    atomics_list_out OUT atoms_tabtype,
    num_atomics_out IN OUT NUMBER,
    delimiters_in IN VARCHAR2 := std_delimiters)
    || Version of parse_string which stores the list of atomics
    || in a PL/SQL table.
    ||
    || Parameters:
    ||          string_in - the string to be parsed.
    ||          atomics_list_out - the table of atomics.
    ||          num_atomics_out - the number of atomics found.
    ||          delimiters_in - the set of delimiters used in parse.
    IS
    BEGIN
    /* Initialize variables. */
    num_atomics_out := 0;
    len_string := string_length (string_in);
    IF len_string IS NOT NULL
    THEN
    || Only scan the string if made of something more than blanks.
    || Start at first non-blank character. Remember: INSTR returns 0
    || if a space is not found. Stop scanning if at end of string.
    start_loc := LEAST (1, INSTR (string_in, ' ') + 1);
    WHILE start_loc <= len_string
    LOOP
    || Find the starting point of the NEXT atomic. Go ahead and
    || increment counter for the number of atomics. Then have to
    || actually pull out the atomic. Two cases to consider:
    ||          1. Last atomic goes to end of string.
    ||          2. The atomic is a single blank. Use special constant.
    ||          3. Anything else.
    next_loc := next_atom_loc (string_in, start_loc);
    num_atomics_out := num_atomics_out + 1;
    IF next_loc > len_string
    THEN
    -- Atomic is all characters right to the end of the string.
    atomics_list_out (num_atomics_out) :=
    SUBSTR (string_in, start_loc);
    ELSE
    || Internal atomic. If RTRIMs to NULL, have a blank
    || Use special-case string to stuff a " " in the table.
    atomics_list_out (num_atomics_out) :=
    NVL (RTRIM (SUBSTR (string_in,
    start_loc, next_loc-start_loc)),
                                       a_blank);
    END IF;
    -- Move starting point of scan for next atomic.
    start_loc := next_loc;
    END LOOP;
    END IF;
    END parse_string;
    PROCEDURE parse_string
    (string_in IN VARCHAR2,
    atomics_list_out IN OUT VARCHAR2,
    num_atomics_out IN OUT NUMBER,
    delimiters_in IN VARCHAR2 := std_delimiters)
    || The version of parse_string which writes the atomics out to a packed
    || list in the format "|A|,|C|". I do not repeat any of the comments
    || from the first iteration of parse_string.
    IS
    BEGIN
    /* Initialize variables */
    num_atomics_out := 0;
    atomics_list_out := NULL;
    len_string := string_length (string_in);
    IF len_string IS NOT NULL
    THEN
    start_loc := LEAST (1, INSTR (string_in, ' ') + 1);
    WHILE start_loc <= len_string
    LOOP
    next_loc := next_atom_loc (string_in, start_loc);
    num_atomics_out := num_atomics_out + 1;
    IF next_loc > len_string
    THEN
    atomics_list_out := atomics_list_out || '|' ||      
    SUBSTR (string_in, start_loc);
    ELSE
    atomics_list_out :=
    atomics_list_out || '|' ||      
    NVL (RTRIM (SUBSTR (string_in,
    start_loc, next_loc-start_loc)),
                                       a_blank);
    END IF;
    start_loc := next_loc;
    END LOOP;
    /* Apply terminating delimiter to the string. */
    atomics_list_out := atomics_list_out || '|' ;
    END IF;
    END parse_string;
    FUNCTION number_of_atomics
    (string_in IN VARCHAR2,
    count_type_in IN VARCHAR2 := 'ALL',
    delimiters_in IN VARCHAR2 := std_delimiters)
    RETURN INTEGER
    || Counts the number of atomics in the string_in. You can specify the
    || type of count you want: ALL for all atomics, WORD to count only the
    || words and DELIMITER to count only the delimiters. You can optionally
    || pass your own set of delimiters into the function.
    IS
    return_value INTEGER := 0;
    BEGIN
    /* Initialize variables. */
    len_string := string_length (string_in);
    IF len_string IS NOT NULL
    THEN
    || This loop is much simpler than parse_string. Call the
    || next_atom_loc to move to the next atomic and increment the
    || counter if appropriate. Everything complicated is shifted into
    || sub-programs so that you can read the program "top-down",
    || understand it layer by layer.
    start_loc := LEAST (1, INSTR (string_in, ' ') + 1);
    WHILE start_loc <= len_string
    LOOP
    increment_counter (return_value, UPPER (count_type_in),
    SUBSTR (string_in, start_loc, 1));
    start_loc := next_atom_loc (string_in, start_loc);
    END LOOP;
    END IF;
    RETURN return_value;
    END number_of_atomics;
    FUNCTION nth_atomic
    (string_in IN VARCHAR2,
    nth_in IN NUMBER,
    count_type_in IN VARCHAR2 := 'ALL',
    delimiters_in IN VARCHAR2 := std_delimiters)
    RETURN VARCHAR2
    || Find and return the nth atomic in a string. If nth_in is greater
    || the number of atomics, then return NULL. If nth_in is negative the
    || function counts from the back of the string. You can again request
    || a retrieval by ALL atomics, just the WORDs or just the DELIMITER.
    || So you can ask for the third atomic, or the second word from the end
    || of the string. You can pass your own list of delimiters as well.
    IS
    /* Local copy of string. Supports up to 1000 characters. */
    local_string VARCHAR2 (1000) :=
    LTRIM (RTRIM (SUBSTR (string_in, 1, 1000)));
    /* Running count of atomics so far counted. */
    atomic_count NUMBER := 1;
    /* Boolean variable which controls the looping logic. */
    still_scanning BOOLEAN :=
    local_string IS NOT NULL AND nth_in != 0;
    /* The amount by which I increment the counter. */
    scan_increment INTEGER;
    /* Return value of function, maximum length of 100 characters. */
    return_value VARCHAR2 (100):= NULL;
    BEGIN
    IF nth_in = 0
    THEN
    /* Not much to do here. Find 0th atomic? */
    RETURN NULL;
    ELSE
    /* Initialize the loop variables. */
    len_string := string_length (local_string);
    IF nth_in > 0
    THEN
    /* Start at first non-blank character and scan forward. */
    next_loc := 1;
    scan_increment := 1;
    ELSE
    /* Start at last non-blank character and scan backward. */
    next_loc := len_string;
    scan_increment := -1;
    END IF;
    /* Loop through the string until the Boolean is FALSE. */
    WHILE still_scanning
    LOOP
    /* Move start of scan in string to loc of last atomic. */
    start_loc := next_loc;
    /* Find the starting point of the next atomic. */
    next_loc      :=
    next_atom_loc (local_string, start_loc, scan_increment);
    /* Increment the count of atomics. */
    increment_counter
    (atomic_count,
    UPPER (count_type_in),
    SUBSTR (local_string, start_loc, 1));
    || Keep scanning if my count hasn't exceeded the request
    || and I am neither at the beginning nor end of the string.
    still_scanning :=
    atomic_count <= ABS (nth_in) AND
    next_loc <= len_string AND
    next_loc >= 1;
    END LOOP;
    || Done with the loop. If my count has not exceeded the requested
    || amount, then there weren't enough atomics in the string to
    || satisfy the request.
    IF atomic_count <= ABS (nth_in)
    THEN
    RETURN NULL;
    ELSE
    || I need to extract the atomic from the string. If scanning
    || forward, then I start at start_loc and SUBSTR forward.
    || If I am scanning backwards, I start at next_loc+1 (next_loc
    || is the starting point of the NEXT atomic and I want the
    || current one) and SUBSTR forward (when scanning in
    || reverse, next_loc comes before start_loc in the string.
    IF scan_increment = +1
    THEN
    RETURN
    SUBSTR (local_string, start_loc, next_loc - start_loc);
    ELSE
    RETURN
    SUBSTR (local_string, next_loc+1, start_loc - next_loc);
    END IF;
    END IF;
    END IF;
    END nth_atomic;
    END PS_Parse;
    /

  • Problem with code: reading a string

    Hi,
    I am very new to java so excuse my naivety. i need to write some code which will decode an encrypted message. the message is stored as a string which is a series of integers which. Eg. Nick in this code is 1409030110 where a = 1, b = 2,... and there is a 0 (zero) after every word. at the moment the code only goes as far as seperating the individual characters in the message up and printing them out onscreen.
    Heres the code:
    int index = 0;
    while(index < line.length() - 1) {
    char first = line.charAt(index);
    char second = line.charAt(index + 1);
    if(second == 0) {
    char third = line.charAt(index + 2);
    if(third == 0) {
    System.out.print(first + "" + second);
    index = index + 3;
    else {
    System.out.print(first);
    index = index + 2;
    else {
    System.out.print(first + "" + second);
    index = index + 3;
    Basically its meant to undo the code by reading the first two characters in the string then determining whether the second is equal to 0 (zero). if the second is 0 then it needs to decide whether the third character is 0 (zero) because the code could be displaying 10 or 20. if so the first two characters are recorded to another string and if not only the first is recorded. obviously if the second character is not a zero then the code will automatically record the first 2 characters.
    my problem is that the code doesnt seem to recognise the 0 (zero) values. when i run it thru with the string being the coded version of Nick above (1409030110) the outputted answer is 1490010 when it should be 149311. as far as i can see the code is right but its not working! basically the zeros are begin removed but i need each group of non-zero digits to be removed seperately so i can decode them.
    if anyone has understood any of this could you give me some advice, im at my wits end!
    Thanks, Nick

    Try something like this:
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class SimpleDecoder
        /** Default mapping file */
        public static final String DEFAULT_MAPPING_FILE = "SimpleDecoder.properties";
        /** Regular expression pattern to match one or more zeroes */
        public static final String SEPARATOR = "0+";
        private Properties decodeMapping = new Properties();
        public static void main(String [] args)
            try
                SimpleDecoder decoder = new SimpleDecoder();
                decoder.setDecodeMapping(new FileInputStream(DEFAULT_MAPPING_FILE));
                for (int i = 0; i < args.length; ++i)
                    System.out.println("Original encoded string: " + args);
    System.out.println("Decoded string : " + decoder.decode(args[i]));
    catch (Exception e)
    e.printStackTrace();
    public void setDecodeMapping(InputStream stream) throws IOException
    this.decodeMapping.load(stream);
    public String decode(final String encodedString)
    StringBuffer value = new StringBuffer();
    String [] tokens = encodedString.split(SEPARATOR);
    for (int i = 0; i < tokens.length; ++i)
    value.append(this.decodeMapping.getProperty(tokens[i]));
    return value.toString();
    I gave your "1409030110" string on the command line and got back "nick". The SimpleDecoder.properties file had 26 lines in it:
    1 = a
    2 = b
    3 = c
    // etc;Not a very tricky encryption scheme, but it's what you asked for. - MOD

  • Reading a String Literally - Finding the "\" Character with a Regex

    How do I search for "\" characters in a string? Such as..
    String text = "Temp\temp.txt";
    The problem is that Java will read "\t" as a tab, so that
    System.out.println(text);
    Will return
    Temp emp.txt
    Also, searching for the regex "\\\\" will return a null result, presumably because Java interprets the "\t" as a tab character, not as a literal "\" followed by a literal "t".
    How do I get Java to read the string without interpreting it?
    Thanks in advance

    Try also this:
    public static void main(String[] args) {
              String test1 = "String with a\\t which is not a tab but a t preceeded with a \\ character";
              String test2 = "String with a \t which is a tab";
              System.out.println("This are the Strings as user sees / enters them:");
              System.out.println(test1);
              System.out.println(test2);
              System.out.println("");
              System.out.println("***********************************************************");
              System.out.println("");
              System.out
                        .println("Splitting first string using a \\\\\\\\ regex which will be interpreted by the regex engine as \\\\ which will represent a \'\\\' character:");
              System.out.println("");
              for (String s : test1.split("\\\\")) {
                   System.out.println(s);
              System.out.println("");
              System.out.println("***********************************************************");
              System.out.println("");
              System.out.println("Splitting the second string just the same way:");
              System.out.println("");
              for (String s : test2.split("\\\\")) {
                   System.out.println(s);
         }and read the console output.
    It should be:
    This are the Strings as user sees / enters them:
    String with a\t which is not a tab but a t preceeded with a \ character
    String with a       which is a tab
    Splitting first string using a \\\\ regex which will be interpreted by the regex engine as \\ which will represent a '\' character:
    String with a
    t which is not a tab but a t preceeded with a
    character
    Splitting the second string just the same way:
    String with a       which is a tab

  • TS3276 I need feedback for the following issue. When I send email from this 27 inch iMac, the computer adds a string of characters in vertical column that represents the QWERTY key board, all alpha numeric characters are included. Yahoo mail, issue only o

    Restating my issue / question...
    When I send email from this iMac, there is a string of characters assigned. The characters are all the "alpha numeric" characters on the QWERTY key board. This only occurs when email is sent from this iMac. The issue does not manifest when using any other lap top or computer.
    Hence, I have ruled out the issue is a yahoo mail matter.
    Again, I can access the Yahoo mail account form multiple devices and send email without unintended assignment of character strings, but when I send wmail using this iMac, the issue happens everytime.
    Characters are stacked verticaly in a column. It looks as if all characters (except function keys) are included in the string.
    Any ideas?
    GMc

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; } | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}' | open -f -a TextEdit 
    Step 4
    ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • My new wirelss keyboard is repeating the "\" character endlessly; also inserting them into the string of characters I'm typing.  It does is in word and in both safari and firefox.  How do I get this to stop?

    My new wireless keyboard is repeating the "\" character endlessly.  It also inserts the '\" into strings of characters as I type them in word or safari or firefox.  I can't erase the characters fast enough or type fast enough not to get these characters.  \Help!

    Try changing the batteries on the keyboard or see if the keyboard has some sort of reset available.

  • When accessing certain websites, I am met with a random string of characters in the browser window. What could be causing this?

    When trying to access certain websites, http://redditenhancementsuite.com/ or http://www.channel4.com/programmes/the- ... od#3293733 for example, all I get is a random string of characters in my browser window like the following:
    ‹­XmoÛ6þ>`ÿáª/Ý€ZÊËú²Í6Ð%ÍZ¬íŠ&A±O%щTI*®‡ýø='J¶”8^†._L‰wÇ{yîá)ÓG§¿Ÿ\üñᜟx÷vþí7ÓÂWeû+Eο•ô‚ ïë‰üÜš›YtbŽ—ÚO.ÖµŒ(O³ÈË/>aåŸ)+„uÒÏ¿˜ŒˆØˆWŸ”ó2Ï•§Wº:“ŒÐy£Œœ&a‚¥Ò×de9‹œ_—ÒRúˆ<ŽêNÈœ‹š°r1‹¬t1?Îÿ›Z$kœ7ÕÄp#¹úÜH»ž4jr¿ˆŸÅa7‡S.³ªöC/®Äo#r6›Eœ Ÿ’$3¹Œƒ¹83Uoù0~WJÇWpvšExý»É•ëÜqïŽÅ‡¹º5/Y–r"Ž(×^enìàÃÍUâ+ƒ‹ÆVwNOŠ€A8’š| aÅï€Åšhš«›v%0Ú‚"A†UµUQ•XJ—”fiâZ/#Z©Ü³èèé@$Õ²ðxx—¹YÄ‚\!qÛjmMÌØÞa<õzÂÛ#ûÇ°ÙÛçug²ìà„i"˜¶‘¶Q!B-BTÓ†‘ð‡¶˜"ìÍeµh¢hþÚTh"Ï!žC%7+]‘‡zua­YEóÓnsŸ…Ÿá~I8ë÷©@z²ºWùøêœÎðžOe›å_ !Qûds“5Ì Â+£;·N‡ïö)‹Zu*/?ŒÙ'˜¬Ôµÿ»ŸEŠ¥Ð×ÑüÞîS©i|¯GÂÓ€-ì4 …fL/­iêŸ.®(óf€xÿŸ+BØÀVq8ç¬þÄÇ€gŒí°OЄÀ¿Ò©¥–9žœÒKÇüíL œ rz鳊,ךPý%ÒRR.\‘aóâçMÊ|–Jò†rå èPòèK‘£îwxg¬€…*œŽp…LÍ¥Ü%xYçÂÃé÷òFZ\9‹‡Ëd‡ÙSÕ¥ôÎÛmÀ—šóƃ®ÜZˆ¶§ŽÝ]’yÁíuOçcwÜùÏÜvþ‹£™ ×ûR"NN4¿‰Cýz&xšK¿ uŒÜãVÚm|;<ÌÛ;ošÔœ="" ò1êgôt;®]ôÍ+ÐÖ1]:0ªŒ‘ÛpJç;G †ÑÆ«…‚%€‚広ÜȲ6T rawpgYàÜñ•9J†ˆ®‘›“vŒ€Ó-_ö›”5S˜©cw\%Ê~bÞE Ñ#@8BšrÔ8DGN°fLï'¡×S誇#gCÑ1+žU0óàòŒLÀG‰Ë‡Ó5Á‚äºMËöÌ'H*ŸŽ…š®‹ZT„)¹‘­ûˆ.P%£îRU*\Äp?dÚÏ^J‡ëù«Áˆ‚õ7ù0™ÝØvJ2€­—倕:)*Î.œUºODÈïškÙ˜rú±§+TS#òÜè Zñ1£Ûš”ß—br|‹F·”òókºB’j‘]£\mMR¢XŠì\ãðÿožËJ42“9ÞÍùþèoCÁí¢·ÁÁcÐX·ÃóæîK¶C$ý}ï8šGr·žål0 ŽäöL…#¹]£àHàAóßHãÎÐ7Úý—Io${ÏxÇùçaÎRÒç—ñ„P–VTøZ[RºÞŽÝ'ãjµŠ|x@UÖø€5Õ݉óÜcö¡s“JÜVbNßm*70Ý~x‚3l24͇Olã{º|ƒ;•ÂûüÊ…V²Ìōʙ¡ônßN[)zÉwS§ÊÁÌâãÕø¹u°ŠŠÉµÈoÒ}‚¿*þò—ÔTÄ
    The characters change depending on the website. I've tried disabling all extensions and plugins, reinstalling firefox and reinstalling java to no avail. The issue seems to be isolated to firefox, chrome is able to display the webpages without a problem. The problem occures following a malware in infection which would redirect goolgle searches in firefox. It was dealt with using Malwarebytes Anti-malware and by removing some entries from C:\WINDOWS\system32\drivers\etc\hosts file.

    Hi,
    I tried everything above but to no avail. Windows firewall seemed to be allowing Firefox through without it actually being in the exception list. However, I did remove Firefox but this time removing all profile data too. Reinstalling Firefox seemed to make the websites work. However I then restored my bookmarks, and suddenly the websites stopped functioning again, displaying the random string of characters. Could this be an issue with my bookmarks?

  • PowerShell script to find a string of characters in office documents in Doc Libraries and List Item attachments?

    Hi there,
    For SharePoint 2010 site - Does someone have the PowerShell script to find a string of characters in Office/Word/Excel/PDF documents in document libraries or the ones attached to List Items?
    Thanks so much in advance.

    Hi,
    According to your description, my understanding is that you want to find some specific string character in list items using PowerShell Command.
    $w = Get-SPWeb "http://devmy131"
    $l = $w.GetList("http://devmy131/lists/fieldslist");
    $i = $l.Items[0]["Title"].ToString();
    if ($i -like '*document*')
    Write-Host "Title contains document character" $i;
    More information:
    PowerShell -contains -like
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to extract an integer or a float value from a String of characters

    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above String
    This is all i have so far:
    String c;
    String Array[] =new String[g]; (i used a while loop to obtain g(the nubmer of lines in the file))
    while((c=(cr.readLine()))!=null)
    Array[coun]=c;
    it would be reallllllllllllllllllllllllllllllllllllllly easy if there was a predefined method to extract numeric values from a string in java..
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:55 PM

    badmash wrote:
    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    with the space included
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above StringHuh?
    Not true.
    Anyway why not use string split, split on spaces and grab the last element (which by the format you posted would be your 700.0)
    Then there is the Float.parseFloat method.
    It is easy.
    And another thing why not use a List of Strings if you want to store each line? (And why did you post that code which doesn't really have anything to do with your problem?) Also in future please use the code formatting tags when posting code. Select the code you are posting in the message box and click the CODE button.

  • Delete spaces on the right of a string of characters

    Hi,
    I'd like to know how to delete space on the right of a string of characters and ONLY the ones on the right in order I can get the real length of the string (I don't want to condense the spaces between words even though there's more than one).
    data: text(20).
    text = 'SAP Forum'
    In this case, if I use both DESCRIBE LENGTH and DESCRIBE OUTPUT LENGTH, the result will be 20, but the real length is 9.

    Use STRLEN( ), as described by the other posters.
    To delete space chars on the right of a string, use following static method:
    CALL METHOD cl_abap_string_utilities=>del_trailing_blanks
      CHANGING
         str = lv_text.

  • How to design and implement an application that reads a string from the ...

    How to design and implement an application that reads a string from the user and prints it one character per line???

    This is so trivial that it barely deserves the words "design" or "application".
    You can use java.util.Scanner to get user input from the command line.
    You can use String.getChars to convert a String into an array of characters.
    You can use a loop to get all the characters individually.
    You can use System.out.println to print data on its own line.
    Good luck on your homework.

  • Strings with /' characters after return

    I use embedded procedures a fair bit in my database driven web sites programming, so I decided to pre-buld my queries to expedite and simplify the process.
    I wrote the following script:
    #!/usr/bin/python
    import MySQLdb
    from uid_gdbm import *
    proc_params = ('manage_codes','add',555,'Just a test') <-- test list
    def buildquery():
    items = len(proc_params)
    #print items
    prog_name = proc_params[0]
    args ="%("
    stgcount = ""
    for i in range(1, len(proc_params)-1):
    args += repr(proc_params[i])
    stgcount += "'%s'"
    for j in range (1, len(proc_params)-2):
    args += ","
    stgcount +=","
    myquery = "\"call " + prog_name + "(" + stgcount + "'%s'" + ")\" " + args + repr(proc_params[(items -1)]) + ")"
    print myquery < -- prints : "call manage_codes('%s','%s','%s')" %('add','555','Just a test')
    return myquer <-- but after retuning it I get :"call manage_codes(\'%s\',\'%s\',\'%s\')" %(\'add\',\'555\',\'Just a test\')
    as a result I get a MySQL error: ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'"call manage_codes(\'%s\',\'%s\',\'%s\')" %(\'add\',\'555\',\'Just a test\')\' at line 1')
    Any ideas as to why this is  happening and more importantly how cay I get read of the \' escape characters?
    Thanks.

    Just put all the candidate characters in as a String constant, then pick them at random using Random.nextInt() and charAt()

  • CONCATENATE a string a characters into a field

    Hi everyone!
    Let's say that i want to CONCATENATE a string of characters (for example: 'ABC') into every WTAB-AUFNR record that i retrieve. How do i do that?
    Let's assume that WTAB-AUFNR's header currently has the value '50-12345', i want it to be 'ABC50-12345'.

    I've got another CONCATENATE question. Here it is:
    Let's say i wanna have the values in CTAB-WTJHR to be in brackets, which i am going to hardcode by doing a CONCATENATE. So it should work if i write it like this:
    DATA: BEGIN OF CTAB OCCURS 0,
          LEDNR LIKE BPJA-LEDNR,  "Ledger
          OBJNR LIKE BPJA-OBJNR,  "Object Number
          TRGKZ LIKE BPJA-TRGKZ,  "Object Indicator
          WRTTP LIKE BPJA-WRTTP,  "Value Type
          GJAHR LIKE BPJA-GJAHR,  "Fiscal Year
          VERSN LIKE BPJA-VERSN,  "Version
          VORGA LIKE BPJA-VORGA,  "Budget Type
          TWAER LIKE BPJA-TWAER,  "Transaction Currency
          WTJHV LIKE BPJA-WTJHV,  "Original Budget
          WTJHR LIKE BPJA-WTJHR,  "Amount Utilised YTD
          V_BEFORE TYPE I,             "Balance Before This Request
          V_CURRENT TYPE I,            "Current Acquisition Cost
          V_BALANCE TYPE I,            "Balance Variation
          END OF CTAB.
    SELECT SINGLE LEDNR OBJNR TRGKZ WRTTP GJAHR VERSN VORGA TWAER WTJHV
    WTJHR
      INTO CTAB
      FROM BPJA
      WHERE OBJNR = WTAB-AUFNR AND
            WRTTP = '42' AND
            GJAHR = ITAB-LFDAT+0(4).
    APPEND CTAB.
    LOOP AT CTAB.
    CONCATENATE '(' CTAB-WTJHR ')' INTO CTAB-WTJHR.
      MODIFY CTAB TRANSPORTING WTJHR.
    ENDLOOP.
    I've looked through it and i can't find any syntax problem or anything else but i keep getting this message when i try to activate my program: "CTAB-WTJHR" must be a character-type data object (data type C, N, D, T or STRING). field string". When i looked at SE11 and i found out that the WTJHR field in BPJA is a type CURR. Is there a way to solve this?

  • Changing strings to characters

    I have been trying to program this and its not working. I am a java student, so my level of java understanding is pretty basic. well REALLY basic considering the depth and scope of the java language. plus I have only been at this about 2 months. so please keep it as simple as you can. thanks!
    This is the question:
    Write a program for a furniture company. Ask the suer to choose P for pine, O for oak, or M for mahogany. Show the price of a table manufacture with the chosen wood. Pine tables cost $100, oak costs $224, and mahogany costs $310.
    Add a prompt to the program to ask the user to specify a large (L) or small (S) table. ass $35 to the price of any large table.
    and this is what I have so far:
    import java.io.*;     
    public class Furniture
         public static void main(String[]args) throws IOException
              BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
              String swood;
              int mahogany = 310;
              int pine = 100;
              int oak = 225;
              int total = 0;
              String size = "";
              System.out.println("Enter wood: ");
              swood = dataIn.readLine();
              System.out.println("Small or Large?");
              size = dataIn.readLine();
              if(swood == "P")
                   total = 100;
                   System.out.println("Total is: " + total);
              else if(swood == "O")          
                   total = 225;
                   System.out.println("Total is: " + total);
              else if(swood == "M")
                   total = 310;
                   System.out.println("Total is: " + total);
              if(size == "L")
                   int newtotal = total + 35;
                   System.out.println("The new total is: " + newtotal);
    I need to convert my strings into characters but i am not able to figure out how to do it...we have done other conversions using Integer.parseInt() and similar methods but Character.parseChar() is apparently not a part of the java.io package.
    If there are any other changes that need to be made plz point them out. thanks.
    also i tried using Char.At() but i couldnt get it to work??
    Edited by: desichick07 on Oct 25, 2007 4:42 PM

    They meant like this:
    Your current code for the condition was like this:
    if(swood == "P")
    total = 100;
    System.out.println("Total is: " + total);
    else if(swood == "O")
    total = 225;
    System.out.println("Total is: " + total);
    else if(swood == "M")
    total = 310;
    System.out.println("Total is: " + total);
    if(size == "L")
    int newtotal = total + 35;
    System.out.println("The new total is: " + newtotal);
    Now change your code to something like this:
    if(swood.equals("P"))
    total = 100;
    System.out.println("Total is: " + total);
    else if(swood.equals("O"))
    total = 225;
    System.out.println("Total is: " + total);
    else if(swood.equals("M"))
    total = 310;
    System.out.println("Total is: " + total);
    if(size.equals("L"))
    int newtotal = total + 35;
    System.out.println("The new total is: " + newtotal);
    }so instead of using "==", you replace it with equals().

  • Is Safari Find function flexible? (Search for inner strings of characters?)

    I'm running 10.6.8 with Safari Version 5.1.7 (6534.57.2). I see that when you search a web page using the Safari Find function, you can only search for the beginnings of words, not for character strings within the words. Is it possible to expand the Find function's capability to search for inner strings of characters?

    use command F or the edit menus to make the page search box visible - click the magnify/arrow icon at the left side of it - choose "contains" or "starts with".

Maybe you are looking for